少年修仙传客户端代码仓库
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Friday, June 29, 2018
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
 
using vnxbqy.UI;
using System;
 
 
    public class CoinTaskTipModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
{
 
    public bool IsPopup = false;//赏金
    public bool IsinDungeon = false;
 
    public bool IsFairy = false;//仙盟
    public bool IsinDungeon1 = false;
 
    public override void Init()
    {
      
    }
    public override void UnInit()
    {
 
    }
    public void OnBeforePlayerDataInitialize()
    {
        IsPopup = false;
        IsFairy = false;
        IsinDungeon = false;
        IsinDungeon1 = false;
 
    }
 
    public void OnPlayerLoginOk()
    {
        TaskModel.TaskCoinTaskEvent -= TaskCoinTaskEvent;
        TaskModel.TaskCoinTaskEvent += TaskCoinTaskEvent;
 
        TaskModel.FairyTaskEvent -= FairyTaskEvent;
        TaskModel.FairyTaskEvent += FairyTaskEvent;
        StageLoad.Instance.onStageLoadFinish -= onStageLoadFinish;
        StageLoad.Instance.onStageLoadFinish += onStageLoadFinish;
    }
 
   
 
    private void onStageLoadFinish()
    {
        if (IsinDungeon)
        {
            SnxxzGame.Instance.StartCoroutine(PopupPanel());
            IsinDungeon = false;
        }
        if (IsinDungeon1)
        {
            SnxxzGame.Instance.StartCoroutine(FairyAuTaskPanel());
            IsinDungeon1 = false;
        }
    }
 
    private bool IsDungeon()//判断是否在副本中
    {
        var mapId = PlayerDatas.Instance.baseData.MapID;
        var mapConfig = MapConfig.Get(mapId);
        return mapConfig != null && mapConfig.MapFBType != 0;
    }
 
    private void TaskCoinTaskEvent()
    {
        int GetCylinderNumber = TaskAllocation.Instance.ForRingAllNumber();//获取赏金总环数
        var inDungeon = IsDungeon();
        if (GetCylinderNumber == 10)
        {        
            if (inDungeon)
            {
                IsinDungeon = true;
            }
            else
            {
                SnxxzGame.Instance.StartCoroutine(PopupPanel());
            }
        }
        if (GetCylinderNumber == 20)
        {
            if (!inDungeon)
            {
                SnxxzGame.Instance.StartCoroutine(PopupPanel());
            }
        }
    }
    private void FairyTaskEvent()
    {
        int GetFairyAuNumber = TaskAllocation.Instance.FairyAuNumber();//获取仙盟单轮完成环数
        if (GetFairyAuNumber == 10)
        {
            var inDungeon = IsDungeon();
            if (inDungeon)
            {
                IsinDungeon1 = true;
            }
            else
            {
                SnxxzGame.Instance.StartCoroutine(FairyAuTaskPanel());
            }
 
        }
    }
    private IEnumerator PopupPanel()
    {
        yield return WaitingForSecondConst.WaitMS1500;
        if (CrossServerUtility.IsCrossServer())//在跨服竞技场不打开
        {
            yield break;
        }
        if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing || WindowCenter.Instance.IsOpen<TreasureBaseWin>())
        {
            yield break;
        }
        if (WindowCenter.Instance.IsOpen<TaskWin>())
        {
            yield break;
        }
        int GetCylinderNumber = TaskAllocation.Instance.ForRingAllNumber();//获取赏金总环数
        if (GetCylinderNumber == 10)
        {
            IsPopup = true;
        }  
        if (WindowCenter.Instance.IsOpen<MainInterfaceWin>())
        {
            WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.BountyInterface);
        }      
    }
 
    private IEnumerator FairyAuTaskPanel()
    {
        yield return WaitingForSecondConst.WaitMS1500;
        if (CrossServerUtility.IsCrossServer())//在跨服竞技场不打开
        {
            yield break;
        }
        if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing || WindowCenter.Instance.IsOpen<TreasureBaseWin>())
        {
            yield break;
        }
        if (WindowCenter.Instance.IsOpen<FairyAuTaskWin>())
        {
            yield break;
        }
        int AllFairyAuNumber = TaskAllocation.Instance.FairyAuAllNumber();//获取仙盟总环数
        if (AllFairyAuNumber < 70)
        {
            IsFairy = true;
        }       
        if (WindowCenter.Instance.IsOpen<MainInterfaceWin>())
        {
            WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.UnionTask);
        }
    }
}