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
"use strict";
cc._RF.push(module, 'af948+07thE369gBDFRj8pS', 'redbag_rank_item');
// Scripts/mod/redbag/view/redbag_rank_item.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: @syg.com(必填, 创建模块的人员)
// @description:
//      
// <br/>Create: new Date().toISOString()
// --------------------------------------------------------------------
var PathTool = require("pathtool");
 
var RedBagRankItem = cc.Class({
  "extends": BasePanel,
  ctor: function ctor() {
    this.prefabPath = PathTool.getPrefabPath("redbag", "redbag_rank_item");
    this.data = null;
    this.star_list = {};
    this.is_show_point = false;
    this.size = cc.size(600, 123);
  },
  initPanel: function initPanel() {
    this.main_panel = this.seekChild("main_panel");
    this.rank_icon = this.seekChild("rank_icon", cc.Sprite); //名字
 
    this.role_name = Utils.createLabel(26, new cc.Color(0x68, 0x45, 0x2a, 0xff), null, 125 - this.size.width / 2, 0, "", this.main_panel, 0, cc.v2(0, 0.5));
    this.rank_index = Utils.createLabel(30, new cc.Color(0xa9, 0x5f, 0x0f, 0xff), null, 50 - this.size.width / 2, 0, "", this.main_panel, 0, cc.v2(0, 0.5)); //发放总价值
 
    this.send_money = Utils.createLabel(22, new cc.Color(0x68, 0x45, 0x2a, 0xff), null, 355 - this.size.width / 2, 0 + 15, "", this.main_panel, 0, cc.v2(0, 0.5)); //发放数
 
    this.send_num = Utils.createLabel(22, new cc.Color(0xa9, 0x5f, 0x0f, 0xff), null, 355 - this.size.width / 2, 0 - 15, "", this.main_panel, 0, cc.v2(0, 0.5));
  },
  registerEvent: function registerEvent() {
    this.root_wnd.on(cc.Node.EventType.TOUCH_END, function () {
      if (this.calkl_fun) this.call_fun(this.data);
    }, this);
  },
  setData: function setData(data) {
    this.data = data;
    if (this.root_wnd) this.onShow();
  },
  onShow: function onShow() {
    if (this.data == null) return;
    var vo = this.data;
    var index = Number(vo.index) + 1;
    this.index = index || 1;
    this.rank_index.string = this.index;
 
    if (this.index >= 1 && this.index <= 3) {
      this.rank_index.node.active = false;
      this.rank_icon.node.active = true;
      this.loadRes(PathTool.getUIIconPath("common", "common_300" + this.index), function (sf_obj) {
        this.rank_icon.spriteFrame = sf_obj;
      }.bind(this));
      this.rank_icon.node.setScale(0.7);
    } else {
      this.rank_index.node.active = true;
      this.rank_icon.node.active = false;
    }
 
    var name = vo.name || "";
    this.role_name.string = name;
    var price = vo.price || "";
    this.send_money.string = Utils.TI18N("发放总价值:" + price);
    var num = vo.num || 0;
    this.send_num.string = Utils.TI18N("发放红包数:" + num);
  },
  clickHandler: function clickHandler() {
    if (this.call_fun) this.call_fun(this.data);
  },
  addCallBack: function addCallBack(call_fun) {
    this.call_fun = call_fun;
  },
  setVisibleStatus: function setVisibleStatus(bool) {
    this.setVisible(bool);
  },
  getData: function getData() {
    return this.data;
  },
  onDelete: function onDelete() {}
});
module.exports = RedBagRankItem;
 
cc._RF.pop();