| Core/GameEngine/Model/Config/FuncSwitchConfig.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Core/GameEngine/Model/Config/FuncSwitchConfig.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Core/GameEngine/Model/ConfigManager.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Lua/Gen/SnxxzUIFuncSwitchModelWrap.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Lua/Gen/SnxxzUIFuncSwitchModelWrap.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/SystemSetting/FuncSwitchBehaviour.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/SystemSetting/FuncSwitchBehaviour.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/SystemSetting/FuncSwitchModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/SystemSetting/FuncSwitchModel.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/WindowBase/ModelCenter.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Core/GameEngine/Model/Config/FuncSwitchConfig.cs
New file @@ -0,0 +1,41 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, December 03, 2018 //-------------------------------------------------------- using UnityEngine; using System; namespace TableConfig { public partial class FuncSwitchConfig : ConfigBase { public int ID { get ; private set ; } public string AppIdSwitch { get ; private set; } public override string getKey() { return ID.ToString(); } public override void Parse() { try { ID=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0; AppIdSwitch = rawContents[1].Trim(); } catch (Exception ex) { DebugEx.Log(ex); } } } } Core/GameEngine/Model/Config/FuncSwitchConfig.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 1df04b93abf079644b0a4fe90b4a69ce timeCreated: 1543818756 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/GameEngine/Model/ConfigManager.cs
@@ -211,6 +211,8 @@ AddAsyncTask<TaskPowerConfig>(); AddAsyncTask<GodWeaponEffectConfig>(); AddAsyncTask<DungeonHelpBattleConfig>(); AddAsyncTask<FuncSwitchConfig>(); while (!AllCompleted()) { var completedCount = 0; Lua/Gen/SnxxzUIFuncSwitchModelWrap.cs
New file @@ -0,0 +1,241 @@ #if USE_UNI_LUA using LuaAPI = UniLua.Lua; using RealStatePtr = UniLua.ILuaState; using LuaCSFunction = UniLua.CSharpFunctionDelegate; #else using LuaAPI = XLua.LuaDLL.Lua; using RealStatePtr = System.IntPtr; using LuaCSFunction = XLua.LuaDLL.lua_CSFunction; #endif using XLua; using System.Collections.Generic; namespace XLua.CSObjectWrap { using Utils = XLua.Utils; public class SnxxzUIFuncSwitchModelWrap { public static void __Register(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(Snxxz.UI.FuncSwitchModel); Utils.BeginObjectRegister(type, L, translator, 0, 5, 1, 0); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Init", _m_Init); Utils.RegisterFunc(L, Utils.METHOD_IDX, "OnBeforePlayerDataInitialize", _m_OnBeforePlayerDataInitialize); Utils.RegisterFunc(L, Utils.METHOD_IDX, "OnPlayerLoginOk", _m_OnPlayerLoginOk); Utils.RegisterFunc(L, Utils.METHOD_IDX, "UnInit", _m_UnInit); Utils.RegisterFunc(L, Utils.METHOD_IDX, "IsOpen", _m_IsOpen); Utils.RegisterFunc(L, Utils.GETTER_IDX, "switchDataDict", _g_get_switchDataDict); Utils.EndObjectRegister(type, L, translator, null, null, null, null, null); Utils.BeginClassRegister(type, L, __CreateInstance, 1, 0, 0); Utils.EndClassRegister(type, L, translator); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if(LuaAPI.lua_gettop(L) == 1) { Snxxz.UI.FuncSwitchModel gen_ret = new Snxxz.UI.FuncSwitchModel(); translator.Push(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to Snxxz.UI.FuncSwitchModel constructor!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Init(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Snxxz.UI.FuncSwitchModel gen_to_be_invoked = (Snxxz.UI.FuncSwitchModel)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.Init( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_OnBeforePlayerDataInitialize(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Snxxz.UI.FuncSwitchModel gen_to_be_invoked = (Snxxz.UI.FuncSwitchModel)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.OnBeforePlayerDataInitialize( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_OnPlayerLoginOk(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Snxxz.UI.FuncSwitchModel gen_to_be_invoked = (Snxxz.UI.FuncSwitchModel)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.OnPlayerLoginOk( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_UnInit(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Snxxz.UI.FuncSwitchModel gen_to_be_invoked = (Snxxz.UI.FuncSwitchModel)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.UnInit( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_IsOpen(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Snxxz.UI.FuncSwitchModel gen_to_be_invoked = (Snxxz.UI.FuncSwitchModel)translator.FastGetCSObj(L, 1); { int _id = LuaAPI.xlua_tointeger(L, 2); bool gen_ret = gen_to_be_invoked.IsOpen( _id ); LuaAPI.lua_pushboolean(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_switchDataDict(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Snxxz.UI.FuncSwitchModel gen_to_be_invoked = (Snxxz.UI.FuncSwitchModel)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.switchDataDict); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } } } Lua/Gen/SnxxzUIFuncSwitchModelWrap.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 601e81b721c96fe4daf3a87502af29e2 timeCreated: 1543821285 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/SystemSetting/FuncSwitchBehaviour.cs
New file @@ -0,0 +1,29 @@ using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class FuncSwitchBehaviour : MonoBehaviour { [Header("功能开关Id")] [SerializeField] int swithId; [SerializeField] GameObject open; [SerializeField] GameObject close; FuncSwitchModel switchModel { get { return ModelCenter.Instance.GetModel<FuncSwitchModel>(); } } private void OnEnable() { SetDisplay(); } private void SetDisplay() { bool isOpen = switchModel.IsOpen(swithId); open.SetActive(isOpen); close.SetActive(!isOpen); } } } System/SystemSetting/FuncSwitchBehaviour.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 7c0ebacc4227bb946a69f67dbbf9712a timeCreated: 1543820217 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/SystemSetting/FuncSwitchModel.cs
New file @@ -0,0 +1,98 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using LitJson; using TableConfig; namespace Snxxz.UI { [XLua.LuaCallCSharp] [XLua.Hotfix] public class FuncSwitchModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk { public override void Init() { ParseFuncSwitchConfig(); } public void OnBeforePlayerDataInitialize() { } public void OnPlayerLoginOk() { } public override void UnInit() { } public Dictionary<int, FuncSwithData> switchDataDict { get; private set;} private void ParseFuncSwitchConfig() { switchDataDict = null; var funcSwiths = Config.Instance.GetAllValues<FuncSwitchConfig>(); if (funcSwiths == null) return; switchDataDict = new Dictionary<int, FuncSwithData>(); for (int i = 0; i < funcSwiths.Count; i++) { var switchData = new FuncSwithData(funcSwiths[i]); switchDataDict.Add(switchData.Id,switchData); } } public class FuncSwithData { public int Id { get; private set;} public FuncSwitchConfig switchConfig { get; private set; } public Dictionary<string, int> switchDict { get; private set; } public FuncSwithData(FuncSwitchConfig _switchConfig) { Id = 0; switchConfig = _switchConfig; switchDict = null; if (_switchConfig == null) return; switchDict = new Dictionary<string, int>(); Id = _switchConfig.ID; JsonData jsonData = JsonMapper.ToObject(_switchConfig.AppIdSwitch); foreach(var appId in jsonData.Keys) { int open = 0; int.TryParse(jsonData[appId].ToString(),out open); switchDict.Add(appId,open); } } public int GetSwitchNum(string appId) { int num = 1; if (switchDict.ContainsKey(appId)) { num = switchDict[appId]; } return num; } } public bool IsOpen(int id) { if (switchDataDict == null) return true; if(switchDataDict.ContainsKey(id)) { FuncSwithData swithData = switchDataDict[id]; string appId = VersionConfig.Get().appId; int open = swithData.GetSwitchNum(appId); return open == 1; } return true; } } } System/SystemSetting/FuncSwitchModel.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: e28abd07d85b90c4c845c72c82219803 timeCreated: 1543818732 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/WindowBase/ModelCenter.cs
@@ -210,6 +210,7 @@ RegisterModel<IceCrystalVeinModel>(); RegisterModel<DungeonAssistModel>(); RegisterModel<MysticalPurchaseModel>(); RegisterModel<FuncSwitchModel>(); inited = true; }