From ad6e5b11d3ddd32c6cf8ea751e4330aff7e3e6a3 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期一, 03 十二月 2018 16:29:59 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 Core/GameEngine/Model/ConfigManager.cs                |    2 
 Core/GameEngine/Model/Config/FuncSwitchConfig.cs      |   41 +++++
 Core/GameEngine/Model/Config/FuncSwitchConfig.cs.meta |   12 +
 System/SystemSetting/FuncSwitchModel.cs.meta          |   12 +
 System/HappyXB/XBItemCell.cs                          |    2 
 System/SystemSetting/FuncSwitchBehaviour.cs           |   29 +++
 System/SystemSetting/FuncSwitchBehaviour.cs.meta      |   12 +
 Lua/Gen/SnxxzUIFuncSwitchModelWrap.cs                 |  241 ++++++++++++++++++++++++++++++
 Lua/Gen/SnxxzUIFuncSwitchModelWrap.cs.meta            |   12 +
 System/WindowBase/ModelCenter.cs                      |    1 
 System/SystemSetting/FuncSwitchModel.cs               |   98 ++++++++++++
 11 files changed, 460 insertions(+), 2 deletions(-)

diff --git a/Core/GameEngine/Model/Config/FuncSwitchConfig.cs b/Core/GameEngine/Model/Config/FuncSwitchConfig.cs
new file mode 100644
index 0000000..f590980
--- /dev/null
+++ b/Core/GameEngine/Model/Config/FuncSwitchConfig.cs
@@ -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);
+            }
+		}
+	
+	}
+
+}
+
+
+
+
diff --git a/Core/GameEngine/Model/Config/FuncSwitchConfig.cs.meta b/Core/GameEngine/Model/Config/FuncSwitchConfig.cs.meta
new file mode 100644
index 0000000..3165d60
--- /dev/null
+++ b/Core/GameEngine/Model/Config/FuncSwitchConfig.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 1df04b93abf079644b0a4fe90b4a69ce
+timeCreated: 1543818756
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/Core/GameEngine/Model/ConfigManager.cs b/Core/GameEngine/Model/ConfigManager.cs
index e10324b..b8c08aa 100644
--- a/Core/GameEngine/Model/ConfigManager.cs
+++ b/Core/GameEngine/Model/ConfigManager.cs
@@ -211,6 +211,8 @@
         AddAsyncTask<TaskPowerConfig>();
         AddAsyncTask<GodWeaponEffectConfig>();
         AddAsyncTask<DungeonHelpBattleConfig>();
+        AddAsyncTask<FuncSwitchConfig>();
+
         while (!AllCompleted())
         {
             var completedCount = 0;
diff --git a/Lua/Gen/SnxxzUIFuncSwitchModelWrap.cs b/Lua/Gen/SnxxzUIFuncSwitchModelWrap.cs
new file mode 100644
index 0000000..3781515
--- /dev/null
+++ b/Lua/Gen/SnxxzUIFuncSwitchModelWrap.cs
@@ -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;
+        }
+        
+        
+        
+		
+		
+		
+		
+    }
+}
diff --git a/Lua/Gen/SnxxzUIFuncSwitchModelWrap.cs.meta b/Lua/Gen/SnxxzUIFuncSwitchModelWrap.cs.meta
new file mode 100644
index 0000000..0ca3862
--- /dev/null
+++ b/Lua/Gen/SnxxzUIFuncSwitchModelWrap.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 601e81b721c96fe4daf3a87502af29e2
+timeCreated: 1543821285
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/HappyXB/XBItemCell.cs b/System/HappyXB/XBItemCell.cs
index fe814cc..f2418bc 100644
--- a/System/HappyXB/XBItemCell.cs
+++ b/System/HappyXB/XBItemCell.cs
@@ -54,8 +54,6 @@
 
             XBGetItemConfig xbItemConfig = XBModel.GetXBItemConfigByType(xbType);
             if (xbItemConfig == null || xbItemConfig.LuckyGridNum != xbIndex) return;
-
-            SoundPlayer.Instance.PlayUIAudio(67);
             StartCoroutine(BestItemFlashing(xbType));
         }
 
diff --git a/System/SystemSetting/FuncSwitchBehaviour.cs b/System/SystemSetting/FuncSwitchBehaviour.cs
new file mode 100644
index 0000000..08d9f02
--- /dev/null
+++ b/System/SystemSetting/FuncSwitchBehaviour.cs
@@ -0,0 +1,29 @@
+锘縰sing UnityEngine;
+using UnityEngine.UI;
+
+namespace Snxxz.UI
+{
+    [XLua.Hotfix]
+    public class FuncSwitchBehaviour : MonoBehaviour
+    {
+        [Header("鍔熻兘寮�鍏矷d")]
+        [SerializeField] int switchId;
+
+        [SerializeField] GameObject open;
+        [SerializeField] GameObject close;
+
+        FuncSwitchModel switchModel { get { return ModelCenter.Instance.GetModel<FuncSwitchModel>(); } }
+
+        private void Awake()
+        {
+            SetDisplay();
+        }
+
+        private void SetDisplay()
+        {
+            bool isOpen = switchModel.IsOpen(switchId);
+            open.SetActive(isOpen);
+            close.SetActive(!isOpen);
+        }
+    }
+}
diff --git a/System/SystemSetting/FuncSwitchBehaviour.cs.meta b/System/SystemSetting/FuncSwitchBehaviour.cs.meta
new file mode 100644
index 0000000..c3caf49
--- /dev/null
+++ b/System/SystemSetting/FuncSwitchBehaviour.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7c0ebacc4227bb946a69f67dbbf9712a
+timeCreated: 1543820217
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/SystemSetting/FuncSwitchModel.cs b/System/SystemSetting/FuncSwitchModel.cs
new file mode 100644
index 0000000..cd25721
--- /dev/null
+++ b/System/SystemSetting/FuncSwitchModel.cs
@@ -0,0 +1,98 @@
+锘縰sing 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;
+        }
+    }
+}
diff --git a/System/SystemSetting/FuncSwitchModel.cs.meta b/System/SystemSetting/FuncSwitchModel.cs.meta
new file mode 100644
index 0000000..fc54bdb
--- /dev/null
+++ b/System/SystemSetting/FuncSwitchModel.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e28abd07d85b90c4c845c72c82219803
+timeCreated: 1543818732
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/WindowBase/ModelCenter.cs b/System/WindowBase/ModelCenter.cs
index fa40a96..e744437 100644
--- a/System/WindowBase/ModelCenter.cs
+++ b/System/WindowBase/ModelCenter.cs
@@ -210,6 +210,7 @@
             RegisterModel<IceCrystalVeinModel>();
             RegisterModel<DungeonAssistModel>();
             RegisterModel<MysticalPurchaseModel>();
+            RegisterModel<FuncSwitchModel>();
             inited = true;
         }
 

--
Gitblit v1.8.0