少年修仙传客户端基础资源
Leonard Wu
2018-08-15 a24a563bf87176211b80aa0bb1642c8b5b731f89
提供窗口管理的lua接口
3个文件已修改
2个文件已添加
352 ■■■■■ 已修改文件
Assets/Editor/Tool/CreateLuaClassFile.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/XLua/Gen/LuaWindowUtilityWrap.cs 300 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/XLua/Gen/LuaWindowUtilityWrap.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/XLua/Gen/LuaWindowWrap.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/XLua/Gen/link.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/CreateLuaClassFile.cs
@@ -53,7 +53,8 @@
        StreamReader streamReader = new StreamReader(resourceFile);
        string text = streamReader.ReadToEnd();
        streamReader.Close();
        string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
        var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
        text = Regex.Replace(text, "#ClassName#", fileNameWithoutExtension);
        text = Regex.Replace(text, "#DateTime#", System.DateTime.Now.ToLongDateString());
        bool encoderShouldEmitUTF8Identifier = true;
Assets/XLua/Gen/LuaWindowUtilityWrap.cs
New file
@@ -0,0 +1,300 @@
#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 LuaWindowUtilityWrap
    {
        public static void __Register(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            System.Type type = typeof(LuaWindowUtility);
            Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
            Utils.EndObjectRegister(type, L, translator, null, null,
                null, null, null);
            Utils.BeginClassRegister(type, L, __CreateInstance, 8, 0, 0);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "Open", _m_Open_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "OpenWithoutAnimation", _m_OpenWithoutAnimation_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "Get", _m_Get_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "Close", _m_Close_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "CloseAll", _m_CloseAll_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "DestroyWin", _m_DestroyWin_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "CheckOpen", _m_CheckOpen_xlua_st_);
            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)
                {
                    LuaWindowUtility gen_ret = new LuaWindowUtility();
                    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 LuaWindowUtility constructor!");
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Open_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                int gen_param_count = LuaAPI.lua_gettop(L);
                if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 2)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))
                {
                    string __name = LuaAPI.lua_tostring(L, 1);
                    bool __forceSync = LuaAPI.lua_toboolean(L, 2);
                    int __functionalOrder = LuaAPI.xlua_tointeger(L, 3);
                        Snxxz.UI.Window gen_ret = LuaWindowUtility.Open( __name, __forceSync, __functionalOrder );
                        translator.Push(L, gen_ret);
                    return 1;
                }
                if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 2))
                {
                    string __name = LuaAPI.lua_tostring(L, 1);
                    bool __forceSync = LuaAPI.lua_toboolean(L, 2);
                        Snxxz.UI.Window gen_ret = LuaWindowUtility.Open( __name, __forceSync );
                        translator.Push(L, gen_ret);
                    return 1;
                }
                if(gen_param_count == 1&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING))
                {
                    string __name = LuaAPI.lua_tostring(L, 1);
                        Snxxz.UI.Window gen_ret = LuaWindowUtility.Open( __name );
                        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 LuaWindowUtility.Open!");
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_OpenWithoutAnimation_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                {
                    string __name = LuaAPI.lua_tostring(L, 1);
                        Snxxz.UI.Window gen_ret = LuaWindowUtility.OpenWithoutAnimation( __name );
                        translator.Push(L, gen_ret);
                    return 1;
                }
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Get_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                {
                    string __name = LuaAPI.lua_tostring(L, 1);
                        Snxxz.UI.Window gen_ret = LuaWindowUtility.Get( __name );
                        translator.Push(L, gen_ret);
                    return 1;
                }
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Close_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                {
                    string __name = LuaAPI.lua_tostring(L, 1);
                        Snxxz.UI.Window gen_ret = LuaWindowUtility.Close( __name );
                        translator.Push(L, gen_ret);
                    return 1;
                }
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_CloseAll_xlua_st_(RealStatePtr L)
        {
            try {
                {
                    LuaWindowUtility.CloseAll(  );
                    return 0;
                }
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_DestroyWin_xlua_st_(RealStatePtr L)
        {
            try {
                {
                    string __name = LuaAPI.lua_tostring(L, 1);
                    LuaWindowUtility.DestroyWin( __name );
                    return 0;
                }
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_CheckOpen_xlua_st_(RealStatePtr L)
        {
            try {
                {
                    string __name = LuaAPI.lua_tostring(L, 1);
                        bool gen_ret = LuaWindowUtility.CheckOpen( __name );
                        LuaAPI.lua_pushboolean(L, gen_ret);
                    return 1;
                }
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
        }
    }
}
Assets/XLua/Gen/LuaWindowUtilityWrap.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d28ddd57a20469645a4c50c02114597c
timeCreated: 1534343710
licenseType: Free
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Assets/XLua/Gen/LuaWindowWrap.cs
@@ -21,15 +21,13 @@
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            System.Type type = typeof(LuaWindow);
            Utils.BeginObjectRegister(type, L, translator, 0, 0, 2, 2);
            Utils.BeginObjectRegister(type, L, translator, 0, 0, 1, 1);
            
            
            
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "fileName", _g_get_fileName);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "injections", _g_get_injections);
            
            Utils.RegisterFunc(L, Utils.SETTER_IDX, "fileName", _s_set_fileName);
            Utils.RegisterFunc(L, Utils.SETTER_IDX, "injections", _s_set_injections);
            
            
            Utils.EndObjectRegister(type, L, translator, null, null,
@@ -92,20 +90,6 @@
            return 1;
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_injections(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                LuaWindow gen_to_be_invoked = (LuaWindow)translator.FastGetCSObj(L, 1);
                translator.Push(L, gen_to_be_invoked.injections);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            return 1;
        }
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
@@ -116,21 +100,6 @@
            
                LuaWindow gen_to_be_invoked = (LuaWindow)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.fileName = LuaAPI.lua_tostring(L, 2);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            return 0;
        }
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _s_set_injections(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                LuaWindow gen_to_be_invoked = (LuaWindow)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.injections = (Injection[])translator.GetObject(L, 2, typeof(Injection[]));
            
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
Assets/XLua/Gen/link.xml
@@ -3,8 +3,10 @@
<linker>
    <assembly fullname="Assembly-CSharp">
        <type fullname="ConfigUtil" preserve="all"/>
        <type fullname="TableConfig.ItemConfig" preserve="all"/>
        <type fullname="ConfigUtil" preserve="all"/>
        <type fullname="LuaWindow" preserve="all"/>
        <type fullname="LuaWindowUtility" preserve="all"/>
        <type fullname="LuaBehaviour" preserve="all"/>
        <type fullname="XLuaTest.Pedding" preserve="all"/>
        <type fullname="XLuaTest.MyStruct" preserve="all"/>