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
"use strict";
cc._RF.push(module, 'd5f88084JtEc45asqTJ6qQc', 'friend_glory_item');
// Scripts/mod/friend/view/friend_glory_item.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
//     这里是描述这个窗体的作用的
// <br/>Create: 2019-03-14 17:45:48
// --------------------------------------------------------------------
var PathTool = require("pathtool");
 
var Friend_glory_itemPanel = cc.Class({
  "extends": BasePanel,
  ctor: function ctor() {
    this.prefabPath = PathTool.getPrefabPath("friend", "friend_glory_item");
  },
  // 可以初始化声明一些变量的
  initConfig: function initConfig() {},
  // 初始化一些配置数据,可以用于声明一些变量之类的
  initPanel: function initPanel() {
    this.main_container = this.seekChild("main_container");
    this.my_title_lb = this.seekChild("my_title", cc.Label);
    this.my_val_lb = this.seekChild("my_val", cc.Label);
    this.rank_cr = this.seekChild("rank_cr").getComponent("CusRichText");
    this.no_rank_nd = this.seekChild("no_rank");
    this.no_rank_nd.active = false;
    this.power_nd = this.seekChild("power");
    this.power_nd.active = false;
    this.power_label_cr = this.power_nd.getChildByName("power_label").getComponent("CusRichText");
  },
  // 注册事件监听的接口,不需要手动调用,如果是使用gcore.GlobalEvent监听,可以直接调用addGlobalEvent
  registerEvent: function registerEvent() {
    this.root_wnd.on(cc.Node.EventType.TOUCH_END, function () {
      Utils.playButtonSound(1);
 
      if (this.callback) {
        this.callback(this);
      }
    }.bind(this));
  },
  setData: function setData(data) {
    this.data = data;
 
    if (this.root_wnd) {
      this.onShow();
    }
  },
  // 预制体加载完成之后,添加到对应主节点之后的回调可以设置一些数据了
  onShow: function onShow() {
    if (this.data == null) return;
    var data = this.data;
 
    if (data.type == 1) {
      this.my_title_lb.string = Utils.TI18N("玩家战斗力:");
      this.power_label_cr.setNum(data.val);
      this.power_nd.active = true;
      this.my_val_lb.string = "";
    } else if (data.type == 2) {
      this.my_title_lb.string = Utils.TI18N("玩家推图进度:"); // this.my_title_lb.node.x = this.my_title_lb.node.x + 15;
 
      var config = gdata("dungeon_data", "data_drama_dungeon_info", [data.val]);
 
      if (config) {
        this.my_val_lb.string = config.name;
      } else {
        this.my_val_lb.string = Utils.TI18N("暂无");
      }
    } else if (data.type == 3) {
      this.my_title_lb.string = Utils.TI18N("玩家天梯杯数:");
      this.my_val_lb.string = data.val; // this.my_title_lb.node.x = this.my_title_lb.node.x + 15;
    } else if (data.type == 4) {
      this.my_title_lb.string = Utils.TI18N("玩家伙伴数量:"); // this.my_title_lb.node.x = this.my_title_lb.node.x + 15;
 
      this.my_val_lb.string = data.val;
    } else if (data.type == 5) {
      this.my_title_lb.string = Utils.TI18N("试练塔排行:"); // this.my_title_lb.node.x = this.my_title_lb.node.x + 15;
 
      this.my_val_lb.string = data.val;
    }
 
    if (data.rank != 0) {
      this.no_rank_nd.active = false;
      this.rank_cr.node.active = true;
      this.rank_cr.setNum(data.rank);
    } else {
      this.no_rank_nd.active = true;
      this.rank_cr.node.active = false;
    }
  },
  addCallBack: function addCallBack(value) {
    this.callback = value;
  },
  // 面板设置不可见的回调,这里做一些不可见的屏蔽处理
  onHide: function onHide() {},
  // 当面板从主节点释放掉的调用接口,需要手动调用,而且也一定要调用
  onDelete: function onDelete() {}
});
 
cc._RF.pop();