[add] Engine
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import ScreenResize from "../ScreenResize";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
@ccclass("SwitchPosition")
|
||||
export class SwitchPosition {
|
||||
@property({ type: cc.Node })
|
||||
public UI: cc.Node = null;
|
||||
@property({ type: cc.Vec2/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||||
public Pos: cc.Vec2[] = [];
|
||||
|
||||
public SetPos(obj: cc.Node, posNum: cc.Vec2): void {
|
||||
obj.setPosition(posNum);
|
||||
}
|
||||
}
|
||||
@ccclass
|
||||
export default class SwitchPositionGroup extends cc.Component {
|
||||
@property({ displayName: "改變座標群組", type: SwitchPosition })
|
||||
public PosGroups: SwitchPosition[] = [];
|
||||
public Run(): void {
|
||||
if (this.PosGroups != null && this.PosGroups.length) {
|
||||
for (let group of this.PosGroups) {
|
||||
if (!group.UI || !group.Pos[ScreenResize.IsPortrait]) {
|
||||
cc.error("沒有設定節點或座標.name=" + this.node.name);
|
||||
continue;
|
||||
}
|
||||
group.SetPos(group.UI, group.Pos[ScreenResize.IsPortrait]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user