[add] Engine

This commit is contained in:
2022-08-26 16:48:17 +08:00
parent f67e566f2a
commit d9c19f096c
197 changed files with 10626 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import ScreenResize from "../ScreenResize";
import { UIManager } from "../UIManager";
const { ccclass, property } = cc._decorator;
@ccclass("SwitchSizeObj")
export class SwitchScaleObj {
@property({ type: cc.Node })
public UI: cc.Node = null;
@property({ type: cc.Float/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
public ScaleNum: number[] = [];
public SetObjScale(obj: cc.Node, scaleNum: number): void {
obj.setScale(scaleNum);
}
}
@ccclass
export default class SwitchScaleGroupExtra extends cc.Component {
@property({ displayName: "縮放scale群組", type: SwitchScaleObj })
public ScaleGroups: SwitchScaleObj[] = [];
public Run(): void {
if (this.ScaleGroups != null && this.ScaleGroups.length) {
for (let group of this.ScaleGroups) {
group.SetObjScale(group.UI, group.ScaleNum[ScreenResize.IsPortrait]);
}
}
}
onLoad() {
UIManager.DireEvent.AddCallback(this.Run, this);
this.Run();
}
}