Files
18xchat/assets/Scripts/chat18x/ui/items/NavigationBtn.ts
T

27 lines
800 B
TypeScript
Raw Normal View History

2025-09-15 16:11:15 +08:00
import { _decorator, Component, Node, SpringJoint2D, Sprite } from "cc";
const { ccclass, property } = _decorator;
@ccclass("NavigationBtn")
export class NavigationBtn extends Component {
focus: Node;
unfocus: Node;
2025-10-13 15:39:35 +08:00
focusLight: Node;
2025-09-15 16:11:15 +08:00
start() {
this.focus = this.node.getChildByName("focus");
this.unfocus = this.node.getChildByName("unfocus");
2025-10-13 15:39:35 +08:00
this.focusLight = this.node.getChildByName("focusLight");
2025-09-15 16:11:15 +08:00
}
setFocus(focus: boolean) {
if (!this.focus) this.focus = this.node.getChildByName("focus");
if (!this.unfocus) this.unfocus = this.node.getChildByName("unfocus");
2025-10-13 15:39:35 +08:00
if (!this.focusLight)
this.focusLight = this.node.getChildByName("focusLight");
2025-09-15 16:11:15 +08:00
this.focus.active = focus;
this.unfocus.active = !focus;
2025-10-13 15:39:35 +08:00
this.focusLight.active = focus;
2025-09-15 16:11:15 +08:00
}
}