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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
"use strict";
cc._RF.push(module, '93167wGBMpPqIG9aJXvsB7Q', 'hero_main_info_window');
// Scripts/mod/hero/view/hero_main_info_window.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
//     这里是描述这个窗体的作用的
// <br/>Create: 2019-02-18 09:25:07
// --------------------------------------------------------------------
var PathTool = require("pathtool");
 
var HeroConst = require("hero_const");
 
var BaseRole = require("baserole");
 
var HeroEvent = require("hero_event");
 
var HeroCalculate = require("hero_calculate");
 
var MainUIController = require("mainui_controller");
 
var GuideEvent = require("guide_event");
 
var HeroMainInfoWindow = cc.Class({
  "extends": BaseView,
  ctor: function ctor() {
    this.prefabPath = PathTool.getPrefabPath("hero", "hero_main_info_window");
    this.viewTag = SCENE_TAG.ui; //该窗体所属ui层级,全屏ui需要在ui层,非全屏ui在dialogue层,这个要注意
 
    this.win_type = WinType.Full; //是否是全屏窗体  WinType.Full, WinType.Big, WinType.Mini, WinType.Tips
 
    this.rleasePrefab = false;
    this.ctrl = arguments[0];
    this.model = this.ctrl.getModel();
 
    var ActionController = require("action_controller");
 
    if (ActionController.getInstance().action_operate) {
      ActionController.getInstance().action_operate.setVisible(false);
    }
 
    var StrongerController = require("stronger_controller");
 
    if (StrongerController.getInstance().main_win) {
      StrongerController.getInstance().main_win.setVisible(false);
    }
  },
  // 初始化一些配置数据,可以用于声明一些变量之类的
  initConfig: function initConfig() {
    this.role_vo = null;
    this.hero_list = [];
    this.setting = null;
    this.cur_tap = 1; // 当前标签页
  },
  // 预制体加载完成之后的回调,可以在这里捕获相关节点或者组件
  openCallBack: function openCallBack() {
    this.background_sp = this.seekChild("background", cc.Sprite);
    this.main_container_nd = this.seekChild("main_container");
    this.tab_container = this.seekChild("tab_container");
    this.equip_container_nd = this.seekChild("equip_container");
    this.comment_btn_nd = this.seekChild("comment_btn");
    this.lock_btn_nd = this.seekChild("lock_btn");
    this.share_btn_nd = this.seekChild("share_btn");
    this.close_btn_nd = this.seekChild("close_btn");
    this.left_btn_nd = this.seekChild("left_btn");
    this.right_btn_nd = this.seekChild("right_btn");
    this.power_num_nd = this.seekChild("power_num");
    this.power_num_cs = this.power_num_nd.getComponent("CusRichText"); // 立绘
 
    this.draw_btn_nd = this.seekChild("draw_btn"); //皮肤
 
    this.skin_btn_nd = this.seekChild("skin_btn");
    this.hero_info_20_nd = this.seekChild("hero_info_20"); // hero
 
    this.star_node_nd = this.seekChild("star_node");
    this.camp_icon_sp = this.seekChild("camp_icon", cc.Sprite);
    this.name_lb = this.seekChild("name", cc.Label);
    this.mode_node_nd = this.seekChild("mode_node");
    this.star_item_nd = this.seekChild("star_item");
    this.hero_camp_bg_sp = this.seekChild("hero_camp_bg", cc.Sprite);
    this.up_lev_act_nd = this.seekChild("up_lev_act");
    this.up_lev_efc_sk = this.seekChild("up_lev_efc", sp.Skeleton); // 锁定分享评论
 
    this.share_btn_nd = this.seekChild("share_btn");
    this.lock_btn_nd = this.seekChild("lock_btn");
    this.comment_btn_nd = this.seekChild("comment_btn");
    this.lock_icon_sp = this.seekChild("lock_icon", cc.Sprite);
    this.background = this.seekChild("background");
    this.background.scale = this.background.scale * FIT_SCALE; // 分享
 
    this.share_panel_nd = this.seekChild("share_panel");
    this.share_btns = {};
 
    for (var share_i = 1; share_i <= 3; share_i++) {
      var share_btn = this.share_btns[share_i] = this.seekChild(this.share_panel_nd, "share_btn_" + share_i);
      share_btn.share_tag = share_i;
      share_btn.on(cc.Node.EventType.TOUCH_END, this.onClickChannelBtn, this);
    } // 升级动画
 
 
    this.attr_keys = ["atk", "hp", "def", "speed"];
    this.attr_lbs = {};
 
    for (var attr_i = 0; attr_i < 4; attr_i++) {
      this.attr_lbs[this.attr_keys[attr_i]] = this.seekChild(this.up_lev_act_nd, "attr_" + attr_i, cc.Label);
    }
 
    this.btn_taps = {};
 
    for (var tab_index = 1; tab_index <= 3; tab_index++) {
      // this.btn_taps[tab_index] = this.seekChild("tab_btn_" + tab_index);
      this.btn_taps[tab_index] = {};
      var cut_tab_nd = this.seekChild("tab_btn_" + tab_index);
      this.btn_taps[tab_index]["tab_nd"] = cut_tab_nd;
      this.btn_taps[tab_index]["select_img"] = this.seekChild(cut_tab_nd, "select_img");
      this.btn_taps[tab_index]["normal_img"] = this.seekChild(cut_tab_nd, "normal_img");
      this.btn_taps[tab_index]["red_img"] = this.seekChild(cut_tab_nd, "red_point");
      this.btn_taps[tab_index]["red_img"].active = false;
      cut_tab_nd.tab_tag = tab_index;
      cut_tab_nd.on(cc.Node.EventType.TOUCH_END, this.onClickTabBtn, this);
    }
 
    this.hero_model = new BaseRole();
    this.hero_model.setParent(this.mode_node_nd); // 装备面板
 
    var HeroMainEquipPanel = require("hero_main_equip_panel");
 
    this.equip_panel = new HeroMainEquipPanel(this.ctrl);
    this.equip_panel.setParent(this.equip_container_nd);
    this.equip_panel.show(); // 培养
 
    var HeroMainTrainPanel = require("hero_mian_train_panel");
 
    this.train_panel = new HeroMainTrainPanel(this.ctrl);
    this.train_panel.setParent(this.tab_container); // 升星
 
    var HeroMainUpStarPanel = require("hero_main_upgrade_star_panel");
 
    this.up_star_panel = new HeroMainUpStarPanel(this.ctrl);
    this.up_star_panel.setParent(this.tab_container); // 天赋
 
    var HeroMainTalentPanel = require("hero_main_talent_panel");
 
    this.talent_panel = new HeroMainTalentPanel(this.ctrl);
    this.talent_panel.setParent(this.tab_container);
    this.up_lev_act_nd.active = false;
    this.close_btn_nd.on(cc.Node.EventType.TOUCH_END, this.onClickCloseBtn, this);
    this.left_btn_nd.on(cc.Node.EventType.TOUCH_END, this.onClickLeftBtn, this);
    this.right_btn_nd.on(cc.Node.EventType.TOUCH_END, this.onClickRightBtn, this);
    this.share_btn_nd.on(cc.Node.EventType.TOUCH_END, this.onClickShareBtn, this);
    this.lock_btn_nd.on(cc.Node.EventType.TOUCH_END, this.onClickLockBtn, this);
    this.comment_btn_nd.on(cc.Node.EventType.TOUCH_END, this.onClickCommentBtn, this);
    this.share_panel_nd.on(cc.Node.EventType.TOUCH_END, this.onClickSharePanel, this);
    this.draw_btn_nd.on(cc.Node.EventType.TOUCH_END, this.onClickDrawBtn, this);
    this.skin_btn_nd.on(cc.Node.EventType.TOUCH_END, this.onClickSkinBtn, this);
  },
  // 注册事件监听的接口,不需要手动调用,如果是使用gcore.GlobalEvent监听,可以直接调用addGlobalEvent
  registerEvent: function registerEvent() {
    // 英雄信息返回
    this.addGlobalEvent(HeroEvent.Hero_Data_Update, function (hero_vo) {
      if (!hero_vo) return;
 
      if (hero_vo.partner_id == this.hero_vo.partner_id) {
        this.updateHeroInfo(hero_vo); // 更新红点信息
      }
    }.bind(this)); // 装备穿戴
 
    this.addGlobalEvent(HeroEvent.Equip_Update_Event, function (data) {
      if (!this.hero_vo) return;
 
      if (data.partner_id == this.hero_vo.partner_id) {
        this.updateHeroInfo(data);
      }
    }.bind(this)); // 升级成功返回
 
    this.addGlobalEvent(HeroEvent.Hero_Level_Up_Success_Event, function () {
      if (!this.hero_vo) return;
      this.showLevelUpAction();
    }.bind(this)); // 锁定
 
    this.addGlobalEvent(HeroEvent.Hero_Lock_Event, function () {
      if (!this.hero_vo || this.show_model_type == HeroConst.BagTab.eBagPokedex) return;
      this.setLock();
    }.bind(this));
    this.addGlobalEvent(HeroEvent.Hero_Get_Talent_Event, function (list) {
      if (!list) return;
      if (!this.hero_vo) return;
 
      for (var i = 0; i < list.length; ++i) {
        var v = list[i];
 
        if (v.partner_id == this.hero_vo.partner_id) {
          this.hero_vo = Utils.deepCopy1(this.model.getHeroById(v.partner_id));
          this.updatePageRedPoint();
          break;
        }
      }
    }.bind(this));
  },
  // 预制体加载完成之后,添加到对应主节点之后的回调,也就是一个窗体的正式入口,可以设置一些数据了
  openRootWnd: function openRootWnd(params) {
    this.hero_vo = Utils.deepCopy1(params.hero_vo);
    this.hero_list = params.hero_list || [];
    this.setting = params.setting;
    this.callback = this.setting.callback;
    this.show_model_type = this.setting.show_model_type || HeroConst.BagTab.eBagHero;
    MainUIController.getInstance().changeHeroStatus(true);
    this.playHeroAnim = true;
    this.updateWidget();
    if (window.TASK_TIPS) gcore.GlobalEvent.fire(GuideEvent.TaskNextStep, "hero_30402"); //任务引导用到
 
    if (this.show_model_type == HeroConst.BagTab.eBagPokedex) {
      this.skin_btn_nd.active = false;
    }
  },
  // 关闭窗体回调,需要在这里调用该窗体所属controller的close方法没用于置空该窗体实例对象
  closeCallBack: function closeCallBack() {
    if (this.equip_panel) this.equip_panel.deleteMe();
    if (this.train_panel) this.train_panel.deleteMe();
    if (this.up_star_panel) this.up_star_panel.deleteMe();
    if (this.talent_panel) this.talent_panel.deleteMe();
    if (this.hero_model) this.hero_model.deleteMe();
    this.ctrl.openHeroMainInfoWindow(false);
 
    if (this.callback) {
      this.callback();
      this.callback = null;
    }
 
    var ActionController = require("action_controller");
 
    if (ActionController.getInstance().action_operate) {
      ActionController.getInstance().action_operate.setVisible(true);
    }
 
    var StrongerController = require("stronger_controller");
 
    if (StrongerController.getInstance().main_win) {
      StrongerController.getInstance().main_win.setVisible(true);
    }
 
    gcore.GlobalEvent.fire(GuideEvent.CloseTaskEffect);
    MainUIController.getInstance().changeHeroStatus(false);
  },
  checkOpenByconfig: function checkOpenByconfig(config) {
    if (!config) return;
    if (!this.hero_vo) return;
 
    if (config.pos_limit[0] == 'star') {
      var is_open = this.hero_vo.star >= config.pos_limit[1];
 
      if (is_open) {
        return {
          is_open: is_open
        };
      } else {
        return {
          is_open: is_open,
          tip: config.pos_limit[1] + Utils.TI18N("星开启")
        };
      }
    }
  },
  onClickTabBtn: function onClickTabBtn(event) {
    Utils.playButtonSound(ButtonSound.Normal);
    if (event.target.tab_tag === this.cur_tap) return;
 
    if (event.target.tab_tag > 0) {
      this.cur_tap = event.target.tab_tag;
      this.updateTab();
    }
  },
  updateWidget: function updateWidget(hero_vo) {
    if (!this.hero_vo) return;
    var skin_config = null;
 
    if (this.hero_vo.use_skin && this.hero_vo.use_skin != 0) {
      skin_config = Config.partner_skin_data.data_skin_info[this.hero_vo.use_skin];
    } // 背景
 
 
    var camp_type = this.hero_vo.camp_type || HeroConst.CampType.eWater;
    var bg_res = null;
 
    if (skin_config && skin_config.hero_info_bg_res && skin_config.hero_info_bg_res != "") {
      bg_res = PathTool.getUIIconPath("bigbg/hero", skin_config.hero_info_bg_res);
    } else {
      bg_res = PathTool.getUIIconPath("bigbg/hero", HeroConst.CampBgRes[camp_type]);
    }
 
    if (!this.bg_res || this.bg_res !== bg_res) {
      this.loadRes(bg_res, function (bg_sf) {
        this.background_sp.spriteFrame = bg_sf;
        gcore.Timer.set(function () {
          this.main_container_nd.active = true;
          this.updateSpine();
        }.bind(this), 100, 1);
      }.bind(this));
      this.bg_res = bg_res;
    } // 阵容背景
 
 
    var camp_bg_path = null;
 
    if (skin_config && skin_config.hero_camp_res && skin_config.hero_camp_res != "") {
      if (skin_config.hero_camp_res == "null") {
        this.hero_camp_bg_sp.node.active = false;
      } else {
        camp_bg_path = PathTool.getUIIconPath("bigbg/hero", skin_config.hero_camp_res);
        this.hero_camp_bg_sp.node.active = true;
      }
    } else {
      this.hero_camp_bg_sp.node.active = true;
      camp_bg_path = PathTool.getUIIconPath("bigbg/hero", HeroConst.CampBottomBgRes[camp_type]);
    }
 
    this.loadRes(camp_bg_path, function (camp_bg_sf) {
      this.hero_camp_bg_sp.spriteFrame = camp_bg_sf;
    }.bind(this)); // 英雄动画
 
    this.name_lb.string = this.hero_vo.name;
    var camp_res = PathTool.getHeroCampRes(this.hero_vo.camp_type);
    var common_res_path = PathTool.getUIIconPath("common", camp_res);
    this.loadRes(common_res_path, function (sf_obj) {
      this.camp_icon_sp.spriteFrame = sf_obj;
    }.bind(this)); // 战力
 
    this.power_num_cs.setNum(this.hero_vo.power); // 星星
 
    this.updateStars(this.hero_vo.star); // if (!hero_vo || hero_vo.partner_id != this.hero_vo.partner_id)
 
    if (this.playHeroAnim) {
      this.updateSpine();
      this.playHeroAnim = false;
    } // 左右箭头
 
 
    var cur_index = 0;
 
    for (var hero_i in this.hero_list) {
      if (this.hero_list[hero_i].partner_id === this.hero_vo.partner_id) {
        cur_index = parseInt(hero_i);
        break;
      }
    }
 
    if (cur_index == 0) {
      this.left_btn_nd.active = false;
 
      if (this.hero_list.length <= 1) {
        this.right_btn_nd.active = false;
      }
    } else if (cur_index == this.hero_list.length - 1) {
      this.right_btn_nd.active = false;
    } else {
      this.left_btn_nd.active = true;
      this.right_btn_nd.active = true;
    } // 是否可以升星
    // this.is_show_up_star = true;
 
 
    if (this.show_model_type == HeroConst.BagTab.eBagHero) {
      var is_max_star = this.model.isMaxStarHero(this.hero_vo.bid, this.hero_vo.star);
 
      if (is_max_star) {
        this.is_show_up_star = false;
      } else {
        this.is_show_up_star = true;
      }
 
      this.setLock();
      this.updateEquipPanel(); // 是否有天赋
 
      if (this.hero_vo.star >= 6) {
        this.is_show_talent = true;
      } else {
        this.is_show_talent = false;
      }
    } else {
      this.share_btn_nd.active = false;
      this.lock_btn_nd.active = false;
    } // 没有升星的英雄处理
 
 
    if (!this.is_show_up_star) {
      if (this.cur_tap == 2) this.cur_tap = 1;
      this.btn_taps["2"]["tab_nd"].active = false;
    } else {
      this.btn_taps["2"]["tab_nd"].active = true;
    } // 天赋领悟
 
 
    if (!this.is_show_talent) {
      if (this.cur_tap == 3) this.cur_tap = 1;
      this.btn_taps["3"]["tab_nd"].active = false;
    } else {
      this.btn_taps["3"]["tab_nd"].active = true;
    } // 立绘
 
 
    if (this.hero_vo.draw_res) {
      this.draw_btn_nd.active = true;
    } else {
      this.draw_btn_nd.active = false;
    }
 
    this.updateTab();
 
    if (this.show_model_type == HeroConst.BagTab.eBagHero) {
      if (this.model.isOpenTanlentByHerovo(this.hero_vo) && !this.hero_vo.ishaveTalentData()) {
        this.ctrl.sender11099([{
          partner_id: this.hero_vo.partner_id
        }]);
      } // if model:isOpenHolyEquipMentByHerovo(self.select_hero_vo) and not self.select_hero_vo:ishaveHolyEquipmentData() then
      //     controller:sender11092({{partner_id = self.select_hero_vo.partner_id}})
      // end
      // if not self.select_hero_vo:isInitAttr() then
      //     controller:sender11026({{partner_id = self.select_hero_vo.partner_id}})
      // end
 
 
      var bid_config = Config.partner_skin_data.data_partner_bid_info[this.hero_vo.bid];
 
      if (bid_config) {
        this.skin_btn_nd.active = true;
        var role_lv_cfg = Config.partner_skin_data.data_const["skin_open"];
 
        if (role_lv_cfg) {
          if (role_lv_cfg.val[0] == "lev") {
            var role_vo = require("role_controller").getInstance().getRoleVo();
 
            if (role_vo && role_vo.lev < role_lv_cfg.val[1]) {
              this.skin_btn_nd.active = false;
            }
          }
        }
      } else {
        this.skin_btn_nd.active = false;
      }
    }
  },
  // 更新装备面板
  updateEquipPanel: function updateEquipPanel() {
    this.equip_panel.updateHerovo(this.hero_vo);
  },
  setLock: function setLock() {
    var lock_icon = "hero_info_6";
 
    if (this.hero_vo.dic_locks[HeroConst.LockType.eHeroLock]) {
      lock_icon = "hero_info_5";
    }
 
    var icon_path = PathTool.getUIIconPath("hero", lock_icon);
    this.loadRes(icon_path, function (lock_sf) {
      this.lock_icon_sp.spriteFrame = lock_sf;
    }.bind(this));
  },
  updateStars: function updateStars(star_num) {
    var star_res = "";
    var star_scal = 1;
    this.star_node_nd.destroyAllChildren();
    this.star_node_nd.width = 0;
    var star;
 
    if (star_num > 0 && star_num <= 5) {
      star_res = "common_90074";
    } else if (star_num > 5 && star_num <= 9) {
      star_num = star_num - 5;
      star_res = "common_90075";
    } else if (star_num > 9) {
      star = star_num - 10;
      star_num = 1;
      star_res = "common_90073";
      star_scal = 1.2;
    }
 
    for (var star_i = 0; star_i < star_num; star_i++) {
      var star_nd = cc.instantiate(this.star_item_nd);
      star_nd.scale = star_scal;
      var star_sp = star_nd.getComponent(cc.Sprite);
      var common_res_path = PathTool.getUIIconPath("common", star_res);
      this.loadRes(common_res_path, function (star_sp, sf_obj) {
        star_sp.spriteFrame = sf_obj;
      }.bind(this, star_sp));
      this.star_node_nd.addChild(star_nd);
 
      if (star) {
        var node = new cc.Node();
        node.y = -1;
        var lab = node.addComponent(cc.Label);
        lab.string = star;
        lab.fontSize = 15;
        lab.lineHeight = 16;
        lab.horizontalAlign = cc.macro.TextAlignment.CENTER;
        lab.verticalAlign = cc.macro.TextAlignment.CENTER;
        node.addComponent(cc.LabelOutline).color = new cc.color(0, 0, 0);
        star_nd.addChild(node);
      }
    }
  },
  updateSpine: function updateSpine() {
    this.hero_model.setData(BaseRole.type.partner, this.hero_vo, PlayerAction.show, true, 1, {
      skin_id: this.hero_vo.use_skin
    });
 
    if (this.hero_vo.use_skin != 0) {
      var skin_config = Config.partner_skin_data.data_skin_info[this.hero_vo.use_skin];
 
      if (skin_config && skin_config.hero_camp_res == "null") {
        this.hero_info_20_nd.active = false;
      } else {
        this.hero_info_20_nd.active = true;
      }
    } else {
      this.hero_info_20_nd.active = true;
    }
  },
  onClickCloseBtn: function onClickCloseBtn() {
    Utils.playButtonSound(ButtonSound.Close);
    this.ctrl.openHeroMainInfoWindow(false);
  },
  updateTab: function updateTab() {
    if (this.show_model_type == HeroConst.BagTab.eBagPokedex) {
      // 图鉴
      for (var tab_i in this.btn_taps) {
        this.btn_taps[tab_i]["tab_nd"].active = false;
      }
 
      this.train_panel.show(this.hero_vo);
      this.up_star_panel.hide();
      this.equip_panel.hide();
      this.talent_panel.hide();
    } else {
      // 英雄背包
      var no_select_tabs = [];
 
      if (this.cur_tap === 1) {
        no_select_tabs = [2, 3];
        this.train_panel.show(this.hero_vo);
        if (this.up_star_panel.root_wnd) this.up_star_panel.hide();
        if (this.talent_panel.root_wnd) this.talent_panel.hide();
      } else if (this.cur_tap === 2) {
        no_select_tabs = [1, 3];
        this.train_panel.hide();
        if (this.talent_panel.root_wnd) this.talent_panel.hide();
        this.up_star_panel.show(this.hero_vo);
      } else if (this.cur_tap === 3) {
        no_select_tabs = [1, 2];
        this.train_panel.hide();
        if (this.up_star_panel.root_wnd) this.up_star_panel.hide();
        this.talent_panel.show(this.hero_vo);
      } // // 没有升星的英雄处理
      // if (!this.is_show_up_star) {
      //     this.cur_tap = 1;
      //     no_select_tabs = [2, 3];
      //     this.btn_taps["2"]["tab_nd"].active = false;
      //     this.train_panel.setVisible(true);
      //     this.up_star_panel.setVisible(false);
      // } else {
      //     this.btn_taps["2"]["tab_nd"].active = true;
      // }
      // if (!this.is_show_talent) {
      // }
 
 
      this.btn_taps[this.cur_tap]["select_img"].active = true;
      this.btn_taps[this.cur_tap]["normal_img"].active = false;
 
      for (var index_i in no_select_tabs) {
        var no_select_tab = no_select_tabs[index_i];
        this.btn_taps[no_select_tab]["select_img"].active = false;
        this.btn_taps[no_select_tab]["normal_img"].active = true;
      }
 
      this.updatePageRedPoint();
    }
  },
  updateTabShow: function updateTabShow() {},
  onClickRightBtn: function onClickRightBtn() {
    Utils.playButtonSound(ButtonSound.Normal);
    this.getNextVoByDis(1);
  },
  onClickLeftBtn: function onClickLeftBtn() {
    Utils.playButtonSound(ButtonSound.Normal);
    this.getNextVoByDis(-1);
  },
  updateHeroInfo: function updateHeroInfo(hero_vo) {
    if (!hero_vo) {
      if (!this.hero_vo) return;
    } else {
      if (this.hero_vo && hero_vo) {
        if (this.hero_vo.partner_id == hero_vo.partner_id && this.hero_vo.star != hero_vo.star) {
          //英雄升星
          if (hero_vo.star == 6 || hero_vo.star == 10) {
            this.playHeroAnim = true;
          }
        } else if (this.hero_vo.partner_id != hero_vo.partner_id) {
          //切换英雄
          this.playHeroAnim = true;
        }
      }
 
      this.hero_vo = Utils.deepCopy1(hero_vo);
    }
 
    this.updateWidget();
    this.train_panel.updateHerovo(this.hero_vo);
 
    if (this.show_model_type == HeroConst.BagTab.eBagHero) {
      this.up_star_panel.updateHerovo(this.hero_vo);
      this.equip_panel.updateHeroInfo();
      this.talent_panel.updateHeroInfo(this.hero_vo);
    }
  },
  getNextVoByDis: function getNextVoByDis(dis) {
    if (!this.hero_vo) return;
    var cur_index = null;
 
    for (var hero_i in this.hero_list) {
      if (this.hero_list[hero_i].partner_id == this.hero_vo.partner_id) cur_index = hero_i;
    }
 
    if (cur_index >= 0) {
      var next_index = parseInt(cur_index) + dis;
 
      if (next_index < 0) {
        this.left_btn_nd.active = false;
        return;
      } else if (next_index > this.hero_list.length - 1) {
        this.right_btn_nd.active = false;
        return;
      } else {
        this.right_btn_nd.active = true;
        this.left_btn_nd.active = true;
      }
 
      this.updateHeroInfo(this.hero_list[next_index]);
    }
  },
  // 展示升级动画
  showLevelUpAction: function showLevelUpAction() {
    if (!this.hero_vo) return;
 
    for (var attr_i = 0; attr_i < 4; attr_i++) {
      var attr_name = Config.attr_data.data_key_to_name[this.attr_keys[attr_i]];
      var k = this.attr_keys[attr_i] + "2"; // var attr_val = this.hero_vo[this.attr_keys[attr_i]]
 
      var attr_str = attr_name + " +" + Math.ceil(this.hero_vo[k] / 1000);
      this.attr_lbs[this.attr_keys[attr_i]].string = attr_str;
    }
 
    this.up_lev_act_nd.active = true;
    this.up_lev_act_nd.y = 200;
    this.up_lev_act_nd.opacity = 10;
    this.up_lev_act_nd.stopAllActions();
    var move_act = cc.moveTo(1, cc.v2(0, 280));
    var fade_act = cc.fadeIn(0.2);
    move_act.easing(cc.easeSineOut()); // var ease_act = cc.easeSineOut(cc.moveTo(cc.v2(0, 10)));
    // ease_act
 
    var spa_act = cc.spawn(move_act, fade_act);
    var node_act = cc.sequence(spa_act, cc.callFunc(function () {
      this.up_lev_act_nd.active = false;
    }.bind(this)));
    this.up_lev_act_nd.runAction(node_act);
    this.showLevelUpEffect(true);
  },
  // 播放升级特效
  showLevelUpEffect: function showLevelUpEffect(status) {
    if (status) {
      var effect_id = PathTool.getEffectRes(185);
      var effect_path = PathTool.getSpinePath(effect_id);
      this.loadRes(effect_path, function (effect_sd) {
        this.up_lev_efc_sk.skeletonData = effect_sd;
        this.up_lev_efc_sk.setAnimation(0, "action");
      }.bind(this));
      Utils.playEffectSound(AUDIO_TYPE.COMMON, "c_levelup");
    } else {}
  },
  onClickShareBtn: function onClickShareBtn() {
    Utils.playButtonSound(ButtonSound.Normal);
    if (this.share_panel_nd && !this.share_panel_nd.active) this.share_panel_nd.active = true;
  },
  onClickLockBtn: function onClickLockBtn() {
    Utils.playButtonSound(ButtonSound.Normal);
    var is_lock = this.hero_vo.dic_locks[HeroConst.LockType.eHeroLock] || 0;
 
    if (is_lock === 0) {
      is_lock = 1;
    } else if (is_lock === 1) {
      is_lock = 0;
    }
 
    this.ctrl.sender11015(this.hero_vo.partner_id, is_lock);
  },
  onClickCommentBtn: function onClickCommentBtn() {
    Utils.playButtonSound(ButtonSound.Normal);
 
    var PokedexController = require("pokedex_controller");
 
    PokedexController.getInstance().openCommentWindow(true, this.hero_vo); //     function(){
    // }.bind(this));
  },
  onClickChannelBtn: function onClickChannelBtn(event) {
    Utils.playButtonSound(ButtonSound.Normal);
 
    var ChatConst = require("chat_const");
 
    var channel = null;
 
    switch (event.target.share_tag) {
      case 1:
        {
          channel = ChatConst.Channel.Cross;
        }
        break;
 
      case 2:
        {
          channel = ChatConst.Channel.World;
        }
        break;
 
      case 3:
        {
          channel = ChatConst.Channel.Gang;
        }
        break;
    }
 
    if (channel) this.ctrl.sender11060(channel, this.hero_vo.partner_id);
  },
  onClickSharePanel: function onClickSharePanel() {
    Utils.playButtonSound(ButtonSound.Normal);
    if (this.share_panel_nd.active) this.share_panel_nd.active = false;
  },
  onClickDrawBtn: function onClickDrawBtn() {
    if (!this.hero_vo) return;
    var draw_res = this.hero_vo.draw_res;
    var name = this.hero_vo.name;
 
    if (draw_res == null) {
      var config = Config.partner_data.data_partner_base[this.hero_vo.bid];
 
      if (config) {
        draw_res = config.draw_res;
        name = config.name;
      }
    }
 
    if (draw_res && draw_res != "") {
      this.ctrl.openHeroLookDrawWindow(true, draw_res, name, this.hero_vo.bid);
    }
  },
  onClickSkinBtn: function onClickSkinBtn() {
    if (!this.hero_vo) return;
    this.ctrl.openHeroSkinWindow(true, this.hero_vo);
  },
  // 更新页签红点问题
  updatePageRedPoint: function updatePageRedPoint() {
    if (this.show_model_type == HeroConst.BagTab.eBagHero) {
      //背包英雄的才显示红点
      for (var tap_i in this.btn_taps) {
        var tap_info = this.btn_taps[tap_i];
 
        if (tap_info["tab_nd"].active) {
          if (tap_i == this.cur_tap) {
            // 选中则没有
            tap_info["red_img"].active = false;
          } else {
            var is_redpoint = false;
 
            if (tap_i == HeroConst.MainInfoTab.eMainTrain) {
              is_redpoint = HeroCalculate.getInstance().checkSingleHeroLevelUpRedPoint(this.hero_vo);
            } else if (tap_i == HeroConst.MainInfoTab.eMainUpgradeStar) {
              is_redpoint = HeroCalculate.getInstance().checkSingleHeroUpgradeStarRedPoint(this.hero_vo);
            } else if (tap_i == HeroConst.MainInfoTab.eMainTalent) {
              is_redpoint = HeroCalculate.getInstance().checkSingleHeroTalentSkillRedPoint(this.hero_vo);
            }
 
            tap_info["red_img"].active = is_redpoint;
          }
        }
      }
    }
  }
});
 
cc._RF.pop();