mirror of
https://github.com/Gongxh0901/kunpolibrary
synced 2025-06-04 16:44:22 +00:00
屏幕尺寸发生变化时发送事件
This commit is contained in:
parent
ca2d93b475
commit
91f1dbc355
@ -4,14 +4,17 @@
|
|||||||
* @Description: 适配用的类
|
* @Description: 适配用的类
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { debug, ResolutionPolicy, view } from "cc";
|
import { ResolutionPolicy, view } from "cc";
|
||||||
|
import { debug } from "../tool/log";
|
||||||
import { WindowManager } from "../ui/WindowManager";
|
import { WindowManager } from "../ui/WindowManager";
|
||||||
|
import { GlobalEvent } from "./GlobalEvent";
|
||||||
import { Screen } from "./Screen";
|
import { Screen } from "./Screen";
|
||||||
import { size } from "./header";
|
import { size } from "./header";
|
||||||
|
|
||||||
export abstract class Adapter {
|
export abstract class Adapter {
|
||||||
/** @internal */
|
/** @internal */
|
||||||
public init() {
|
public init() {
|
||||||
|
debug("初始化适配器");
|
||||||
// 设计尺寸 不会变化
|
// 设计尺寸 不会变化
|
||||||
let designSize = this.getDesignSize();
|
let designSize = this.getDesignSize();
|
||||||
Screen.DesignHeight = designSize.height;
|
Screen.DesignHeight = designSize.height;
|
||||||
@ -54,6 +57,8 @@ export abstract class Adapter {
|
|||||||
}
|
}
|
||||||
WindowManager._screenResize();
|
WindowManager._screenResize();
|
||||||
this.printScreen();
|
this.printScreen();
|
||||||
|
// 发送屏幕尺寸发生变化的消息
|
||||||
|
GlobalEvent.send("kunpo::adapter::resize");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user