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
"use strict";
cc._RF.push(module, 'd8003AmJbFEEp07VGw/JRhl', 'guild_action_goal_item');
// Scripts/mod/guild/view/guild_action_goal_item.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: @syg.com(必填, 创建模块的人员)
// @description:
//      公会活跃item
// <br/>Create: new Date().toISOString()
// --------------------------------------------------------------------
var PathTool = require("pathtool");
 
var GuildController = require("guild_controller");
 
var GuildActionGoalItem = cc.Class({
  "extends": BasePanel,
  ctor: function ctor() {
    this.prefabPath = PathTool.getPrefabPath("guild", "guild_action_goal_item");
    this.ctrl = GuildController.getInstance();
  },
  initPanel: function initPanel() {
    this.container = this.seekChild("container"); //日常
 
    this.title_1 = this.seekChild(this.container, "title_1");
    this.title_1.active = false; //周常
 
    this.title_2 = this.seekChild(this.container, "title_2");
    this.title_2.active = false;
    this.btn_goto = this.seekChild(this.container, "btn_goto");
    this.sprite_has = this.seekChild(this.container, "sprite_has");
    this.sprite_has.active = false;
    this.btn_commit = this.seekChild("btn_commit");
    this.btn_commit.active = false;
    this.item_desc = {};
 
    for (var i = 1; i < 4; i++) {
      this.item_desc[i] = this.seekChild("desc_" + i, cc.Label);
    }
  },
  registerEvent: function registerEvent() {
    if (this.btn_goto) {
      this.btn_goto.on(cc.Node.EventType.TOUCH_END, function () {
        if (this.data.show_jump) require("backpack_controller").getInstance().gotoItemSources(this.data.show_jump, {});else message(Utils.TI18N("该活动未开启"));
      }, this);
    }
 
    if (this.btn_commit) {
      this.btn_commit.on(cc.Node.EventType.TOUCH_END, function () {
        this.ctrl.send16903(this.data.id);
      }, this);
    }
  },
  setData: function setData(data) {
    this.data = data;
    if (this.root_wnd) this.onShow();
  },
  setExtendData: function setExtendData(data) {
    this.task_data = data;
  },
  onShow: function onShow() {
    if (this.data == null) return;
    var data = this.data;
    if (data.desc) this.item_desc[1].string = data.desc;
    this.title_1.active = data.type == 1;
    this.title_2.active = data.type == 2;
    if (data.exp) this.item_desc[3].string = data.exp;
    this.changeItemStatus(this.data.index);
  },
  changeItemStatus: function changeItemStatus(index) {
    this.btn_goto.active = this.task_data[index].finish == 0;
    this.btn_commit.active = this.task_data[index].finish == 1;
    this.sprite_has.active = this.task_data[index].finish == 2;
    var str = cc.js.formatStr("(%s/%s)", this.task_data[index].value, this.task_data[index].target_val);
    this.item_desc[2].string = str;
  },
  onDelete: function onDelete() {}
});
module.exports = GuildActionGoalItem;
 
cc._RF.pop();