少年修仙传客户端代码仓库
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Monday, November 06, 2017
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System;
//用于任务分配
namespace vnxbqy.UI
{
 
    
    public class TaskAllocation : Singleton<TaskAllocation>
 
    {
 
        private static StringBuilder textBuilder = new StringBuilder();
        private const string Info_Pattern = "{([a-zA-Z0-9_]+)}";
        TaskModel m_TaskModel;
        TaskModel taskmodel {
            get {
                return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<TaskModel>());
            }
        }
        public string GetTaskInfo(string val, int _item)//用于0820中字典的值替换(1字符串2任务ID)
        {
            textBuilder.Length = 0;
            int index = 0;
            if (Regex.IsMatch(val, Info_Pattern))
            {
                if (taskmodel.ReplaceDic.ContainsKey(_item))
                {
                    Dictionary<string, int> _dic = taskmodel.ReplaceDic[_item];
                    foreach (Match match in Regex.Matches(val, Info_Pattern))
                    {
                        textBuilder.Append(val.Substring(index, match.Index - index));
                        if (_dic.ContainsKey(match.Groups[1].Value))
                        {
                            textBuilder.Append(_dic[match.Groups[1].Value]);
                        }
                        else
                        {
                            textBuilder.Append(0);
                        }
 
                        index = match.Index + match.Length;
                    }
                }
                textBuilder.Append(val.Substring(index, val.Length - index));
                return textBuilder.ToString();
            }
            else
            {
                return val;
            }
        }
 
        public int ForRingNumber()//获取赏金环数
        {
            if (taskmodel.ReplaceDic.ContainsKey(1))
            {
                Dictionary<string, int> _dic = taskmodel.ReplaceDic[1];
                if (_dic.ContainsKey("around_count"))
                {
                    string str = "around_count";
                    return _dic[str];
 
                }
            }
            return 0;
        }
        public int ForRingAllNumber()//获取赏金总环数
        {
            if (taskmodel.ReplaceDic.ContainsKey(1))
            {
                Dictionary<string, int> _dic = taskmodel.ReplaceDic[1];
                if (_dic.ContainsKey("around_allcount"))
                {
                    string str = "around_allcount";
                    return _dic[str];
 
                }
            }
            return 0;
        }
 
        public int FairyAuNumber()//获取仙盟环数
        {
            if (taskmodel.ReplaceDic.ContainsKey(1))
            {
                Dictionary<string, int> _dic = taskmodel.ReplaceDic[1];
                if (_dic.ContainsKey("around_count_family"))
                {
                    string str = "around_count_family";
                    return _dic[str];
 
                }
            }
            return 0;
        }
 
        public int FairyAuAllNumber()//获取仙盟总环数
        {
            if (taskmodel.ReplaceDic.ContainsKey(1))
            {
                Dictionary<string, int> _dic = taskmodel.ReplaceDic[1];
                if (_dic.ContainsKey("around_allcount_family"))
                {
                    string str = "around_allcount_family";
                    return _dic[str];
 
                }
            }
            return 0;
        }
        PlayerMainDate m_MainModel;
        PlayerMainDate mainModel { get { return m_MainModel ?? (m_MainModel = ModelCenter.Instance.GetModel<PlayerMainDate>()); } }
        public void SkillTask(int TaskID)//用于解锁被动技能任务
        {
            int Gold = (int)UIHelper.GetMoneyCnt(1);//仙玉
            if (mainModel.TaskId_Skill.Contains(TaskID))
            {
                int Index = mainModel.TaskId_Skill.IndexOf(TaskID);
                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(TaskID);
                            if (WindowCenter.Instance.IsOpen<SkillWin>())
                            {
                                return;
                            }
                            WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.SkillFunc2Type2);
                        }
                        else
                        {
                            if (VersionConfig.Get().isBanShu)
                            {
                                SysNotifyMgr.Instance.ShowTip("GoldErr");
                                return;
                            }
                            WindowCenter.Instance.Open<RechargeTipWin>();
                        }
                    }
                });
            }
        }
 
        DateTime m_TaskTime = DateTime.Now;
        public DateTime TaskTime {
            get { return m_TaskTime; }
            set { m_TaskTime = value; }
        }
 
    }
 
}