少年修仙传客户端代码仓库
client_Wu Xijin
2019-06-13 033958214c0b16d7e7b93cc821b018c295251867
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Friday, January 05, 2018
//--------------------------------------------------------
 
using Snxxz.UI;
using System;
using System.Collections;
using System.Collections.Generic;
 
using UnityEngine;
using UnityEngine.UI;
//坐骑面板
namespace Snxxz.UI
{
 
    public class MountWin : Window
    {
        [SerializeField] ScrollerController m_ScrollerController;
        [SerializeField] Button m_MountHunBtn;//坐骑兽魂按钮
        [SerializeField] Button m_DeblockingBtton;//解锁按钮
        [SerializeField] Button m_TrainBtn_1;//坐骑驯养1颗
        [SerializeField] Button m_AutoTrainBtn;//自动驯养
        [SerializeField] Button m_StopDomesticateBtn;//停止驯养
 
        [SerializeField] MountPanelAssignment m_MountPanelAssignment;
        [SerializeField] UIEffect m_UieffectLVUp;//坐骑升级
        [SerializeField] PositionTween m_PositionTweenLVUp;
        [SerializeField] Text m_MountName;//被选中的坐骑名
 
        [SerializeField] Button m_PropertyButton1;//坐骑属性按钮
        [SerializeField] Button m_PropertyButton2;//坐骑属性按钮
        List<HorseConfig> sortMountlist = new List<HorseConfig>();//坐骑顺序排列
        public int signHorseID = 0;//用来标记坐骑ID
        private int mountDanId = 0;//消耗品坐骑丹ID
        private int mountDanExp = 0;//消耗品坐骑丹经验值
        public bool Ismultiplicity = false;//是否多倍
        public bool IsFairyJade = false;
        public AchievementGuideEffect AchievementGuideEffect1;
        public AchievementGuideEffect AchievementGuideEffect2;
        private int MountLv = 0;
        List<HorseSkillClass> MountSkills = new List<HorseSkillClass>();
        [SerializeField] Vector3 m_Vector3 = new Vector3(1.8f, 1.8f, 1.8f);
 
        private float LatencyTime = 0;//等待时间
 
        #region Built-in
 
        PackModel _playerPack;
        PackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); } }
        MountModel m_MountModel;
        MountModel mountModel { get { return m_MountModel ?? (m_MountModel = ModelCenter.Instance.GetModel<MountModel>()); } }
        RidingAndPetActivationModel ridingAndPetActivationModel { get { return ModelCenter.Instance.GetModel<RidingAndPetActivationModel>(); } }
 
        public static event Action RedPointMountDan;
        static int StringToHash = Animator.StringToHash("Action");
        protected override void BindController()
        {
            var config = FuncConfigConfig.Get("HorseUpItem");
            mountDanId = int.Parse(config.Numerical1);
            mountDanExp = int.Parse(config.Numerical2);
        }
 
        protected override void AddListeners()
        {
            m_MountHunBtn.AddListener(OnClickMountHunButton);
            m_DeblockingBtton.AddListener(OnClickDeblockingBtton);
            m_TrainBtn_1.AddListener(OnClickTrainBtn);
            m_AutoTrainBtn.AddListener(OnClickAutoTrainBtn);
            m_StopDomesticateBtn.AddListener(OnClickStopDomesticateBtn);
            m_PropertyButton1.AddListener(OnClickPropertyButton);
            m_PropertyButton2.AddListener(OnClickPropertyButton);
        }
 
 
        protected override void OnPreOpen()
        {
            mountModel.Wait = true;
            MountModel.Event_MountAlteration += OnMountAlteration;
            MountModel.Event_MountHA301U += OnMountUpdate;
            MountModel.Event_MountHA301A += OnMountAdd;
            MountModel.OnMountUieffectUpLv += OnMountUieffectUpLv;
            RidingAndPetActivationWin.FairyJadeDEvent += FairyJadeDEvent;
            FlySkillIconWin.FairyJadeDEvent += FairyJadeDEvent;
            m_ScrollerController.OnRefreshCell += OnRefreshGridCell;
            ToAddSorting();
            DefaultOption();
            SetHorseID();
            OnCreateGridLineCell(m_ScrollerController);
            m_ScrollerController.JumpIndex(JumpIndex());
        }
        protected override void OnActived()
        {
            base.OnActived();
        }
        protected override void OnAfterOpen()
        {
            HandleAchievement();
        }
 
        protected override void OnPreClose()
        {
            AchievementGoto.achievementType = 0;
            MountModel.Event_MountAlteration -= OnMountAlteration;
            MountModel.Event_MountHA301U -= OnMountUpdate;
            MountModel.Event_MountHA301A -= OnMountAdd;
            m_ScrollerController.OnRefreshCell -= OnRefreshGridCell;
            MountModel.OnMountUieffectUpLv -= OnMountUieffectUpLv;
            RidingAndPetActivationWin.FairyJadeDEvent -= FairyJadeDEvent;
            FlySkillIconWin.FairyJadeDEvent -= FairyJadeDEvent;
            OnClickStopDomesticateBtn();
            UI3DModelExhibition.Instance.StopShow();
        }
 
        protected override void LateUpdate()
        {
            base.LateUpdate();
        }
        private void FairyJadeDEvent()
        {
            FairyJadeDomesticate();
        }
 
        protected override void OnAfterClose()
        {
            if (PlayerDatas.Instance.baseData.LV >= 1500 && RedPointMountDan != null)
            {
                RedPointMountDan();
            }
            if (ItemOperateUtility.Instance.useItemModel != null)//跳轉選中
            {
                ItemOperateUtility.Instance.useItemModel = null;
            }
        }
 
        public void SetHorseID()
        {
            if (ItemOperateUtility.Instance.useItemModel != null)//坐骑单
            {
                int ItemId = ItemOperateUtility.Instance.useItemModel.itemId;
                if (ItemId == 181)
                {
                   int MountID= mountModel.GetMinExpMount();
                    if (MountID != 0)
                    {
                        signHorseID = MountID;
                        return;
                    }
                }
            }
 
            if (ItemOperateUtility.Instance.useItemModel != null)//跳轉選中(碎片)
            {
                int ItemId = ItemOperateUtility.Instance.useItemModel.itemId;
 
                for (int i = 0; i < sortMountlist.Count; i++)
                {
                    if (sortMountlist[i].UnlockItemID == ItemId)
                    {
                        signHorseID = sortMountlist[i].HorseID;
                        return;
                    }
                }
            }
            for (int i = 0; i < sortMountlist.Count; i++)//未解鎖選中
            {
                if (!mountModel._DicHorse.ContainsKey(sortMountlist[i].HorseID))
                {
                    int MaterialNumber = playerPack.GetItemCountByID(PackType.Item, sortMountlist[i].UnlockItemID);//获取背包解锁材料的数量
                    if (MaterialNumber != 0)
                    {
                        signHorseID = sortMountlist[i].HorseID;
                        return;
                    }
                }
            }
            foreach (var key in mountModel.mountRedpoint.Keys)
            {
                if (mountModel.mountRedpoint[key].state == RedPointState.Simple)
                {
                    signHorseID = key;
                    return;
                }
            }
            for (int i = 0; i < sortMountlist.Count; i++)
            {
                if (sortMountlist[i].HorseID == mountModel.HorseIDNow)
                {
                    signHorseID = sortMountlist[i].HorseID;
                    return;
                }
            }
            signHorseID = sortMountlist[0].HorseID;
        }
 
        private int JumpIndex(int HorseID = 0)
        {
            int Index = 0;
            Index = sortMountlist.FindIndex((x) =>
            {
                return x.HorseID == signHorseID;
            });
            if (Index == -1)
            {
                Index = 0;
            }
            return JumpSelect(Index);
        }
 
        void OnCreateGridLineCell(ScrollerController gridCtrl)
        {
            gridCtrl.Refresh();
            for (int i = 0; i < sortMountlist.Count; i++)
            {
                gridCtrl.AddCell(ScrollerDataType.Header, sortMountlist[i].HorseID);
            }
            gridCtrl.Restart();
        }
        private void OnRefreshGridCell(ScrollerDataType type, CellView cell)
        {
            SelectThemount selectThemount = cell.GetComponent<SelectThemount>();
            int horseID = cell.index;
            var horseConfig = HorseConfig.Get(horseID);
            selectThemount.QualityTxt1.text = ProductOrder(horseConfig.Quality.ToString());
            selectThemount.MountNameTxt.text = horseConfig.Name;
            selectThemount.HidingTipstext.text = Language.Get("Petwin8");
            selectThemount.HidingTipstext_A.text = Language.Get("Petwin8");
            if (mountModel._DicHorse.ContainsKey(horseID))
            {
                selectThemount.MountLvText.gameObject.SetActive(true);
                selectThemount.MountLvActivation.SetActive(false);
 
                if (mountModel._DicHorse[horseID].Lv >= horseConfig.MaxLV)
                {
                    selectThemount.MountLvText.text = string.Format(Language.Get("Horse_MaxLv"), mountModel._DicHorse[horseID].Lv);
                }
                else
                {
                    selectThemount.MountLvText.text = string.Format(Language.Get("Horse_lv"), mountModel._DicHorse[horseID].Lv);
                }
            }
            else
            {
                selectThemount.MountLvText.gameObject.SetActive(false);
                selectThemount.MountLvActivation.SetActive(true);
                selectThemount.MountLvActivation.GetComponent<Text>().text = Language.Get("Petwin6");
            }
            if (horseID == signHorseID)
            {
                if (mountModel._DicHorse.ContainsKey(signHorseID))
                {
                    MountLv = mountModel._DicHorse[signHorseID].Lv;
                }
                else
                {
                    MountLv = 0;
                }
                selectThemount.ChoosenImg.SetActive(false);
                selectThemount.DarkImage.SetActive(true);
                if (MountLv > 0 && mountModel.HorseIDNow != horseID)
                {
                    var config = HorseConfig.Get(signHorseID);
                    if (MountLv >= config.UseNeedRank)
                    {
                        selectThemount.PlayedEquipText.text = Language.Get("MountText2");
                    }
                    else
                    {
                        selectThemount.PlayedEquipText.text = string.Format(Language.Get("MountText1"), config.UseNeedRank);
                    }
                    selectThemount.PlayedEquipBtn.gameObject.SetActive(true);
                    selectThemount.PlayedEquipBtn.RemoveAllListeners();
                    selectThemount.PlayedEquipBtn.AddListener(() =>
                    {
                        int useNeedRank = config.UseNeedRank;
                        if (mountModel._DicHorse[signHorseID].Lv < useNeedRank)
                        {
                            ScrollTip.ShowTip(Language.Get("AppearanceMount_Z"));//未达到外观切换条件
                            return;
                        }
                        OnClickStopDomesticateBtn();
                        mountModel.AppearanceSwitch(signHorseID);
                        ScrollTip.ShowTip(Language.Get("Z1062"));//外观切换成功
                    });
                }
                else
                {
                    selectThemount.PlayedEquipBtn.gameObject.SetActive(false);
                }
                m_MountName.text = horseConfig.Name;              
                if (mountModel._HorseIDNow != string.Empty && int.Parse(mountModel._HorseIDNow) == horseID)
                {
                    selectThemount.HidingTips.SetActive(true);
                  
                }
                else
                {
                    selectThemount.HidingTips.SetActive(false);
                }
            }
            else
            {
                selectThemount.ChoosenImg.SetActive(true);
                selectThemount.DarkImage.SetActive(false);
                selectThemount.PlayedEquipBtn.gameObject.SetActive(false);
                if (mountModel._HorseIDNow != string.Empty && int.Parse(mountModel._HorseIDNow) == horseID)
                {
                 
                    selectThemount.HidingTips_A.SetActive(true);
                }
                else
                {
                    selectThemount.HidingTips_A.SetActive(false);
                }
            }
            selectThemount.RedPoint.redpointId = mountModel.mountRedpoint[horseID].id;
            if (selectThemount.DarkImage.activeSelf)
            {
                m_MountPanelAssignment.PanelAssignment(horseID);
            }
            selectThemount.MountButton.RemoveAllListeners();
            selectThemount.MountButton.AddListener(() =>
            {
                if (horseID != signHorseID)
                {
                    OnClickStopDomesticateBtn();
                    StartCoroutine(SwitchDelay(horseID));
                }
            });
        }
 
        IEnumerator SwitchDelay( int horseId)
        {
            yield return new WaitForSeconds(0.2f);
            signHorseID = horseId;
            m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
        }
        private void DefaultOption()//默认选择
        {
            if (mountModel._HorseIDNow == string.Empty)
            {
                signHorseID = sortMountlist[0].HorseID;
            }
            else
            {
                signHorseID = int.Parse(mountModel._HorseIDNow);
            }
        }
        private void OnClickMountHunButton()
        {
            OnClickStopDomesticateBtn();
            WindowCenter.Instance.Open<MountStoneTipsWin>();
        }
        private void OnClickDeblockingBtton()//解锁按钮
        {
            HorseConfig horsefig = HorseConfig.Get(signHorseID);
            int MaterialNumber = playerPack.GetItemCountByID(PackType.Item, horsefig.UnlockItemID);//获取背包解锁材料的数量
            if (MaterialNumber >= horsefig.UnlockItemCnt)
            {
                CA501_tagPlayerActivateHorse _tagA501 = new CA501_tagPlayerActivateHorse();
                _tagA501.HorseID = (uint)signHorseID;
                GameNetSystem.Instance.SendInfo(_tagA501);
               
            }
            else
            {
                ScrollTip.ShowTip(Language.Get("Z1063"));//所需材料不足
            }
        }
        private void OnClickTrainBtn()//驯养1颗
        {
            OnClickStopDomesticateBtn();
            if (ExecuteJudgment(signHorseID))
            {
                if (playerPack.GetItemCountByID(PackType.Item, mountDanId) <= 0)//如果背包中没有坐骑丹结束方法
                {
                    FuncConfigConfig _tagfun = FuncConfigConfig.Get("HorseUpItem");
                    ItemConfig _tagchine = ItemConfig.Get(int.Parse(_tagfun.Numerical1));
                    if (!WindowCenter.Instance.IsOpen<RidingAndPetActivationWin>())
                    {
                        ItemTipUtility.Show(_tagchine.ID);
                    }
                    return;
                }
                SingleUseMountDan(1);
            }
            else
            {
                ServerTipDetails.DisplayNormalTip(Language.Get("Z1028"));//当前坐骑升阶满级
            }
        }
        private void SingleUseMountDan(int MountDanNumber)//单次使用坐骑丹
        {
            mountModel.MountDanUse(signHorseID, MountDanNumber);//向服务端发包坐骑经验单
        }
        public void OnClickAutoTrainBtn()//自动驯养
        {
            OnClickStopDomesticateBtn();
            if (ExecuteJudgment(signHorseID))
            {
 
                if (playerPack.GetItemCountByID(PackType.Item, mountDanId) <= 0)//仙玉驯养面板
                {
                    WindowCenter.Instance.Open<AutoTrainTipsWin>();
                }
                else
                {
                    m_AutoTrainBtn.gameObject.SetActive(false);
                    m_StopDomesticateBtn.gameObject.SetActive(true);
                    StartCoroutine("AutomaticDomesticated");
                }
            }
            else
            {
                ServerTipDetails.DisplayNormalTip(Language.Get("Z1028"));//当前坐骑升阶满级
            }
        }
        IEnumerator AutomaticDomesticated()//自动驯养
        {
            while (ExecuteJudgment(signHorseID))
            {
                if (playerPack.GetItemCountByID(PackType.Item, mountDanId) <= 0)//如果背包中没有坐骑丹结束方法
                {
                    m_AutoTrainBtn.gameObject.SetActive(true);
                    m_StopDomesticateBtn.gameObject.SetActive(false);
                    //ScrollTip.ShowTip(Language.Get("HorseDan5_text"));
                    yield break;
                }
                else if (WindowCenter.Instance.IsOpen<RidingAndPetActivationWin>())//打开骑宠激活界面结束方法
                {
                    m_AutoTrainBtn.gameObject.SetActive(true);
                    m_StopDomesticateBtn.gameObject.SetActive(false);
                    yield break;
                }
                else
                {
                    if (mountModel.Wait)
                    {
                        if (mountModel._DicHorse.ContainsKey(signHorseID))
                        {
                            int exp=HorseUpConfig.GetHorseIDAndLV(signHorseID, mountModel._DicHorse[signHorseID].Lv).NeedExp;
                           int NeedNum= ridingAndPetActivationModel.PetAndHorseNeedDanNum(exp);
                            int NumNow = playerPack.GetItemCountByID(PackType.Item, mountDanId);
                            if (NumNow >= NeedNum)
                            {
                                mountModel.MountDanUse(signHorseID, NeedNum);//向服务端发包坐骑经验单
                                mountModel.Wait = false;
                            }
                            else
                            {
                                mountModel.MountDanUse(signHorseID, NumNow);//向服务端发包坐骑经验单
                                mountModel.Wait = false;
                            }
                        }                      
                    }
                    yield return null;
                }
            }
            m_AutoTrainBtn.gameObject.SetActive(true);
            m_StopDomesticateBtn.gameObject.SetActive(false);
            ServerTipDetails.DisplayNormalTip(Language.Get("Z1028"));//当前坐骑升阶满级;
            yield break;
        }
 
        public void FairyJadeDomesticate()
        {
            int NumberLv = AutoTrainTipsWin._Lvnumber;//等级所需的等级
            if (NumberLv > mountModel._DicHorse[signHorseID].Lv && !WindowCenter.Instance.IsOpen<RidingAndPetActivationWin>() && AutoTrainTipsWin.IsFairy)
            {
                m_AutoTrainBtn.gameObject.SetActive(false);
                m_StopDomesticateBtn.gameObject.SetActive(true);
                StartCoroutine("FairyJadeD");
            }
           
        }
        IEnumerator FairyJadeD()//仙玉驯养
        {
            int number = AutoTrainTipsWin.DomesticateNumber;//所需的颗数
            int NumberLv = AutoTrainTipsWin._Lvnumber;//等级所需的等级
            while (NumberLv > mountModel._DicHorse[signHorseID].Lv)
            {
                if (WindowCenter.Instance.IsOpen<RidingAndPetActivationWin>())
                {
                    m_AutoTrainBtn.gameObject.SetActive(true);
                    m_StopDomesticateBtn.gameObject.SetActive(false);
                    StopCoroutine("FairyJadeD");
                    yield break;
                }
                if (mountModel.Wait)
                {
                    int exp = HorseUpConfig.GetHorseIDAndLV(signHorseID, mountModel._DicHorse[signHorseID].Lv).NeedExp;
                    int NeedNum = ridingAndPetActivationModel.PetAndHorseNeedDanNum(exp);
                    mountModel.MountDanUse(signHorseID, NeedNum, true);//向服务端发包坐骑经验单
                    mountModel.Wait = false;
                }
                yield return null;
            }
            if (!m_AutoTrainBtn.gameObject.activeSelf)
            {
                AutoTrainTipsWin.IsFairy = false;
                m_AutoTrainBtn.gameObject.SetActive(true);
                m_StopDomesticateBtn.gameObject.SetActive(false);
                StopCoroutine("FairyJadeD");
                yield break;
            }
            yield break;
        }
        public void OnClickStopDomesticateBtn()
        {
            if (!m_AutoTrainBtn.gameObject.activeSelf)
            {
                m_AutoTrainBtn.gameObject.SetActive(true);
                m_StopDomesticateBtn.gameObject.SetActive(false);
                StopCoroutine("AutomaticDomesticated");
                StopCoroutine("FairyJadeD");
            }
        }
        private void OnMountUieffectUpLv()
        {
            if (!m_UieffectLVUp.IsPlaying)
            {
                m_UieffectLVUp.Play();
                m_PositionTweenLVUp.Play();
            }
        }
        private void OnMountAdd(int _HorseID)//坐骑添加
        {
            m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
            ridingAndPetActivationModel.RidingAndPetActivationSet(RidingAndPetActivation.MountActivation, _HorseID);
        }
        private void OnMountUpdate(int _HorseID)//坐骑刷新
        {
            mountModel.Wait = true;
            MountSkills.Clear();
            foreach (var key in mountModel.GetMountSkillAndItem.Keys)
            {
                if (mountModel.GetMountSkillAndItem[key].HorseID == _HorseID)
                {
                    MountSkills.Add(mountModel.GetMountSkillAndItem[key]);
                }
            }
            if (m_MountModel._DicHorse[_HorseID].Lv > MountLv)
            {
                for (int i = 0; i < MountSkills.Count; i++)
                {
                    if (MountSkills[i].HorseLV == m_MountModel._DicHorse[_HorseID].Lv)
                    {
                        ridingAndPetActivationModel.RidingAndPetActivationSet(RidingAndPetActivation.MountSkillActivates, _HorseID, MountSkills[i].SkillID, MountSkills[i].HorseLV);
                    }
                }
            }
            m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
        }
        private void OnMountAlteration(string NowMount)//坐骑外观变化时调用
        {
            m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
        }
        #endregion
        bool ExecuteJudgment(int horeseID)//判断是否满阶可否继续使用的执行判断条件
        {
            bool _bool = false;
            int _NoweLv = mountModel._DicHorse[horeseID].Lv;
 
            int _MaxLv = HorseConfig.Get(horeseID).MaxLV;
            if (_MaxLv > _NoweLv)
            {
                _bool = true;
                return _bool;
            }
            else
            {
                _bool = false;
                return _bool;
            }
        }
        void ToAddSorting()//坐骑的列表排序
        {
          //  sortMountlist.Clear();
            if (sortMountlist.Count <= 0)
            {
                sortMountlist = HorseConfig.GetValues();
            }          
            sortMountlist.Sort(Compare);
        }
        int Compare(HorseConfig x, HorseConfig y)//数组排列
        {
            bool havex = IsNoFullLv(x.HorseID);
            bool havey = IsNoFullLv(y.HorseID);
            bool have_x = IsFullLv(x.HorseID);
            bool have_y = IsFullLv(y.HorseID);
            if (havex.CompareTo(havey) != 0)
            {
                return -havex.CompareTo(havey);
            }
            if (have_x.CompareTo(have_y) != 0)
            {
                return -have_x.CompareTo(have_y);
            }
            if (x.Sort.CompareTo(y.Sort) != 0)
            {
                return x.Sort.CompareTo(y.Sort);
            }
            return 1;
        }
        private bool IsNoFullLv(int mountID)//未满街
        {
            HorseConfig HorseConfig = HorseConfig.Get(mountID);
            if (mountModel._DicHorse.ContainsKey(mountID))
            {
                if (HorseConfig.MaxLV > mountModel._DicHorse[mountID].Lv)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            return false;
        }
        private bool IsFullLv(int mountID)//满阶
        {
            HorseConfig HorseConfig = HorseConfig.Get(mountID);
            if (mountModel._DicHorse.ContainsKey(mountID))
            {
                if (HorseConfig.MaxLV <= mountModel._DicHorse[mountID].Lv)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            return false;
        }
        private void HandleAchievement()
        {
            if (AchievementGoto.achievementType == AchievementGoto.MountDomesticated)//坐骑培养
            {
                AchievementGoto.achievementType = 0;
                SuccessConfig successConfig = SuccessConfig.Get(AchievementGoto.guideAchievementId);
                int[] HorseId = successConfig.Condition;
                signHorseID = HorseId[0];
                m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
                m_ScrollerController.JumpIndex(JumpIndex());
                int MaterialNumber = playerPack.GetItemCountByID(PackType.Item, 181);
                if (mountModel._DicHorse.ContainsKey(signHorseID))
                {
                    if (MaterialNumber > 0)
                    {
                        AchievementGuideEffect2 = AchievementGuideEffectPool.Require(1);
                        AchievementGuideEffect2.transform.SetParentEx(m_TrainBtn_1.transform, Vector3.zero, Vector3.zero, Vector3.one);
                    }
                    else
                    {
                        SysNotifyMgr.Instance.ShowTip("HorseShowTipAchievement2");
                    }
                }
                else
                {
                    SysNotifyMgr.Instance.ShowTip("HorseShowTipAchievement1");
                }
                AchievementGoto.achievementType = 0;
            }
        }
 
        private void OnClickPropertyButton()
        {
            ridingAndPetActivationModel.property = PropertyTip.Mount;
            ridingAndPetActivationModel.RidingId = signHorseID;
            WindowCenter.Instance.Open<TargetPetAttrWin>();
        }
 
        string ProductOrder(string _petProductOrder)//坐骑品质
        {
            FuncConfigConfig _PetQuality = FuncConfigConfig.Get("PetQuality");
            string[] _productlist = _PetQuality.Numerical1.Split('|');
            for (int i = 0; i < _productlist.Length; i++)
            {
                if (_petProductOrder == _productlist[i])
                {
                    string[] _productText = _PetQuality.Numerical2.Split('|');
                    string str = _productText[i];
                    return str;
                }
            }
            return null;
        }
        private int JumpSelect(int Index)
        {
            if (Index <= 4)
            {
                return 0;
            }
            return Index;
        }
    }
}