2022-08-26 16:48:17 +08:00

27 lines
787 B
TypeScript

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]);
}
}
}
}