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
|
// {
|
|
// }
|
//}
|
|
|
}
|
}
|