asmrobot
2024-12-31 a8536c3c73a4445b1f1252a1d3271e0c73b35613
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
using RichCreator.Utility.InputControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace RichCreator.Models
{
    /// <summary>
    /// 状态信息
    /// </summary>
    public class StateProvider
    {
        private StateProvider()
        { }
 
        /// <summary>
        /// 支持的状态
        /// </summary>
        public static readonly StateInfoItem[] States = new StateInfoItem[] {
            new StateInfoItem ("AccountIndex","账号","-1"),
            new StateInfoItem ("RoleIndex","角色","-1"),
            new StateInfoItem ("HouseIndex","房间","-1"),
            new StateInfoItem("PreRoleTime","前角色","0m0s"),
            new StateInfoItem ("RoleTimePassed","角色","0m0s"),
            new StateInfoItem ("PreMapTime","前图","0m0s"),
            new StateInfoItem ("MapTimePassed","本图","0m0s"),
            new StateInfoItem ("PreHouseTime","前房","0m0s")
            //new StateInfoItem ("DirectionKey","方向按键","无"),
            //new StateInfoItem ("AttackKey","攻击按键","无")
        };
 
        private Dictionary<string, StateInfoItem> stateDic = new Dictionary<string, StateInfoItem>();
 
        private void SetValue(string key, string value)
        {
            if (!stateDic.ContainsKey(key))
            {
                return;
            }
            StateInfoItem item = stateDic[key];
            item.Value = value;
            //更新值
            G.Instance.UpdateState(item.Index, item.HeaderText + ":" + value);
        }
 
 
        private static StateProvider instance = null;
        private static object lockHelper = new object();
 
        public static StateProvider Instance
        {
            get
            {
                if (instance == null)
                {
                    lock (lockHelper)
                    {
                        if (instance == null)
                        {
                            instance = new StateProvider();
                            ///所有状态添加到字典中
                            for (int i = 0; i < States.Length; i++)
                            {
                                States[i].Index = i;
                                if (!instance.stateDic.ContainsKey(States[i].Key))
                                {
                                    instance.stateDic.Add(States[i].Key, States[i]);
                                }
                            }
                        }
                    }
                }
                return instance;
            }
        }
        
        /// <summary>
        /// 当前账号
        /// </summary>
        public Int32 AccountIndex
        {
            set
            {
                SetValue("AccountIndex", value.ToString());
            }
        }
 
 
        /// <summary>
        /// 角色索引
        /// </summary>
        public int RoleIndex
        {
            set
            {
                SetValue("RoleIndex", value.ToString());
            }
        }
 
        /// <summary>
        /// 房间索引
        /// </summary>
        public Int32 HouseIndex
        {
            set
            {
                SetValue("HouseIndex", value.ToString());
            }
        }
        
        /// <summary>
        /// 前角色所花时间
        /// </summary>
        public Int32 PreRoleTime
        {
            set
            {
                SetValue("PreRoleTime", (value / 60) + "m" + (value % 60) + "s");
            }
        }
        
        /// <summary>
        /// 角色已用时间
        /// </summary>
        public Int32 RoleTimePassed
        {
            set
            {
                SetValue("RoleTimePassed", (value / 60) + "m" + (value % 60) + "s");
            }
        }
 
        /// <summary>
        /// 上一次地图时间
        /// </summary>
        public Int32 PreMapTime
        {
            set
            {
                SetValue("PreMapTime", (value / 60) + "m" + (value % 60) + "s");
            }
        }
 
        /// <summary>
        /// 刷图已用时间
        /// </summary>
        public Int32 MapTimePassed
        {
            set
            {
                SetValue("MapTimePassed", (value / 60) + "m" + (value % 60) + "s");
            }
        }
 
        /// <summary>
        /// 刷上一个房间所有时间
        /// </summary>
        public Int32 PreHouseTime
        {
            set
            {
                SetValue("PreHouseTime", (value / 60) + "m" + (value % 60) + "s");
            }
        }
        
        /// <summary>
        /// 方向按键
        /// </summary>
        public string DirectionKey
        {
            set
            {
                SetValue("DirectionKey", value);
            }
        }
 
        /// <summary>
        /// 攻击按键
        /// </summary>
        public HIDCode AttackKey
        {
            set
            {
                SetValue("AttackKey", value.ToString());
            }
        }
 
        ///// <summary>
        ///// 角色位置
        ///// </summary>
        //public Int32 RolePosition
        //{
        //    set
        //    {
 
        //    }
        //}
 
        ///// <summary>
        ///// 怪物位置
        ///// </summary>
        //public Int32 MonsterPosition
        //{
        //    set
        //    {
 
        //    }
        //}
 
 
    }
}