Ejemplo n.º 1
0
    public static int ClearAssetBundleCache(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(bool)))
        {
            bool clearAll = LuaScriptMgr.GetBoolean(L, 1);
            CAssetBundleManager.Instance.ClearCaches(clearAll);
        }
        else
        {
            LogParamError("ClearAssetCaches", count);
            LuaDLL.lua_pushnil(L);
        }

        return(CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 2
0
    public static int CleanPurchaseInfo(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(float)))
        {
            //int purchaseType = (int)LuaScriptMgr.GetNumber(L, 1);
            // 删除本地数据
            //FileBilling.Instance.Remove(purchaseType);
            //FileBilling.Instance.WriteFile();
        }
        else
        {
            LogParamError("CleanPurchaseInfo", count);
        }
        return(GameUtilWrap.CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 3
0
    private static int StartScreenFade(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(float), typeof(float), typeof(float)))
        {
            var form     = (float)LuaScriptMgr.GetNumber(L, 1);
            var to       = (float)LuaScriptMgr.GetNumber(L, 2);
            var duration = (float)LuaScriptMgr.GetNumber(L, 3);
            ScreenFadeEffectManager.Instance.StartFade(form, to, duration);
        }
        else
        {
            LogParamError("StartScreenFade", count);
        }
        return(CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 4
0
    public static int RegisterCallback(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(LuaFunction), typeof(LuaFunction), typeof(LuaFunction)))
        {
            var fnLoginCallback  = LuaScriptMgr.GetLuaFunction(L, 1);
            var fnLogoutCallback = LuaScriptMgr.GetLuaFunction(L, 2);
            var fnBuyCallback    = LuaScriptMgr.GetLuaFunction(L, 3);
            PlatformControl.RegisterCallback(fnLoginCallback, fnLogoutCallback, fnBuyCallback);
        }
        else
        {
            LogParamError("RegisterCallback", count);
        }
        return(GameUtilWrap.CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 5
0
    private static int DrawLine(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if ((count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(LuaTable), typeof(LuaTable))))
        {
            var from = LuaScriptMgr.GetVector3(L, 1);
            var to   = LuaScriptMgr.GetVector3(L, 2);
            HobaDebuger.DrawLine(from, to, Color.red);
        }
        else
        {
            LogParamError("DrawLine", count);
        }

        return(CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 6
0
    public static int GetPushStatus(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 1;

        if (count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(int)))
        {
            int  type   = (int)LuaScriptMgr.GetNumber(L, 1);
            bool enable = PlatformControl.GetPushStatus(type);
            LuaScriptMgr.Push(L, enable);
        }
        else
        {
            LogParamError("GetPushStatus", count);
            LuaScriptMgr.Push(L, false);
        }
        return(GameUtilWrap.CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 7
0
    private static int LoadLevelAdditive(IntPtr L)
    {
        int num = LuaDLL.lua_gettop(L);

        if ((num == 1) && LuaScriptMgr.CheckTypes(L, 1, typeof(string)))
        {
            Application.LoadLevelAdditive(LuaScriptMgr.GetString(L, 1));
            return(0);
        }
        if ((num == 1) && LuaScriptMgr.CheckTypes(L, 1, typeof(int)))
        {
            int index = (int)LuaDLL.lua_tonumber(L, 1);
            Application.LoadLevelAdditive(index);
            return(0);
        }
        LuaDLL.luaL_error(L, "invalid arguments to method: Application.LoadLevelAdditive");
        return(0);
    }
Ejemplo n.º 8
0
    public static int ShowGameLogs(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(int), typeof(GameObject), typeof(GameObject)))
        {
            var logType       = (int)LuaScriptMgr.GetNumber(L, 1);
            var textGo        = LuaScriptMgr.GetUnityObject <GameObject>(L, 2);
            var contentViewGo = LuaScriptMgr.GetUnityObject <GameObject>(L, 3);
            CLogFile.ShowGameLogs4Debug(logType, textGo, contentViewGo);
        }
        else
        {
            HobaDebuger.LogError("ShowGameLogs: must have 3 params");
        }
        return(CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 9
0
    public static int AddOrSubForTest(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(int), typeof(bool)))
        {
            int  type  = (int)LuaScriptMgr.GetNumber(L, 1);
            bool isAdd = LuaScriptMgr.GetBoolean(L, 2);
            CCamCtrlMan.Instance.AddOrSubForTest(type, isAdd);
        }
        else
        {
            LogParamError("AddOrSubForTest", count);
        }

        return(GameUtilWrap.CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 10
0
    private static int WritePersistentConfig(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(float)))
        {
            float fVolume = (float)LuaScriptMgr.GetNumber(L, 1);
            EntryPoint.Instance.GamePersistentConfigParams.BGMVolume = fVolume;
            EntryPoint.Instance.GamePersistentConfigParams.WriteToFile();
        }
        else
        {
            LogParamError("WritePersistentConfig", count);
        }

        return(CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 11
0
    private static int CheckName_ContainMainWord(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 1;

        if ((count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(string))))
        {
            string name = LuaScriptMgr.GetString(L, 1);
            bool   ret  = Utilities.ContainMainWord(name);
            LuaScriptMgr.Push(L, ret);
        }
        else
        {
            LogParamError("CheckName_ContainMainWord", count);
            LuaScriptMgr.Push(L, false);
        }
        return(CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 12
0
    private static int SetGameCamDestDistOffset(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(float), typeof(bool)))
        {
            float fDist      = (float)LuaScriptMgr.GetNumber(L, 1);
            bool  bImmediate = LuaScriptMgr.GetBoolean(L, 2);

            CCamCtrlMan.Instance.GetGameCamCtrl().SetDestDistOffset(fDist, bImmediate);
        }
        else
        {
            LogParamError("SetGameCamDestDistOffset", count);
        }
        return(CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 13
0
    private static int SetGameCamHeightOffsetInterval(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(float), typeof(float), typeof(bool)))
        {
            float fHeightOffsetMin = (float)LuaScriptMgr.GetNumber(L, 1);
            float fHeightOffsetMax = (float)LuaScriptMgr.GetNumber(L, 2);
            bool  isImmediately    = LuaScriptMgr.GetBoolean(L, 3);
            CCamCtrlMan.Instance.GetGameCamCtrl().SetHeightOffsetInterval(fHeightOffsetMin, fHeightOffsetMax, isImmediately);
        }
        else
        {
            LogParamError("SetGameCamHeightOffsetInterval", count);
        }
        return(CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 14
0
    public static int GetCustomData(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 1;

        if (count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(string)))
        {
            string key  = LuaScriptMgr.GetString(L, 1);
            string data = PlatformControl.GetCustomData(key);
            LuaScriptMgr.Push(L, data);
        }
        else
        {
            LogParamError("GetCustomData", count);
            LuaScriptMgr.Push(L, string.Empty);
        }
        return(GameUtilWrap.CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 15
0
    public static int SetImageAndChangeLayout(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        // gameObject, voiceSecond, maxWidth
        if ((count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(int), typeof(int))))
        {
            var labelObj = LuaScriptMgr.GetUnityObject <GameObject>(L, 1);
            if (labelObj == null)
            {
                HobaDebuger.LogWarning("SetImageAndChangeLayout: param 1 must be GameObject");
                return(GameUtilWrap.CheckReturnNum(L, count, nRet));
            }

            Image imgComp = labelObj.GetComponent <Image>();
            if (imgComp == null)
            {
                HobaDebuger.LogWarning("SetImageAndChangeLayout: param 1 must have image component");
                return(GameUtilWrap.CheckReturnNum(L, count, nRet));
            }

            int imageWidth = (int)LuaScriptMgr.GetNumber(L, 2);

            var maxPreferredWidth = (int)LuaScriptMgr.GetNumber(L, 3);
            var layout            = labelObj.GetComponent <LayoutElement>();
            if (maxPreferredWidth > 0 && layout != null)
            {
                if (imageWidth > maxPreferredWidth)
                {
                    layout.preferredWidth = maxPreferredWidth;
                }
                else
                {
                    layout.preferredWidth = imageWidth;
                }
            }
        }
        else
        {
            GameUtilWrap.LogParamError("SetImageAndChangeLayout", count);
        }
        return(GameUtilWrap.CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 16
0
    static int _CreateWWW(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);


        if (count == 1)
        {
            string arg0 = LuaScriptMgr.GetString(L, 1);
            WWW    obj  = new WWW(arg0);
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(string), typeof(byte[])))
        {
            string arg0  = LuaScriptMgr.GetString(L, 1);
            byte[] objs1 = LuaScriptMgr.GetArrayNumber <byte>(L, 2);
            WWW    obj   = new WWW(arg0, objs1);
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(string), typeof(WWWForm)))
        {
            string  arg0 = LuaScriptMgr.GetString(L, 1);
            WWWForm arg1 = LuaScriptMgr.GetNetObject <WWWForm>(L, 2);
            WWW     obj  = new WWW(arg0, arg1);
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else if (count == 3)
        {
            string arg0  = LuaScriptMgr.GetString(L, 1);
            byte[] objs1 = LuaScriptMgr.GetArrayNumber <byte>(L, 2);
            Dictionary <string, string> arg2 = LuaScriptMgr.GetNetObject <Dictionary <string, string> >(L, 3);
            WWW obj = new WWW(arg0, objs1, arg2);
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: WWW.New");
        }

        return(0);
    }
Ejemplo n.º 17
0
    private static int SubUnicodeString(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 1;

        if ((count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(string), typeof(int), typeof(int))) ||
            (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(string), typeof(int))))
        {
            string str = LuaScriptMgr.GetString(L, 1);
            if (string.IsNullOrEmpty(str))
            {
                HobaDebuger.LogWarning("SubUnicodeString string is null or empty");
                LuaScriptMgr.Push(L, "");
                return(CheckReturnNum(L, count, nRet));
            }
            int startIndex = (int)LuaScriptMgr.GetNumber(L, 2) - 1;
            try
            {
                if (count == 2)
                {
                    str = str.Substring(startIndex);
                }
                else
                {
                    int length = (int)LuaScriptMgr.GetNumber(L, 3);
                    str = str.Substring(startIndex, length);
                }
                LuaScriptMgr.Push(L, str);
                return(CheckReturnNum(L, count, nRet));
            }
            catch (Exception e)
            {
                HobaDebuger.LogErrorFormat("SubUnicodeString Exception: {0}", e.Message);
                LuaScriptMgr.Push(L, "");
                return(CheckReturnNum(L, count, nRet));
            }
        }
        else
        {
            LogParamError("SubUnicodeString", count);
            LuaScriptMgr.Push(L, "");
            return(CheckReturnNum(L, count, nRet));
        }
    }
Ejemplo n.º 18
0
    static int GetWorldCorners(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 1)
        {
            Camera    arg0 = (Camera)LuaScriptMgr.GetUnityObject(L, 1, typeof(Camera));
            Vector3[] o    = NGUITools.GetWorldCorners(arg0);
            LuaScriptMgr.PushArray(L, o);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(Camera), typeof(Transform)))
        {
            Camera    arg0 = (Camera)LuaScriptMgr.GetLuaObject(L, 1);
            Transform arg1 = (Transform)LuaScriptMgr.GetLuaObject(L, 2);
            Vector3[] o    = NGUITools.GetWorldCorners(arg0, arg1);
            LuaScriptMgr.PushArray(L, o);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(Camera), typeof(float)))
        {
            Camera    arg0 = (Camera)LuaScriptMgr.GetLuaObject(L, 1);
            float     arg1 = (float)LuaDLL.lua_tonumber(L, 2);
            Vector3[] o    = NGUITools.GetWorldCorners(arg0, arg1);
            LuaScriptMgr.PushArray(L, o);
            return(1);
        }
        else if (count == 3)
        {
            Camera    arg0 = (Camera)LuaScriptMgr.GetUnityObject(L, 1, typeof(Camera));
            float     arg1 = (float)LuaScriptMgr.GetNumber(L, 2);
            Transform arg2 = (Transform)LuaScriptMgr.GetUnityObject(L, 3, typeof(Transform));
            Vector3[] o    = NGUITools.GetWorldCorners(arg0, arg1, arg2);
            LuaScriptMgr.PushArray(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: NGUITools.GetWorldCorners");
        }

        return(0);
    }
Ejemplo n.º 19
0
    static int Play(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 1)
        {
            Animation obj = (Animation)LuaScriptMgr.GetUnityObjectSelf(L, 1, "Animation");
            bool      o   = obj.Play();
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(Animation), typeof(string)))
        {
            Animation obj  = (Animation)LuaScriptMgr.GetUnityObjectSelf(L, 1, "Animation");
            string    arg0 = LuaScriptMgr.GetString(L, 2);
            bool      o    = obj.Play(arg0);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(Animation), typeof(PlayMode)))
        {
            Animation obj  = (Animation)LuaScriptMgr.GetUnityObjectSelf(L, 1, "Animation");
            PlayMode  arg0 = (PlayMode)LuaScriptMgr.GetLuaObject(L, 2);
            bool      o    = obj.Play(arg0);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else if (count == 3)
        {
            Animation obj  = (Animation)LuaScriptMgr.GetUnityObjectSelf(L, 1, "Animation");
            string    arg0 = LuaScriptMgr.GetLuaString(L, 2);
            PlayMode  arg1 = (PlayMode)LuaScriptMgr.GetNetObject(L, 3, typeof(PlayMode));
            bool      o    = obj.Play(arg0, arg1);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: Animation.Play");
        }

        return(0);
    }
Ejemplo n.º 20
0
    static int SetLookAtRot(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 4 && LuaScriptMgr.CheckTypes(L, 1, typeof(GImageModel), typeof(float), typeof(float), typeof(float)))
        {
            GImageModel obj  = (GImageModel)LuaScriptMgr.GetUnityObjectSelf(L, 1, "GImageModel");
            float       arg0 = (float)LuaScriptMgr.GetNumber(L, 2);
            float       arg1 = (float)LuaScriptMgr.GetNumber(L, 3);
            float       arg2 = (float)LuaScriptMgr.GetNumber(L, 4);
            obj.SetLookAtRot(arg0, arg1, arg2);
        }
        else
        {
            Common.HobaDebuger.LogError("SetLookAtRot param count != 4");
        }

        return(0);
    }
Ejemplo n.º 21
0
    static int Sort(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        Type[] types1 = { typeof(List <string>), typeof(Comparison <string>) };
        Type[] types2 = { typeof(List <string>), typeof(IComparer <string>) };

        if (count == 1)
        {
            List <string> obj = LuaScriptMgr.GetNetObject <List <string> >(L, 1);
            obj.Sort();
            return(0);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, types1, 1))
        {
            List <string>       obj  = LuaScriptMgr.GetNetObject <List <string> >(L, 1);
            Comparison <string> arg0 = LuaScriptMgr.GetNetObject <Comparison <string> >(L, 2);
            obj.Sort(arg0);
            return(0);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, types2, 1))
        {
            List <string>      obj  = LuaScriptMgr.GetNetObject <List <string> >(L, 1);
            IComparer <string> arg0 = LuaScriptMgr.GetNetObject <IComparer <string> >(L, 2);
            obj.Sort(arg0);
            return(0);
        }
        else if (count == 4)
        {
            List <string>      obj  = LuaScriptMgr.GetNetObject <List <string> >(L, 1);
            int                arg0 = (int)LuaScriptMgr.GetNumber(L, 2);
            int                arg1 = (int)LuaScriptMgr.GetNumber(L, 3);
            IComparer <string> arg2 = LuaScriptMgr.GetNetObject <IComparer <string> >(L, 4);
            obj.Sort(arg0, arg1, arg2);
            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: List<string>.Sort");
        }

        return(0);
    }
Ejemplo n.º 22
0
    public static int SwitchToVoiceMode(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 1;

        if (count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(int)))
        {
            int  mode = (int)LuaDLL.lua_tonumber(L, 1);
            bool ret  = VoiceManager.Instance.SwitchToVoiceMode((VoiceMode)mode);
            LuaScriptMgr.Push(L, ret);
        }
        else
        {
            LogParamError("SwitchToVoiceMode", count);
            LuaScriptMgr.Push(L, false);
        }

        return(GameUtilWrap.CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 23
0
    private static int SetDestDistOffsetAndDestPitchDeg(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 4 && LuaScriptMgr.CheckTypes(L, 1, typeof(float), typeof(float), typeof(float), typeof(float)))
        {
            float fDistOffset      = (float)LuaScriptMgr.GetNumber(L, 1);
            float fPitchDeg        = (float)LuaScriptMgr.GetNumber(L, 2);
            float fDistOffsetSpeed = (float)LuaScriptMgr.GetNumber(L, 3);
            float fPitchSpeed      = (float)LuaScriptMgr.GetNumber(L, 4);
            CCamCtrlMan.Instance.GetGameCamCtrl().SetDestDistOffsetAndDestPitchDeg(fDistOffset, fPitchDeg, fDistOffsetSpeed, fPitchSpeed);
        }
        else
        {
            LogParamError("SetDestDistOffsetAndDestPitchDeg", count);
        }
        return(CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 24
0
    static int GetDateTimeFormats(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 1)
        {
            DateTime obj = (DateTime)LuaScriptMgr.GetNetObjectSelf(L, 1, "DateTime");
            string[] o   = obj.GetDateTimeFormats();
            LuaScriptMgr.PushArray(L, o);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(DateTime), typeof(IFormatProvider)))
        {
            DateTime        obj  = (DateTime)LuaScriptMgr.GetNetObjectSelf(L, 1, "DateTime");
            IFormatProvider arg0 = (IFormatProvider)LuaScriptMgr.GetLuaObject(L, 2);
            string[]        o    = obj.GetDateTimeFormats(arg0);
            LuaScriptMgr.PushArray(L, o);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(DateTime), typeof(char)))
        {
            DateTime obj  = (DateTime)LuaScriptMgr.GetNetObjectSelf(L, 1, "DateTime");
            char     arg0 = (char)LuaDLL.lua_tonumber(L, 2);
            string[] o    = obj.GetDateTimeFormats(arg0);
            LuaScriptMgr.PushArray(L, o);
            return(1);
        }
        else if (count == 3)
        {
            DateTime        obj  = (DateTime)LuaScriptMgr.GetNetObjectSelf(L, 1, "DateTime");
            char            arg0 = (char)LuaScriptMgr.GetNumber(L, 2);
            IFormatProvider arg1 = (IFormatProvider)LuaScriptMgr.GetNetObject(L, 3, typeof(IFormatProvider));
            string[]        o    = obj.GetDateTimeFormats(arg0, arg1);
            LuaScriptMgr.PushArray(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: DateTime.GetDateTimeFormats");
        }

        return(0);
    }
Ejemplo n.º 25
0
    static int ToString(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 1)
        {
            DateTime obj = (DateTime)LuaScriptMgr.GetNetObjectSelf(L, 1, "DateTime");
            string   o   = obj.ToString();
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(DateTime), typeof(string)))
        {
            DateTime obj  = (DateTime)LuaScriptMgr.GetNetObjectSelf(L, 1, "DateTime");
            string   arg0 = LuaScriptMgr.GetString(L, 2);
            string   o    = obj.ToString(arg0);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(DateTime), typeof(IFormatProvider)))
        {
            DateTime        obj  = (DateTime)LuaScriptMgr.GetNetObjectSelf(L, 1, "DateTime");
            IFormatProvider arg0 = (IFormatProvider)LuaScriptMgr.GetLuaObject(L, 2);
            string          o    = obj.ToString(arg0);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else if (count == 3)
        {
            DateTime        obj  = (DateTime)LuaScriptMgr.GetNetObjectSelf(L, 1, "DateTime");
            string          arg0 = LuaScriptMgr.GetLuaString(L, 2);
            IFormatProvider arg1 = (IFormatProvider)LuaScriptMgr.GetNetObject(L, 3, typeof(IFormatProvider));
            string          o    = obj.ToString(arg0, arg1);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: DateTime.ToString");
        }

        return(0);
    }
Ejemplo n.º 26
0
    static int _CreatePlane(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);


        if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(LuaTable), typeof(float)))
        {
            Vector3 arg0 = LuaScriptMgr.GetVector3(L, 1);
            float   arg1 = (float)LuaScriptMgr.GetNumber(L, 2);
            Plane   obj  = new Plane(arg0, arg1);
            LuaScriptMgr.PushValue(L, obj);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(LuaTable), typeof(LuaTable)))
        {
            Vector3 arg0 = LuaScriptMgr.GetVector3(L, 1);
            Vector3 arg1 = LuaScriptMgr.GetVector3(L, 2);
            Plane   obj  = new Plane(arg0, arg1);
            LuaScriptMgr.PushValue(L, obj);
            return(1);
        }
        else if (count == 3)
        {
            Vector3 arg0 = LuaScriptMgr.GetVector3(L, 1);
            Vector3 arg1 = LuaScriptMgr.GetVector3(L, 2);
            Vector3 arg2 = LuaScriptMgr.GetVector3(L, 3);
            Plane   obj  = new Plane(arg0, arg1, arg2);
            LuaScriptMgr.PushValue(L, obj);
            return(1);
        }
        else if (count == 0)
        {
            Plane obj = new Plane();
            LuaScriptMgr.PushValue(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: Plane.New");
        }

        return(0);
    }
Ejemplo n.º 27
0
    static int SendMessage(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 2)
        {
            GameObject obj  = LuaScriptMgr.GetNetObject <GameObject>(L, 1);
            string     arg0 = LuaScriptMgr.GetLuaString(L, 2);
            obj.SendMessage(arg0);
            return(0);
        }
        else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(string), typeof(SendMessageOptions)))
        {
            GameObject         obj  = LuaScriptMgr.GetNetObject <GameObject>(L, 1);
            string             arg0 = LuaScriptMgr.GetString(L, 2);
            SendMessageOptions arg1 = LuaScriptMgr.GetNetObject <SendMessageOptions>(L, 3);
            obj.SendMessage(arg0, arg1);
            return(0);
        }
        else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(string), typeof(object)))
        {
            GameObject obj  = LuaScriptMgr.GetNetObject <GameObject>(L, 1);
            string     arg0 = LuaScriptMgr.GetString(L, 2);
            object     arg1 = LuaScriptMgr.GetVarObject(L, 3);
            obj.SendMessage(arg0, arg1);
            return(0);
        }
        else if (count == 4)
        {
            GameObject         obj  = LuaScriptMgr.GetNetObject <GameObject>(L, 1);
            string             arg0 = LuaScriptMgr.GetLuaString(L, 2);
            object             arg1 = LuaScriptMgr.GetVarObject(L, 3);
            SendMessageOptions arg2 = LuaScriptMgr.GetNetObject <SendMessageOptions>(L, 4);
            obj.SendMessage(arg0, arg1, arg2);
            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: GameObject.SendMessage");
        }

        return(0);
    }
Ejemplo n.º 28
0
    private static int LuaMemory(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(string)))
        {
            var    luaMemory = LuaScriptMgr.GetString(L, 1);
            string path      = Application.dataPath;
            path = path.Substring(0, path.Length - 6) + "Logs/LuaMemory.csv";
            File.WriteAllText(path, luaMemory);
        }
        else
        {
            LogParamError("LuaMemory", count);
        }

        return(CheckReturnNum(L, count, nRet));
    }
Ejemplo n.º 29
0
    static int BroadcastMessage(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 2)
        {
            Component obj  = (Component)LuaScriptMgr.GetUnityObjectSelf(L, 1, "Component");
            string    arg0 = LuaScriptMgr.GetLuaString(L, 2);
            obj.BroadcastMessage(arg0);
            return(0);
        }
        else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(Component), typeof(string), typeof(SendMessageOptions)))
        {
            Component          obj  = (Component)LuaScriptMgr.GetUnityObjectSelf(L, 1, "Component");
            string             arg0 = LuaScriptMgr.GetString(L, 2);
            SendMessageOptions arg1 = (SendMessageOptions)LuaScriptMgr.GetLuaObject(L, 3);
            obj.BroadcastMessage(arg0, arg1);
            return(0);
        }
        else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(Component), typeof(string), typeof(object)))
        {
            Component obj  = (Component)LuaScriptMgr.GetUnityObjectSelf(L, 1, "Component");
            string    arg0 = LuaScriptMgr.GetString(L, 2);
            object    arg1 = LuaScriptMgr.GetVarObject(L, 3);
            obj.BroadcastMessage(arg0, arg1);
            return(0);
        }
        else if (count == 4)
        {
            Component          obj  = (Component)LuaScriptMgr.GetUnityObjectSelf(L, 1, "Component");
            string             arg0 = LuaScriptMgr.GetLuaString(L, 2);
            object             arg1 = LuaScriptMgr.GetVarObject(L, 3);
            SendMessageOptions arg2 = (SendMessageOptions)LuaScriptMgr.GetNetObject(L, 4, typeof(SendMessageOptions));
            obj.BroadcastMessage(arg0, arg1, arg2);
            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: Component.BroadcastMessage");
        }

        return(0);
    }
Ejemplo n.º 30
0
    public static int GetChildFromTemplate(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 1;

        if ((count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(int))))
        {
            var labelObj = LuaScriptMgr.GetUnityObject <GameObject>(L, 1);
            if (labelObj == null)
            {
                HobaDebuger.LogWarning("GetChildFromTemplate: param 1 must be GameObject");
                LuaDLL.lua_pushnil(L);
            }
            else
            {
                var tempComp = labelObj.GetComponent <UITemplate>();
                if (tempComp == null)
                {
                    HobaDebuger.LogWarning("GetChildFromTemplate: param 1 must have UITemplate component");
                    LuaDLL.lua_pushnil(L);
                }
                else
                {
                    var id  = (int)LuaScriptMgr.GetNumber(L, 2);
                    var ret = tempComp.GetControl(id);
                    if (ret != null)
                    {
                        LuaScriptMgr.Push(L, ret);
                    }
                    else
                    {
                        LuaDLL.lua_pushnil(L);
                    }
                }
            }
        }
        else
        {
            GameUtilWrap.LogParamError("GetChildFromTemplate", count);
            LuaDLL.lua_pushnil(L);
        }
        return(GameUtilWrap.CheckReturnNum(L, count, nRet));
    }