33 lines
978 B
TypeScript
33 lines
978 B
TypeScript
|
import ScreenResize from "../ScreenResize";
|
||
|
import { UIManager } from "../UIManager";
|
||
|
|
||
|
const { ccclass, property } = cc._decorator;
|
||
|
|
||
|
@ccclass("SwitchActiveObj")
|
||
|
export class SwitchActiveObj {
|
||
|
@property({ type: cc.Node })
|
||
|
public UI: cc.Node = null;
|
||
|
@property({ type: cc.Boolean/*, visible: function (this: ImageGroup) { return this.Reset; } */ })
|
||
|
public show: boolean[] = [];
|
||
|
|
||
|
public SetObjActive(obj: cc.Node, show: boolean): void {
|
||
|
obj.active = show;
|
||
|
}
|
||
|
}
|
||
|
@ccclass
|
||
|
export default class SwitchActiveGroupExtra extends cc.Component {
|
||
|
@property({ displayName: "縮放scale群組", type: SwitchActiveObj })
|
||
|
public ScaleGroups: SwitchActiveObj[] = [];
|
||
|
public Run(): void {
|
||
|
if (this.ScaleGroups != null && this.ScaleGroups.length) {
|
||
|
for (let group of this.ScaleGroups) {
|
||
|
group.SetObjActive(group.UI, group.show[ScreenResize.IsPortrait]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
onLoad() {
|
||
|
UIManager.DireEvent.AddCallback(this.Run, this);
|
||
|
this.Run();
|
||
|
}
|
||
|
}
|