| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- cc.Class({
- extends: cc.Component,
- properties: {
- Name: {
- default: '',
- tooltip: '建筑名称',
- },
- Price: {
- default: '',
- tooltip: '需要金币的价格',
- },
- DiamondPrice: {
- default: 1,
- type:cc.Integer,
- tooltip: '需要钻石的价格',
- },
- Synopsis: {
- default: '',
- tooltip: '简介',
- },
- Sprite: {
- default: null,
- tooltip: '对应图片组件',
- type: cc.Sprite
- },
- clickEvents: {
- default: [],
- type: cc.Component.EventHandler,
- tooltip: CC_DEV && 'i18n:COMPONENT.button.click_events',
- }
- },
- onPressed() {
- let NameNode = this.node.getChildByName('Name');
- if (NameNode) {
- let Num = NameNode.getChildByName('Num');
- if (Num) {
- let NumLabel = Num.getComponent(cc.Label);
- // cc.log('NumLabel='+NumLabel.string);
- if (parseInt(NumLabel.string) < 1) {
- //this is Content_Button
- GlobalD.game._ManageUIScript.onPurchaseTips(this);
- return;
- }
- }
- }
- // GlobalD.game._ManageUIScript.onPurchaseTips(this.node.name);
- // return;
- GlobalD.game._ManageUIScript.onSetButtonState({ Target: this }, { Name: this.Name, Price: this.Price, Synopsis: this.Synopsis });
- },
- onPressedInfo(event, customEventData) {
- GlobalD.game._ManageUIScript.onSetButtonInfoState({ Target: this }, { Name: this.Name, Price: this.Price, Synopsis: this.Synopsis });
- }
- });
|