import { _decorator, Component, Node, SpringJoint2D, Sprite } from "cc"; const { ccclass, property } = _decorator; @ccclass("NavigationBtn") export class NavigationBtn extends Component { focus: Node; unfocus: Node; focusLight: Node; start() { this.focus = this.node.getChildByName("focus"); this.unfocus = this.node.getChildByName("unfocus"); this.focusLight = this.node.getChildByName("focusLight"); } setFocus(focus: boolean) { if (!this.focus) this.focus = this.node.getChildByName("focus"); if (!this.unfocus) this.unfocus = this.node.getChildByName("unfocus"); if (!this.focusLight) this.focusLight = this.node.getChildByName("focusLight"); this.focus.active = focus; this.unfocus.active = !focus; this.focusLight.active = focus; } }