28 lines
839 B
TypeScript
28 lines
839 B
TypeScript
|
import ScreenResize from "../ScreenResize";
|
||
|
|
||
|
const { ccclass, property } = cc._decorator;
|
||
|
|
||
|
@ccclass("SwitchSize")
|
||
|
export class SwitchScale {
|
||
|
@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 SwitchScaleGroup extends cc.Component {
|
||
|
@property({ displayName: "縮放scale群組", type: SwitchScale })
|
||
|
public ScaleGroups: SwitchScale[] = [];
|
||
|
public Run(): void {
|
||
|
if (this.ScaleGroups != null && this.ScaleGroups.length) {
|
||
|
for (let group of this.ScaleGroups) {
|
||
|
group.SetObjScale(group.UI, group.ScaleNum[ScreenResize.IsPortrait]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|