From dbceb10cd120b2121cb93b63d50d804bc6f02f16 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期二, 26 二月 2019 11:23:34 +0800
Subject: [PATCH] Merge branch 'master' into ItemReconstruction
---
Core/GameEngine/Model/Config/TreasureConfig.cs | 425 +++++++++++++++++++++++++---------------------------
1 files changed, 203 insertions(+), 222 deletions(-)
diff --git a/Core/GameEngine/Model/Config/TreasureConfig.cs b/Core/GameEngine/Model/Config/TreasureConfig.cs
index 8cde4b3..016e1f1 100644
--- a/Core/GameEngine/Model/Config/TreasureConfig.cs
+++ b/Core/GameEngine/Model/Config/TreasureConfig.cs
@@ -1,18 +1,18 @@
-锘�//--------------------------------------------------------
-// [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 TreasureConfig
-{
-
+锘�//--------------------------------------------------------
+// [Author]: Fish
+// [ Date ]: Wednesday, February 20, 2019
+//--------------------------------------------------------
+
+using System.Collections.Generic;
+using System.IO;
+using System.Threading;
+using System;
+using UnityEngine;
+
+[XLua.LuaCallCSharp]
+public partial class TreasureConfig
+{
+
public readonly int ID;
public readonly int Category;
public readonly int PreTreasure;
@@ -30,25 +30,22 @@
public readonly int MapId;
public readonly int LineId;
public readonly int ChallengeLevel;
- public readonly int[] Potentials;
- public readonly int[] SkillPower;
- public readonly string NeedItem;
public readonly int EffectID;
public readonly string[] Verse;
public readonly int ShowNetGotEffect;
public readonly int PreferredStage;
- public readonly int UIScale;
-
- public TreasureConfig()
- {
- }
-
- public TreasureConfig(string input)
- {
- try
- {
- var tables = input.Split('\t');
-
+ public readonly int UIScale;
+
+ public TreasureConfig()
+ {
+ }
+
+ public TreasureConfig(string input)
+ {
+ try
+ {
+ var tables = input.Split('\t');
+
int.TryParse(tables[0],out ID);
int.TryParse(tables[1],out Category);
@@ -88,199 +85,183 @@
int.TryParse(tables[16],out ChallengeLevel);
- string[] PotentialsStringArray = tables[17].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
- Potentials = new int[PotentialsStringArray.Length];
- for (int i=0;i<PotentialsStringArray.Length;i++)
- {
- int.TryParse(PotentialsStringArray[i],out Potentials[i]);
- }
+ int.TryParse(tables[17],out EffectID);
- string[] SkillPowerStringArray = tables[18].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
- SkillPower = new int[SkillPowerStringArray.Length];
- for (int i=0;i<SkillPowerStringArray.Length;i++)
- {
- int.TryParse(SkillPowerStringArray[i],out SkillPower[i]);
- }
+ Verse = tables[18].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
- NeedItem = tables[19];
+ int.TryParse(tables[19],out ShowNetGotEffect);
- int.TryParse(tables[20],out EffectID);
+ int.TryParse(tables[20],out PreferredStage);
- Verse = tables[21].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
-
- int.TryParse(tables[22],out ShowNetGotEffect);
-
- int.TryParse(tables[23],out PreferredStage);
-
- int.TryParse(tables[24],out UIScale);
- }
- catch (Exception ex)
- {
- DebugEx.Log(ex);
- }
- }
-
- static Dictionary<string, TreasureConfig> configs = new Dictionary<string, TreasureConfig>();
- public static TreasureConfig Get(string id)
- {
- if (!inited)
- {
- Debug.Log("TreasureConfig 杩樻湭瀹屾垚鍒濆鍖栥��");
- return null;
- }
-
- if (configs.ContainsKey(id))
- {
- return configs[id];
- }
-
- TreasureConfig config = null;
- if (rawDatas.ContainsKey(id))
- {
- config = configs[id] = new TreasureConfig(rawDatas[id]);
- rawDatas.Remove(id);
- }
-
- return config;
- }
-
- public static TreasureConfig 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<TreasureConfig> GetValues()
- {
- var values = new List<TreasureConfig>();
- 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 +"/Treasure.txt";
- }
- else
- {
- path = AssetVersionUtility.GetAssetFilePath("config/Treasure.txt");
- }
-
- var tempConfig = new TreasureConfig();
- 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 TreasureConfig(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 TreasureConfig(line);
- configs[id] = config;
- (config as IConfigPostProcess).OnConfigParseCompleted();
- }
- else
- {
- rawDatas[id] = line;
- }
- }
- catch (System.Exception ex)
- {
- Debug.LogError(ex);
- }
- }
-
- inited = true;
- });
- }
- }
-
-}
-
-
-
-
+ int.TryParse(tables[21],out UIScale);
+ }
+ catch (Exception ex)
+ {
+ DebugEx.Log(ex);
+ }
+ }
+
+ static Dictionary<string, TreasureConfig> configs = new Dictionary<string, TreasureConfig>();
+ public static TreasureConfig Get(string id)
+ {
+ if (!inited)
+ {
+ Debug.Log("TreasureConfig 杩樻湭瀹屾垚鍒濆鍖栥��");
+ return null;
+ }
+
+ if (configs.ContainsKey(id))
+ {
+ return configs[id];
+ }
+
+ TreasureConfig config = null;
+ if (rawDatas.ContainsKey(id))
+ {
+ config = configs[id] = new TreasureConfig(rawDatas[id]);
+ rawDatas.Remove(id);
+ }
+
+ return config;
+ }
+
+ public static TreasureConfig 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<TreasureConfig> GetValues()
+ {
+ var values = new List<TreasureConfig>();
+ 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 +"/Treasure.txt";
+ }
+ else
+ {
+ path = AssetVersionUtility.GetAssetFilePath("config/Treasure.txt");
+ }
+
+ var tempConfig = new TreasureConfig();
+ 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 TreasureConfig(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 TreasureConfig(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