From feeceecc1252fd472a7027fc2049cd95816ea162 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期五, 19 四月 2019 17:32:31 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
---
Core/GameEngine/Model/Config/AttrFruitConfig.cs | 417 ++++++++++++++++++++++++++++++-----------------------------
1 files changed, 210 insertions(+), 207 deletions(-)
diff --git a/Core/GameEngine/Model/Config/AttrFruitConfig.cs b/Core/GameEngine/Model/Config/AttrFruitConfig.cs
index 5b0fe3a..fae7285 100644
--- a/Core/GameEngine/Model/Config/AttrFruitConfig.cs
+++ b/Core/GameEngine/Model/Config/AttrFruitConfig.cs
@@ -1,222 +1,225 @@
-锘�//--------------------------------------------------------
-// [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 AttrFruitConfig
-{
-
+锘�//--------------------------------------------------------
+// [Author]: Fish
+// [ Date ]: Friday, April 19, 2019
+//--------------------------------------------------------
+
+using System.Collections.Generic;
+using System.IO;
+using System.Threading;
+using System;
+using UnityEngine;
+
+[XLua.LuaCallCSharp]
+public partial class AttrFruitConfig
+{
+
public readonly int ID;
public readonly int FuncID;
- public readonly int MaxUseCnt;
+ public readonly Int2[] MaxUseCnt;
+ public readonly string AddItemMaxCnt;
public readonly int RecycleExp;
public readonly int FightPowerEx;
- public readonly int Sort;
- public readonly int[] RecipeLv;
-
- public AttrFruitConfig()
- {
- }
-
- public AttrFruitConfig(string input)
- {
- try
- {
- var tables = input.Split('\t');
-
+ public readonly int drugType;
+ public readonly int Sort;
+
+ public AttrFruitConfig()
+ {
+ }
+
+ public AttrFruitConfig(string input)
+ {
+ try
+ {
+ var tables = input.Split('\t');
+
int.TryParse(tables[0],out ID);
int.TryParse(tables[1],out FuncID);
- int.TryParse(tables[2],out MaxUseCnt);
-
- int.TryParse(tables[3],out RecycleExp);
-
- int.TryParse(tables[4],out FightPowerEx);
-
- int.TryParse(tables[5],out Sort);
-
- string[] RecipeLvStringArray = tables[6].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
- RecipeLv = new int[RecipeLvStringArray.Length];
- for (int i=0;i<RecipeLvStringArray.Length;i++)
+ string[] MaxUseCntStringArray = tables[2].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ MaxUseCnt = new Int2[MaxUseCntStringArray.Length];
+ for (int i=0;i<MaxUseCntStringArray.Length;i++)
{
- int.TryParse(RecipeLvStringArray[i],out RecipeLv[i]);
+ Int2.TryParse(MaxUseCntStringArray[i],out MaxUseCnt[i]);
}
- }
- catch (Exception ex)
- {
- DebugEx.Log(ex);
- }
- }
- static Dictionary<string, AttrFruitConfig> configs = new Dictionary<string, AttrFruitConfig>();
- public static AttrFruitConfig Get(string id)
- {
- if (!inited)
- {
- Debug.Log("AttrFruitConfig 杩樻湭瀹屾垚鍒濆鍖栥��");
- return null;
- }
-
- if (configs.ContainsKey(id))
- {
- return configs[id];
- }
+ AddItemMaxCnt = tables[3];
- AttrFruitConfig config = null;
- if (rawDatas.ContainsKey(id))
- {
- config = configs[id] = new AttrFruitConfig(rawDatas[id]);
- rawDatas.Remove(id);
- }
+ int.TryParse(tables[4],out RecycleExp);
- return config;
- }
+ int.TryParse(tables[5],out FightPowerEx);
- public static AttrFruitConfig Get(int id)
- {
- return Get(id.ToString());
- }
+ int.TryParse(tables[6],out drugType);
- public static List<string> GetKeys()
- {
- var keys = new List<string>();
- keys.AddRange(configs.Keys);
- keys.AddRange(rawDatas.Keys);
- return keys;
- }
-
- public static List<AttrFruitConfig> GetValues()
- {
- var values = new List<AttrFruitConfig>();
- 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 +"/AttrFruit.txt";
- }
- else
- {
- path = AssetVersionUtility.GetAssetFilePath("config/AttrFruit.txt");
- }
-
- var tempConfig = new AttrFruitConfig();
- 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 AttrFruitConfig(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 AttrFruitConfig(line);
- configs[id] = config;
- (config as IConfigPostProcess).OnConfigParseCompleted();
- }
- else
- {
- rawDatas[id] = line;
- }
- }
- catch (System.Exception ex)
- {
- Debug.LogError(ex);
- }
- }
-
- inited = true;
- });
- }
- }
-
-}
-
-
-
-
+ int.TryParse(tables[7],out Sort);
+ }
+ catch (Exception ex)
+ {
+ DebugEx.Log(ex);
+ }
+ }
+
+ static Dictionary<string, AttrFruitConfig> configs = new Dictionary<string, AttrFruitConfig>();
+ public static AttrFruitConfig Get(string id)
+ {
+ if (!inited)
+ {
+ Debug.Log("AttrFruitConfig 杩樻湭瀹屾垚鍒濆鍖栥��");
+ return null;
+ }
+
+ if (configs.ContainsKey(id))
+ {
+ return configs[id];
+ }
+
+ AttrFruitConfig config = null;
+ if (rawDatas.ContainsKey(id))
+ {
+ config = configs[id] = new AttrFruitConfig(rawDatas[id]);
+ rawDatas.Remove(id);
+ }
+
+ return config;
+ }
+
+ public static AttrFruitConfig 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<AttrFruitConfig> GetValues()
+ {
+ var values = new List<AttrFruitConfig>();
+ 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 +"/AttrFruit.txt";
+ }
+ else
+ {
+ path = AssetVersionUtility.GetAssetFilePath("config/AttrFruit.txt");
+ }
+
+ var tempConfig = new AttrFruitConfig();
+ 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 AttrFruitConfig(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 AttrFruitConfig(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