hch
4 天以前 6ae4b14b7fb6640ec805f070a1f0f691941c6917
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
using System;
using System.Collections.Generic;
using UnityEngine;
using LitJson;
using System.Linq;
 
 
//查看其他玩家的简短信息, 该模块处理数据,其他由各自功能模块处理 通过OnRevPackage
public class OtherPlayerDetailManager : GameSystemManager<OtherPlayerDetailManager>
{
    public int viewPlayer { get; private set; }
 
    // 查询类型:根据类型做不同处理
    // 按功能自定义枚举值 EnumHelper的 ViewPlayerType
    public int viewPlayerType { get; private set; }
 
    public int viewPreSetType { get; private set; }
    public RolePlusData.EquipData otherPlayerViewEquip;//查看他人界面正在查看中的装备
    private Dictionary<int, ViewPlayerData> viewPlayerDataDic = new Dictionary<int, ViewPlayerData>();
 
    // 查看类型,玩家ID
    public event Action<int, int> OnRevPackage; //尽量不要用第一个参数viewtype做判断,容易出错
 
    public override void Init()
    {
        DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin += OnBeforePlayerDataInitializeEventOnRelogin;
    }
 
    public override void Release()
    {
        DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin -= OnBeforePlayerDataInitializeEventOnRelogin;
    }
 
 
    public void OnBeforePlayerDataInitializeEventOnRelogin()
    {
        viewPlayer = -1;
        viewPlayerType = -1;
        viewPreSetType = -1;
        otherPlayerViewEquip = null;
        viewHeroDetailData = null;
    }
 
    // 获取其他玩家本地缓存数据
    public ViewPlayerData GetViewPlayerData(int playerId)
    {
        ViewPlayerData viewPlayerData = null;
        viewPlayerDataDic.TryGetValue(playerId, out viewPlayerData);
        return viewPlayerData;
    }
 
    // 向服务端请求其他玩家数据 serverID发0默认本服玩家
    public void ViewPlayerDetail(int playerId, int serverID, int viewType = (int)ViewPlayerType.viewPlayerData, int viewBattlePreSetType = (int)BattlePreSetType.Story)
    {
        // 自己不能查看自己的信息
        if (playerId == PlayerDatas.Instance.baseData.PlayerID)
            return;
 
        viewPlayerType = viewType;
        viewPreSetType = viewBattlePreSetType;
        ViewRoleParticulars(playerId, serverID);
    }
 
    // 向服务端请求玩家数据
    void ViewRoleParticulars(int playerID, int serverID)
    {
        if (playerID <= 0)
            return;
 
        viewPlayer = playerID;
 
        if (viewPlayerDataDic.ContainsKey(playerID))
        {
            ViewPlayerData viewPlayerData = viewPlayerDataDic[playerID];
            if ((DateTime.Now - viewPlayerData.getTime).TotalSeconds < 30)
            {
                ShowRoleParticulars(playerID);
                return;
            }
        }
 
        CA212_tagCMViewPlayerInfo pak = new CA212_tagCMViewPlayerInfo();
        pak.PlayerID = (uint)playerID;
        pak.ServerID = (uint)serverID;
        GameNetSystem.Instance.SendInfo(pak);
    }
    public void OnRevRoleEquip(HA705_tagSCQueryPlayerCacheResult package)
    {
 
        ViewPlayerData viewPlayerData = null;
        if (!viewPlayerDataDic.TryGetValue((int)package.PlayerID, out viewPlayerData))
        {
            viewPlayerData = new ViewPlayerData();
            viewPlayerData.getTime = DateTime.Now;
            viewPlayerDataDic.Add((int)package.PlayerID, viewPlayerData);
        }
 
        viewPlayerData.getTime = DateTime.Now;
        viewPlayerData.PlayerID = (int)package.PlayerID;
        viewPlayerData.PlayerName = UIHelper.ServerStringTrim(package.PlayerName);
        viewPlayerData.LV = package.LV;
        viewPlayerData.Job = package.Job;
        viewPlayerData.RealmLV = package.RealmLV;
        viewPlayerData.Face = (int)package.Face;
        viewPlayerData.FacePic = (int)package.FacePic;
        viewPlayerData.ModelMark = (int)package.ModelMark;
        viewPlayerData.EquipShowSwitch = (int)package.EquipShowSwitch;
        viewPlayerData.TitleID = (int)package.TitleID;
        viewPlayerData.ServerID = (int)package.ServerID;
        viewPlayerData.FightPower = package.FightPower + package.FightPowerEx * (long)Constants.ExpPointValue;
        viewPlayerData.FamilyID = (int)package.FamilyID;
        viewPlayerData.FamilyName = UIHelper.ServerStringTrim(package.FamilyName);
        viewPlayerData.FamilyEmblemID = (int)package.FamilyEmblemID;
        viewPlayerData.FamilyDataServerID = (int)package.FamilyDataServerID;
        viewPlayerData.FamilyEmblemWord = UIHelper.ServerStringTrim(package.FamilyEmblemWord);
 
 
        if (viewPlayerData.rolePlusData == null)
        {
            //第一次初始化
            viewPlayerData.rolePlusData = new RolePlusData();
        }
        if (package.PlusDataSize != 0)
        {
            viewPlayerData.rolePlusData.AnalysisRolePlusData(package.PlusData);
        }
 
 
        ShowRoleParticulars((int)package.PlayerID);
    }
 
    //尽量不要用第一个参数viewtype做判断,容易出错,比如同时发送两个不同的viewPlayerType请求的时候
    private void ShowRoleParticulars(int playerID)
    {
        if (viewPlayerType == (int)ViewPlayerType.viewPlayerData)
        {
            if (UIManager.Instance.IsOpened<OtherPlayerDetailWin>())
            {
                UIManager.Instance.CloseWindow<OtherPlayerDetailWin>();
            }
            UIManager.Instance.OpenWindow<OtherPlayerDetailWin>(viewPreSetType);
        }
 
        OnRevPackage?.Invoke(viewPlayerType, playerID);
        viewPlayerType = -1;
        viewPreSetType = -1;
    }
 
    public ViewHeroDetailData viewHeroDetailData;
    public void OpenOtherHeroDetailWin(ViewHeroDetailData viewHeroDetailData)
    {
        this.viewHeroDetailData = viewHeroDetailData;
        if (!UIManager.Instance.IsOpened<OtherHeroDetailWin>())
        {
            UIManager.Instance.OpenWindow<OtherHeroDetailWin>();
        }
    }
 
    #region 获取PlusData中的数据
 
    /// <summary>
    /// 获取特定战斗环境下的命格方案详情
    /// </summary>
    public RolePlusData.MinggePresetData GetMinggePresetByBattleType(int playerID, int battleType)
    {
        int presetID = GetFuncPresetID(playerID, battleType, (int)FuncPresetType.Mingge);
        var minggeData = GetMinggeTotalData(playerID);
        if (minggeData == null || minggeData.PresetDic == null)
            return null;
 
        // 取出对应的方案数据
        if (minggeData.PresetDic.TryGetValue(presetID, out var data))
        {
            return data;
        }
 
        // 如果找不到该方案ID(兼容性),尝试取默认方案 ID=1
        if (presetID != 1 && minggeData.PresetDic.TryGetValue(1, out var defaultData))
        {
            return defaultData;
        }
 
        return null;
    }
    public RolePlusData.MinggeData GetMinggeTotalData(int playerID)
    {
        ViewPlayerData viewPlayerData = GetViewPlayerData(playerID);
        return viewPlayerData?.rolePlusData?.minggeData;
    }
 
    public int GetFuncPresetID(int playerID, int battleType, int funcType)
    {
        ViewPlayerData viewPlayerData = GetViewPlayerData(playerID);
        if (viewPlayerData?.rolePlusData?.BatPresetDic?.TryGetValue(battleType, out var data) != true)
        {
            return 1;
        }
        return data.ContainsKey(funcType) ? data[funcType] : 1;
    }
 
    public Dictionary<int, RolePlusData.HeroData> GetHeroDataDict(int playerID, int presetID)
    {
        ViewPlayerData viewPlayerData = GetViewPlayerData(playerID);
        if (viewPlayerData?.rolePlusData?.LineupDic?.TryGetValue(presetID, out var lineupData) != true)
        {
            return null;
        }
        return lineupData?.HeroDic;
    }
 
    public List<RolePlusData.HeroData> GetHeroDataSortList(int playerID, int presetID)
    {
        var heroDataDict = GetHeroDataDict(playerID, presetID);
        if (heroDataDict == null)
        {
            return null;
        }
        var res = new List<RolePlusData.HeroData>();
        List<int> keyList = heroDataDict.Keys.ToList();
        keyList.Sort();
        foreach (var num in keyList)
        {
            if (!heroDataDict.ContainsKey(num))
            {
                continue;
            }
            res.Add(heroDataDict[num]);
        }
        return res;
    }
 
    public bool TryGetFightPointByTeamType(int playerID, int presetID, out long fightPower)
    {
        fightPower = 0;
        var lineupDic = GetViewPlayerData(playerID)?.rolePlusData?.LineupDic;
        if (lineupDic != null && lineupDic.TryGetValue(presetID, out var lineupData))
        {
            fightPower = lineupData.FightPower;
            return true;
        }
        return false;
    }
 
    public Dictionary<int, RolePlusData.EquipData> GetEquipDataDict(int playerID)
    {
        ViewPlayerData viewPlayerData = GetViewPlayerData(playerID);
        return viewPlayerData?.rolePlusData?.EquipDic;
    }
 
    public int GetUseDataFirstValue(RolePlusData.EquipData equip, int key)
    {
        if (equip.UserData != null && equip.UserData.ContainsKey(key) && equip.UserData[key].Count > 0)
        {
            return equip.UserData[key][0];
        }
        return 0;
    }
 
    public int GetUseDataFirstValue(RolePlusData.HeroData hero, int key)
    {
        if (hero.Data != null && hero.Data.ContainsKey(key) && hero.Data[key].Count > 0)
        {
            return hero.Data[key][0];
        }
        return 0;
    }
 
    public int GetEquipLV(RolePlusData.EquipData equip)
    {
        if (equip == null)
        {
            return 0;
        }
        return GetUseDataFirstValue(equip, 22);
    }
 
    public List<int> GetUseData(RolePlusData.EquipData equip, int key)
    {
        List<int> list = null;
        if (equip.UserData != null)
        {
            equip.UserData.TryGetValue(key, out list);
        }
        return list == null ? new List<int>() : list;
    }
 
    public List<int> GetUseData(RolePlusData.HeroData hero, int key)
    {
        List<int> list = null;
        if (hero.Data != null)
        {
            hero.Data.TryGetValue(key, out list);
        }
        return list == null ? new List<int>() : list;
    }
 
    //基础属性ID列表
    public List<int> GetEquipBaseAttrs(RolePlusData.EquipData equip)
    {
        if (equip == null)
        {
            return new List<int>();
        }
        return GetUseData(equip, 21);
    }
 
 
    //基础属性值列表
    public List<int> GetEquipBaseValues(RolePlusData.EquipData equip)
    {
        if (equip == null)
        {
            return new List<int>();
        }
        return GetUseData(equip, 23);
    }
 
    //战斗属性ID列表
    public List<int> GetEquipFightAttrs(RolePlusData.EquipData equip)
    {
        if (equip == null)
        {
            return new List<int>();
        }
        return GetUseData(equip, 17);
    }
 
    //战斗属性值列表
    public List<int> GetEquipFightValues(RolePlusData.EquipData equip)
    {
        if (equip == null)
        {
            return new List<int>();
        }
        return GetUseData(equip, 19);
    }
 
    //  武将突破等级
    public int GetBreakLevel(RolePlusData.HeroData hero)
    {
        if (hero == null)
            return 0;
        return GetUseDataFirstValue(hero, 74);
    }
 
    //  武将觉醒等级
    public int GetAwakeLevel(RolePlusData.HeroData hero)
    {
 
        if (hero == null)
            return 0;
        return GetUseDataFirstValue(hero, 76);
    }
    // 71 # 英雄天赋ID列表
    public List<int> GetTalentIDList(RolePlusData.HeroData hero)
    {
        if (hero == null)
            return new List<int>();
        return GetUseData(hero, 71);
    }
 
    // 73 # 英雄天赋ID等级列表,对应71天赋ID的等级
    public List<int> GetTalentLvList(RolePlusData.HeroData hero)
    {
        if (hero == null)
            return new List<int>();
        return GetUseData(hero, 73);
    }
 
    // 获取红颜属性值
    public RolePlusData.BeautyData GetBeautyData(int playerID)
    {
        ViewPlayerData viewPlayerData = GetViewPlayerData(playerID);
        return viewPlayerData?.rolePlusData?.beautyData;
    }
 
    // 获取坐骑数据对象
    public RolePlusData.HorseData GetHorseData(int playerID)
    {
        ViewPlayerData viewPlayerData = GetViewPlayerData(playerID);
        return viewPlayerData?.rolePlusData?.horseData;
    }
 
    // 获取古宝数据对象
    public RolePlusData.GubaoData GetGubaoData(int playerID)
    {
        ViewPlayerData viewPlayerData = GetViewPlayerData(playerID);
        return viewPlayerData?.rolePlusData?.gubaoData;
    }
 
    #endregion
    #region 解析PlusData
    public class ViewPlayerData
    {
        public int PlayerID;
        public string PlayerName;
        public int LV;
        public int Job;
        public int RealmLV;
        public int Face;
        public int FacePic;
        public int ModelMark;          // 变形模型mark
        public int EquipShowSwitch;    // 其他外观信息
        public int TitleID;
        public int ServerID;
        public long FightPower;
        public int FamilyID;
        public int FamilyDataServerID;  //公会数据所在服务器ID,A619查看公会用
        public string FamilyName;
        public int FamilyEmblemID;
        public string FamilyEmblemWord;
        public RolePlusData rolePlusData;
        public DateTime getTime;
    }
 
    public class RolePlusData
    {
        // --- 定义存储数据的结构 ---
 
        // 装备字典 <位置索引, 装备数据>
        public Dictionary<int, EquipData> EquipDic = new Dictionary<int, EquipData>();
 
        // 阵容字典 <阵容ID, 阵容数据>
        public Dictionary<int, LineupData> LineupDic = new Dictionary<int, LineupData>();
 
        //<战斗预设类型,<预设类型,使用的方案ID>>
        public Dictionary<int, Dictionary<int, int>> BatPresetDic = new Dictionary<int, Dictionary<int, int>>();
 
        // 红颜数据
        public BeautyData beautyData;
 
        // 坐骑数据
        public HorseData horseData;
 
        // 古宝数据
        public GubaoData gubaoData;
 
        // 命格数据
        public MinggeData minggeData;
 
        // 红颜数据类
        public class BeautyData
        {
            public int Cnt; // 已解锁数
            public Dictionary<int, long> AttrDict = new Dictionary<int, long>(); // 属性
        }
 
        // 坐骑数据类
        public class HorseData
        {
            public int LV;       // 等级
            public int ClassLV;  // 阶级
            public Dictionary<int, long> AttrDict = new Dictionary<int, long>(); // 属性
        }
 
        // 装备数据类
        public class EquipData
        {
            public int ItemID;
            public Dictionary<int, List<int>> UserData = new Dictionary<int, List<int>>();
        }
 
        // 古宝数据类
        public class GubaoData
        {
            public int Cnt; // 已解锁数
            public Dictionary<int, long> AttrDict = new Dictionary<int, long>(); // 属性
        }
 
        public class MinggeData
        {
            public int GWLV; // 感悟等级
            public Dictionary<int, MinggePresetData> PresetDic = new Dictionary<int, MinggePresetData>(); // <预设ID, 预设详情>
        }
 
        public class MinggePresetData
        {
            // 命格技能 <意象技能ID, 等级>
            public Dictionary<int, int> SkillDic = new Dictionary<int, int>();
            // 命格属性 <属性ID, 值>
            public Dictionary<int, long> AttrDict = new Dictionary<int, long>();
        }
 
        // 阵容数据类
        public class LineupData
        {
            public int PlayerID;
            public long FightPower;
            public int ShapeType;
            // 英雄字典 <站位, 英雄数据>
            public Dictionary<int, HeroData> HeroDic = new Dictionary<int, HeroData>();
 
        }
 
        // 英雄数据类
        public class HeroData
        {
            public int HeroID;
            public int SkinID;
            public int LV;
            public int Star;
            public long FightPower;
            public List<int> SkillIDList = new List<int>();
            // 属性字典 <属性ID, 属性值>
            public Dictionary<int, long> AttrDict = new Dictionary<int, long>();
            // 英雄专属UserData (格式与物品UserData相同)
            // 使用 Dictionary<int, List<int>> 结构,key为ItemUseDataKey枚举值
            public Dictionary<int, List<int>> Data = new Dictionary<int, List<int>>();
        }
 
        // 通用的属性解析方法
        private Dictionary<int, long> ParseAttrDict(JsonData jd, string key)
        {
            Dictionary<int, long> result = new Dictionary<int, long>();
            if (jd.Keys.Contains(key))
            {
                JsonData attrs = jd[key];
                foreach (string attrKey in attrs.Keys)
                {
                    if (int.TryParse(attrKey, out int attrId))
                    {
                        JsonData v = attrs[attrKey];
                        long val = 0;
                        // 健壮性数值转换
                        if (v.IsLong) val = (long)v;
                        else if (v.IsInt) val = (long)(int)v;
                        else if (v.IsDouble) val = (long)(double)v;
                        else if (v.IsString) long.TryParse(v.ToString(), out val);
 
                        result[attrId] = val;
                    }
                }
            }
            return result;
        }
 
        // --- 解析逻辑 ---
        public void AnalysisRolePlusData(string jsonStr)
        {
            try
            {
                if (string.IsNullOrEmpty(jsonStr)) return;
 
                EquipDic.Clear();
                LineupDic.Clear();
                BatPresetDic.Clear();
                beautyData = null; // 必须置空,防止显示上一个玩家的数据
                horseData = null;  // 必须置空
                gubaoData = null;  // 必须置空
                minggeData = null;
 
                // 1. 转为 JsonData 对象
                JsonData jd = JsonMapper.ToObject(jsonStr);
 
                // 2. 解析装备 (Equip)
                if (jd.Keys.Contains("Equip"))
                {
                    JsonData equipJd = jd["Equip"];
                    foreach (string key in equipJd.Keys)
                    {
                        if (int.TryParse(key, out int posIndex))
                        {
                            JsonData itemJd = equipJd[key];
                            EquipData equipData = new EquipData();
 
                            if (itemJd.Keys.Contains("ItemID"))
                                equipData.ItemID = (int)itemJd["ItemID"];
 
                            if (itemJd.Keys.Contains("UserData") && !string.IsNullOrEmpty((string)itemJd["UserData"]))
                                equipData.UserData = ConfigParse.Analysis((string)itemJd["UserData"]);
 
                            EquipDic[posIndex] = equipData;
                        }
                    }
                }
 
                // 【新增】解析古宝 (Gubao)
                if (jd.Keys.Contains("Gubao"))
                {
                    JsonData gubaoJd = jd["Gubao"];
                    gubaoData = new GubaoData();
 
                    if (gubaoJd.Keys.Contains("Cnt"))
                        gubaoData.Cnt = (int)gubaoJd["Cnt"];
 
                    // 解析属性
                    gubaoData.AttrDict = ParseAttrDict(gubaoJd, "Attr");
                }
 
                // 【新增】解析红颜 (Beauty)
                if (jd.Keys.Contains("Beauty"))
                {
                    JsonData beautyJd = jd["Beauty"];
                    beautyData = new BeautyData();
 
                    if (beautyJd.Keys.Contains("Cnt"))
                        beautyData.Cnt = (int)beautyJd["Cnt"];
 
                    // 解析属性
                    beautyData.AttrDict = ParseAttrDict(beautyJd, "Attr");
                }
                // 【新增】解析坐骑 (Horse)
                if (jd.Keys.Contains("Horse"))
                {
                    JsonData horseJd = jd["Horse"];
                    horseData = new HorseData();
 
                    if (horseJd.Keys.Contains("LV"))
                        horseData.LV = (int)horseJd["LV"];
 
                    if (horseJd.Keys.Contains("ClassLV"))
                        horseData.ClassLV = (int)horseJd["ClassLV"];
 
                    // 解析属性
                    horseData.AttrDict = ParseAttrDict(horseJd, "Attr");
                }
                // 3. 解析阵容 (Lineup)
                if (jd.Keys.Contains("Lineup"))
                {
                    JsonData lineupJd = jd["Lineup"];
                    foreach (string key in lineupJd.Keys)
                    {
                        if (int.TryParse(key, out int lineupId))
                        {
                            JsonData oneLineupJd = lineupJd[key];
                            LineupData lineupData = new LineupData();
 
                            if (oneLineupJd.Keys.Contains("PlayerID"))
                                lineupData.PlayerID = (int)oneLineupJd["PlayerID"];
 
                            if (oneLineupJd.Keys.Contains("FightPower"))
                                lineupData.FightPower = long.Parse(oneLineupJd["FightPower"].ToString());
 
                            if (oneLineupJd.Keys.Contains("ShapeType"))
                                lineupData.ShapeType = (int)oneLineupJd["ShapeType"];
 
                            // 解析阵容下的英雄 (Hero)
                            if (oneLineupJd.Keys.Contains("Hero"))
                            {
                                JsonData heroRootJd = oneLineupJd["Hero"];
                                foreach (string heroKey in heroRootJd.Keys)
                                {
                                    if (int.TryParse(heroKey, out int heroPos))
                                    {
                                        JsonData heroJd = heroRootJd[heroKey];
                                        HeroData heroData = new HeroData();
 
                                        if (heroJd.Keys.Contains("HeroID")) heroData.HeroID = (int)heroJd["HeroID"];
                                        if (heroJd.Keys.Contains("SkinID")) heroData.SkinID = (int)heroJd["SkinID"];
                                        if (heroJd.Keys.Contains("LV")) heroData.LV = (int)heroJd["LV"];
                                        if (heroJd.Keys.Contains("Star")) heroData.Star = (int)heroJd["Star"];
                                        if (heroJd.Keys.Contains("FightPower")) heroData.FightPower = long.Parse(heroJd["FightPower"].ToString());
                                        // 解析Data字段(武将物品UserData)
                                        if (heroJd.Keys.Contains("Data") && !string.IsNullOrEmpty((string)heroJd["Data"]))
                                        {
                                            heroData.Data = ConfigParse.Analysis((string)heroJd["Data"]);
                                        }
 
                                        // 解析技能列表 List<int>
                                        if (heroJd.Keys.Contains("SkillIDList"))
                                        {
                                            JsonData skills = heroJd["SkillIDList"];
                                            for (int i = 0; i < skills.Count; i++)
                                            {
                                                heroData.SkillIDList.Add((int)skills[i]);
                                            }
                                        }
                                        heroData.AttrDict = ParseAttrDict(heroJd, "AttrDict");
                                        lineupData.HeroDic[heroPos] = heroData;
                                    }
                                }
                            }
                            LineupDic[lineupId] = lineupData;
                        }
                    }
                }
                //BatPreset - {"战斗预设类型":{"预设类型":使用的方案ID, ...}, ...}      
                if (jd.Keys.Contains("BatPreset"))
                {
                    JsonData batPresetJson = jd["BatPreset"];
                    BatPresetDic = new Dictionary<int, Dictionary<int, int>>();
                    foreach (string outerKey in batPresetJson.Keys)
                    {
                        if (int.TryParse(outerKey, out int outerKeyInt))
                        {
                            JsonData innerJson = batPresetJson[outerKey];
                            var innerDict = new Dictionary<int, int>();
                            foreach (string innerKey in innerJson.Keys)
                            {
                                if (int.TryParse(innerKey, out int innerKeyInt))
                                {
                                    innerDict[innerKeyInt] = int.Parse(innerJson[innerKey].ToString());
                                }
                            }
                            BatPresetDic[outerKeyInt] = innerDict;
                        }
                    }
 
                }
                // 【新增】解析命格 (Mingge)
                if (jd.Keys.Contains("Mingge"))
                {
                    JsonData minggeJd = jd["Mingge"];
                    minggeData = new MinggeData();
 
                    // 1. 解析感悟等级
                    if (minggeJd.Keys.Contains("GWLV"))
                        minggeData.GWLV = (int)minggeJd["GWLV"];
 
                    // 2. 解析预设 (Preset)
                    if (minggeJd.Keys.Contains("Preset"))
                    {
                        JsonData presetRootJd = minggeJd["Preset"];
                        foreach (string key in presetRootJd.Keys)
                        {
                            // key 为命格预设ID
                            if (int.TryParse(key, out int presetId))
                            {
                                JsonData singlePresetJd = presetRootJd[key];
                                MinggePresetData presetData = new MinggePresetData();
 
                                // 解析属性 (Attr)
                                presetData.AttrDict = ParseAttrDict(singlePresetJd, "Attr");
 
                                // 解析技能 (Skill) - {"SkillID": level, ...}
                                if (singlePresetJd.Keys.Contains("Skill"))
                                {
                                    JsonData skillJd = singlePresetJd["Skill"];
                                    foreach (string skillKey in skillJd.Keys)
                                    {
                                        if (int.TryParse(skillKey, out int skillId))
                                        {
                                            if (int.TryParse(skillJd[skillKey].ToString(), out int level))
                                            {
                                                presetData.SkillDic[skillId] = level;
                                            }
                                        }
                                    }
                                }
 
                                minggeData.PresetDic[presetId] = presetData;
                            }
                        }
                    }
                }
 
            }
            catch (Exception e)
            {
                Debug.LogError("AnalysisRolePlusData Error: " + e.Message + "\nJSON: " + jsonStr);
            }
        }
 
    }
    #endregion
 
 
}
 
public class ViewHeroDetailData
{
    public int viewHeroType;//0:战场点击我方的英雄模型 1:查看他人英雄详情界面点击英雄卡牌
    public BattleClickHeroData clickHeroData;
    public ViewNPCAttr viewNPCAttr;
    public OtherPlayerDetailManager.RolePlusData.HeroData heroData;
    public List<OtherPlayerDetailManager.RolePlusData.HeroData> heroDatas;
    public OtherPlayerDetailManager.RolePlusData.EquipData equip;
}