Pārlūkot izejas kodu

领取成功更新用户数据

sa03 6 gadi atpakaļ
vecāks
revīzija
abdda7e1d5
1 mainītis faili ar 16 papildinājumiem un 1 dzēšanām
  1. 16 1
      assets/scripts/levelHome/LevelHomePropItem.js

+ 16 - 1
assets/scripts/levelHome/LevelHomePropItem.js

@@ -2,6 +2,7 @@
 const HomeApi = require("../net/HomeApi");
 const DWTool = require("../utils/DWTool");
 const itemList = require('../data/item');
+const GameModule = require("../utils/GameModule");
 
 cc.Class({
     extends: cc.Component,
@@ -46,8 +47,22 @@ cc.Class({
         // this.node.x = 150;
 
         this.node.on(cc.Node.EventType.TOUCH_END, _.debounce(() => {
+            // 上报领取
             HomeApi.itemCollect(this.buildingId, () => {
-
+                // 钻石
+                if(this.propData.id == 10002) {
+                    GameModule.userInfo.updateUserRes({
+                        diamond: this.propData.count 
+                    })
+                }
+
+                // 艺人券
+                if(this.propData.id == 10003) {
+                    GameModule.userInfo.updateUserRes({
+                        ticket: this.propData.count 
+                    })
+                }
+ 
                 this.pickupCallback();
                 let showFrame = this.propSprite.spriteFrame;
                 let showText = `${this.propData.name} x ${this.propData.count}`