| | |
| | | { |
| | | |
| | | public readonly int ID; |
| | | public readonly int OpenServerWeek; |
| | | public readonly int OpenServerDay; |
| | | public readonly int DataMapID; |
| | | public readonly int StartHour; |
| | | public readonly int StartMinute; |
| | | public readonly int EndHour; |
| | | public readonly int EndMinute; |
| | | public readonly int CanEnter; |
| | | public readonly int StateValue; |
| | | public readonly int OpenServerWeek; |
| | | public readonly int OpenServerDay; |
| | | public readonly int DataMapID; |
| | | public readonly int StartHour; |
| | | public readonly int StartMinute; |
| | | public readonly int EndHour; |
| | | public readonly int EndMinute; |
| | | public readonly int CanEnter; |
| | | public readonly int StateValue; |
| | | |
| | | public DungeonSpecialStateTimeConfig() |
| | | public DungeonSpecialStateTimeConfig() |
| | | { |
| | | } |
| | | |
| | |
| | | { |
| | | var tables = input.Split('\t'); |
| | | |
| | | int.TryParse(tables[0],out ID); |
| | | int.TryParse(tables[0], out ID); |
| | | |
| | | int.TryParse(tables[1],out OpenServerWeek); |
| | | int.TryParse(tables[1], out OpenServerWeek); |
| | | |
| | | int.TryParse(tables[2],out OpenServerDay); |
| | | int.TryParse(tables[2], out OpenServerDay); |
| | | |
| | | int.TryParse(tables[3],out DataMapID); |
| | | int.TryParse(tables[3], out DataMapID); |
| | | |
| | | int.TryParse(tables[4],out StartHour); |
| | | int.TryParse(tables[4], out StartHour); |
| | | |
| | | int.TryParse(tables[5],out StartMinute); |
| | | int.TryParse(tables[5], out StartMinute); |
| | | |
| | | int.TryParse(tables[6],out EndHour); |
| | | int.TryParse(tables[6], out EndHour); |
| | | |
| | | int.TryParse(tables[7],out EndMinute); |
| | | int.TryParse(tables[7], out EndMinute); |
| | | |
| | | int.TryParse(tables[8],out CanEnter); |
| | | int.TryParse(tables[8], out CanEnter); |
| | | |
| | | int.TryParse(tables[9],out StateValue); |
| | | int.TryParse(tables[9], out StateValue); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | |
| | | static Dictionary<string, DungeonSpecialStateTimeConfig> configs = new Dictionary<string, DungeonSpecialStateTimeConfig>(); |
| | | public static DungeonSpecialStateTimeConfig Get(string id) |
| | | { |
| | | if (!inited) |
| | | { |
| | | if (!inited) |
| | | { |
| | | Debug.Log("DungeonSpecialStateTimeConfig 还未完成初始化。"); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | if (configs.ContainsKey(id)) |
| | | { |
| | | return configs[id]; |
| | |
| | | return config; |
| | | } |
| | | |
| | | public static DungeonSpecialStateTimeConfig Get(int id) |
| | | public static DungeonSpecialStateTimeConfig Get(int id) |
| | | { |
| | | return Get(id.ToString()); |
| | | } |
| | |
| | | return values; |
| | | } |
| | | |
| | | public static bool Has(string id) |
| | | public static bool Has(string id) |
| | | { |
| | | return configs.ContainsKey(id) || rawDatas.ContainsKey(id); |
| | | } |
| | | |
| | | public static bool Has(int id) |
| | | public static bool Has(int id) |
| | | { |
| | | return Has(id.ToString()); |
| | | } |
| | | |
| | | public static bool inited { get; private set; } |
| | | public static bool inited { get; private set; } |
| | | protected static Dictionary<string, string> rawDatas = new Dictionary<string, string>(); |
| | | public static void Init(bool sync=false) |
| | | public static void Init(bool sync = false) |
| | | { |
| | | inited = false; |
| | | var path = string.Empty; |
| | | inited = false; |
| | | var path = string.Empty; |
| | | if (AssetSource.refdataFromEditor) |
| | | { |
| | | path = ResourcesPath.CONFIG_FODLER +"/DungeonSpecialStateTime.txt"; |
| | | path = ResourcesPath.CONFIG_FODLER + "/DungeonSpecialStateTime.txt"; |
| | | } |
| | | else |
| | | { |
| | | path = AssetVersionUtility.GetAssetFilePath("config/DungeonSpecialStateTime.txt"); |
| | | } |
| | | |
| | | var tempConfig = new DungeonSpecialStateTimeConfig(); |
| | | var tempConfig = new DungeonSpecialStateTimeConfig(); |
| | | var preParse = tempConfig is IConfigPostProcess; |
| | | |
| | | if (sync) |
| | |
| | | |
| | | if (preParse) |
| | | { |
| | | configs[id] = new DungeonSpecialStateTimeConfig(line); |
| | | var config = new DungeonSpecialStateTimeConfig(line); |
| | | configs[id] = config; |
| | | (config as IConfigPostProcess).OnConfigParseCompleted(); |
| | | } |
| | | else |
| | | { |
| | | rawDatas[id] = line; |
| | | } |
| | | } |
| | | inited = true; |
| | | inited = true; |
| | | } |
| | | else |
| | | { |
| | | ThreadPool.QueueUserWorkItem((object _object) => |
| | | { |
| | | var lines = File.ReadAllLines(path); |
| | | if (!preParse) |
| | | { |
| | | rawDatas = new Dictionary<string, string>(lines.Length - 3); |
| | | } |
| | | if (!preParse) |
| | | { |
| | | rawDatas = new Dictionary<string, string>(lines.Length - 3); |
| | | } |
| | | for (int i = 3; i < lines.Length; i++) |
| | | { |
| | | var line = lines[i]; |
| | | var index = line.IndexOf("\t"); |
| | | var id = line.Substring(0, index); |
| | | |
| | | if (preParse) |
| | | { |
| | | configs[id] = new DungeonSpecialStateTimeConfig(line); |
| | | } |
| | | else |
| | | { |
| | | rawDatas[id] = line; |
| | | } |
| | | if (preParse) |
| | | { |
| | | var config = new DungeonSpecialStateTimeConfig(line); |
| | | configs[id] = config; |
| | | (config as IConfigPostProcess).OnConfigParseCompleted(); |
| | | } |
| | | else |
| | | { |
| | | rawDatas[id] = line; |
| | | } |
| | | } |
| | | |
| | | inited = true; |