cc.Class({ extends: cc.Component, properties: { Env: { default: null, type: cc.Node, }, Labour: { default: null, type: cc.Node, }, Shop: { default: null, type: cc.Node, }, SpeBuilding: { default: null, type: cc.Node, }, EvnBtn: { default: null, type: cc.Node, }, LabourBtn: { default: null, type: cc.Node, }, ShopBtn: { default: null, type: cc.Node, }, SpeBuildingBtn: { default: null, type: cc.Node, }, Normal_Sprite: cc.SpriteFrame, Selecteded_Sprite: cc.SpriteFrame, SelectedFrame:cc.Node, Building00:cc.Node, Building10:cc.Node, Building20:cc.Node, Building30:cc.Node, ManageUI:cc.Node, }, HiddenAll() { if (this.Env.active) this.Env.active = false; if (this.Labour.active) this.Labour.active = false; if (this.Shop.active) this.Shop.active = false; if (this.SpeBuilding.active) this.SpeBuilding.active = false; }, //切换建筑的面板 onSwitchBuildingContent(event, index) { // if (task.taskCursor == 7) { // return; // } this.EvnBtn.setScale(1); this.LabourBtn.setScale(1); this.ShopBtn.setScale(1); this.SpeBuildingBtn.setScale(1); this.EvnBtn.getComponent(cc.Sprite).spriteFrame =this.Selecteded_Sprite; this.LabourBtn.getComponent(cc.Sprite).spriteFrame =this.Selecteded_Sprite; this.ShopBtn.getComponent(cc.Sprite).spriteFrame =this.Selecteded_Sprite; this.SpeBuildingBtn.getComponent(cc.Sprite).spriteFrame =this.Selecteded_Sprite; // var ClickedBtnNode = event.target; // ClickedBtnNode.setScale(1.3); // ClickedBtnNode.getComponent(cc.Sprite).spriteFrame =this.Normal_Sprite; this.HiddenAll(); //面板设置index //环境 if ('0' == index) { // this._className.string = '环境'; this.Env.active = true; this.EvnBtn.getComponent(cc.Sprite).spriteFrame = this.Normal_Sprite; this.SelectedFrame.parent = this.Building00; this.ManageUI.getComponent('ManageUI').onSetButtonInfo(this.Building00.getComponent('Content_Button').Name, this.Building00.getComponent('Content_Button').Price, this.Building00.getComponent('Content_Button').Synopsis); } //劳动 else if ('1' == index) { // this._className.string = '劳动'; this.Labour.active = true; this.LabourBtn.getComponent(cc.Sprite).spriteFrame = this.Normal_Sprite; this.SelectedFrame.parent = this.Building10; this.ManageUI.getComponent('ManageUI').onSetButtonInfo(this.Building10.getComponent('Content_Button').Name, this.Building10.getComponent('Content_Button').Price, this.Building10.getComponent('Content_Button').Synopsis); } //商铺 else if ('2' == index) { // this._className.string = '商店'; this.Shop.active = true; this.ShopBtn.getComponent(cc.Sprite).spriteFrame = this.Normal_Sprite; this.SelectedFrame.parent = this.Building20; this.ManageUI.getComponent('ManageUI').onSetButtonInfo(this.Building20.getComponent('Content_Button').Name, this.Building20.getComponent('Content_Button').Price, this.Building20.getComponent('Content_Button').Synopsis); } else if ('3' == index) { // this._className.string = '商店'; this.SpeBuilding.active = true; this.SpeBuildingBtn.getComponent(cc.Sprite).spriteFrame = this.Normal_Sprite; this.SelectedFrame.parent = this.Building30; this.ManageUI.getComponent('ManageUI').onSetButtonInfo(this.Building30.getComponent('Content_Button').Name, this.Building30.getComponent('Content_Button').Price, this.Building30.getComponent('Content_Button').Synopsis); } } });