[add] Engine
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
@ccclass("SwitchWH")
|
||||
export class SwitchWH {
|
||||
@property({ type: cc.Node })
|
||||
public UI: cc.Node = null;
|
||||
@property({ type: cc.Vec2/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public WH: cc.Vec2[] = [];
|
||||
|
||||
public SetWH(obj: cc.Node, WHNum: cc.Vec2): void {
|
||||
obj.SetSizeDelta(WHNum);
|
||||
}
|
||||
}
|
||||
@ccclass
|
||||
export default class SwitchWHGroup extends cc.Component {
|
||||
@property({ displayName: "改變寬高群組", type: SwitchWH })
|
||||
public WHGroups: SwitchWH[] = [];
|
||||
public Run(): void {
|
||||
if (this.WHGroups != null && this.WHGroups.length) {
|
||||
for (let group of this.WHGroups) {
|
||||
group.SetWH(group.UI, group.WH[ScreenResize.IsPortrait]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user