少年修仙传客户端代码仓库
client_linchunjie
2019-03-11 7fe938c9938a6ddb3803d2128dfa7485ed2d10ed
6340 【前端】【2.0】境界改版开发单
1个文件已删除
6个文件已修改
542 ■■■■■ 已修改文件
Core/GameEngine/Model/Config/RealmConfig.cs 431 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Config/RealmConfig.cs.meta 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/Player/Realm.meta 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/Gen/RealmConfigWrap.cs 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/DailyQuest/DailyQuestRealmPracticeBehaviour.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Realm/RealmModel.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Team/TeamModel.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
            });
        }
    }
}
Core/GameEngine/Model/Config/RealmConfig.cs.meta
@@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: d49ca04ff4a91bc4fb645c417f9ef0b3
timeCreated: 1550121380
timeCreated: 1552295065
licenseType: Pro
MonoImporter:
  serializedVersion: 2
Core/GameEngine/Model/Player/Realm.meta
File was deleted
Lua/Gen/RealmConfigWrap.cs
@@ -27,16 +27,12 @@
            
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "Lv", _g_get_Lv);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "Name", _g_get_Name);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsBigRealm", _g_get_IsBigRealm);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "NeedPoint", _g_get_NeedPoint);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "NeedGood", _g_get_NeedGood);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "NeedNum", _g_get_NeedNum);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "NeedActiveTreasure", _g_get_NeedActiveTreasure);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "AddAttrType", _g_get_AddAttrType);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "AddAttrNum", _g_get_AddAttrNum);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "BossID", _g_get_BossID);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "Img", _g_get_Img);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "SitTime", _g_get_SitTime);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "Quality", _g_get_Quality);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "FightPower", _g_get_FightPower);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "specialProperty", _g_get_specialProperty);
@@ -318,34 +314,6 @@
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_IsBigRealm(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                RealmConfig gen_to_be_invoked = (RealmConfig)translator.FastGetCSObj(L, 1);
                LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.IsBigRealm);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            return 1;
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_NeedPoint(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                RealmConfig gen_to_be_invoked = (RealmConfig)translator.FastGetCSObj(L, 1);
                LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.NeedPoint);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            return 1;
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_NeedGood(RealStatePtr L)
        {
            try {
@@ -367,20 +335,6 @@
            
                RealmConfig gen_to_be_invoked = (RealmConfig)translator.FastGetCSObj(L, 1);
                LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.NeedNum);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            return 1;
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_NeedActiveTreasure(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                RealmConfig gen_to_be_invoked = (RealmConfig)translator.FastGetCSObj(L, 1);
                LuaAPI.lua_pushstring(L, gen_to_be_invoked.NeedActiveTreasure);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
@@ -437,20 +391,6 @@
            
                RealmConfig gen_to_be_invoked = (RealmConfig)translator.FastGetCSObj(L, 1);
                LuaAPI.lua_pushstring(L, gen_to_be_invoked.Img);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            return 1;
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_SitTime(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                RealmConfig gen_to_be_invoked = (RealmConfig)translator.FastGetCSObj(L, 1);
                LuaAPI.lua_pushstring(L, gen_to_be_invoked.SitTime);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
System/DailyQuest/DailyQuestRealmPracticeBehaviour.cs
@@ -91,7 +91,7 @@
        {
            var isMaxRealm = realmModel.realmMaxLevel == PlayerDatas.Instance.baseData.realmLevel;
            var realmConfig = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel);
            var pointNeed = realmConfig.NeedPoint;
            var pointNeed = 0;
            var pointOwn = PlayerDatas.Instance.extersion.realmPoint;
            if (isMaxRealm)
@@ -174,7 +174,7 @@
            var duration = 2f;
            var realmConfig = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel);
            var pointNeed = realmConfig.NeedPoint;
            var pointNeed = 0;
            while (timer < duration)
            {
System/Realm/RealmModel.cs
@@ -10,8 +10,9 @@
{
    public class RealmModel : Model, IPlayerLoginOk, IBeforePlayerDataInitialize
    {
        Dictionary<int, Dictionary<int, int>> m_RealmProperties = new Dictionary<int, Dictionary<int, int>>();
        public int realmMaxLevel { get; private set; }
        public bool isDungeonPass { get; private set; }
        public const int REALM_DUNGEON_ID = 31110;
@@ -46,5 +47,11 @@
                }
            }
        }
        bool TryLevelUp(out int error)
        {
            error = 0;
            return true;
        }
    }
}
System/Team/TeamModel.cs
@@ -383,17 +383,6 @@
                            switch (dungeonId)
                            {
                                case 311101:
                                    if (RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel).IsBigRealm == 1)
                                    {
                                        var index = GetBigRealmIndex();
                                        if (index == 1 || index == 2)
                                        {
                                            invite = true;
                                            int.TryParse(json["311101"][index - 1].ToString(), out level);
                                        }
                                    }
                                    break;
                                default:
                                    invite = true;
                                    int.TryParse(json[dungeonId.ToString()][0].ToString(), out level);
@@ -1200,22 +1189,6 @@
        private int GetBigRealmIndex()
        {
            var index = 0;
            if (RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel).IsBigRealm == 1)
            {
                foreach (var item in RealmConfig.GetValues())
                {
                    if (item.IsBigRealm == 1)
                    {
                        index++;
                    }
                    if (item.Lv == PlayerDatas.Instance.baseData.realmLevel)
                    {
                        break;
                    }
                }
            }
            return index;
        }