少年修仙传客户端代码仓库
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, September 18, 2018
//--------------------------------------------------------
 
using System;
using System.Collections;
using System.Collections.Generic;
 
using UnityEngine;
using UnityEngine.UI;
 
namespace vnxbqy.UI
{
 
    public class SkillTaskWin : Window
    {
        [SerializeField] RichText m_Text_Condition_1;//条件
        [SerializeField] RichText m_Text_Reward_1;//奖励
        [SerializeField] Text m_NeedMoney_Text;//所需仙玉
        [SerializeField] Button m_GoToSkillBtn;
        [SerializeField] Button m_OpenNowBtn;
        [SerializeField] Button m_GoToBtn;
        [SerializeField] Button m_ClaoseBtn;
        [SerializeField] Image m_Image;//孔数
        PlayerMainDate m_MainModel;
        PlayerMainDate mainModel { get { return m_MainModel ?? (m_MainModel = ModelCenter.Instance.GetModel<PlayerMainDate>()); } }
        TaskModel m_TaskModel;
        TaskModel taskmodel { get { return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<TaskModel>()); } }
        #region Built-in
        protected override void BindController()
        {
 
        }
 
        protected override void AddListeners()
        {
            m_ClaoseBtn.AddListener(() => { Close(); });
            m_GoToSkillBtn.AddListener(OnClickGoToSkillBtn);
            m_OpenNowBtn.AddListener(OnClickOpenNowBtn);
            m_GoToBtn.AddListener(OnClickGoToBtn);
        }
 
        protected override void OnPreOpen()
        {
            if (!taskmodel.allMissionDict.ContainsKey(mainModel.TaskSkillID))
            {
                return;
            }
            string str = taskmodel.allMissionDict[mainModel.TaskSkillID].InforList;
            var taskinfo = TASKINFOConfig.Get(str);
            if (taskinfo != null)
            {
                m_Text_Condition_1.text = taskinfo.show_writing;
                if (taskmodel._DicTaskInformation.ContainsKey(mainModel.TaskSkillID))
                {
                    Dictionary<string, string> SkillDic = new Dictionary<string, string>();
                    SkillDic = taskmodel._DicTaskInformation[mainModel.TaskSkillID];
                    string strA = "on_kill_" + mainModel.TaskSkillID.ToString();
                    string strB = "get_byid_" + mainModel.TaskSkillID.ToString();
                    m_Text_Condition_1.SetReplaceInfo(SkillDic);
                }
            }
            if (mainModel.TaskId_Skill.Contains(mainModel.TaskSkillID))
            {
                int Index = mainModel.TaskId_Skill.IndexOf(mainModel.TaskSkillID);
                m_Text_Reward_1.text = string.Format(Language.Get("PassiveSkillTask1"), (mainModel.SkillIndex[Index] + 1));
                SetImageSprite(mainModel.SkillIndex[Index] + 1);
                m_NeedMoney_Text.text = string.Format(Language.Get("PassiveSkillTask2"), mainModel.NeedFairyJade[Index]);
            }
        }
 
        protected override void OnAfterOpen()
        {
        }
 
        protected override void OnPreClose()
        {
        }
 
        protected override void OnAfterClose()
        {
 
        }
 
        private void OnClickGoToSkillBtn()
        {
            if (mainModel.TaskId_Skill.Contains(mainModel.TaskSkillID))
            {
                int Index = mainModel.TaskId_Skill.IndexOf(mainModel.TaskSkillID);
                mainModel.Skill_Index = mainModel.SkillIndex[Index] + 1;
            }
            WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.SkillFunc2);
        }
        private void OnClickOpenNowBtn()
        {
            int Gold = (int)UIHelper.GetMoneyCnt(1);//仙玉
            if (mainModel.TaskId_Skill.Contains(mainModel.TaskSkillID))
            {
                int Index = mainModel.TaskId_Skill.IndexOf(mainModel.TaskSkillID);
                int NeedMoney = mainModel.NeedFairyJade[Index];
                string strNull = string.Format(Language.Get("PassiveSkillTask3"), NeedMoney);
                ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), strNull, (bool isOk) =>
                {
                    if (isOk)
                    {
                        if (Gold >= NeedMoney)
                        {
                            taskmodel.CompletionOfTask(mainModel.TaskSkillID);
                            WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.SkillFunc2Type2);
                        }
                        else
                        {
                            if (VersionConfig.Get().isBanShu)
                            {
                                SysNotifyMgr.Instance.ShowTip("GoldErr");
                                return;
                            }
                            WindowCenter.Instance.Open<RechargeTipWin>();
                        }
                    }
                });
            }
        }
        private void OnClickGoToBtn()
        {
 
            m_Text_Condition_1.ExcuteHref();
 
            // Close();
        }
 
        private void SetImageSprite(int Index)
        {
            switch (Index)
            {
                case 1:
                    m_Image.SetSprite("Slot_1");
                    break;
                case 2:
                    m_Image.SetSprite("Slot_2");
                    break;
                case 3:
                    m_Image.SetSprite("Slot_3");
                    break;
                case 4:
                    m_Image.SetSprite("Slot_4");
                    break;
                case 5:
                    m_Image.SetSprite("Slot_5");
                    break;
                case 6:
                    m_Image.SetSprite("Slot_6");
                    break;
 
            }
        }
        #endregion
 
    }
 
}