少年修仙传客户端代码仓库
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
using System;
using System.Collections;
using System.Collections.Generic;
 
using UnityEngine;
using UnityEngine.UI;
 
namespace vnxbqy.UI
{
    public class ReliveWin : Window
    {
        [SerializeField]
        private Text _timeDownText;
        [SerializeField]
        private Image _ringImage;
 
        [SerializeField] Text dieDesText;
        [SerializeField] Text buffText;
        [SerializeField] Button inplaceRebornBtn;
 
        PlayerDeadModel _deadModel;
        PlayerDeadModel DeadModel
        {
            get { return _deadModel ?? (_deadModel = ModelCenter.Instance.GetModel<PlayerDeadModel>()); }
        }
 
        public const int ElderBattleMapID = 31160; //上古战场地图Id
        public const int UnionleagueMapID = 31220; //仙盟联赛地图
        int questTimes = 0;
        #region Built-in
        protected override void BindController()
        {
        }
 
        protected override void AddListeners()
        {
            inplaceRebornBtn.onClick.AddListener(OnClickInplaceRebornBtn);
        }
 
        protected override void OnPreOpen()
        {
            TimeDownMgr.CoolTimeData coolDown;
            TimeDownMgr.Instance.Get(TimeDownMgr.CoolTimeType.DuplicatesReborn, out coolDown);
            RefreshTime(Mathf.RoundToInt(coolDown.duration - coolDown.time));
            DeadModel.RefreshDuplicatesRebornCDEvent = RefreshTime;
            int curMapId = PlayerDatas.Instance.baseData.MapID;
            MapConfig mapConfig = MapConfig.Get(curMapId);
            dieDesText.SetActive(false);
            buffText.SetActive(curMapId == ElderBattleMapID);
            inplaceRebornBtn.SetActive(curMapId == UnionleagueMapID
                || curMapId == JadeDynastyBossModel.JADEDYNASTY_MAP);
            switch (curMapId)
            {
                case ElderBattleMapID:
                    SetBuffDes();
                    break;
                case UnionleagueMapID:
                    break;
            }
 
            for (int i = 0; i < DeadModel.dungeonKillArray.Length; i++)
            {
                if(DeadModel.dungeonKillArray[i] == curMapId)
                {
                    dieDesText.SetActive(true);
                    string msg = StringUtility.Contact(Language.Get("AncientBattlefield_Text_1", mapConfig.Name, UIHelper.ServerStringTrim(DeadModel.killerName)));
                    dieDesText.text = msg;
                }
            }
        }
 
        protected override void OnAfterOpen()
        {
            this.transform.SetAsLastSibling();
        }
 
        protected override void OnPreClose()
        {
            StopAllCoroutines();
        }
 
        protected override void OnAfterClose()
        {
        }
        #endregion
 
        private void SetBuffDes()
        {
            List<int> buffIds = new List<int>();
            StatusMgr.Instance.GetBuffIds(PlayerDatas.Instance.PlayerId, ref buffIds);
            var skillIds = SkillConfig.GetSkills(0, 0, DeadModel.deadBuffId);
            string skillName = string.Empty;
            int buffLv = 0;
            bool isMaxBuff = false;
            if (buffIds.Count > 0)
            {
                for (int i = 0; i < buffIds.Count; i++)
                {
                    int buffId = buffIds[i];
                    SkillConfig skillConfig = SkillConfig.Get(buffId);
                    if (skillConfig.SkillTypeID == DeadModel.deadBuffId)
                    {
                        buffLv = skillConfig.SkillLV + 1;
                        isMaxBuff = buffLv > DeadModel.maxDeadBuffLV ? true : false;
                        break;
                    }
                }
            }
 
            if (skillIds != null && skillIds.Count > 0)
            {
                var skillId = skillIds[0];
                var skillConfig = SkillConfig.Get(skillId);
                skillName = skillConfig.SkillName;
            }
            buffText.text = Language.Get("AncientBattlefield_Text_2", skillName);
            buffText.SetActive(!isMaxBuff);
        }
 
        public void RefreshTime(int time)
        {
            _timeDownText.text = time.ToString();
            _ringImage.fillAmount = (float)time / DeadModel.duplicatesRebornTime;
            if (time <= 0)
            {
                DeadModel.SendRebornQuest(0);
                StartCoroutine(CheckPlayerIsReborn());
            }
        }
        IEnumerator CheckPlayerIsReborn()
        {
            questTimes = 0;
            while (questTimes < 5)
            {
                yield return new WaitForSeconds(1);
                questTimes += 1;
                if (DeadModel.playerIsDie)
                {
                    DeadModel.SendRebornQuest(0);
                }
                else
                {
                    questTimes = 5;
                }
            }
        }
 
        private void OnClickInplaceRebornBtn()
        {
            DeadModel.InpacleReborn();
        }
 
        private void CloseWin()
        {
            Close();
        }
 
    }
}