2023-06-02 12:25:21 +08:00
|
|
|
import UIState from './component/UIState';
|
2023-06-07 17:19:10 +08:00
|
|
|
const { ccclass, property } = cc._decorator;
|
2023-06-02 12:25:21 +08:00
|
|
|
|
2023-06-07 17:19:10 +08:00
|
|
|
@ccclass
|
|
|
|
export class Main extends cc.Component {
|
|
|
|
@property(cc.Button)
|
|
|
|
btnChangeOutter:cc.Button = null;
|
2023-06-02 12:25:21 +08:00
|
|
|
|
2023-06-07 17:19:10 +08:00
|
|
|
@property(cc.Button)
|
|
|
|
btnChangeInner:cc.Button = null;
|
2023-06-02 12:25:21 +08:00
|
|
|
|
2023-06-07 17:19:10 +08:00
|
|
|
@property(cc.Node)
|
|
|
|
innerBox:cc.Node = null;
|
2023-06-02 12:25:21 +08:00
|
|
|
|
|
|
|
start() {
|
2023-06-07 17:19:10 +08:00
|
|
|
this.btnChangeOutter.node.on(cc.Node.EventType.TOUCH_END, () => {
|
2023-06-02 12:25:21 +08:00
|
|
|
const uiState = this.node.getComponent(UIState);
|
|
|
|
uiState.state = uiState.state === 0 ? 1 : 0;
|
|
|
|
});
|
2023-06-07 17:19:10 +08:00
|
|
|
this.btnChangeInner.node.on(cc.Node.EventType.TOUCH_END, () => {
|
2023-06-02 12:25:21 +08:00
|
|
|
const uiState = this.innerBox.getComponent(UIState);
|
|
|
|
uiState.state = uiState.state === 0 ? 1 : 0;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
update(deltaTime: number) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|