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
"use strict";
cc._RF.push(module, 'dd5cf1eTI9Psqq2GzRvu4pN', 'arena_champion_report_item');
// Scripts/mod/arena/view/champion/arena_champion_report_item.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
//     这里是描述这个窗体的作用的
// <br/>Create: 2019-04-27 14:37:08
// --------------------------------------------------------------------
var PathTool = require("pathtool");
 
var Arena_champion_report_itemPanel = cc.Class({
  "extends": BasePanel,
  ctor: function ctor() {
    this.prefabPath = PathTool.getPrefabPath("arena", "arena_champion_report_item");
  },
  // 可以初始化声明一些变量的
  initConfig: function initConfig() {},
  // 初始化一些配置数据,可以用于声明一些变量之类的
  initPanel: function initPanel() {
    this.desc_1_lb = this.seekChild("desc_1", cc.Label);
    this.desc_2_lb = this.seekChild("desc_2", cc.Label);
    this.desc_3_lb = this.seekChild("desc_3", cc.Label);
    this.progress_1_pb = this.seekChild("progress_1", cc.ProgressBar);
    this.progress_2_pb = this.seekChild("progress_2", cc.ProgressBar);
    this.progress_3_pb = this.seekChild("progress_3", cc.ProgressBar);
    this.role_con_nd = this.seekChild("role_con");
    var hero_item = this.hero_item = ItemsPool.getInstance().getItem("hero_exhibition_item");
    ;
    hero_item.setParent(this.role_con_nd);
    hero_item.setExtendData({
      scale: 0.8
    });
    hero_item.show();
  },
  // 注册事件监听的接口,不需要手动调用,如果是使用gcore.GlobalEvent监听,可以直接调用addGlobalEvent
  registerEvent: function registerEvent() {},
  // 预制体加载完成之后,添加到对应主节点之后的回调可以设置一些数据了
  onShow: function onShow(params) {
    if (this.data) this.updateWidgets();
  },
  // 面板设置不可见的回调,这里做一些不可见的屏蔽处理
  onHide: function onHide() {},
  // 当面板从主节点释放掉的调用接口,需要手动调用,而且也一定要调用
  onDelete: function onDelete() {},
  setData: function setData(data) {
    // cc.log("DDDDDDDDDDDDDDDDDDDDDD");
    // cc.log(data);
    this.data = data;
    if (this.root_wnd) this.updateWidgets();
  },
  setExtendData: function setExtendData(data) {
    this.total_hurt = data.total_hurt;
    this.total_behurt = data.total_behurt;
    this.total_curt = data.total_curt;
  },
  updateWidgets: function updateWidgets() {
    var data = this.data;
    this.desc_1_lb.string = data.hurt;
    this.desc_2_lb.string = data.behurt;
    this.desc_3_lb.string = data.curt;
 
    if (this.total_hurt == 0) {
      this.progress_1_pb.progress = 0;
    } else {
      this.progress_1_pb.progress = data.hurt / this.total_hurt;
    }
 
    if (this.total_behurt == 0) {
      this.progress_2_pb.progress = 0;
    } else {
      this.progress_2_pb.progress = data.behurt / this.total_behurt;
    }
 
    if (this.total_curt == 0) {
      this.progress_3_pb.progress = 0;
    } else {
      this.progress_3_pb.progress = data.curt / this.total_curt;
    }
 
    this.hero_item.setData(data);
  }
});
 
cc._RF.pop();