少年修仙传客户端代码仓库
hch
3 天以前 600733c8f592cb9e65f2b7a3e110ac1d686e6bfe
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
using vnxbqy.UI;
using System;
using System.Collections.Generic;
using UnityEngine;
using LitJson;
using System.Text;
 
//Arena主控制代码
public class FosterModel : ILModel<FosterModel>
{
    //坐骑培养信息
    public event Action<HA301_tagTrainHorseData> UpdateTrainHorseEvent;
    //宠物培养信息
    public event Action<IL_HA817_tagMCPetTrainInfo> UpdatePetTrainEvent;
    //灵器培养信息
    public event Action<IL_HA818_tagMCLingQiTrainInfo> UpdateLingQiTrainEvent;
 
    Dictionary<int, IL_HA818_tagMCLingQiTrainInfo> LingQiDict = new Dictionary<int, IL_HA818_tagMCLingQiTrainInfo>();
    IL_HA817_tagMCPetTrainInfo m_PetTrainInfo = new IL_HA817_tagMCPetTrainInfo();
    HA301_tagTrainHorseData m_TrainHorseData = new HA301_tagTrainHorseData();
 
    PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
    PetModel petmodel { get { return ModelCenter.Instance.GetModel<PetModel>(); } }
 
    int HorseAttrLength = 0;
    int HorseAttrLengthLV = 0;
    int PetAttrLength = 0;
    int PetAttrLengthLV = 0;
    int LingQiAttrLength = 0;
    int LingQiAttrLengthLV = 0;
 
    public int[] BuyItemID = new int[3];//当前购买物品ID
    public uint[] CurrentLevel = new uint[3] ;//购买当前状态的等级,培养丹
    public uint[] CurrentHave = new uint[3];//已有的培养丹
    public int StateNow = 1; //1.坐骑 2.灵宠 3.守护 4.翅膀 5.灭世 6.噬神
    public int FeedState = 1;//1,2,3,
    public int FeedUpLevel = 1;//提升等级
    public int curEquipID;
    public bool bOpenParent;
    public Dictionary<int, List<uint>> AllLevel = new Dictionary<int, List<uint>>();
    
    protected override void Init()
    {
        CurrentLevel[0] = 0;
        CurrentLevel[1] = 0;
        CurrentLevel[2] = 0;
 
        AddKey(1);
        AddKey(2);
        AddKey(14);
        AddKey(13);
        AddKey(16);
        AddKey(17);
    }
    
    protected override void UnInit()
    {
 
    }
    void AddKey(int key)
    {
        List<uint> keys = new List<uint>();
        keys.Add(0);
        keys.Add(0);
        keys.Add(0);
        AllLevel.Add(key, keys);
    }
 
    #region  //发送命令
    //购买
    public void BuyItem(int ID,int count )
    {
        CA310_tagCMBuyItem buyShop = new CA310_tagCMBuyItem();
        buyShop.BuyItemIndex = (ushort)ID;
        buyShop.BuyCount = (uint)count;
        GameNetSystem.Instance.SendInfo(buyShop);
    }
 
    // A3 27 灵器培养 #tagCMLingQiTrain
    public void SendLingQiTrain(byte _EquipPlace, byte _TrainType, ushort _UseItemCnt)
    {
        FeedState = _TrainType;
        IL_CA327_tagCMLingQiTrain pack = new IL_CA327_tagCMLingQiTrain();
        pack.EquipPlace= _EquipPlace;    //灵器装备位
        pack.TrainType = _TrainType;    //培养类型: 1-基础培养,2-特殊培养,3-百分比培养
        pack.UseItemCnt = _UseItemCnt;    //消耗材料个数
        GameNetSystem.Instance.SendInfo(pack);
    }
    // A5 31 坐骑培养 #tagCMHorseTrain
    public void SendHorseTrain(byte _TrainType, ushort _UseItemCnt)
    {
        FeedState = _TrainType;
        IL_CA531_tagCMHorseTrain pack = new IL_CA531_tagCMHorseTrain();
        pack.TrainType = _TrainType;    //培养类型: 1-基础培养,2-特殊培养,3-百分比培养
        pack.UseItemCnt = _UseItemCnt;    //消耗材料个数
        GameNetSystem.Instance.SendInfo(pack);
    }
    // A7 05 宠物培养 #tagCMPetTrain
    public void SendPetTrain(byte _TrainType, ushort _UseItemCnt)
    {
        FeedState = _TrainType;
        IL_CA705_tagCMPetTrain pack = new IL_CA705_tagCMPetTrain();
        pack.TrainType = _TrainType;    //培养类型: 1-基础培养,2-特殊培养,3-百分比培养
        pack.UseItemCnt = _UseItemCnt;    //消耗材料个数
        GameNetSystem.Instance.SendInfo(pack);
    }
    #endregion
 
    #region  //接收命令
    //坐骑培养信息
    public void ReceiveTrainHorseData(HA301_tagTrainHorseData vNetData)
    {
        m_TrainHorseData = vNetData;
        AllLevel[1] = new List<uint>(vNetData.TrainLVList);
        if (UpdateTrainHorseEvent != null)
        {
            UpdateTrainHorseEvent(vNetData);
        }       
    }
 
    // 宠物培养信息
    public void ReceivePetTrainData(IL_HA817_tagMCPetTrainInfo vNetData)
    {
        m_PetTrainInfo = vNetData;
        AllLevel[2] = new List<uint>(vNetData.TrainLVList);
        if (UpdatePetTrainEvent != null)
        {
            UpdatePetTrainEvent(vNetData);
        }
    }
    //灵器培养信息
    public void ReceiveLingQiTrainData(IL_HA818_tagMCLingQiTrainInfo vNetData)
    {
        if(LingQiDict.ContainsKey(vNetData.EquipPlace))
        {
            LingQiDict[vNetData.EquipPlace] = vNetData;
        }
        else
        {
            LingQiDict.Add(vNetData.EquipPlace, vNetData);
        }
 
        AllLevel[vNetData.EquipPlace] = new List<uint>(vNetData.TrainLVList);
        if (UpdateLingQiTrainEvent != null)
        {
            UpdateLingQiTrainEvent(vNetData);
        }
    }
    #endregion
 
    public void InitTrainHorseData()
    {
        if (UpdateTrainHorseEvent != null)
        {
            UpdateTrainHorseEvent(m_TrainHorseData);
        }
    }
    public void InitPetTrainData()
    {
        if (UpdatePetTrainEvent != null)
        {
            UpdatePetTrainEvent(m_PetTrainInfo);
        }
    }
    public void InitLingQiTrainData()
    {
        if (UpdateLingQiTrainEvent != null)
        {
            UpdateLingQiTrainEvent(LingQiDict[curEquipID]);
        }
    }
    public ILHorseTrainConfig GeHorseTrainConfig(int type, uint level)
    {
        string key = type.ToString() + level.ToString();
        return ILHorseTrainConfig.GetTrainConfigByType(key);
    }
    public ILPetTrainConfig GePetTrainConfig(int type, uint level)
    {
        string key = type.ToString() + level.ToString();
        return ILPetTrainConfig.GetTrainConfigByType(key);
     }
    public ILLingQiTrainConfig GeLingQiTrainConfig(int equip,int type, uint level)
    {
        string key = equip.ToString()+type.ToString() + level.ToString();
        return ILLingQiTrainConfig.GetTrainConfigByType(key);
    }
       
    //获取坐骑培养属性ID
    public void GeHorseUpItemAttrID(int type, uint level, out int[] values)
    {
        string key = type.ToString() + level.ToString();
        ILHorseTrainConfig htConfig = ILHorseTrainConfig.GetTrainConfigByType(key);
        HorseAttrLength = htConfig.UpItemAttrTypeList.Length;
        values = new int[HorseAttrLength];
 
        for (int j = 0; j < htConfig.UpItemAttrTypeList.Length; j++)
        {
            values[j] = htConfig.UpItemAttrTypeList[j];
        }
    }
    //获取坐骑培养特殊属性ID
    public void GeHorseLVAttrID(int type, uint level, out int[] values)
    {
        level = level +1;
        int maxLevel = ILHorseTrainConfig.GetConfigCountByType(type);
        if (level >= maxLevel)
            level = (uint)maxLevel;
        string key = type.ToString() + level.ToString();
        ILHorseTrainConfig htConfig = ILHorseTrainConfig.GetTrainConfigByType(key);
        HorseAttrLengthLV = htConfig.LVAttrTypeList.Length;
        values = new int[HorseAttrLengthLV];
        for (int j = 0; j < htConfig.LVAttrTypeList.Length; j++)
        {
             values[j] = htConfig.LVAttrTypeList[j];
        }
    }
    //获取宠物培养属性ID
    public void GePetUpItemAttrID(int type, uint level, out int[] values)
    {
        string key = type.ToString() + level.ToString();
        ILPetTrainConfig htConfig = ILPetTrainConfig.GetTrainConfigByType(key);
        PetAttrLength = htConfig.UpItemAttrTypeList.Length;
        values = new int[PetAttrLength];
        for (int j = 0; j < htConfig.UpItemAttrTypeList.Length; j++)
        {
            values[j] = htConfig.UpItemAttrTypeList[j];
        }
    }
    //获取宠物培养特殊属性ID
    public void GePetLVAttrID(int type, uint level, out int[] values)
    {
        level = level + 1;
        int maxLevel = ILPetTrainConfig.GetConfigCountByType(type);
        if (level >= maxLevel)
            level = (uint)maxLevel;
 
        string key = type.ToString() + level.ToString();
        ILPetTrainConfig htConfig = ILPetTrainConfig.GetTrainConfigByType(key);
        PetAttrLengthLV = htConfig.LVAttrTypeList.Length;
        values = new int[PetAttrLengthLV];
        for (int j = 0; j < htConfig.LVAttrTypeList.Length; j++)
        {
            values[j] = htConfig.LVAttrTypeList[j];
        }
    }
    //获取灵器培养属性ID
    public void GeLingQiUpItemAttrID(int Equip,int type, uint level, out int[] values)
    {
        string key = Equip.ToString()+ type.ToString() + level.ToString();
        ILLingQiTrainConfig htConfig = ILLingQiTrainConfig.GetTrainConfigByType(key);
        LingQiAttrLength = htConfig.UpItemAttrTypeList.Length;
        values = new int[LingQiAttrLength];
        for (int j = 0; j < htConfig.UpItemAttrTypeList.Length; j++)
        {
            values[j] = htConfig.UpItemAttrTypeList[j];
        }
    }
    //获取灵器培养特殊属性ID
    public void GeLingQiLVAttrID(int Equip, int type, uint level, out int[] values)
    {
        level = level + 1;
        int maxLevel = ILLingQiTrainConfig.GetConfigCountByType(Equip,type);
        if (level >= maxLevel)
            level = (uint)maxLevel;
 
        string key = Equip.ToString() + type.ToString() + level.ToString();
        ILLingQiTrainConfig htConfig = ILLingQiTrainConfig.GetTrainConfigByType(key);
        LingQiAttrLengthLV = htConfig.LVAttrTypeList.Length;
        values = new int[LingQiAttrLengthLV];
        for (int j = 0; j < htConfig.LVAttrTypeList.Length; j++)
        {
            values[j] = htConfig.LVAttrTypeList[j];
        }
    }
    //获取坐骑培养当前值
    public void GetCurrentHorseValue(int type, uint level, int count, out int[] values)
    {
        string key = type.ToString() + level.ToString();
        ILHorseTrainConfig htConfig = ILHorseTrainConfig.GetTrainConfigByType(key);
        values = new int[htConfig.UpItemAttrValueList.Length];
        for (int j = 0; j < htConfig.UpItemAttrValueList.Length; j++)
        {
            values[j] = (count / htConfig.EatCntEverytime) * htConfig.UpItemAttrValueList[j];
        }
    }
    //获取坐骑培养累加值
    public void GetSumHorseValue(int type,uint level,out int[] values )
    {
        string key = type.ToString() + level.ToString();
        ILHorseTrainConfig htConfig = ILHorseTrainConfig.GetTrainConfigByType(key);
        HorseAttrLength = htConfig.UpItemAttrTypeList.Length;
        HorseAttrLengthLV = htConfig.LVAttrTypeList.Length;
        int length = HorseAttrLength + HorseAttrLengthLV;
        values = new int[length]; 
        if (level <= 1)
        {            
            for (int i = 0; i < values.Length; i++)
                values[i] = 0;
        }
        else
        {
            for (int i = 1; i < level ;i++)
            {
                key = type.ToString() + i.ToString();
                htConfig = ILHorseTrainConfig.GetTrainConfigByType(key);
                int count = htConfig.UpItemAttrValueList.Length;
                for (int j = 0; j < htConfig.UpItemAttrValueList.Length; j++)
                {
                    values[j] += (htConfig.EatCntTotal / htConfig.EatCntEverytime) * htConfig.UpItemAttrValueList[j];
                }               
            }
            for (int i = 1; i <= level; i++)
            {
                key = type.ToString() + i.ToString();
                htConfig = ILHorseTrainConfig.GetTrainConfigByType(key);
                int count = htConfig.UpItemAttrValueList.Length;                
                if (type >= 2)
                {
                    for (int j = 0; j < htConfig.LVAttrValueList.Length; j++)
                    {
                        values[count + j] += htConfig.LVAttrValueList[j];
                    }
                }
            }
        }
    }
    //获取灵宠培养当前值
    public void GetCurrentPetValue(int type, uint level, int count, out int[] values)
    {
        string key = type.ToString() + level.ToString();
        ILPetTrainConfig htConfig = ILPetTrainConfig.GetTrainConfigByType(key);
        values = new int[htConfig.UpItemAttrValueList.Length];
        for (int j = 0; j < htConfig.UpItemAttrValueList.Length; j++)
        {
            values[j] = (count / htConfig.EatCntEverytime) * htConfig.UpItemAttrValueList[j];
        }
    }
    //获取灵宠培养累加值
    public void GetSumPetValue(int type, uint level, out int[] values)
    {
        string key = type.ToString() + level.ToString();
        ILPetTrainConfig htConfig = ILPetTrainConfig.GetTrainConfigByType(key);
        PetAttrLength = htConfig.UpItemAttrTypeList.Length;
        PetAttrLengthLV = htConfig.LVAttrTypeList.Length;
        int length = PetAttrLength + PetAttrLengthLV;
        values = new int[length];
        if (level <= 1)
        {
            for (int i = 0; i < values.Length; i++)
                values[i] = 0;
        }
        else
        {
            for (int i = 1; i < level; i++)
            {
                key = type.ToString() + i.ToString();
                htConfig = ILPetTrainConfig.GetTrainConfigByType(key);
                int count = htConfig.UpItemAttrValueList.Length;
                for (int j = 0; j < htConfig.UpItemAttrValueList.Length; j++)
                {
                    values[j] += (htConfig.EatCntTotal / htConfig.EatCntEverytime) * htConfig.UpItemAttrValueList[j];
                }               
            }
            for (int i = 1; i <= level; i++)
            {
                key = type.ToString() + i.ToString();
                htConfig = ILPetTrainConfig.GetTrainConfigByType(key);
                int count = htConfig.UpItemAttrValueList.Length;
              
                if (type >= 2)
                {
                    for (int j = 0; j < htConfig.LVAttrValueList.Length; j++)
                    {
                        values[count + j] += htConfig.LVAttrValueList[j];
                    }
                }
            }
        }
    }
    //获取灵器培养当前值
    public void GetCurrentLingQiValue(int Equip ,int type, uint level, int count, out int[] values)
    {
        string key = Equip.ToString()+type.ToString() + level.ToString();
        ILLingQiTrainConfig htConfig = ILLingQiTrainConfig.GetTrainConfigByType(key);
        values = new int[htConfig.UpItemAttrValueList.Length];
        for (int j = 0; j < htConfig.UpItemAttrValueList.Length; j++)
        {
            values[j] = (count / htConfig.EatCntEverytime)  * htConfig.UpItemAttrValueList[j];
        }
    }
    //获取灵器培养累加值
    public void GetSumLingQiValue(int Equip, int type, uint level, out int[] values)
    {
        string key = Equip.ToString() + type.ToString() + level.ToString();
        ILLingQiTrainConfig htConfig = ILLingQiTrainConfig.GetTrainConfigByType(key);
        LingQiAttrLength = htConfig.UpItemAttrTypeList.Length;
        LingQiAttrLengthLV = htConfig.LVAttrTypeList.Length;
        int length = LingQiAttrLength + LingQiAttrLengthLV;
        values = new int[length];
        if (level <= 1)
        {
            for (int i = 0; i < values.Length; i++)
                values[i] = 0;
        }
        else
        {
            for (int i = 1; i < level; i++)
            {
                key = Equip.ToString() + type.ToString() + i.ToString();
                htConfig = ILLingQiTrainConfig.GetTrainConfigByType(key);
                int count = htConfig.UpItemAttrValueList.Length;
                for (int j = 0; j < htConfig.UpItemAttrValueList.Length; j++)
                {
                    values[j] += (htConfig.EatCntTotal / htConfig.EatCntEverytime) * htConfig.UpItemAttrValueList[j];
                }                      
            }
            for (int i = 1; i <= level; i++)
            {
                key = Equip.ToString() + type.ToString() + i.ToString();
                htConfig = ILLingQiTrainConfig.GetTrainConfigByType(key);
                int count = htConfig.UpItemAttrValueList.Length;              
                if (type >= 2)
                {
                    for (int j = 0; j < htConfig.LVAttrValueList.Length; j++)
                    {
                        values[count + j] += htConfig.LVAttrValueList[j];
                    }
                }
 
            }
        }
    }
    //更新坐骑培养红点
    public bool GetHorseRedPointUpdate(int index,int id)
    {
        uint level = AllLevel[1][index];
        if (level == 0)
            return false;
 
        ILHorseTrainConfig TrainConfig = GeHorseTrainConfig(index + 1, AllLevel[1][index]);
        bool isWork = PlayerDatas.Instance.baseData.realmLevel >= TrainConfig.NeedRealmLV ? true : false;
        if (!isWork)
            return false;
        isWork = false;
        int remainItemCount = packModel.GetItemCountByID(PackType.Item, id);
        if (remainItemCount > 0)
        {
            int type = index + 1;           
            string key = type.ToString() + level.ToString();
            ILHorseTrainConfig htConfig = ILHorseTrainConfig.GetTrainConfigByType(key);
            if (remainItemCount >= htConfig.EatCntEverytime)
                isWork = true;
        }
        return isWork;
    }
    //更新灵宠培养红点
    public bool GetPetRedPointUpdate(int index, int id)
    {
        uint level = AllLevel[2][index];
        if (level == 0)
            return false;
        ILPetTrainConfig TrainConfig = GePetTrainConfig(index + 1, AllLevel[2][index]);
        bool isWork = PlayerDatas.Instance.baseData.realmLevel >= TrainConfig.NeedRealmLV ? true : false;
        if (!isWork)
            return false;
        isWork = false;
        int remainItemCount = packModel.GetItemCountByID(PackType.Item, GeneralDefine.PetTrainIDList[index]);
        if (remainItemCount > 0)
        {
            int type = index + 1;
           
            string key = type.ToString() + level.ToString();
            ILPetTrainConfig htConfig = ILPetTrainConfig.GetTrainConfigByType(key);
            if (remainItemCount >= htConfig.EatCntEverytime)
                isWork = true;
        }                
 
        return isWork;
    }
    //更新灵器培养红点
    public bool GetLingQiRedPointUpdate(int EquipID)
    {
        if (EquipID == 0)
            return false;
 
        bool isWork = false;
        ILLingQiTrainConfig TrainConfig;
 
        for (int i = 0; i < GeneralDefine.LingQiTrainIDList[EquipID].Count; i++)
        {
            int remainItemCount = packModel.GetItemCountByID(PackType.Item, GeneralDefine.LingQiTrainIDList[EquipID][i]);
            if (remainItemCount > 0)
            {
                int type = i + 1;
                uint level = AllLevel[EquipID][i];
                if (level == 0)
                    return false;
                TrainConfig = GeLingQiTrainConfig(EquipID, i + 1, AllLevel[EquipID][i]);
                isWork = PlayerDatas.Instance.baseData.realmLevel >= TrainConfig.NeedRealmLV ? true : false;
                if(!isWork)
                    return false;
                string key = EquipID.ToString() + type.ToString() + level.ToString();
                ILLingQiTrainConfig htConfig = ILLingQiTrainConfig.GetTrainConfigByType(key);
                if(remainItemCount >= htConfig.EatCntEverytime)
                    return true;
            }                
        }
        return isWork;
    }    
   
   
    public bool CheckHorseOpen(bool _openParent)
    {
        bOpenParent = _openParent;
        ILHorseTrainConfig TrainConfig = GeHorseTrainConfig(1, 1);
        if (TrainConfig == null)
            return false;
        bool bOpen = PlayerDatas.Instance.baseData.realmLevel >= TrainConfig.NeedRealmLV ? true : false;
        if(!bOpen)
        {            
            RealmConfig presentCfg = RealmConfig.Get(TrainConfig.NeedRealmLV);
            SysNotifyMgr.Instance.ShowTip("FosterHorseOpenFail", presentCfg.Name);
        }
        StateNow = 1;
        return bOpen;
    }
    public bool CheckPetOpen(bool _openParent)
    {
        bOpenParent = _openParent;
        ILPetTrainConfig TrainConfig = GePetTrainConfig(1, 1);
        bool bOpen = PlayerDatas.Instance.baseData.realmLevel >= TrainConfig.NeedRealmLV ? true : false;
 
        if (!bOpen)
        {
            RealmConfig presentCfg = RealmConfig.Get(TrainConfig.NeedRealmLV);
            SysNotifyMgr.Instance.ShowTip("FosterPetOpenFail", presentCfg.Name);
        }
        StateNow = 2;
        if (!petmodel.CheckPetNow())
        {
            SysNotifyMgr.Instance.ShowTip("FosterPetLockFail");
            return false;
        }
        return bOpen;
    }
 
    public bool CheckLingQiOpen(int _curEquType,bool _openParent)
    {
        bOpenParent = _openParent;
        ILLingQiTrainConfig TrainConfig;
        //int EquipID = (int)SpiritEquipModel.Instance.curEquType;
        //if (EquipID == 0)
        //{
        //    EquipID = _curEquType;
        //}
        int EquipID = _curEquType;
        var place = new Int2(0, (int)EquipID);
        var index = EquipSet.ClientPlaceToServerPlace(place);
        var itemModel = this.packModel.GetItemByIndex(PackType.Equip, index);
        if(itemModel == null)
        {
            switch (EquipID)
            {
                case 14:
                    SysNotifyMgr.Instance.ShowTip("FosterLingQi14EquipFail");
                    break;
                case 13:
                    SysNotifyMgr.Instance.ShowTip("FosterLingQi13EquipFail");
                    break;
                case 16:
                    SysNotifyMgr.Instance.ShowTip("FosterLingQi16EquipFail");
                    break;
                case 17:
                    SysNotifyMgr.Instance.ShowTip("FosterLingQi17EquipFail");
                    break;
 
            }
            return false;
        }
        curEquipID = EquipID;
        TrainConfig = GeLingQiTrainConfig(EquipID, 1, 1);
        bool bOpen = PlayerDatas.Instance.baseData.realmLevel >= TrainConfig.NeedRealmLV ? true : false;
        
        if (!bOpen)
        {
            RealmConfig presentCfg = RealmConfig.Get(TrainConfig.NeedRealmLV);
            switch (EquipID)
            {
                case 14:
                    SysNotifyMgr.Instance.ShowTip("FosterLingQi14OpenFail", presentCfg.Name);
                    break;
                case 13:
                    SysNotifyMgr.Instance.ShowTip("FosterLingQi13OpenFail", presentCfg.Name);
                    break;
                case 16:
                    SysNotifyMgr.Instance.ShowTip("FosterLingQi16OpenFail", presentCfg.Name);
                    break;
                case 17:
                    SysNotifyMgr.Instance.ShowTip("FosterLingQi17OpenFail", presentCfg.Name);
                    break;
 
            }
        }
        StateNow = 3;
        return bOpen;
    }
}