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

28 lines
855 B
TypeScript

import ScreenResize from "../ScreenResize";
const { ccclass, property } = cc._decorator;
@ccclass("SwitchRotation")
export class SwitchRotation {
@property({ type: cc.Node })
public UI: cc.Node = null;
@property({ type: cc.Float/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
public rotaitonNum: number[] = [];
public SetObjRotation(obj: cc.Node, r: number): void {
obj.angle = -r;
}
}
@ccclass
export default class SwitchRotationGroup extends cc.Component {
@property({ displayName: "設定rotation群組", type: SwitchRotation })
public ScaleGroups: SwitchRotation[] = [];
public Run(): void {
if (this.ScaleGroups != null && this.ScaleGroups.length) {
for (let group of this.ScaleGroups) {
group.SetObjRotation(group.UI, group.rotaitonNum[ScreenResize.IsPortrait]);
}
}
}
}