|
|
@@ -18,6 +18,14 @@ cc.Class({
|
|
|
default: null,
|
|
|
type: cc.Node,
|
|
|
},
|
|
|
+ Seed: {
|
|
|
+ default: null,
|
|
|
+ type: cc.Node,
|
|
|
+ },
|
|
|
+ Fruit: {
|
|
|
+ default: null,
|
|
|
+ type: cc.Node,
|
|
|
+ },
|
|
|
EvnBtn: {
|
|
|
default: null,
|
|
|
type: cc.Node,
|
|
|
@@ -34,12 +42,23 @@ cc.Class({
|
|
|
default: null,
|
|
|
type: cc.Node,
|
|
|
},
|
|
|
+ SeedBtn: {
|
|
|
+ default: null,
|
|
|
+ type: cc.Node,
|
|
|
+ },
|
|
|
+ FruitBtn: {
|
|
|
+ default: null,
|
|
|
+ type: cc.Node,
|
|
|
+ },
|
|
|
|
|
|
SelectedFrame: cc.Node,
|
|
|
Building00: cc.Node,
|
|
|
Building10: cc.Node,
|
|
|
Building20: cc.Node,
|
|
|
Building30: cc.Node,
|
|
|
+
|
|
|
+ Building40: cc.Node,
|
|
|
+ Building50: cc.Node,
|
|
|
ManageUI: cc.Node,
|
|
|
|
|
|
|
|
|
@@ -57,6 +76,12 @@ cc.Class({
|
|
|
Selecteded_Spe_Sprite: cc.SpriteFrame,
|
|
|
|
|
|
|
|
|
+ Normal_Seed_Sprite: cc.SpriteFrame,
|
|
|
+ Selecteded_Seed_Sprite: cc.SpriteFrame,
|
|
|
+
|
|
|
+ Normal_Fruit_Sprite: cc.SpriteFrame,
|
|
|
+ Selecteded_Fruit_Sprite: cc.SpriteFrame,
|
|
|
+
|
|
|
//需要切换节点顺序的父节点
|
|
|
container: cc.Node
|
|
|
},
|
|
|
@@ -70,6 +95,10 @@ cc.Class({
|
|
|
this.Shop.active = false;
|
|
|
if (this.SpeBuilding.active)
|
|
|
this.SpeBuilding.active = false;
|
|
|
+ if (this.Seed.active)
|
|
|
+ this.Seed.active = false;
|
|
|
+ if (this.Fruit.active)
|
|
|
+ this.Fruit.active = false;
|
|
|
},
|
|
|
start(){
|
|
|
//默认设置第一个节点为 最上面
|
|
|
@@ -78,28 +107,40 @@ cc.Class({
|
|
|
//切换建筑的面板
|
|
|
onSwitchBuildingContent(event, index) {
|
|
|
|
|
|
-
|
|
|
this.EvnBtn.setScale(1);
|
|
|
this.LabourBtn.setScale(1);
|
|
|
this.ShopBtn.setScale(1);
|
|
|
this.SpeBuildingBtn.setScale(1);
|
|
|
+ this.SeedBtn.setScale(1);
|
|
|
+ this.FruitBtn.setScale(1);
|
|
|
|
|
|
this.EvnBtn.getComponent(cc.Sprite).spriteFrame = this.Normal_Env_Sprite;
|
|
|
this.LabourBtn.getComponent(cc.Sprite).spriteFrame = this.Normal_Labour_Sprite;
|
|
|
this.ShopBtn.getComponent(cc.Sprite).spriteFrame = this.Normal_Shop_Sprite;
|
|
|
this.SpeBuildingBtn.getComponent(cc.Sprite).spriteFrame = this.Normal_Spe_Sprite;
|
|
|
+ this.SeedBtn.getComponent(cc.Sprite).spriteFrame = this.Normal_Seed_Sprite;
|
|
|
+ this.FruitBtn.getComponent(cc.Sprite).spriteFrame = this.Normal_Fruit_Sprite;
|
|
|
+
|
|
|
+ this.EvnBtn.setContentSize(100,54);
|
|
|
+ this.LabourBtn.setContentSize(100,54);
|
|
|
+ this.ShopBtn.setContentSize(100,54);
|
|
|
+ this.SpeBuildingBtn.setContentSize(100,54);
|
|
|
+ this.SeedBtn.setContentSize(100,54);
|
|
|
+ this.FruitBtn.setContentSize(100,54);
|
|
|
+
|
|
|
|
|
|
- this.EvnBtn.y = 0;
|
|
|
- this.LabourBtn.y = 0;
|
|
|
- this.ShopBtn.y = 0;
|
|
|
- this.SpeBuildingBtn.y = 0;
|
|
|
+ this.EvnBtn.y = -5;
|
|
|
+ this.LabourBtn.y = -5;
|
|
|
+ this.ShopBtn.y = -5;
|
|
|
+ this.SpeBuildingBtn.y = -5;
|
|
|
+ this.SeedBtn.y = -5;
|
|
|
+ this.FruitBtn.y = -5;
|
|
|
|
|
|
this.HiddenAll();
|
|
|
//面板设置index
|
|
|
//环境
|
|
|
- let posY = -5;
|
|
|
if ('0' == index) {
|
|
|
- this.EvnBtn.y = posY;
|
|
|
+ this.EvnBtn.y = -20;
|
|
|
this.EvnBtn.getComponent(cc.Sprite).spriteFrame = this.Selecteded_Env_Sprite;
|
|
|
this.Env.active = true;
|
|
|
this.SelectedFrame.parent = this.Building00;
|
|
|
@@ -107,38 +148,59 @@ cc.Class({
|
|
|
|
|
|
//设置节点顺序
|
|
|
this.EvnBtn.setSiblingIndex(10);
|
|
|
-
|
|
|
+ this.EvnBtn.setContentSize(86,88);
|
|
|
}
|
|
|
//劳动
|
|
|
else if ('1' == index) {
|
|
|
- this.LabourBtn.y = posY;
|
|
|
+ this.LabourBtn.y = -20;
|
|
|
this.LabourBtn.getComponent(cc.Sprite).spriteFrame = this.Selecteded_Labour_Sprite;
|
|
|
this.Labour.active = true;
|
|
|
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);
|
|
|
|
|
|
this.LabourBtn.setSiblingIndex(10);
|
|
|
+ this.LabourBtn.setContentSize(86,88);
|
|
|
}
|
|
|
//商铺
|
|
|
else if ('2' == index) {
|
|
|
- this.ShopBtn.y = posY;
|
|
|
+ this.ShopBtn.y = -20;
|
|
|
this.ShopBtn.getComponent(cc.Sprite).spriteFrame = this.Selecteded_Shop_Sprite;
|
|
|
this.Shop.active = true;
|
|
|
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);
|
|
|
|
|
|
this.ShopBtn.setSiblingIndex(10);
|
|
|
+ this.ShopBtn.setContentSize(86,88);
|
|
|
|
|
|
} else if ('3' == index) {
|
|
|
- this.SpeBuildingBtn.y = posY;
|
|
|
+ this.SpeBuildingBtn.y = -20;
|
|
|
this.SpeBuildingBtn.getComponent(cc.Sprite).spriteFrame = this.Selecteded_Spe_Sprite;
|
|
|
this.SpeBuilding.active = true;
|
|
|
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);
|
|
|
|
|
|
this.SpeBuildingBtn.setSiblingIndex(10);
|
|
|
-
|
|
|
+ this.SpeBuildingBtn.setContentSize(86,88);
|
|
|
+ } else if ('4' == index) {
|
|
|
+ this.SeedBtn.y = -20;
|
|
|
+ this.SeedBtn.getComponent(cc.Sprite).spriteFrame = this.Selecteded_Seed_Sprite;
|
|
|
+ this.Seed.active = true;
|
|
|
+ this.SelectedFrame.parent = this.Building40;
|
|
|
+ this.ManageUI.getComponent('ManageUI').onSetButtonInfo(this.Building40.getComponent('Content_Button').Name, this.Building40.getComponent('Content_Button').Price, this.Building40.getComponent('Content_Button').Synopsis);
|
|
|
+
|
|
|
+ this.SeedBtn.setSiblingIndex(10);
|
|
|
+ this.SeedBtn.setContentSize(86,88);
|
|
|
+ } else if ('5' == index) {
|
|
|
+ this.FruitBtn.y = -20;
|
|
|
+ this.FruitBtn.getComponent(cc.Sprite).spriteFrame = this.Selecteded_Fruit_Sprite;
|
|
|
+ this.Fruit.active = true;
|
|
|
+ this.SelectedFrame.parent = this.Building50;
|
|
|
+ this.ManageUI.getComponent('ManageUI').onSetButtonInfo(this.Building50.getComponent('Content_Button').Name, this.Building50.getComponent('Content_Button').Price, this.Building50.getComponent('Content_Button').Synopsis);
|
|
|
+
|
|
|
+ this.FruitBtn.setSiblingIndex(10);
|
|
|
+ this.FruitBtn.setContentSize(86,88);
|
|
|
}
|
|
|
+
|
|
|
|
|
|
//切换节点顺序
|
|
|
// this.switch();
|