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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
"use strict";
cc._RF.push(module, 'b6e1cg9UO9KNJp1fOS36aj/', 'tips_controller');
// Scripts/mod/tips/tips_controller.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
//      这里填写详细说明,主要填写该模块的功能简要
// <br/>Create: 2018-12-28 09:23:39
// --------------------------------------------------------------------
var TipsConst = require("tips_const");
 
var TipsController = cc.Class({
  "extends": BaseController,
  ctor: function ctor() {},
  // 初始化配置数据
  initConfig: function initConfig() {
    var TipsModel = require("tips_model");
 
    this.model = new TipsModel();
    this.model.initConfig();
    this.tips_list = {}; // tips列表对象
  },
  // 返回当前的model
  getModel: function getModel() {
    return this.model;
  },
  // 注册监听事件
  registerEvents: function registerEvents() {
    if (this.re_link_game == null) {
      this.login_event_success = gcore.GlobalEvent.bind(EventId.EVT_RE_LINK_GAME, function () {
        this.closeAllTips();
      }.bind(this));
    }
  },
  // 注册协议接受事件
  registerProtocals: function registerProtocals() {// this.RegisterProtocal(1110, this.on1110);
  },
  closeTIpsByType: function closeTIpsByType(type) {
    var tips = this.tips_list[type];
 
    if (tips) {
      tips.close();
    }
 
    this.tips_list[type] = null;
  },
  // 关掉所有tips
  closeAllTips: function closeAllTips() {
    for (var key in this.tips_list) {
      var tips = this.tips_list[key];
 
      if (tips && tips.close) {
        tips.close();
        tips = null;
      }
    }
 
    this.tips_list = {};
  },
  // 显示通用物品tips
  showGoodsTips: function showGoodsTips(data, is_show_btn, is_special_source) {
    if (data == null) return;
 
    if (this.tips_list[TipsConst.type.GOODS] == null) {
      var BackPackTips = require("backpack_tips");
 
      var tips = new BackPackTips();
      tips.open({
        data: data,
        show: is_show_btn,
        is_special_source: is_special_source
      });
      this.tips_list[TipsConst.type.GOODS] = tips;
    }
  },
  showEquipTips: function showEquipTips(data, type, partner) {
    if (data == null) return;
 
    if (this.tips_list[TipsConst.type.EQUIP] == null) {
      var EquipTips = require("equip_tips");
 
      var tips = new EquipTips();
      tips.open({
        data: data,
        type: type,
        partner: partner
      });
      this.tips_list[TipsConst.type.EQUIP] = tips;
    }
  },
  showHeadCircleTips: function showHeadCircleTips(data) {
    if (data == null) return;
    this.closeTIpsByType(TipsConst.type.HEAD_CIRCLE);
 
    var HeadCircleTips = require("head_circle_tips");
 
    var tips = new HeadCircleTips();
    tips.open(data);
    this.tips_list[TipsConst.type.HEAD_CIRCLE] = tips;
  },
  //普通tips
  showCommonTips: function showCommonTips(tips, point, font_size, delay, width) {
    if (this.common_tips != null) {
      this.common_tips.close();
      this.common_tips = null;
    }
 
    width = width || 400;
 
    var CommonTips = require("common_tips");
 
    this.common_tips = new CommonTips(delay);
    this.common_tips.open();
    this.common_tips.showTips(tips, width, font_size || 24);
    this.common_tips.addCallBack(function () {
      this.adjustTipsPosition(this.common_tips, point);
    }.bind(this));
    this.tips_list[TipsConst.type.COMMON] = this.common_tips;
    return this.common_tips;
  },
  //  神界冒险的tips
  showAdventureBuffTips: function showAdventureBuffTips(buff_list, point, holiday_buff_list) {
    if (this.adventure_buff_tips) {
      this.adventure_buff_tips.close();
      this.adventure_buff_tips = null;
    }
 
    var AdventureBuffTips = require("adventure_buff_tips");
 
    this.adventure_buff_tips = new AdventureBuffTips(buff_list, holiday_buff_list);
    this.adventure_buff_tips.open();
    this.adventure_buff_tips.showTips();
    this.adventure_buff_tips.addCallBack(function () {
      this.adjustTipsPosition(this.adventure_buff_tips, point);
    }.bind(this));
    this.tips_list[TipsConst.type.ADVENTURE_BUFF] = this.adventure_buff_tips;
    return this.adventure_buff_tips;
  },
  //显示碎片合成
  showBackPackCompTips: function showBackPackCompTips(status, base_id) {
    if (status == true) {
      if (!this.comp_tips) {
        this.comp_tips = Utils.createClass("backpack_comp_tips_window", this);
      }
 
      this.comp_tips.open(base_id);
    } else {
      if (this.comp_tips) {
        this.comp_tips.close();
        this.comp_tips = null;
      }
    }
  },
  //显示碎片合成选择
  showCompChooseTips: function showCompChooseTips(status, base_id) {
    if (status == true) {
      if (!this.choose_tips) {
        this.choose_tips = Utils.createClass("comp_choose_tips_window", this);
      }
 
      this.choose_tips.open(base_id);
    } else {
      if (this.choose_tips) {
        this.choose_tips.close();
        this.choose_tips = null;
      }
    }
  },
  //位置调整(现在默认为显示的tips的anchorPoint的为cc.p(0.5, 0.5))
  adjustTipsPosition: function adjustTipsPosition(target, point, view_size) {
    var win_size = cc.size(SCREEN_WIDTH, SCREEN_HEIGHT); //父节点的尺寸
 
    var temp_size = view_size || target.getBgContentSize(); //获取内部背景随动的节点尺寸
 
    var size = cc.size(temp_size.width, temp_size.height);
    var parent = ViewManager.getInstance().getSceneNode(SCENE_TAG.msg);
    var local_pos = parent.convertToNodeSpaceAR(point);
    var start_x = local_pos.x;
    var start_y = local_pos.y - size.height / 2;
 
    if (start_x + size.width / 2 > win_size.width / 2) {
      start_x = start_x - size.width / 2;
    } else if (start_x - size.width / 2 < -win_size.width / 2) {
      start_x = start_x + size.width / 2;
    }
 
    if (start_y > win_size.height / 2) {
      start_y = win_size.height / 2;
    } else if (start_y - size.height < -win_size.height / 2) {
      start_y = start_y + size.height;
    }
 
    target.setPosition(start_x, start_y);
  },
  // --技能tips
  showSkillTips: function showSkillTips(skill_vo, is_lock, not_show_next, hide_flag) {
    if (typeof skill_vo == "number") {
      skill_vo = Config.skill_data.data_get_skill[skill_vo];
    }
 
    var SkillTips = require("skill_tips_window");
 
    var skill_tips = new SkillTips(); //SkillTips.New()
 
    var data = {
      skill_vo: skill_vo,
      is_lock: is_lock,
      not_show_next: not_show_next,
      hide_flag: hide_flag
    };
    skill_tips.open(data);
    this.tips_list[TipsConst.type.SKILL] = skill_tips; // table.insert(this.tips_list,skill_tips)
    // return skill_tips
  },
  getCompTipsRoot: function getCompTipsRoot() {
    if (this.comp_tips) return this.comp_tips.root_wnd;
  },
  showFirstCharge: function showFirstCharge(callFunc) {
    var NewfirstchargeController = require("newfirstcharge_controller");
 
    if (NewfirstchargeController.getInstance().getNewFirstChargeView()) {
      callFunc();
      return;
    }
 
    var RoleController = require("role_controller");
 
    var role_vo = RoleController.getInstance().getRoleVo();
 
    if (role_vo.vip_exp * 0.1 >= 6) {
      callFunc();
      return;
    }
 
    var CommonAlert = require("commonalert");
 
    CommonAlert.show(Utils.TI18N("您有4倍充值返利未使用,是否前往?"), Utils.TI18N('立即前往'), function () {
      NewfirstchargeController.getInstance().openNewFirstChargeView(true);
    }, Utils.TI18N("继续充值"), callFunc);
  },
  showWeekCardTips: function showWeekCardTips(status, data) {
    if (status == true) {
      if (!this.weekcard_tips) {
        var WeekCardTips = require("week_card_tips_window");
 
        this.weekcard_tips = new WeekCardTips(this);
      }
 
      this.weekcard_tips.open(data);
    } else {
      if (this.weekcard_tips) {
        this.weekcard_tips.close();
        this.weekcard_tips = null;
      }
    }
  }
});
module.exports = TipsController;
 
cc._RF.pop();