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
"use strict";
cc._RF.push(module, 'b59f6RhApBBIbTwOxbFXzpb', 'guildskill_item');
// Scripts/mod/guildskill/view/guildskill_item.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: @syg.com(必填, 创建模块的人员)
// @description:
//      公会技能的属性单列
// <br/>Create: new Date().toISOString()
// --------------------------------------------------------------------
var PathTool = require("pathtool");
 
var ViewClass = require("viewclass");
 
var PartnerCalculate = require("partner_calculate");
 
var GuildSkillAttrItem = cc.Class({
  "extends": ViewClass,
  ctor: function ctor() {
    this.node = arguments[0];
    this.attr_key = arguments[1];
    this.size = this.node.getContentSize();
    var attr_config = gdata("attr_data", "data_key_to_name", [this.attr_key]) || "";
    this.attr_desc = this.node.getChildByName("attr_desc").getComponent(cc.RichText);
    this.attr_desc.string = cc.js.formatStr("<color=#68452A>%s</c> <color=#249004><size=26>%s</size></c>", attr_config, Utils.TI18N("+0"));
    var attr_res = PathTool.getAttrIconByStr(this.attr_key);
    var attr_icon = this.node.getChildByName("attr_icon").getComponent(cc.Sprite);
    this.attr_icon = attr_icon;
    this.loadRes(PathTool.getCommonIcomPath(attr_res), function (sf_obj) {
      this.attr_icon.spriteFrame = sf_obj;
    }.bind(this));
  },
  setData: function setData(data, attr_key) {
    data = data || 0;
    this.attr_key = attr_key;
    var attr_config = gdata("attr_data", "data_key_to_name", [this.attr_key]) || "";
    this.attr_desc.string = cc.js.formatStr("<color=#68452A>%s</c> <color=#249004><size=26>%s</size></c>", attr_config, Utils.TI18N("+0"));
    var attr_res = PathTool.getAttrIconByStr(this.attr_key);
    this.loadRes(PathTool.getCommonIcomPath(attr_res), function (sf_obj) {
      this.attr_icon.spriteFrame = sf_obj;
    }.bind(this)); // this.attr_desc.string = cc.js.formatStr("<color=#68452A>%s</c> <color=#249004><size=26>%s</size></c>", attr_config, data)
 
    if (PartnerCalculate.isShowPerByStr(this.attr_key) == true) this.attr_desc.string = cc.js.formatStr("<color=#68452A>%s</c> <color=#249004><size=26>%s</size></c>", attr_config, "+" + data * 0.1 + "%");else this.attr_desc.string = cc.js.formatStr("<color=#68452A>%s</c> <color=#249004><size=26>%s</size></c>", attr_config, "+" + data);
  },
  onDelete: function onDelete() {}
});
module.exports = GuildSkillAttrItem;
 
cc._RF.pop();