少年修仙传客户端代码仓库
client_linchunjie
2018-09-19 aecb6a5a62d8a4cfc7b924ce957a9c7ea90c235d
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
//--------------------------------------------------------
//    [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;
//用于任务分配
namespace Snxxz.UI {
 
    public class TaskAllocation:Singleton<TaskAllocation> {
 
        private static StringBuilder textBuilder = new StringBuilder();
        private const string Info_Pattern = "{([a-zA-Z0-9_]+)}";
        PlayerTaskDatas m_TaskModel;
        PlayerTaskDatas taskmodel
        {
            get
            {
                return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<PlayerTaskDatas>());
            }
        }
        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;
        }
 
    }
 
}