difenduandada
2024-12-31 34abe6963b344c882358274957f4b992456fee40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
"use strict";
cc._RF.push(module, '9c78dNEg4tCBIyKysShc8vh', 'orderaction_reward_item_panel');
// Scripts/mod/orderaction/view/orderaction_reward_item_panel.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
//     这里是描述这个窗体的作用的
// <br/>Create: 2019-08-12 17:36:49
// --------------------------------------------------------------------
var PathTool = require("pathtool");
 
var OrderactionController = require("orderaction_controller");
 
var Orderaction_reward_itemPanel = cc.Class({
  "extends": BasePanel,
  ctor: function ctor() {
    this.prefabPath = PathTool.getPrefabPath("orderaction", "reward_item1");
    this.ctrl = OrderactionController.getInstance();
    this.model = this.ctrl.getModel();
  },
  // 可以初始化声明一些变量的
  initConfig: function initConfig() {},
  // 初始化一些配置数据,可以用于声明一些变量之类的
  initPanel: function initPanel() {
    var main_container = this.root_wnd.getChildByName("main_container");
    this.goods_item = main_container.getChildByName("goods_item");
    this.good_item_content = this.goods_item.getChildByName("content");
    this.mark = main_container.getChildByName("mark");
    this.mark.active = false;
    this.lev_num = main_container.getChildByName("lev_num").getComponent(cc.Label);
    this.lev_num.string = "";
    this.common_goods_item = ItemsPool.getInstance().getItem("backpack_item");
    this.common_goods_item.initConfig(false, 0.8, null, true);
    this.common_goods_item.setParent(main_container);
    this.common_goods_item.setPosition(263, 58);
    this.common_goods_item.addActionCallBack(function () {
      if (this.data && this.data.lev && this.data.status != null) {
        if (this.data.status == 0) {
          this.ctrl.send25304(this.data.lev);
        }
      }
    }.bind(this));
    this.common_goods_item.show();
 
    if (this.data) {
      this.updateData(this.data);
    }
  },
  // 注册事件监听的接口,不需要手动调用,如果是使用gcore.GlobalEvent监听,可以直接调用addGlobalEvent
  registerEvent: function registerEvent() {},
  updateData: function updateData(data) {
    this.lev_num.string = data.lev || 1;
    var common = true;
 
    if (this.common_goods_item) {
      if (data.reward && data.reward[0]) {
        this.common_goods_item.setData({
          bid: data.reward[0][0],
          num: data.reward[0][1]
        });
        this.common_goods_item.setVisible(true);
        this.common_goods_item.showOrderWarLock(true);
      } else {
        this.common_goods_item.setVisible(false);
      } // 领取状态
 
 
      if (data.status == 1) {
        this.common_goods_item.IsGetStatus(true);
      } else {
        this.common_goods_item.IsGetStatus(false);
      }
    }
 
    var is_locak_status = true;
 
    if (data.cur_lev >= data.lev) {
      if (this.common_goods_item) {
        this.common_goods_item.showOrderWarLock(false);
        common = false;
      }
 
      if (data.is_locak == 1) {
        is_locak_status = false;
      } else {
        is_locak_status = true;
      }
    } else {
      if (this.common_goods_item) {
        this.common_goods_item.showOrderWarLock(true);
        common = true;
      }
 
      is_locak_status = true;
    }
 
    if (common == false) {
      if (data.status == 1) {
        this.common_goods_item.showItemEffect(false);
      } else {
        this.common_goods_item.showItemEffect(true, 263, PlayerAction.action_1, true, 1.1);
      }
    } else {
      this.common_goods_item.showItemEffect(false);
    } // 普通奖励
 
 
    if (data.status != 0) {
      common = false;
    }
 
    this.common_goods_item.setDefaultTip(common); // 进阶奖励
 
    var advance = true;
    var effect_id;
 
    if (this.model.getGiftStatus() == 1) {
      if (data.rmb_status == 0) {
        if (data.cur_lev >= data.lev) {
          advance = false;
        }
      }
    }
 
    if (advance == false) {
      effect_id = 263;
    }
 
    var data_list = data.rmb_reward || [];
    var setting = {};
    setting.start_x = 10;
    setting.scale = 0.8;
    setting.max_count = 3;
    setting.lock = is_locak_status;
    setting.is_tip = advance;
    setting.show_effect_id = effect_id;
 
    var callback = function () {
      if (this.data && this.data.lev && this.data.rmb_status != null) {
        if (this.data.rmb_status == 0) {
          this.ctrl.send25304(this.data.lev);
        }
      }
    }.bind(this);
 
    setting.callback = callback;
    this.item_list = Utils.commonShowSingleRowItemList(this.goods_item, this.item_list, data_list, setting, this.good_item_content, true);
  },
  setData: function setData(data) {
    if (!data) return;
    this.data = data;
 
    if (this.root_wnd) {
      this.updateData(data);
    }
  },
  // 预制体加载完成之后,添加到对应主节点之后的回调可以设置一些数据了
  onShow: function onShow(params) {},
  // 面板设置不可见的回调,这里做一些不可见的屏蔽处理
  onHide: function onHide() {},
  // 当面板从主节点释放掉的调用接口,需要手动调用,而且也一定要调用
  onDelete: function onDelete() {
    if (this.item_list) {
      for (var i in this.item_list) {
        this.item_list[i].deleteMe();
      }
 
      this.item_list = null;
    }
 
    if (this.common_goods_item) {
      this.common_goods_item.deleteMe();
      this.common_goods_item = null;
    } // self:removeAllChildren()
    // self:removeFromParent()
 
  }
});
 
cc._RF.pop();