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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
"use strict";
cc._RF.push(module, '6b04c15zmZNv4O9N6JUfO8m', 'battle_drama_main_point_item');
// Scripts/mod/battle_drama/view/battle_drama_main_point_item.js
 
"use strict";
 
// -- --------------------------------------------------------------------
// -- 
// -- 
// -- @author: mengjiabin@syg.com(必填, 创建模块的人员)
// -- @editor: mengjiabin@syg.com(必填, 后续维护以及修改的人员)
// -- @description:
// --      剧情副本关卡点item
// -- <br/>Create: 2018-xx-xx
// -- --------------------------------------------------------------------
var BattleDramaController = require("battle_drama_controller");
 
var BattleDramaMainPointItem = cc.Class({
  "extends": BaseClass,
  ctor: function ctor() {
    this.ctrl = BattleDramaController.getInstance();
    this.model = this.ctrl.getModel();
    this.initConfig();
    this.initUi();
  },
  initConfig: function initConfig() {
    this.is_big_point = false; //是否为大关
  },
  // 初始化UI
  initUi: function initUi() {
    this.size = cc.size(50, 50);
    this.root_wnd = new cc.Node("point_item");
    this.root_wnd.setAnchorPoint(0.5, 0.5);
    this.root_wnd.setContentSize(this.size);
    this.button = this.root_wnd.addComponent(cc.Button);
    this.normal_img = this.root_wnd.addComponent(cc.Sprite);
    LoaderManager.getInstance().loadRes(PathTool.getUIIconPath("battle", "battle_normal_point"), function (res_object) {
      this.normal_img.spriteFrame = res_object;
    }.bind(this));
    this.setRootVisible(false);
    this.registerEvent();
  },
  registerEvent: function registerEvent() {
    Utils.onTouchEnd(this.root_wnd, function () {
      if (this.is_big_point == 1) {
        if (this.data) {
          this.ctrl.openDramBossInfoView(true, this.data);
        }
      }
    }.bind(this), 1);
  },
  // 设置数据
  setData: function setData(data) {
    if (!data) return;
    this.data = data; // --this.swap_boss_max_data = swap_boss_max_data
    // var drama_data = this.model.getDramaData();
 
    this.is_big_point = data.info_data.is_big;
    this.dun_id = data.info_data.id;
    this.chapter_id = data.info_data.chapter_id;
    this.next_id = data.info_data.next_id;
    this.v_data = data.v_data;
    this.updateStatus(this.v_data.status, this.is_big_point);
  },
  setPosition: function setPosition(x, y) {
    if (this.root_wnd) {
      this.root_wnd.setPosition(x, y);
    }
  },
  updateStatus: function updateStatus(status, is_big_point) {
    this.setRootVisible(false);
    if (!this.normal_img) return;
 
    if (status == 1 || status == 2 || status == 3) {
      //制作中,有倒计时
      this.setRootVisible(true);
 
      if (status == 3 && is_big_point == 1) {
        LoaderManager.getInstance().loadRes(PathTool.getUIIconPath("battle", "battle_drama_has_ack"), function (res_object) {
          this.normal_img.spriteFrame = res_object;
        }.bind(this));
 
        if (this.button) {
          this.button.transition = cc.Button.Transition.SCALE;
          this.button.duration = 0.1;
          this.button.zoomScale = 0.9;
        }
      } else {
        if (is_big_point == 1) {
          LoaderManager.getInstance().loadRes(PathTool.getUIIconPath("battle", "battle_drama_no_ack"), function (res_object) {
            this.normal_img.spriteFrame = res_object;
          }.bind(this));
        }
 
        if (this.button) {
          this.button.transition = cc.Button.Transition.NONE;
        }
      }
    } else {
      if (is_big_point == 1) {
        LoaderManager.getInstance().loadRes(PathTool.getUIIconPath("battle", "battle_drama_no_ack"), function (res_object) {
          this.normal_img.spriteFrame = res_object;
        }.bind(this));
 
        if (this.button) {
          this.button.transition = cc.Button.Transition.NONE;
        }
      }
    }
  },
  setRootVisible: function setRootVisible(bool) {
    if (this.root_wnd) {
      this.root_wnd.active = bool;
    }
  },
  getPositionX: function getPositionX() {
    if (this.root_wnd) {
      return this.root_wnd.x;
    }
 
    return 0;
  },
  // 清除数据
  clearInfo: function clearInfo() {
    if (this.root_wnd) {
      this.root_wnd.stopAllActions();
      this.root_wnd.removeFromParent();
    }
  },
  // 删掉的时候关闭
  DeleteMe: function DeleteMe() {
    if (this.root_wnd) {
      this.root_wnd.stopAllActions();
      this.root_wnd.removeFromParent();
      this.root_wnd.removeAllChildren();
    }
  }
});
 
cc._RF.pop();