Dispose() public method

public Dispose ( ) : void
return void
示例#1
0
 private void SafeRelease(ref LuaFunction func)
 {
     if (func != null)
     {
         func.Dispose();
         func = null;
     }
 }
示例#2
0
文件: Util.cs 项目: tallitia/YYScript
    public static void CallLuaFunction <T1, T2, T3>(string name, T1 arg1, T2 arg2, T3 arg3)
    {
        LuaManager manager = MainGame.GetManager <LuaManager>();

        LuaInterface.LuaFunction func = manager.GetFunction(name);
        if (func != null)
        {
            func.Call <T1, T2, T3>(arg1, arg2, arg3);
            func.Dispose();
            func = null;
        }
    }
示例#3
0
文件: Util.cs 项目: tallitia/YYScript
    public static void CallLuaFunction(string name)
    {
        LuaManager manager = MainGame.GetManager <LuaManager>();

        LuaInterface.LuaFunction func = manager.GetFunction(name);
        if (func != null)
        {
            func.Call();
            func.Dispose();
            func = null;
        }
    }
示例#4
0
文件: Util.cs 项目: tallitia/YYScript
    public static R InvokeLuaFunction <T, R>(string name, T arg)
    {
        LuaManager manager = MainGame.GetManager <LuaManager>();

        LuaInterface.LuaFunction func = manager.GetFunction(name);
        if (func != null)
        {
            R ret = func.Invoke <T, R>(arg);
            func.Dispose();
            func = null;
            return(ret);
        }
        return(default(R));
    }
    public void LoadUI(string pkg, string pageName, LuaInterface.LuaFunction gfunc = null)
    {
#if ASYNC_MODE
        UIPackage.CreateObjectAsync(pkg, pageName, delegate(GObject obj)
        {
            Debug.Log("异步加载打开");
            if (gfunc != null)
            {
                gfunc.Call <GObject>(obj);
                gfunc.Dispose();
                gfunc = null;
            }
        });
#else
        Debug.Log("同步加载打开");
        GObject obj = UIPackage.CreateObject(pkg, pageName);
        if (gfunc != null)
        {
            gfunc.Call <GObject>(obj);
            gfunc.Dispose();
            gfunc = null;
        }
#endif
    }
        IEnumerator OnLoadAsset(string abname, string assetName, LuaFunction func) {
            // Load asset from assetBundle.
            string abName = abname.ToLower() + AppConst.ExtName;
            AssetBundleAssetOperation request = ResourceManager.LoadAssetAsync(abName, assetName, typeof(GameObject));
            if (request == null) yield break;
            yield return StartCoroutine(request);

            // Get the asset.
            GameObject prefab = request.GetAsset<GameObject>();
            if (func != null) {
                func.Call(prefab);
                func.Dispose();
                func = null;
            }
        }
 public static void OnComplete(Tweener tweener, LuaFunction func)
 {
     tweener.OnComplete(() =>
     {
         try
         {
             func.Call();
         }
         catch (Exception e)
         {
             Debug.LogError(e);
         }
         func.Dispose();
         func = null;
     });
 }
示例#8
0
    static void Destroy()
    {
        _decodeRecvMethod.Dispose();
        _decodeRecvMethod = null;

        _hasMethod.Dispose();
        _hasMethod = null;

        _callMethod.Dispose();
        _callMethod = null;

        LuaState state = _state;

        _state = null;

        state.Dispose();
        state = null;
    }
示例#9
0
        public void Dispose()
        {
            --count;
            //Debugger.Log("LuaDelegate {0} SubRef {1}", reference, count);

            func.Dispose();

            if (self != null)
            {
                self.Dispose();
            }

            if (count == 0)
            {
                method = null;
                func   = null;
                self   = null;
            }
        }
示例#10
0
        void destroyLuaBridge()
        {
            if (luaProtoMsgParseFun != null)
            {
                luaProtoMsgParseFun.Dispose();
                luaProtoMsgParseFun = null;
            }

            if (luaBinaryMsgParseFun != null)
            {
                luaBinaryMsgParseFun.Dispose();
                luaBinaryMsgParseFun = null;
            }

            if (luaEventFun != null)
            {
                luaEventFun.Dispose();
                luaEventFun = null;
            }
        }
示例#11
0
文件: Util.cs 项目: tallitia/YYScript
    public static R InvokeLuaFunction <T1, T2, R>(string name, T1 arg1, T2 arg2)
    {
        LuaManager manager = MainGame.GetManager <LuaManager>();

        if (manager == null)
        {
            return(default(R));
        }

        LuaInterface.LuaFunction func = manager.GetFunction(name);
        if (func == null)
        {
            return(default(R));
        }

        R ret = func.Invoke <T1, T2, R>(arg1, arg2);

        func.Dispose();
        func = null;
        return(ret);
    }
 public static void OnComplete(Tweener tweener, LuaFunction func, object self)
 {
     tweener.OnComplete(() =>
     {
         try
         {
             func.Call(self);
         }
         catch (Exception e)
         {
             Debug.LogError(e);
         }
         func.Dispose();
         func = null;
         if (self is LuaTable)
         {
             ((LuaTable)self).Dispose();
             self = null;
         }
     });
 }
示例#13
0
 void SafeRelease(ref LuaFunction luaRef) {
     if (luaRef != null) {
         luaRef.Dispose();
         luaRef = null;
     }
 }
 public static Tweener TweenVector2(Vector2 start, Vector2 end, float duration, LuaFunction OnUpdate)
 {
     return DOTween.To(() => start, x =>
     {
         try
         {
             OnUpdate.Call(x);
         }
         catch (Exception e)
         {
             Debug.LogError(e);
         }
     }, end, duration).OnComplete(() =>
     {
         OnUpdate.Dispose();
         OnUpdate = null;
     });
 }
 public static Tweener TweenFloat(float start, float end, float duration, LuaFunction OnUpdate)
 {
     return DOTween.To(() => start, x =>
     {
         try
         {
             OnUpdate.Call(x);
         }
         catch (Exception e)
         {
             Debug.LogError(e);
         }
     }
     , end, duration).SetEase(Ease.Linear).OnComplete(() =>
     {
         OnUpdate.Dispose();
         OnUpdate = null;
     });
 }
 public static Tweener TweenVector3(Vector3 start, Vector3 end, float duration, LuaFunction OnUpdate)
 {
     return DOTween.To(() => start, x => OnUpdate.Call(x), end, duration).OnComplete(() =>
     {
         OnUpdate.Dispose();
         OnUpdate = null;
     });
 }