少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Friday, November 24, 2017
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
 
using System.Collections.Generic;
using System;
using vnxbqy.UI;
 
//用于记录主界面的一些信息
 
public class PlayerMainDate : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
{
    CapacityDelayModel m_CapacityDelayModel;
    CapacityDelayModel capacityDelayModel { get { return m_CapacityDelayModel ?? (m_CapacityDelayModel = ModelCenter.Instance.GetModel<CapacityDelayModel>()); } }
    PlayerDeadModel _deadModel;
    PlayerDeadModel DeadModel
    { get { return _deadModel ?? (_deadModel = ModelCenter.Instance.GetModel<PlayerDeadModel>()); } }
    PackModel m_PlayerPackModel;
    PackModel playerPack
    {
        get { return m_PlayerPackModel ?? (m_PlayerPackModel = ModelCenter.Instance.GetModel<PackModel>()); }
    }
    BuffModel m_BuffModel;
    BuffModel Buffmodel { get { return m_BuffModel ?? (m_BuffModel = ModelCenter.Instance.GetModel<BuffModel>()); } }
    DungeonAssistModel assistModel { get { return ModelCenter.Instance.GetModel<DungeonAssistModel>(); } }
 
    public event Action AddPowerEvent;
 
    //用于记录XP技能的信息
    public delegate void OnXpSkill();
    public static event OnXpSkill Event_XpSkill;
    public int SkillID = 0;
    //--------------------------------------------------------------
    public Dictionary<int, int> GetCurrencyItemID = new Dictionary<int, int>();
 
    //关于自动寻路
    public bool MoveBool = false;
 
    //-------用于每分钟经验的获取
    public delegate void OnExperience(int _source, int _ExpPoint, int _Exp);//(1.单位经验亿点,2.经验单位点)
    public static event OnExperience Event_Experience;
 
    //--------------------用于战斗力滚动
    private ulong prowNum = 0;
    public ulong ProwNumAdd = 0;
    private bool prowBool = true;
 
    //----------用于显示电量;
    public float ElectricQuantity = 1;
    public static Action ElectricQuantityEvent;
    //---------用于网络信号;
    public int NetworkState = 1;
    public int WifiSignal = 3;//wifi信号强度
    public static Action NetworkStateEvent;
 
    //--------娲皇遗迹;中的层数记录一下下
    public Dictionary<int, int> WHYJPowerDic = new Dictionary<int, int>();
    public  int ruinsTranscriptMapId;//娲皇地图ID
    public int WaHuangHighestFloor = 0;//记录娲皇层数扣除参数
    public int _layerNumber = 1;//服务端的层数
    public int LayerNumber
    {
        get
        {
            if (_layerNumber < 0)
            {
                _layerNumber = 0;
            }
            return _layerNumber;
        }
        set
        {
            _layerNumber = value;
        }
    }
    public int LayerNumberNow = 0;//现在的选择层数
    public bool IsSend = false;//像服务端法宝请求回包保护
    //-------------用来控住主界面的Tip的执行调用
    public bool IsTipBool = true;
 
    //创建角色奖励领取状态
    public int createAwardState = -1;
 
    //----------记录任务面板玩家是否执行点击,进行自动任务
    public bool IsSelfMotionTask = false;
 
 
    //-------------记录仙盟任务放弃任务否不再提示
    public bool IsBoolFairyAuTaskAbandon = false;
    //------------记录仙盟任务花费仙玉是否不再提示
    public bool IsBoolFairyAuTask = false;
 
    //------------记录赏金任务花费仙玉是否不再提示
    public bool IsBoolCoinTask = false;
    //-----记录当前神秘任务的ID
    public int MysteriousTaskID = 0;
    // 用来记录区域状态 (PK模式)
 
    public int AreaState = 0;//默认和平状态
 
    //-------用于记录在Boss区域任务条的显隐状态
    public bool IsBossAreaTask = false;
    // --用于任务仙玉不足购买飞鞋
    public bool IsFlyShoseBool = false;
    public int FlyShoseTaskID = 0;
    //--------获取玩家死亡状态
    public bool IsDead = false;
 
    //----------关于某些副本可以进行地图挂机
    public List<int> OneKeyList = new List<int>();
 
    //----------使用娲皇卷轴后的Buff表现
    public static event Action EmperorBuffEvent;
    public bool IsEmperor = false;
 
    //---------关于任务需要的数据
    public List<int> TaskId_Skill = new List<int>();//任务ID
    public List<int> SkillIndex = new List<int>();//技能槽索引
    public List<int> NeedFairyJade = new List<int>();//所需解锁仙玉
    public int Skill_Index = 0;
    public int TaskSkillID = 0;
    //-----关于支线翅膀任务的特殊逻辑
    public int WingTask = 0;
 
    //------ 关于切线PK状态的特殊逻辑
    public List<int> ActivityList = new List<int>();
    public List<int> ShieldedArea = new List<int>();//需要屏蔽的地图区域
 
    //---------记录主界面Top面板是否在可见位置
    public bool MainTopPanelShow = true;
 
    //任务面板受伤血界面影响
    public static Action DemonJarDamageRankWinChange;
 
    public event Func<bool> customDisplayPower;
 
    public override void Init()
    {
        IsTipBool = true;
        ElectricQuantity = ynmbxxjUtil.Instance.BatteryLevel * 0.01f;
        if (GetCurrencyItemID.Count <= 0)
        {
            string str = FuncConfigConfig.Get("MoneyDisplayModel").Numerical1;
            GetCurrencyItemID = ConfigParse.GetDic<int, int>(str);
 
        }
        OneKeyList.Clear();
        var funconfig = FuncConfigConfig.Get("OneKeyBtnMap");
        int[] Listmap = ConfigParse.GetMultipleStr<int>(funconfig.Numerical1);
        for (int i = 0; i < Listmap.Length; i++)
        {
            OneKeyList.Add(Listmap[i]);
        }
        NetworkState = (int)ynmbxxjUtil.Instance.NetworkType;
        GetPassiveSkillTask();
        var WingsTask = FuncConfigConfig.Get("WingsTask");
        WingTask = int.Parse(WingsTask.Numerical1);
 
        var ActivityListcon = FuncConfigConfig.Get("FairyGrabMapLine");
        int[] Activity_List = ConfigParse.GetMultipleStr<int>(ActivityListcon.Numerical1);
        for (int i = 0; i < Activity_List.Length; i++)
        {
            ActivityList.Add(Activity_List[i]);
        }
        //ShieldedArea.Add(10010);
        //ShieldedArea.Add(10020);
        //ShieldedArea.Add(10030);
        //ShieldedArea.Add(10040);
        string WaHuangHighestFloorStr= FuncConfigConfig.Get("WaHuangHighestFloor").Numerical1;
        WaHuangHighestFloor = int.Parse(WaHuangHighestFloorStr);
        ruinsTranscriptMapId = int.Parse(FuncConfigConfig.Get("SpRewardMapID").Numerical1);//娲皇地图ID
 
        WHYJPowerDic.Clear();
        for (int i = 0; i < 8; i++)
        {
            DungeonHelpBattleConfig Config = assistModel.GetHelpBattleConfig(51010,i);
            if (Config != null)
            {
                int type = i + 1;
                if (type == 1)
                {
                    WHYJPowerDic.Add(type, 0);
                }
                else
                {
                    WHYJPowerDic.Add(type, Config.RobotFightPower);
                }    
            }
        }
       // WHYJPowerDic = ConfigParse.GetDic<int, int>(FuncConfigConfig.Get("WHFloorChoose").Numerical1);//娲皇战力
 
    }
 
    private void GetPassiveSkillTask()//获取任务数据
    {
        TaskId_Skill.Clear();
        SkillIndex.Clear();
        NeedFairyJade.Clear();
        var PassiveSkillTaskconfig = FuncConfigConfig.Get("PassiveSkillTask");
        int[] TaskId_SkillInt = ConfigParse.GetMultipleStr<int>(PassiveSkillTaskconfig.Numerical1);
        for (int i = 0; i < TaskId_SkillInt.Length; i++)
        {
            TaskId_Skill.Add(TaskId_SkillInt[i]);
        }
        int[] TaskId_SkillInt1 = ConfigParse.GetMultipleStr<int>(PassiveSkillTaskconfig.Numerical2);
        for (int i = 0; i < TaskId_SkillInt1.Length; i++)
        {
            SkillIndex.Add(TaskId_SkillInt1[i]);
        }
        int[] TaskId_SkillInt2 = ConfigParse.GetMultipleStr<int>(PassiveSkillTaskconfig.Numerical3);
        for (int i = 0; i < TaskId_SkillInt2.Length; i++)
        {
            NeedFairyJade.Add(TaskId_SkillInt2[i]);
        }  
    }
 
 
    private void UseItemSuccessAct(int Index, int ItemID)
    {
        if (ItemID == 221)
        {
            if (!WindowCenter.Instance.IsOpen<MainInterfaceWin>())
            {
                WindowCenter.Instance.CloseAll(WindowCenter.CloseAllIgnoreType.SystemAndCustom);
                WindowCenter.Instance.Open<MainInterfaceWin>();
            }
            if (PlayerDatas.Instance.hero != null)
            {
                SFXController _sfx = SFXPlayUtility.Instance.PlayBattleEffect(5174, PlayerDatas.Instance.hero);
                _sfx.m_OnFinished += OnSFXDisable;
            }
 
        }
    }
    private void OnSFXDisable(SFXController _controller)
    {
        _controller.m_OnFinished -= OnSFXDisable;
        if (EmperorBuffEvent != null)
        {
            IsEmperor = true;
            EmperorBuffEvent();
        }
    }
 
 
    public override void UnInit()
    {
 
    }
 
    public void OnPlayerLoginOk()
    {
        MapTransferUtility.s_OnHeroStartMoveToNPC -= OnStartPathFind;
        PlayerDatas.Instance.hero.OnPathFindStop -= OnFinishedPathFind;
        ynmbxxjUtil.Instance.OnBatteryLevelChanged -= OnBatteryChanged;//电量
        ynmbxxjUtil.Instance.OnNetworkStatusChanged -= OnNetStatusChanged;//无网络
        DeadModel.playerDieEvent -= playerDieEvent;
        playerPack.useItemSuccessEvent -= UseItemSuccessAct;
        PlayerDatas.Instance.playerDataRefreshEvent -= Updatefighting;
 
        MapTransferUtility.s_OnHeroStartMoveToNPC += OnStartPathFind;
        PlayerDatas.Instance.hero.OnPathFindStop += OnFinishedPathFind;
        ynmbxxjUtil.Instance.OnBatteryLevelChanged += OnBatteryChanged;//电量
        ynmbxxjUtil.Instance.OnNetworkStatusChanged += OnNetStatusChanged;//无网络
        DeadModel.playerDieEvent += playerDieEvent;//获取玩家死亡状态
        playerPack.useItemSuccessEvent += UseItemSuccessAct;
        PlayerDatas.Instance.playerDataRefreshEvent += Updatefighting;
    }
 
    private void Updatefighting(PlayerDataType _tCDBPlayerRefresh)
    {
        if (_tCDBPlayerRefresh == PlayerDataType.ExAttr5)//判断是否再跨服
        {
            bool Isbool = CrossServerUtility.IsCrossServerBoss();
            if (!Isbool)
            {
                int mapID = PlayerDatas.Instance.baseData.MapID;
                var config = MapConfig.Get(mapID);
                if (Buffmodel.PkType != config.Camp)
                {
                    Buffmodel.PkType = config.Camp;
                    DTCA202_tagMCAttackMode.Send_SwitchAttackMode((E_AttackMode)config.Camp);
                }
            }
        }
    }
 
    private void playerDieEvent()
    {
        IsDead = true;
    }
 
    public void OnBeforePlayerDataInitialize()
    {
        FlyShoseTaskID = 0;
        IsFlyShoseBool = false;
        IsTipBool = true;
        prowNum = 0;
        ProwNumAdd = 0;
        prowBool = true;
        SkillID = 0;
        MoveBool = false;
        IsSelfMotionTask = false;
        IsBoolFairyAuTask = false;
        IsBoolFairyAuTaskAbandon = false;
        IsBoolCoinTask = false;
        IsBossAreaTask = false;
        IsDead = false;
        IsEmperor = false;
        if (PlayerDatas.Instance.hero != null)
        {
            MapTransferUtility.s_OnHeroStartMoveToNPC -= OnStartPathFind;
            PlayerDatas.Instance.hero.OnPathFindStop -= OnFinishedPathFind;
        }
 
    }
 
    private void OnNetStatusChanged(NetworkReachability arg0)
    {
        NetworkState = (int)arg0;
        if (NetworkStateEvent != null)
        {
            NetworkStateEvent();
        }
    }
 
    private void onWifiSignalChanged(int arg0)
    {
        WifiSignal = arg0;
        NetworkState = arg0;
        if (NetworkStateEvent != null)
        {
            NetworkStateEvent();
        }
    }
 
    private void onPhoneSignalChanged(int arg0)
    {
        NetworkState = arg0;
        if (NetworkStateEvent != null)
        {
            NetworkStateEvent();
        }
    }
 
    private void OnBatteryChanged(int arg0)
    {
        ElectricQuantity = ynmbxxjUtil.Instance.BatteryLevel * 0.01f;
        if (ElectricQuantityEvent != null)
        {
            ElectricQuantityEvent();
        }
    }
 
 
    private void OnStartPathFind()
    {
 
        MoveBool = true;
    }
 
    private void OnFinishedPathFind()
    {
 
        MoveBool = false;
    }
    public void XpSkill(int _SkillID, int _RemainTime)
    {
        SkillID = _SkillID;
        if (Event_XpSkill != null)
            Event_XpSkill();
    }
 
    public void PowerAdd(ulong power)
    {
        if (prowBool)
        {
            prowNum = power;
            prowBool = false;
        }
        else
        {
            if (power > prowNum)
            {
                ProwNumAdd = power - prowNum;
                prowNum = power;
                if (customDisplayPower != null && customDisplayPower())
                {
                    return;
                }
                if (WindowCenter.Instance.IsOpen<PowerAddWin>())
                {
                    AddPowerEvent?.Invoke();
                    return;
                }
                WindowCenter.Instance.Open<PowerAddWin>();
            }
            else
            {
                prowNum = power;
            }
        }
    }
 
    public void CustomPowerUp(ulong power)
    {
        ProwNumAdd = power;
        if (WindowCenter.Instance.IsOpen<PowerAddWin>())
        {
            AddPowerEvent?.Invoke();
            return;
        }
        WindowCenter.Instance.Open<PowerAddWin>();
    }
 
    public void KissMonsterExperience(int _source, int _ExpPoint, int _Exp)//(1.单位经验亿点,2.经验单位点)
    {
        if (Event_Experience != null)
        {
            Event_Experience(_source, _ExpPoint, _Exp);
        }
    }
    public bool IsRedPointShowPanel()//当主界面有带有“领”字的红点上层面板默认展开
    {
        bool IsBool = false;
        var State1 = RedpointCenter.Instance.GetRedpointState(201);//福利
        var State2 = RedpointCenter.Instance.GetRedpointState(210);
        if (State1 == RedPointState.Simple || State1 == RedPointState.GetReward || State2 == RedPointState.Simple)
        {
            IsBool = true;
        }
        return IsBool;
    }
}