cc.Class({ extends: cc.Component, properties: { Name:cc.String, AllowSpriteFrame:cc.SpriteFrame, NotAllowSpriteFrame:cc.SpriteFrame, }, start () { if(this.Name == 'Food') { if(GlobalD.GameData.GetFoodTradeState()) { this.node.getComponent(cc.Sprite).spriteFrame = this.AllowSpriteFrame; } else { this.node.getComponent(cc.Sprite).spriteFrame = this.NotAllowSpriteFrame; } } else if(this.Name == 'Wood') { if(GlobalD.GameData.GetWoodTradeState()) { this.node.getComponent(cc.Sprite).spriteFrame = this.AllowSpriteFrame; } else { this.node.getComponent(cc.Sprite).spriteFrame = this.NotAllowSpriteFrame; } } else if(this.Name == 'Mineral') { if(GlobalD.GameData.GetMineralTradeState()) { this.node.getComponent(cc.Sprite).spriteFrame = this.AllowSpriteFrame; } else { this.node.getComponent(cc.Sprite).spriteFrame = this.NotAllowSpriteFrame; } } }, });