少年修仙传客户端代码仓库
client_Zxw
2019-03-13 f5b1ede04cc03e35cc334b74d6ce8921a029cd1e
3335 强化进阶
4个文件已添加
1个文件已修改
268 ■■■■■ 已修改文件
Core/GameEngine/Model/Config/EquipPlusEvolveConfig.cs 214 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/EquipPlusEvolveConfig.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/TelPartialConfig/EquipPlusEvolveConfig.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/TelPartialConfig/EquipPlusEvolveConfig.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Utility/ConfigInitiator.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/EquipPlusEvolveConfig.cs
New file
@@ -0,0 +1,214 @@
//--------------------------------------------------------
//    [Author]:           Fish
//    [  Date ]:           Wednesday, March 13, 2019
//--------------------------------------------------------
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System;
using UnityEngine;
[XLua.LuaCallCSharp]
public partial class EquipPlusEvolveConfig
{
    public readonly int ID;
    public readonly int EquipPlace;
    public readonly int EvolveLV;
    public readonly int NeedPlusLV;
    public readonly string CostItem;
    public readonly string Attr;
    public EquipPlusEvolveConfig()
    {
    }
    public EquipPlusEvolveConfig(string input)
    {
        try
        {
            var tables = input.Split('\t');
            int.TryParse(tables[0],out ID);
            int.TryParse(tables[1],out EquipPlace);
            int.TryParse(tables[2],out EvolveLV);
            int.TryParse(tables[3],out NeedPlusLV);
            CostItem = tables[4];
            Attr = tables[5];
        }
        catch (Exception ex)
        {
            DebugEx.Log(ex);
        }
    }
    static Dictionary<string, EquipPlusEvolveConfig> configs = new Dictionary<string, EquipPlusEvolveConfig>();
    public static EquipPlusEvolveConfig Get(string id)
    {
        if (!inited)
        {
            Debug.Log("EquipPlusEvolveConfig 还未完成初始化。");
            return null;
        }
        if (configs.ContainsKey(id))
        {
            return configs[id];
        }
        EquipPlusEvolveConfig config = null;
        if (rawDatas.ContainsKey(id))
        {
            config = configs[id] = new EquipPlusEvolveConfig(rawDatas[id]);
            rawDatas.Remove(id);
        }
        return config;
    }
    public static EquipPlusEvolveConfig 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<EquipPlusEvolveConfig> GetValues()
    {
        var values = new List<EquipPlusEvolveConfig>();
        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 +"/EquipPlusEvolve.txt";
        }
        else
        {
            path = AssetVersionUtility.GetAssetFilePath("config/EquipPlusEvolve.txt");
        }
        var tempConfig = new EquipPlusEvolveConfig();
        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 EquipPlusEvolveConfig(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 EquipPlusEvolveConfig(line);
                            configs[id] = config;
                            (config as IConfigPostProcess).OnConfigParseCompleted();
                        }
                        else
                        {
                            rawDatas[id] = line;
                        }
                    }
                    catch (System.Exception ex)
                    {
                        Debug.LogError(ex);
                    }
                }
                inited = true;
            });
        }
    }
}
Core/GameEngine/Model/Config/EquipPlusEvolveConfig.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 92e53a1a4e4766d4f95f949ace5c9d48
timeCreated: 1552466135
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Core/GameEngine/Model/TelPartialConfig/EquipPlusEvolveConfig.cs
New file
@@ -0,0 +1,29 @@
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Wednesday, March 13, 2019
//--------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Text;
public partial class EquipPlusEvolveConfig : IConfigPostProcess
{
    static Dictionary<string, EquipPlusEvolveConfig> equipPlusEvolve = new Dictionary<string, EquipPlusEvolveConfig>();
    public void OnConfigParseCompleted()
    {
        equipPlusEvolve.Add(StringUtility.Contact(EquipPlace, EvolveLV).ToString(), this);
    }
    public static EquipPlusEvolveConfig GetEquipPlaceAndEvolveLV(int equipPlace, int evolveLV)
    {
        EquipPlusEvolveConfig equipPlusEvolveConfig = null;
        equipPlusEvolve.TryGetValue(StringUtility.Contact(equipPlace, evolveLV).ToString(), out equipPlusEvolveConfig);
        return equipPlusEvolveConfig;
    }
}
Core/GameEngine/Model/TelPartialConfig/EquipPlusEvolveConfig.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 28fda1791f83c8c42a42d6dd2102fb53
timeCreated: 1552466618
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Utility/ConfigInitiator.cs
@@ -284,6 +284,7 @@
        normalTasks.Add(new ConfigInitTask("EquipSuitConfig", () => { EquipSuitConfig.Init(); }, () => { return EquipSuitConfig.inited; }));
        normalTasks.Add(new ConfigInitTask("EquipStarConfig", () => { EquipStarConfig.Init(); }, () => { return EquipStarConfig.inited; }));
        normalTasks.Add(new ConfigInitTask("WashLevelMaxConfig", () => { WashLevelMaxConfig.Init(); }, () => { return WashLevelMaxConfig.inited; }));
        normalTasks.Add(new ConfigInitTask("EquipPlusEvolveConfig", () => { EquipPlusEvolveConfig.Init(); }, () => { return EquipPlusEvolveConfig.inited; }));
    }
    static List<ConfigInitTask> doingTasks = new List<ConfigInitTask>();