From c0aa0f6da553ed5ae7ebc1921377e8ae10239bb4 Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期三, 13 三月 2019 16:53:08 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
---
Core/GameEngine/Model/Config/RealmConfig.cs | 431 ++++++++++++++++++++++++++---------------------------
1 files changed, 211 insertions(+), 220 deletions(-)
diff --git a/Core/GameEngine/Model/Config/RealmConfig.cs b/Core/GameEngine/Model/Config/RealmConfig.cs
index 79c642f..7d92c04 100644
--- a/Core/GameEngine/Model/Config/RealmConfig.cs
+++ b/Core/GameEngine/Model/Config/RealmConfig.cs
@@ -1,257 +1,248 @@
-锘�//--------------------------------------------------------
-// [Author]: Fish
-// [ Date ]: Thursday, February 14, 2019
-//--------------------------------------------------------
-
-using System.Collections.Generic;
-using System.IO;
-using System.Threading;
-using System;
-using UnityEngine;
-
-[XLua.LuaCallCSharp]
-public partial class RealmConfig
-{
-
+锘�//--------------------------------------------------------
+// [Author]: Fish
+// [ Date ]: Monday, March 11, 2019
+//--------------------------------------------------------
+
+using System.Collections.Generic;
+using System.IO;
+using System.Threading;
+using System;
+using UnityEngine;
+
+[XLua.LuaCallCSharp]
+public partial class RealmConfig
+{
+
public readonly int Lv;
public readonly string Name;
- public readonly int IsBigRealm;
- public readonly int NeedPoint;
+ public readonly int NeedLV;
public readonly int NeedGood;
public readonly int NeedNum;
- public readonly string NeedActiveTreasure;
public readonly int[] AddAttrType;
public readonly int[] AddAttrNum;
public readonly int BossID;
public readonly string Img;
- public readonly string SitTime;
public readonly int Quality;
public readonly int FightPower;
public readonly int specialProperty;
public readonly int effectId;
- public readonly int requireIconEffect;
-
- public RealmConfig()
- {
- }
-
- public RealmConfig(string input)
- {
- try
- {
- var tables = input.Split('\t');
-
+ public readonly int requireIconEffect;
+
+ public RealmConfig()
+ {
+ }
+
+ public RealmConfig(string input)
+ {
+ try
+ {
+ var tables = input.Split('\t');
+
int.TryParse(tables[0],out Lv);
Name = tables[1];
- int.TryParse(tables[2],out IsBigRealm);
+ int.TryParse(tables[2],out NeedLV);
- int.TryParse(tables[3],out NeedPoint);
+ int.TryParse(tables[3],out NeedGood);
- int.TryParse(tables[4],out NeedGood);
+ int.TryParse(tables[4],out NeedNum);
- int.TryParse(tables[5],out NeedNum);
-
- NeedActiveTreasure = tables[6];
-
- string[] AddAttrTypeStringArray = tables[7].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ string[] AddAttrTypeStringArray = tables[5].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
AddAttrType = new int[AddAttrTypeStringArray.Length];
for (int i=0;i<AddAttrTypeStringArray.Length;i++)
{
int.TryParse(AddAttrTypeStringArray[i],out AddAttrType[i]);
}
- string[] AddAttrNumStringArray = tables[8].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ string[] AddAttrNumStringArray = tables[6].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
AddAttrNum = new int[AddAttrNumStringArray.Length];
for (int i=0;i<AddAttrNumStringArray.Length;i++)
{
int.TryParse(AddAttrNumStringArray[i],out AddAttrNum[i]);
}
- int.TryParse(tables[9],out BossID);
+ int.TryParse(tables[7],out BossID);
- Img = tables[10];
+ Img = tables[8];
- SitTime = tables[11];
+ int.TryParse(tables[9],out Quality);
- int.TryParse(tables[12],out Quality);
+ int.TryParse(tables[10],out FightPower);
- int.TryParse(tables[13],out FightPower);
+ int.TryParse(tables[11],out specialProperty);
- int.TryParse(tables[14],out specialProperty);
+ int.TryParse(tables[12],out effectId);
- int.TryParse(tables[15],out effectId);
-
- int.TryParse(tables[16],out requireIconEffect);
- }
- catch (Exception ex)
- {
- DebugEx.Log(ex);
- }
- }
-
- static Dictionary<string, RealmConfig> configs = new Dictionary<string, RealmConfig>();
- public static RealmConfig Get(string id)
- {
- if (!inited)
- {
- Debug.Log("RealmConfig 杩樻湭瀹屾垚鍒濆鍖栥��");
- return null;
- }
-
- if (configs.ContainsKey(id))
- {
- return configs[id];
- }
-
- RealmConfig config = null;
- if (rawDatas.ContainsKey(id))
- {
- config = configs[id] = new RealmConfig(rawDatas[id]);
- rawDatas.Remove(id);
- }
-
- return config;
- }
-
- public static RealmConfig Get(int id)
- {
- return Get(id.ToString());
- }
-
- public static List<string> GetKeys()
- {
- var keys = new List<string>();
- keys.AddRange(configs.Keys);
- keys.AddRange(rawDatas.Keys);
- return keys;
- }
-
- public static List<RealmConfig> GetValues()
- {
- var values = new List<RealmConfig>();
- values.AddRange(configs.Values);
-
- var keys = new List<string>(rawDatas.Keys);
- foreach (var key in keys)
- {
- values.Add(Get(key));
- }
-
- return values;
- }
-
- public static bool Has(string id)
- {
- return configs.ContainsKey(id) || rawDatas.ContainsKey(id);
- }
-
- public static bool Has(int id)
- {
- return Has(id.ToString());
- }
-
- public static bool inited { get; private set; }
- protected static Dictionary<string, string> rawDatas = new Dictionary<string, string>();
- public static void Init(bool sync=false)
- {
- inited = false;
- var path = string.Empty;
- if (AssetSource.refdataFromEditor)
- {
- path = ResourcesPath.CONFIG_FODLER +"/Realm.txt";
- }
- else
- {
- path = AssetVersionUtility.GetAssetFilePath("config/Realm.txt");
- }
-
- var tempConfig = new RealmConfig();
- var preParse = tempConfig is IConfigPostProcess;
-
- if (sync)
- {
- var lines = File.ReadAllLines(path);
- if (!preParse)
- {
- rawDatas = new Dictionary<string, string>(lines.Length - 3);
- }
- for (int i = 3; i < lines.Length; i++)
- {
- try
- {
- var line = lines[i];
- var index = line.IndexOf("\t");
- if (index == -1)
- {
- continue;
- }
- var id = line.Substring(0, index);
-
- if (preParse)
- {
- var config = new RealmConfig(line);
- configs[id] = config;
- (config as IConfigPostProcess).OnConfigParseCompleted();
- }
- else
- {
- rawDatas[id] = line;
- }
- }
- catch (System.Exception ex)
- {
- Debug.LogError(ex);
- }
- }
- inited = true;
- }
- else
- {
- ThreadPool.QueueUserWorkItem((object _object) =>
- {
- var lines = File.ReadAllLines(path);
- if (!preParse)
- {
- rawDatas = new Dictionary<string, string>(lines.Length - 3);
- }
- for (int i = 3; i < lines.Length; i++)
- {
- try
- {
- var line = lines[i];
- var index = line.IndexOf("\t");
- if (index == -1)
- {
- continue;
- }
- var id = line.Substring(0, index);
-
- if (preParse)
- {
- var config = new RealmConfig(line);
- configs[id] = config;
- (config as IConfigPostProcess).OnConfigParseCompleted();
- }
- else
- {
- rawDatas[id] = line;
- }
- }
- catch (System.Exception ex)
- {
- Debug.LogError(ex);
- }
- }
-
- inited = true;
- });
- }
- }
-
-}
-
-
-
-
+ int.TryParse(tables[13],out requireIconEffect);
+ }
+ catch (Exception ex)
+ {
+ DebugEx.Log(ex);
+ }
+ }
+
+ static Dictionary<string, RealmConfig> configs = new Dictionary<string, RealmConfig>();
+ public static RealmConfig Get(string id)
+ {
+ if (!inited)
+ {
+ Debug.Log("RealmConfig 杩樻湭瀹屾垚鍒濆鍖栥��");
+ return null;
+ }
+
+ if (configs.ContainsKey(id))
+ {
+ return configs[id];
+ }
+
+ RealmConfig config = null;
+ if (rawDatas.ContainsKey(id))
+ {
+ config = configs[id] = new RealmConfig(rawDatas[id]);
+ rawDatas.Remove(id);
+ }
+
+ return config;
+ }
+
+ public static RealmConfig Get(int id)
+ {
+ return Get(id.ToString());
+ }
+
+ public static List<string> GetKeys()
+ {
+ var keys = new List<string>();
+ keys.AddRange(configs.Keys);
+ keys.AddRange(rawDatas.Keys);
+ return keys;
+ }
+
+ public static List<RealmConfig> GetValues()
+ {
+ var values = new List<RealmConfig>();
+ values.AddRange(configs.Values);
+
+ var keys = new List<string>(rawDatas.Keys);
+ foreach (var key in keys)
+ {
+ values.Add(Get(key));
+ }
+
+ return values;
+ }
+
+ public static bool Has(string id)
+ {
+ return configs.ContainsKey(id) || rawDatas.ContainsKey(id);
+ }
+
+ public static bool Has(int id)
+ {
+ return Has(id.ToString());
+ }
+
+ public static bool inited { get; private set; }
+ protected static Dictionary<string, string> rawDatas = new Dictionary<string, string>();
+ public static void Init(bool sync=false)
+ {
+ inited = false;
+ var path = string.Empty;
+ if (AssetSource.refdataFromEditor)
+ {
+ path = ResourcesPath.CONFIG_FODLER +"/Realm.txt";
+ }
+ else
+ {
+ path = AssetVersionUtility.GetAssetFilePath("config/Realm.txt");
+ }
+
+ var tempConfig = new RealmConfig();
+ var preParse = tempConfig is IConfigPostProcess;
+
+ if (sync)
+ {
+ var lines = File.ReadAllLines(path);
+ if (!preParse)
+ {
+ rawDatas = new Dictionary<string, string>(lines.Length - 3);
+ }
+ for (int i = 3; i < lines.Length; i++)
+ {
+ try
+ {
+ var line = lines[i];
+ var index = line.IndexOf("\t");
+ if (index == -1)
+ {
+ continue;
+ }
+ var id = line.Substring(0, index);
+
+ if (preParse)
+ {
+ var config = new RealmConfig(line);
+ configs[id] = config;
+ (config as IConfigPostProcess).OnConfigParseCompleted();
+ }
+ else
+ {
+ rawDatas[id] = line;
+ }
+ }
+ catch (System.Exception ex)
+ {
+ Debug.LogError(ex);
+ }
+ }
+ inited = true;
+ }
+ else
+ {
+ ThreadPool.QueueUserWorkItem((object _object) =>
+ {
+ var lines = File.ReadAllLines(path);
+ if (!preParse)
+ {
+ rawDatas = new Dictionary<string, string>(lines.Length - 3);
+ }
+ for (int i = 3; i < lines.Length; i++)
+ {
+ try
+ {
+ var line = lines[i];
+ var index = line.IndexOf("\t");
+ if (index == -1)
+ {
+ continue;
+ }
+ var id = line.Substring(0, index);
+
+ if (preParse)
+ {
+ var config = new RealmConfig(line);
+ configs[id] = config;
+ (config as IConfigPostProcess).OnConfigParseCompleted();
+ }
+ else
+ {
+ rawDatas[id] = line;
+ }
+ }
+ catch (System.Exception ex)
+ {
+ Debug.LogError(ex);
+ }
+ }
+
+ inited = true;
+ });
+ }
+ }
+
+}
+
+
+
+
--
Gitblit v1.8.0