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
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
//      这里填写详细说明,主要填写该模块的功能简要
// <br/>Create: {DATE}
// --------------------------------------------------------------------
var HeroConst = require("hero_const");
var HeroEvent = require("hero_event");
var PartnerConst = require("partner_const");
var HeroCalculate = require("hero_calculate");
var BackPackConst = require("backpack_const");
 
var HeroController = cc.Class({
    extends: BaseController,
    ctor: function () {
    },
 
    // 初始化配置数据
    initConfig: function () {
        var HeroModel = require("hero_model");
 
        this.model = new HeroModel(this);
        this.model.initConfig();
    },
 
    // 返回当前的model
    getModel: function () {
        return this.model;
    },
 
    // 注册监听事件
    registerEvents: function () {
        // 断线重连重置一下伙伴及其装备缓存数据
        this.re_link_game_event = gcore.GlobalEvent.bind(EventId.EVT_RE_LINK_GAME, function () {
            // this.sender11000();
            // this.sender11040();
            // this.sender11037();
        }.bind(this))
 
        // 角色数据创建完毕后,监听资产数据变化情况
        this.login_event_success = gcore.GlobalEvent.bind(EventId.EVT_ROLE_CREATE_SUCCESS, function () {
            gcore.GlobalEvent.unbind(this.login_event_success)
            this.login_event_success = null;
            // this.sender11000();
            // this.sender11040();
            // this.sender11037();
            var StartowerController = require("startower_controller");
            StartowerController.getInstance().sender11320();
 
            var RoleController = require("role_controller")
            var role_vo = RoleController.getInstance().getRoleVo();
            this.role_update_evt = role_vo.bind(EventId.UPDATE_ROLE_ATTRIBUTE, function (key, lev) {
                   if (key == "coin") {
                        this.model.checkLevelRedPointUpdate();
                   } else if (key == "hero_exp") {
                        this.model.checkLevelRedPointUpdate();
                   } else if (key == "lev") {
                        this.model.checkUnlockFormRedPoint(lev);
                   }
            }, this);
 
 
        }.bind(this))
 
        // 物品道具增加 判断红点
        if (!this.add_goods_event) {
             this.add_goods_event = gcore.GlobalEvent.bind(EventId.ADD_GOODS, function(bag_code,temp_add) {
 
                if (bag_code == BackPackConst.Bag_Code.EQUIPS) {
                    this.model.is_equip_redpoint_bag_update = true
                    this.model.checkEquipRedPointUpdate()
                } else {
                    for (var item_i in temp_add) {
                        var item = temp_add[item_i];
                        if (item.base_id == this.model.upgrade_star_cost_id) {
                            this.model.is_upgradestar_redpoint_bag_update = true;
                            this.model.checkUpgradeStarRedPointUpdate();
                            this.model.checkLevelRedPointUpdate();                     
                        } else if (item.base_id == this.model.talent_skill_cost_id) {
                            this.model.setUpdateTalentRedpoint();
                            this.model.checkTalentRedPointUpdate();                            
                        }
 
                        // gdata("item_data", "data_skill_item_list", item.base_id);
 
                        if(Utils.getItemConfig(item.base_id)){
                            this.model.setUpdateTalentRedpoint()
                            this.model.checkTalentRedPointUpdate()
                        }
                    }
                }
            }.bind(this))
        }
 
        // 物品道具删除 判断红点
        if (!this.del_goods_event) {
             this.del_goods_event = gcore.GlobalEvent.bind(EventId.DELETE_GOODS, function(bag_code,temp_add) {
                if (bag_code == BackPackConst.Bag_Code.EQUIPS) {
                    this.model.is_equip_redpoint_bag_update = true;
                    this.model.checkEquipRedPointUpdate();
                } else {
                    for (var item_i in temp_add) {
                        var item = temp_add[item_i];
 
                        if (item.base_id == this.model.upgrade_star_cost_id) {
                            this.model.is_upgradestar_redpoint_bag_update = true
                            this.model.checkUpgradeStarRedPointUpdate()
                            this.model.checkLevelRedPointUpdate()                            
                        } else if (item.base_id == this.model.talent_skill_cost_id) {
                            this.model.setUpdateTalentRedpoint()
                            this.model.checkTalentRedPointUpdate()                            
                        }                        
                        if(Utils.getItemConfig(item.base_id)){
                            this.model.setUpdateTalentRedpoint()
                            this.model.checkTalentRedPointUpdate()
                        }
                    }
                }
            }.bind(this))
        }
 
        // 物品道具改变 判断红点
        if (!this.modify_goods_event) {
             this.modify_goods_event = gcore.GlobalEvent.bind(EventId.MODIFY_GOODS_NUM, function(bag_code,temp_add) {
                if (bag_code == BackPackConst.Bag_Code.EQUIPS) {
                    this.model.is_equip_redpoint_bag_update = true;
                    this.model.checkEquipRedPointUpdate();          
                } else {
                    for (var item_i in temp_add) {
                        var item = temp_add[item_i];
 
                        if (item.base_id == this.model.upgrade_star_cost_id) {
                            this.model.is_upgradestar_redpoint_bag_update = true
                            this.model.checkUpgradeStarRedPointUpdate()
                            this.model.checkLevelRedPointUpdate()                            
                        } else if (item.base_id == this.model.talent_skill_cost_id) {
                            this.model.setUpdateTalentRedpoint()
                            this.model.checkTalentRedPointUpdate()                            
                        }                        
                        if(Utils.getItemConfig(item.base_id)){
                            this.model.setUpdateTalentRedpoint()
                            this.model.checkTalentRedPointUpdate()
                        }
                    }
                }
            }.bind(this))
        }
 
        // 激活神器(圣器) 判断红点
        if (!this.update_drama_hallows_event) {
            var HallowsEvent = require("hallows_event");
            this.update_drama_hallows_event = gcore.GlobalEvent.bind(HallowsEvent.HallowsActivityEvent, function() {
                this.model.checkUnlockHallowsRedPoint();
            }.bind(this))
         }        
    },
 
    // 注册协议接受事件
    registerProtocals: function () {
        // this.RegisterProtocal(1110, this.on1110);
        this.RegisterProtocal(11000, this.handle11000.bind(this));     //请求所有伙伴
        this.RegisterProtocal(11001, this.handle11001.bind(this));     //伙伴增加
        this.RegisterProtocal(11002, this.handle11002.bind(this));     //伙伴属性变更通知(单个伙伴属性)
        this.RegisterProtocal(11007, this.handle11007.bind(this));     //伙伴属性变更通知(list列表伙伴属性)
 
        //升级
        this.RegisterProtocal(11003, this.handle11003.bind(this));     //伙伴升级
        this.RegisterProtocal(11004, this.handle11004.bind(this));     //伙伴进阶
        this.RegisterProtocal(11005, this.handle11005.bind(this));     //伙伴升星
        this.RegisterProtocal(11006, this.handle11006.bind(this));     //删除伙伴推送
 
        this.RegisterProtocal(11009, this.handle11009.bind(this));     //购买英雄数量上限
        this.RegisterProtocal(11016, this.handle11016.bind(this));     //伙伴下一阶属性
        this.RegisterProtocal(11017, this.handle11017.bind(this));     //推送伙伴最新数量
 
        //装备相关
        this.RegisterProtocal(11010, this.handle11010.bind(this));     //穿戴装备
        this.RegisterProtocal(11011, this.handle11011.bind(this));     //卸下装备
        this.RegisterProtocal(11012, this.handle11012.bind(this));     //推送装备改变
        // this.RegisterProtocal(11013, this.handle11013.bind(this));     //装备精炼
        // this.RegisterProtocal(11014, this.handle11014.bind(this));     //一键精炼
 
        this.RegisterProtocal(11015, this.handle11015.bind(this));     //英雄锁定
 
        //请求阵法
        // this.RegisterProtocal(11200, this.handle11200.bind(this));     //请求自身阵法
        // this.RegisterProtocal(11201, this.handle11201.bind(this));     //更换自身阵法
        // this.RegisterProtocal(11202, this.handle11202.bind(this));     //伙伴上阵/下阵/交换
        // this.RegisterProtocal(11203, this.handle11203.bind(this));     //阵法数据改变推送
        // this.RegisterProtocal(11204, this.handle11204.bind(this));     //阵法升级/激活
        this.RegisterProtocal(11211, this.handle11211.bind(this));     //请求队伍
        this.RegisterProtocal(11212, this.handle11212.bind(this));     //请求保存队伍协议
        this.RegisterProtocal(11213, this.handle11213.bind(this));     //请求多个队伍
 
        // //符文相关
        this.RegisterProtocal(11030, this.handle11030.bind(this));     //符文穿戴
        this.RegisterProtocal(11031, this.handle11031.bind(this));     //推送符文改变
        this.RegisterProtocal(11032, this.handle11032.bind(this));     //符文升星
        this.RegisterProtocal(11033, this.handle11033.bind(this));     //符文重置
        this.RegisterProtocal(11034, this.handle11034.bind(this));     //符文重铸保存
        this.RegisterProtocal(11035, this.handle11035.bind(this));     //符文碎片合成
        this.RegisterProtocal(11036, this.handle11036.bind(this));     //符文合成
        this.RegisterProtocal(11037, this.handle11037.bind(this));     //符文祝福值
        this.RegisterProtocal(11038, this.handle11038.bind(this));     //领取符文祝福值
 
        this.RegisterProtocal(11040, this.handle11040.bind(this));     //英雄图鉴信息
        this.RegisterProtocal(11060, this.handle11060.bind(this));     //英雄图鉴信息
 
        this.RegisterProtocal(11075, this.handle11075.bind(this));     //请求英雄遣散 分解材料
        this.RegisterProtocal(11076, this.handle11076.bind(this));     //英雄遣散 分解    
        
 
        // --天赋相关
        this.RegisterProtocal(11096, this.handle11096.bind(this))     //学习天赋技能
        this.RegisterProtocal(11097, this.handle11097.bind(this))     //天赋技能升级
        this.RegisterProtocal(11098, this.handle11098.bind(this))     //天赋遗忘
        this.RegisterProtocal(11099, this.handle11099.bind(this))     //获取英雄天赋信息      
        
        this.RegisterProtocal(11063, this.handle11063.bind(this))     //--英雄详细信息
 
        this.RegisterProtocal(11019, this.handle11019.bind(this))     //--皮肤
        this.RegisterProtocal(11020, this.handle11020.bind(this))     //--
    },
    sender11063(partner_id){
        let protocal ={}
        protocal.partner_id = partner_id
        this.SendProtocal(11063,protocal)
    },
    handle11063( data ){
        this.model.updateHeroVoDetailedInfo(data)
    },
    sender11000: function () {
        var protocal = {}
        this.SendProtocal(11000, protocal);
    },
 
    handle11000: function (data) {     //请求所有伙伴
        this.model.setHeroMaxCount(data.num);
        this.model.setHeroBuyNum(data.buy_num);
        this.model.updateHeroList(data.partners);
 
        var calculate = HeroCalculate.getInstance();
        RedMgr.getInstance().addCalHandler(calculate.checkAllStarFuseRedpoint.bind(calculate), RedIds.RefuseHero);
 
        this.sender11020();
    },
 
    handle11001: function (data) {     //伙伴增加
        this.model.updateHeroList(data.partners, true)
 
        //消除熔炼祭坛的红点 里面会重新计算红点
        HeroCalculate.getInstance().clearAllStarFuseRedpointRecord();
 
        this.model.is_upgradestar_redpoint_bag_update = true;
        this.model.checkUpgradeStarRedPointUpdate();
    },
 
    handle11002: function (data) {     //单个伙伴属性变更通知
        this.model.updateHeroVo(data);
    },
 
    handle11007: function (data) {     //list伙伴属性变更通知(
        var RoleController = require("role_controller")
        RoleController.getInstance().getRoleVo().showPower(true)
        this.model.updateHeroList(data.ref_partners, null, true);
    },
 
    sender11003: function (partner_id) {         // 伙伴升级
        var protocal = {};
        protocal.partner_id = partner_id;
        this.SendProtocal(11003, protocal);
    },
 
    handle11003: function (data) {     //伙伴升级
        if (data && data.result === 1) {
            gcore.GlobalEvent.getInstance().fire(HeroEvent.Hero_Level_Up_Success_Event, data)
        }
    },
 
    sender11004: function (partner_id) {
        var protocal = {};
        protocal.partner_id = partner_id;
        this.SendProtocal(11004, protocal);
    },
 
    handle11004: function (data) {     //伙伴进阶结果
        if (data && data.result == 1) {
            // 显示进阶窗口
        }
    },
 
    sender11005: function (partner_id, hero_list, random_list) {
        var protocal = {}
        protocal.partner_id = partner_id;
        protocal.expend1 = hero_list;
        protocal.expend2 = random_list;
        this.SendProtocal(11005, protocal);
    },
 
    handle11005: function (data) {     //伙伴升星
        message(data.msg)
        if (data && data.result === 1) {
            gcore.GlobalEvent.fire(HeroEvent.Upgrade_Star_Success_Event);
        } else {
            this.model.setUpgradeStarUpdateRecord(true);
        }
    },
 
    handle11006: function (data) {     //删除伙伴推送
        this.model.delHeroDataList(data.expend2);
    },
 
    sender11009: function () {
        this.SendProtocal(11009, {});
    },
 
    handle11009: function (data) {     //购买英雄数量上限        
        if (data.result) {
            this.model.setHeroMaxCount(data.num);
            this.model.setHeroBuyNum(data.buy_num);
            gcore.GlobalEvent.fire(HeroEvent.Buy_Hero_Max_Count_Event);
        }
    },
 
    sender11016: function (partner_id) {
        var protocal = {};
        protocal.partner_id = partner_id;
        this.SendProtocal(11016, protocal);
    },
 
    handle11016: function (data) {     //伙伴下一阶属性
        gcore.GlobalEvent.fire(HeroEvent.Next_Break_Info_Event, data);
    },
 
    handle11017: function (data) {     //推送伙伴最新数量
    },
 
    // 0 表示一键穿戴
    sender11010: function (partner_id, item_id) {     //穿戴装备
        this.model.setEquipUpdateRecord(false);
        var protocal = {}
        protocal.partner_id = partner_id
        protocal.item_id = item_id
        this.SendProtocal(11010, protocal);
    },
 
    handle11010: function (data) {
        message(data.msg);
        if (!data.result)
            this.model.setEquipUpdateRecord(true);
    },
 
    sender11011: function (partner_id, pos_id) {
        this.model.setEquipUpdateRecord(false);        
        var protocal = {}
        protocal.partner_id = partner_id
        //此值改成装备唯一id 
        protocal.pos_id = pos_id
        this.SendProtocal(11011, protocal);
    },
 
    handle11011: function (data) {     //卸下装备
        message(data.msg)
        if (!data.result)
            this.model.setEquipUpdateRecord(true);        
    },
 
    handle11012: function (data) {     //推送装备改变
        message(data.msg);
        if (data) {
            this.model.updateHeroEquipList(data);
            data = this.model.getHeroById(data.partner_id)
            gcore.GlobalEvent.fire(HeroEvent.Equip_Update_Event,data);
            this.model.is_equip_redpoint_hero_update = true;
            this.model.checkEquipRedPointUpdate()
        }
    },
 
    sender11015: function (partner_id, is_lock) {
        var protocal = {}
        protocal.partner_id = partner_id;
        protocal.type = is_lock;
        this.SendProtocal(11015, protocal)
    },
 
    handle11015: function (data) {     //英雄锁定
        if (data.result == 1) {
            this.model.setLockByPartnerid(data.partner_id, data.type)
            gcore.GlobalEvent.fire(HeroEvent.Hero_Lock_Event)
        }
    },
 
    sender11211: function (type) {     // 请求单个布阵信息 
        var protocal = {}
        protocal.type = type
        this.SendProtocal(11211, protocal)
    },
 
    handle11211: function (data) {     // 请求单个布阵信息结果
        if (!data || typeof data.type != "number") return
        if (data && (data.type === PartnerConst.Fun_Form.Drama || data.type === PartnerConst.Fun_Form.Arena))
            this.model.setFormList(data);
        gcore.GlobalEvent.fire(HeroEvent.Update_Fun_Form, data);
    },
 
    sender11212: function (type, formation_type, pos_info, hallows_id) {
        var protocal = {}
        protocal.type = type
        protocal.formation_type = formation_type
        protocal.pos_info = pos_info
        protocal.hallows_id = hallows_id
        this.SendProtocal(11212, protocal)
    },
 
    handle11212: function (data) {     //请求保存队伍协议
        if (data.code) {
            if (data.type === PartnerConst.Fun_Form.Drama) {
                var type_list = [];
                var drma_info = {};
                drma_info["type"] = PartnerConst.Fun_Form.Drama;
                type_list.push(drma_info);
                var arena_info = {};
                arena_info["type"] = PartnerConst.Fun_Form.Arena;
                type_list.push(arena_info);
                this.sender11213(type_list);
            } else if (data.type === PartnerConst.Fun_Form.Arena) {
                this.sender11211(data.type);
            } else if(data.type === PartnerConst.Fun_Form.LimitExercise){
                var LimitExerciseController = require("limitexercise_controller")
                LimitExerciseController.getInstance().checkJoinFight()
            }
            gcore.GlobalEvent.fire(HeroEvent.Update_Save_Form, data);
        } else {
            message(Utils.TI18N(data.msg))
        }
    },
 
    sender11213: function (type_list) {    // 请求多个布阵
        var protocal = {}
        protocal.type_list = type_list;
        this.SendProtocal(11213, protocal);
    },
 
    handle11213: function (data) {     //请求多个布阵结果
        if (!data || !data.info) return;        
        for (var form_i in data.info) {
            var form_data = data.info[form_i];
            if (form_data && (form_data.type === PartnerConst.Fun_Form.Drama ||
                form_data.type === PartnerConst.Fun_Form.Arena))
                this.model.setFormList(form_data);
        }
    },
 
    //符文-----------------
 
    //符文穿戴/卸下
    sender11030: function (partner_id, pos_id, artifact_id, type) {
        this.model.setEquipUpdateRecord(false)
        var protocal = {}
        protocal.partner_id = partner_id
        protocal.pos_id = pos_id
        protocal.artifact_id = artifact_id
        protocal.type = type
        this.SendProtocal(11030, protocal)
    },
 
    handle11030: function (data) {     //符文穿戴
        message(data.msg);
        if (data.result == 0) {
            this.model.setEquipUpdateRecord(true)
        }
    },
 
    //推送符文改变
    handle11031: function (data) {
        message(data.msg || "");
        this.model.updatePartnerArtifactList(data)
    },
 
    //符文升星
    sender11032: function (partner_id, artifact_id, expends) {
        var protocal = {};
        protocal.partner_id = partner_id;
        protocal.artifact_id = artifact_id;
        protocal.expends = expends;
        this.SendProtocal(11032, protocal)
    },
 
    handle11032: function (data) {     //符文升星
        message(data.msg);
        if (data.result == 1) {
            gcore.GlobalEvent.fire(HeroEvent.Artifact_UpStar_Event, data)
        }
    },
 
    //符文重置
    sender11033: function (partner_id, artifact_id, skills) {
        var protocal = {};
        protocal.partner_id = partner_id;
        protocal.artifact_id = artifact_id;
        protocal.skills = skills;
        this.SendProtocal(11033, protocal)
    },
 
    handle11033: function (data) {     //符文重置
        message(data.msg);
        if (data.result == 1) {
            gcore.GlobalEvent.fire(HeroEvent.Artifact_Recast_Event)
        }
    },
 
    //符文重铸保存
    sender11034: function (partner_id, artifact_id, type) {
        var protocal = {};
        protocal.partner_id = partner_id;
        protocal.artifact_id = artifact_id;
        protocal.type = type;
        this.SendProtocal(11034, protocal);
    },
 
 
    handle11034: function (data) {     //符文重铸保存
        message(data.msg)
        if (data.result == 1) {
            gcore.GlobalEvent.fire(HeroEvent.Artifact_Save_Event)
        }
    },
 
    //符文分解
    sender11035: function (artifact_id) {
        var protocal = {};
        protocal.artifact_id = artifact_id;
        this.SendProtocal(11035, protocal)
    },
 
    handle11035: function (data) {     //符文碎片合成
        message(data.msg)
    },
 
    //符文合成
    sender11036: function (item_id, expend) {
        var protocal = {};
        protocal.item_id = item_id;
        protocal.expends = expend;
        this.SendProtocal(11036, protocal);
    },
 
    handle11036: function (data) {     //符文合成
        message(data.msg);
        if (data.result == 1) {
            gcore.GlobalEvent.fire(HeroEvent.Artifact_Compound_Event, data.flag)
        }
    },
 
    //符文祝福值
    sender11037: function () {
        var protocal = {}
        this.SendProtocal(11037, protocal);
    },
 
    handle11037: function (data) {     //符文祝福值
        if (data && data.lucky != null) {
            this.model.setArtifactLucky(data.lucky);
            gcore.GlobalEvent.fire(HeroEvent.Artifact_Lucky_Event)
        }
    },
 
    //领取符文祝福值
    sender11038: function () {
        this.SendProtocal(11038, {});
    },
 
    handle11038: function (data) {     //领取符文祝福值
        message(data.msg)
    },
 
    sender11040: function () {
        var protocal = {}
        this.SendProtocal(11040, protocal);
    },
 
    handle11040: function (data) {     //英雄图鉴信息
        this.model.setHadHeroInfo(data.partners);
    },
 
    sender11060: function (channel, partner_id) {
        var protocal = {};
        protocal.channel = channel;
        protocal.partner_id = partner_id;
        this.SendProtocal(11060, protocal);
    },
 
    handle11060: function (data) {     //英雄图鉴信息
        message(data.msg);
    },
 
    sender11075: function (hero_list) {     //请求英雄分解材料
        var protocal = {};
        protocal.list = hero_list;
        this.SendProtocal(11075, protocal);
    },
 
    handle11075: function (data) {
        if (data.code == 1) {
            gcore.GlobalEvent.fire(HeroEvent.Hero_Reset_Look_Event, data.list);
        }
    },
 
    sender11076: function (partner_list) {
        var protocal = {}
        protocal.list = partner_list
        this.SendProtocal(11076, protocal);
    },
 
    handle11076: function (data) {     //英雄遣散 
        message(data.msg)
        if (data.code) {
            this.model.delHeroDataList(data.list);
        }
    },
    //-天赋相关开始
    sender11096(partner_id, pos, skill_id){
        let protocal = {}
        protocal.partner_id = partner_id
        protocal.pos = pos
        protocal.skill_id = skill_id
        this.SendProtocal(11096, protocal)
    },
    handle11096(data){
        if(data.result == true){
            this.model.updateHeroVoTalent([data], true)
            data = this.model.getHeroById(data.partner_id)
            gcore.GlobalEvent.fire(HeroEvent.Hero_Learn_Talent_Event, data)
            HeroCalculate.getInstance().clearAllHeroRecordByRedPointType(HeroConst.RedPointType.eRPTalent)
        }else{
            message(data.msg)
        }
    },
    // 英雄(伙伴)背包界面
    // @ hero_vo 英雄对应数据对象
    openHeroBagWindow: function (status, hero_vo) {
        if (!status) {
            if (this.hero_bag_window) {
                this.hero_bag_window.close()
                this.hero_bag_window = null
            }
        } else {
            if (!this.hero_bag_window) {
                var HeroBagWIndow = require("hero_bag_window");
                this.hero_bag_window = new HeroBagWIndow(this);
            }
            this.hero_bag_window.open(hero_vo);
        }
    },
 
    //打开英雄图书馆信息
    openHeroLibraryMainWindow: function (status, bid) {
        if (status == false) {
            if (this.hero_library_mainWindow != null) {
                this.hero_library_mainWindow.close()
                this.hero_library_mainWindow = null
            }
        } else {
            if (this.hero_library_mainWindow == null) {
                var HeroLibraryMainWindow = require("hero_library_main_window")
                this.hero_library_mainWindow = new HeroLibraryMainWindow()
            }
            this.hero_library_mainWindow.open(bid)
        }
    },
 
 
    //打开英雄图书馆信息
    openHeroLibraryInfoWindow: function (status, bid) {
        if (status == false) {
            if (this.hero_library_info != null) {
                this.hero_library_info.close()
                this.hero_library_info = null
            }
        } else {
            if (this.hero_library_info == null) {
                var HeroLibraryInfoWindow = require("hero_library_info_window")
                this.hero_library_info = new HeroLibraryInfoWindow()
            }
            this.hero_library_info.open(bid)
        }
    },
 
    //打开英雄图书馆传记信息
    openHeroLibraryStoryPanel: function (status, name, content) {
        if (status == false) {
            if (this.hero_library_story != null) {
                this.hero_library_story.close()
                this.hero_library_story = null
            }
        } else {
            if (this.hero_library_story == null) {
                var HeroLibraryInfoWindow = require("hero_library_story_window")
                this.hero_library_story = new HeroLibraryInfoWindow()
            }
            this.hero_library_story.open({ name: name, content: content })
        }
    },
 
    // -- 英雄(伙伴)主信息 界面
    // --@ hero_vo 英雄对应数据对象
    // --@ hero_list 英雄对象列表 
    // --@ setting 结构
    // --setting.showType 显示英雄新的页签类型
    // --setting.show_model_type 显示模式 1:英雄模式  2:图鉴模式 定义参考 HeroConst.BagTab.eBagHero
    openHeroMainInfoWindow: function (status, hero_vo, hero_list, setting) {
        if (status) {
            if (!this.hero_main_info_window) {
                var HeroMainInfoWindow = require("hero_main_info_window");
                this.hero_main_info_window = new HeroMainInfoWindow(this);
            }
            var open_pragma = {}
            open_pragma.hero_vo = hero_vo;
            open_pragma.hero_list = hero_list;
            open_pragma.setting = setting;
            this.hero_main_info_window.open(open_pragma);
        } else {
            if (this.hero_main_info_window) {
                this.hero_main_info_window.close();
                this.hero_main_info_window = null
            }
        }
    },
 
    // 打开立绘界面
    openHeroLookDrawWindow: function (status, draw_res_id, name, bid, share_type) {
        if (status) {
            if (!this.hero_look_draw_window) {
                this.hero_look_draw_window = Utils.createClass("hero_look_draw_window")
            }
            var data = {
                draw_res_id: draw_res_id,
                name: name,
                bid: bid,
                share_type: share_type,
            }
            this.hero_look_draw_window.open(data)
        } else {
            if (this.hero_look_draw_window) {
                this.hero_look_draw_window.close();
                this.hero_look_draw_window = null;
            }
        }
    },
 
    // --打开进阶界面
    openHeroBreakPanel: function (status, hero_vo) {
        if (status) {
            if (!this.hero_break_panel) {
                var HeroBreakPanel = require("hero_break_window");
                this.hero_break_panel = new HeroBreakPanel(this);
            }
            this.hero_break_panel.open(hero_vo);
        } else {
            if (this.hero_break_panel) {
                this.hero_break_panel.close();
                this.hero_break_panel = null;
            }
        }
    },
 
    // 打开进阶成功界面 old_vo new_vo 都是heroVo对象
    openBreakExhibitionWindow: function (status, old_vo, new_vo) {
        if (status) {
            if (!this.break_exhibition_window) {
                var HeroBreakExhibitionWindow = require("hero_break_exhibition_window");
                this.break_exhibition_window = new HeroBreakExhibitionWindow(this);
            }
            if (this.break_exhibition_window && !this.break_exhibition_window.isOpen()) {
                var open_pragma = {};
                open_pragma.old_vo = old_vo;
                open_pragma.new_vo = new_vo;
                this.break_exhibition_window.open(open_pragma);
            }
        } else {
            if (this.break_exhibition_window) {
                this.break_exhibition_window.close();
                this.break_exhibition_window = null;
            }
            if(old_vo && typeof (old_vo) =="number"){
                let skill_bid = old_vo
                this.openSkillUnlockWindow(true,skill_bid)
            }
        }
    },
 
 
    // 打开升星成功界面 old_vo new_vo 都是heroVo对象
    openHeroUpgradeStarExhibitionPanel: function (status, old_vo, new_vo) {
        if (status) {
            if (!this.upgrade_star_exhibition_window) {
                var HeroUpgradeStarExhibitionPanel = require("hero_upgrade_star_exhibition_window");
                this.upgrade_star_exhibition_window = new HeroUpgradeStarExhibitionPanel(this);
            }
            if (this.upgrade_star_exhibition_window && !this.upgrade_star_exhibition_window.isOpen()) {
                var open_pragma = {};
                open_pragma.old_vo = old_vo;
                open_pragma.new_vo = new_vo;
                this.upgrade_star_exhibition_window.open(open_pragma);
            }
        } else if (this.upgrade_star_exhibition_window) {
            this.upgrade_star_exhibition_window.close();
            this.upgrade_star_exhibition_window = null;
        }
    },
 
    // --打开天赋技能学习面板
    // function HeroController:openSkillUnlockWindow(status, skill_bid)
 
    //     if status == true then
    //         if not this.unlock_window then 
    //             this.unlock_window = SkillUnlockWindow.New(skill_bid)
    //         end
    //         if this.unlock_window and this.unlock_window:isOpen() == false then
    //             this.unlock_window:open()
    //         end
    //     else 
    //         if this.unlock_window then 
    //             this.unlock_window:close()
    //             this.unlock_window = null
    //         end
    //     end
    // end
 
 
 
    // --打开英雄过滤
    // function HeroController:openFormFilterHeroPanel(status, dic_filter_camp_type, dic_filter_career_type)
    //     if status == true then
    //         if not this.form_filter_hero_panel then 
    //             this.form_filter_hero_panel = FormFilterHeroPanel.New()
    //         end
    //         if this.form_filter_hero_panel and this.form_filter_hero_panel:isOpen() == false then
    //             this.form_filter_hero_panel:open(dic_filter_camp_type, dic_filter_career_type)
    //         end
    //     else 
    //         if this.form_filter_hero_panel then 
    //             this.form_filter_hero_panel:close()
    //             this.form_filter_hero_panel = null
    //         end
    //     end
    // end
 
    // --打开布阵出战界面
    // --@fun_form_type 布阵队伍类型
    // --@show_type 出战界面显示类型 1 出战 2 保存布阵
    openFormGoFightPanel: function (status, fun_form_type, setting, show_type) {
        if (!status) {
            if (this.form_go_fight_panel) {
                this.form_go_fight_panel.close();
                this.form_go_fight_panel = null;
            }
        } else {
            if (!this.form_go_fight_panel) {
                var FormGoFightPanel = require("form_go_fight_window");
                this.form_go_fight_panel = new FormGoFightPanel(this);
            }
            var open_pragma = {}
            open_pragma.fun_form_type = fun_form_type;
            open_pragma.setting = setting;
            open_pragma.show_type = show_type;
            this.form_go_fight_panel.open(open_pragma);
            // this.form_go_fight_panel.(fun_form_type, setting, show_type);
        }
    },
 
    // 打开布阵 改成和 布阵出战界面 合二为一
    openFormMainWindow: function (status, fun_form_type) {
        this.openFormGoFightPanel(status, fun_form_type, {}, HeroConst.FormShowType.eFormSave)
    },
 
    // 打开选择阵法界面
    // @formation_type 阵法类型 也是配置表的id
    openFormationSelectPanel: function (status, formation_type, callback) {
        if (status) {
            if (!this.formation_select_panel) {
                var FormSelectPannel = require("form_select_panel");
                this.formation_select_panel = new FormSelectPannel(this);
            }
            // if (this.formation_select_panel && !this.formation_select_panel.isOpen()) {
            var open_pragma = {};
            open_pragma.formation_type = formation_type;
            open_pragma.callback = callback;
            this.formation_select_panel.open(open_pragma);
            // }
        } else {
            if (this.formation_select_panel) {
                this.formation_select_panel.close()
                this.formation_select_panel = null
            }
        }
    },
 
    // 打开选择神器界面
    // @hallows_id 神器id
    openFormHallowsSelectPanel: function (status, hallows_id, callback) {
        if (status) {
            if (!this.form_hallows_select_panel) {
                var FormHallowsSelectPanel = require("form_hallows_select_window");
                this.form_hallows_select_panel = new FormHallowsSelectPanel(this);
            }
            var open_pragma = {};
            open_pragma.hallows_id = hallows_id;
            open_pragma.callback = callback;
            this.form_hallows_select_panel.open(open_pragma);
            // end
        } else {
            if (this.form_hallows_select_panel) {
                this.form_hallows_select_panel.close()
                this.form_hallows_select_panel = null
            }
        }
    },
 
    // 打开英雄升星界面 4升5 5升6 融合祭坛
    openHeroUpgradeStarFuseWindow: function (status, hero_vo) {
        if (status) {
            if (!this.upgrade_star_fuse_window || !this.upgrade_star_fuse_window.root_wnd) {
                var HeroUpgradeStarFuseWindow = require("hero_upgrade_star_fuse_window");
                this.upgrade_star_fuse_window = new HeroUpgradeStarFuseWindow(this);
            }
            if (this.upgrade_star_fuse_window && !this.upgrade_star_fuse_window.isOpen()) {
                this.upgrade_star_fuse_window.open(hero_vo);
            }
        } else {
            if (this.upgrade_star_fuse_window) {
                this.upgrade_star_fuse_window.close();
                this.upgrade_star_fuse_window = null;
            }
        }
    },
    // @select_data 是模拟hero_vo的数据
    // @dic_other_selected 已经其他被选择的数据 [id] = hero_vo模式
    // @ form_type --来源位置  1: 表示融合祭坛 2: 表示升星界面的
    // @ is_master 是否是主卡(融合祭坛专用)
    openHeroUpgradeStarSelectPanel: function (status, select_data, dic_other_selected, form_type, is_master, select_cb, cur_hero_vo) {
        if (status) {
            if (!this.upgrade_star_select_panel) {
                var HeroUpgradeStarSelectPanel = require("hero_upgrade_star_select_window");
                this.upgrade_star_select_panel = new HeroUpgradeStarSelectPanel(this);
            }
            var open_pragma = {};
            open_pragma.select_data = select_data;
            open_pragma.dic_other_selected = dic_other_selected;
            open_pragma.form_type = form_type;
            open_pragma.select_cb = select_cb;
            open_pragma.cur_hero_vo = cur_hero_vo;
            open_pragma.is_master = is_master;
            this.upgrade_star_select_panel.open(open_pragma);
            // if this.upgrade_star_select_panel and this.upgrade_star_select_panel:isOpen() == false then
        } else {
            if (this.upgrade_star_select_panel) {
                this.upgrade_star_select_panel.close();
                this.upgrade_star_select_panel = null;
            }
        }
    },
 
    // 打开重生操作界面
    openHeroResetWindow: function (status, data) {
        if (status) {
            if (!this.hero_reset_window) {
                var HeroResetWindow = require("hero_reset_window");
                this.hero_reset_window = new HeroResetWindow(this);
            }
            if (this.hero_reset_window)
                this.hero_reset_window.open(data);
        } else {
            if (this.hero_reset_window) {
                this.hero_reset_window.close()
                this.hero_reset_window = null;
            }
        }
    },
 
    openHeroResetReturnPanel: function (bool, item_list) {
        if (bool) {
            if (!this.hero_reset_return_panel) {
                var HeroResetReturnPanel = require("hero_rest_return_window");
                this.hero_reset_return_panel = new HeroResetReturnPanel(this);
            }
            var open_pragma = {};
            open_pragma.item_list = item_list;
            this.hero_reset_return_panel.open(open_pragma);
        } else {
            if (this.hero_reset_return_panel) {
                this.hero_reset_return_panel.close()
                this.hero_reset_return_panel = null;
            }
        }
    },
 
    openHeroResetOfferPanel: function (bool, item_list ,is_show_tips, callback ,reset_type ,dec) {
        if (bool) {
            if (!this.hero_reset_offer_panel) {
                var HeroResetOfferPanel = require("hero_reset_offer_window");
                this.hero_reset_offer_panel = new HeroResetOfferPanel(this);
            }
            var open_pragma = {};
            open_pragma.item_list = item_list;
            open_pragma.callback = callback;
            open_pragma.is_show_tips = is_show_tips;
            open_pragma.reset_type = reset_type;
            open_pragma.dec = dec;
            this.hero_reset_offer_panel.open(open_pragma);
        } else {
            if (this.hero_reset_offer_panel) {
                this.hero_reset_offer_panel.close()
                this.hero_reset_offer_panel = null;
            }
        }
    },
 
    // --打开装备穿戴界面
    openEquipPanel: function (status, pos, partner_id, data) {
        if (status) {
            if (!this.equip_panel) {
                var EquipClothWindow = require("equip_cloth_window");
                this.equip_panel = new EquipClothWindow(this);
            }
            var open_pragma = {};
            open_pragma.equip_type = pos;
            open_pragma.partner_id = partner_id;
            open_pragma.data = data;
 
            this.equip_panel.open(open_pragma);
        } else {
            if (this.equip_panel) {
                this.equip_panel.close();
                this.equip_panel = null;
            }
        }
    },
 
    // desc:打开装备tips
    // time:2018-05-24 05:50:42
    // @bool:打开与关闭
    // @data:装备数据
    // @open_type:装备状态,0.其他状态,1: 背包中 3:伙伴身上 具体查看 PartnerConst.EqmTips
    // @partner_id:穿戴在伙伴身上就有伙伴id,其他可不填或填0
    // @return 
    openEquipTips: function (status, data, open_type, partner) {
        if (status) {
            var TipsController = require("tips_controller");
            TipsController.getInstance().showEquipTips(data, open_type, partner);
        }
        // if (status) {
        //     // 引导的时候不弹
        //     // if GuideController:getInstance():isInGuide() return // 引导的时候不要显示tips了 因为可能会被挡住
        //     if (!this.equip_tips) {
        //         var EquipTips = require("equip_tips");
        //         this.equip_tips = new EquipTips();
        //     } 
        //     open_type = open_type || PartnerConst.EqmTips.normal;
        //     this.equip_tips.open();
        // } else {
        //     if (this.equip_tips) {
        //         this.equip_tips.close();
        //         this.equip_tips = null;
        //     }
        // }
    },
 
    // ----------------------------------------神器相关------------------------------
    // 打开符文重铸界面
    openArtifactRecastWindow: function (status, data, partner_id) {
        if (status == true) {
            if (!this.artifact_recast_win) {
                this.artifact_recast_win = Utils.createClass("artifact_recast_window")
            }
            this.artifact_recast_win.open({ data: data, partner_id: partner_id })
        } else {
            if (this.artifact_recast_win) {
                this.artifact_recast_win.close()
                this.artifact_recast_win = null
            }
        }
    },
 
    //打开神器列表选择界面
    // function HeroController:openArtifactListWindow(bool,artifact_type,partner_id,select_vo)
    //     if bool == true then
    //         if not this.artifact_list_panel then 
    //             this.artifact_list_panel = ArtifactListWindow.New()
    //         end
    //         artifact_type = artifact_type or 0
    //         partner_id = partner_id or 0
    //         if this.artifact_list_panel and this.artifact_list_panel:isOpen() == false then
    //             this.artifact_list_panel:open(artifact_type,partner_id,select_vo)
    //         end
    //     else 
    //         if this.artifact_list_panel then 
    //             this.artifact_list_panel:close()
    //             this.artifact_list_panel = null
    //         end
    //     end
    // end
    openArtifactListWindow: function (bool, artifact_type, partner_id, select_vo) {
        if (bool == true) {
            if (!this.artifact_list_window) {
                this.artifact_list_window = Utils.createClass("artifact_list_window")
            }
            artifact_type = artifact_type || 0;
            partner_id = partner_id || 0;
            var data = {};
            data.artifact_type = artifact_type;
            data.partner_id = partner_id;
            data.select_vo = select_vo;
            this.artifact_list_window.open(data)
        } else {
            if (this.artifact_list_window) {
                this.artifact_list_window.close()
                this.artifact_list_window = null
            }
        }
    },
 
    // 符文选择界面
    openArtifactChoseWindow: function (bool, data) {
        if (bool == true) {
            if (!this.artifact_chose_window) {
                this.artifact_chose_window = Utils.createClass("artifact_chose_window")
            }
            this.artifact_chose_window.open(data)
        } else {
            if (this.artifact_chose_window) {
                this.artifact_chose_window.close()
                this.artifact_chose_window = null
            }
        }
    },
 
    // --==============================--
    // --desc:打开符文操作界面
    // --time:2018-05-17 05:34:13
    // --@bool:
    // --@data:符文数据,为goods_vo数据
    // --@open_type:打开类型,分为
    // --@return 
    // --==============================--
    openArtifactTipsWindow: function (bool, data, open_type, partner_id, pos) {
        if (bool == true) {
            if (data == null || data.config == null) {
                message(Utils.TI18N("数据异常"))
                return
            }
            if (!this.artifact_tips_window) {
                this.artifact_tips_window = Utils.createClass("artifact_tips_window")
            }
            if (open_type == null) {
                open_type = PartnerConst.ArtifactTips.backpack;
            }
            var param = { data: data, open_type: open_type, partner_id: partner_id, pos: pos }
            this.artifact_tips_window.open(param)
        } else {
            if (this.artifact_tips_window) {
                this.artifact_tips_window.close()
                this.artifact_tips_window = null
            }
        }
    },
 
    // 打开符文合成tips界面
    openArtifactComTipsWindow: function (status, bid) {
        if (status == true) {
            if (!this.artifact_com_win) {
                this.artifact_com_win = Utils.createClass("artifact_com_tips_window")
            }
            this.artifact_com_win.open(bid)
        } else {
            if (this.artifact_com_win) {
                this.artifact_com_win.close()
                this.artifact_com_win = null
            }
        }
    },
 
    // 打开符文祝福奖励领取界面
    openArtifactAwardWindow: function (status) {
        if (status == true) {
            if (!this.artifact_award_win) {
                this.artifact_award_win = Utils.createClass("artifact_award_window")
            }
            this.artifact_award_win.open()
        } else {
            if (this.artifact_award_win) {
                this.artifact_award_win.close()
                this.artifact_award_win = null
            }
        }
    },
 
    // 打开符文技能预览界面
    // -@show_type 显示类型 1 是符文技能预览 2 是英雄天赋技能
    openArtifactSkillWindow: function (status,show_type) {
        if (status == true) {
            if (!this.artifact_skill_win) {
                this.artifact_skill_win = Utils.createClass("artifact_skill_window",show_type)
            }
            this.artifact_skill_win.open()
        } else {
            if (this.artifact_skill_win) {
                this.artifact_skill_win.close()
                this.artifact_skill_win = null
            }
        }
    },
    // ----------------------------------------神器相关结束------------------------------
 
 
 
    // -- 打开英雄tips界面
    // --is_hide_equip 是否隐藏装备
    openHeroTipsPanel(bool, hero_vo, is_hide_equip) {
        if (bool == true) {
            if (!this.hero_tips_window) {
                let HeroTipsWindow = require("hero_tips_window")
                this.hero_tips_window = new HeroTipsWindow()
            }
            if(this.hero_tips_window.isOpen() == false){
                this.hero_tips_window.open({ hero_vo: hero_vo, is_hide_equip: is_hide_equip })
            }
        } else {
            if (this.hero_tips_window) {
                this.hero_tips_window.close()
                this.hero_tips_window = null
            }
        }
    },
    // -- 打开英雄属性tips界面
    openHeroTipsAttrPanel(bool, hero_vo, is_my) {
        if (bool == true) {
            if (!this.hero_tips_attr_panel) {
                let HeroTipsAttrWindow = require("hero_tips_attr_window")
                this.hero_tips_attr_panel = new HeroTipsAttrWindow()
            }
            this.hero_tips_attr_panel.open({ hero_vo: hero_vo, is_my: is_my })
        } else {
            if (this.hero_tips_attr_panel) {
                this.hero_tips_attr_panel.close()
                this.hero_tips_attr_panel = null
            }
        }
    },
 
    // -- 打开英雄tips界面根据bid
    openHeroTipsPanelByBid(bid) {
        let hero_vo = this.model.getMockHeroVoByBid(bid)
        if (hero_vo) {
            this.openHeroTipsPanel(true, hero_vo, true)
        }
    },
    // 打开英雄图书馆信息根据bid 和星级
    openHeroInfoWindowByBidStar: function (bid, star, callback) {
        if (bid == null || star == null) return
        var key = Utils.getNorKey(bid, star);
        var hero_vo = this.model.getHeroPokedexByBid(key);
        if (hero_vo) {
            this.openHeroMainInfoWindow(true, hero_vo, [hero_vo], { show_model_type: HeroConst.BagTab.eBagPokedex, callback: callback })
        }
    },
 
    getHeroGoFightRoot: function (finish_cb) {
        if (finish_cb) {
            if (this.form_go_fight_panel) {
                this.form_go_fight_panel.getRootWnd(finish_cb);
            } else {
                finish_cb(null);
            }
        } else {
            if (this.form_go_fight_panel)
                return this.form_go_fight_panel.root_wnd;            
        }        
    },
 
    getHeroBagRoot: function (finish_cb) {
        if (finish_cb) {
            if (this.hero_bag_window) {
                this.hero_bag_window.getRootWnd(finish_cb);
            } else {
                finish_cb(null);
            }
        } else {
            if (this.hero_bag_window)
                return this.hero_bag_window.root_wnd;
        }
    },
 
    getHeroMianInfoRoot: function (finish_cb) {
        if (finish_cb) {
            if (this.hero_main_info_window) {
                this.hero_main_info_window.getRootWnd(finish_cb);
            } else {
                finish_cb(null);
            }
        } else {
            if (this.hero_main_info_window)
                return this.hero_main_info_window.root_wnd;
        }
    },
 
    // --请求天赋技能信息
    sender11099(list){
        let protocal = {}
        protocal.partner_ids = list
        this.SendProtocal(11099, protocal)
    },
    handle11099(data){
        this.model.updateHeroVoTalent(data.partner_ids)
        gcore.GlobalEvent.fire(HeroEvent.Hero_Get_Talent_Event, data.partner_ids)
    },
    // --天赋技能升级
    sender11097(partner_id, pos){
        let protocal = {}
        protocal.partner_id = partner_id
        protocal.pos = pos
        this.SendProtocal(11097, protocal)
    },
    handle11097(data){
        if(data.result == true){
            this.model.updateHeroVoTalent([data], true)
            data = this.model.getHeroById(data.partner_id)
            gcore.GlobalEvent.fire(HeroEvent.Hero_Level_Up_Talent_Event, data)
            HeroCalculate.getInstance().clearAllHeroRecordByRedPointType(HeroConst.RedPointType.eRPTalent)
        }else{
            message(data.msg)
        }
    },
    // --天赋遗忘
    sender11098(partner_id, pos){
        let protocal = {}
        protocal.partner_id = partner_id
        protocal.pos = pos
        this.SendProtocal(11098, protocal)
    },
    handle11098(data){
        if(data.result == true){
            this.model.updateHeroVoTalent([data], true)
            data = this.model.getHeroById(data.partner_id)
            gcore.GlobalEvent.fire(HeroEvent.Hero_Forget_Talent_Event, data)
            HeroCalculate.getInstance().clearAllHeroRecordByRedPointType(HeroConst.RedPointType.eRPTalent)
        }else{
            message(data.msg)
        }
    },
    // -- 打开英雄学习技能界面
    openHeroTalentSkillLearnPanel(bool, hero_vo, pos){
        var self = this
        if(bool == true){
            if(!self.hero_talent_skill_panel){
                var HeroTalentSkillLearnPanel = require("hero_talent_skill_learn_window")
                self.hero_talent_skill_panel = new HeroTalentSkillLearnPanel()
            }
            self.hero_talent_skill_panel.open({hero_vo:hero_vo, pos:pos})
        }else{
            if(self.hero_talent_skill_panel){ 
                self.hero_talent_skill_panel.close()
                self.hero_talent_skill_panel = null
            }
        }
    },
    // -- 打开英雄学习技能升级界面
    openHeroTalentSkillLevelUpPanel(bool, hero_vo, skill_id, pos){
        if(bool == true){
            if(!this.hero_talent_levelup_panel){
                var HeroTalentSkillLevelUpPanel = require("hero_talent_skill_level_up_window")
                this.hero_talent_levelup_panel = new HeroTalentSkillLevelUpPanel()
            }
            this.hero_talent_levelup_panel.open({hero_vo:hero_vo, skill_id:skill_id, pos:pos})
        }else{
            if(this.hero_talent_levelup_panel){
                this.hero_talent_levelup_panel.close()
                this.hero_talent_levelup_panel = null
            }
        }
    },
    //开启新技能
    openSkillUnlockWindow(status, skill_bid){
        if(status == true){
            if (this.unlock_window == null){
                let SkillUnlockWindow = require("skill_unlock_window") 
                this.unlock_window = new SkillUnlockWindow(skill_bid)
            }
            if(this.unlock_window && this.unlock_window.isOpen() == false){
                this.unlock_window.open()
            }
        }else{
            if(this.unlock_window){ 
                this.unlock_window.close()
                this.unlock_window = null
            }
        }
    },
 
 
    //播放英雄音效
    onPlayHeroVoice: function (vocie_res, time) {
        //默认4秒
        time = time || 4;
        //补充1秒时差
        time += 1;
        
        if (this.voice_time_ticket == null) {
            let volume = gcore.SysEnv.get("music_volume");
            volume -= 0.6;
            SoundManager.getInstance().setBackgroundVolume(volume);
        } else {
            gcore.Timer.del(this.voice_time_ticket);
            this.voice_time_ticket = null;
        }
 
        if (this.hero_music != null) {
            if(this.hero_music == "undef"){
                SoundManager.getInstance().removeEffectSound(null);
            }else{
                SoundManager.getInstance().removeEffectSound(this.hero_music);
            }
        }
        this.hero_music = SoundManager.getInstance().playHeroEffectOnce(AUDIO_TYPE.DUBBING, vocie_res);
        if(this.hero_music == undefined){
            this.hero_music = "undef";
        }
        this.voice_time_ticket = gcore.Timer.set(function () {
            let volume = gcore.SysEnv.get("music_volume");
            SoundManager.getInstance().setBackgroundVolume(volume);
            this.voice_time_ticket = null;
        }.bind(this), time * 1000, 1)
    },
    /**
     * 皮肤提示
     * @param {*} status 打开与关闭
     * @param {*} data  皮肤信息
     * @param {*} open_type  装备状态,0.其他状态,1: 背包中 3:伙伴身上 具体查看 PartnerConst.EqmTips
     * @param {*} partner 穿戴在伙伴身上就有伙伴id,其他可不填或填0
     */
    openHeroSkinTipsPanel(status, data, open_type, partner){
        if(status == true){
            if(!this.hero_skin_tips_panel){
                var HeroSkinTipsPanel = require("hero_skin_tips_window")
                this.hero_skin_tips_panel = new HeroSkinTipsPanel(this)
            }
            this.hero_skin_tips_panel.open({data:data,open_type:open_type,partner:partner})
        }else{
            if(this.hero_skin_tips_panel){ 
                this.hero_skin_tips_panel.close()
                this.hero_skin_tips_panel = null
            }
        }
    },
    
    //---------------------------皮肤协议结束-----------------------------------------
    //皮肤使用
    sender11019: function (partner_id, skin_id) {
        let protocal = {};
        protocal.partner_id = partner_id;
        protocal.skin_id = skin_id;
        this.SendProtocal(11019, protocal);
    },
 
    handle11019: function (data) {
        message(data.msg);
        cc.log("11019",data)
        if (data.result == 1) {
            message(Utils.TI18N("更换成功"));
        }
    },
 
    //皮肤使用
    sender11020: function () {
        let protocal = {};
        this.SendProtocal(11020, protocal);
    },
 
    handle11020: function (data) {
        cc.log("11020",data)
        this.model.initHeroSkin(data);
 
    },
 
    //---------------------------皮肤协议结束-----------------------------------------
 
    //打开皮肤界面
    openHeroSkinWindow: function (status, vo) {
        if (status == true) {
            if (!this.hero_skin_window) {
                this.hero_skin_window = Utils.createClass("hero_skin_window");
            }
            this.hero_skin_window.open(vo);
        } else {
            if (this.hero_skin_window) {
                this.hero_skin_window.close();
                this.hero_skin_window = null;
            }
        }
    },
});
 
module.exports = HeroController;