예제 #1
0
 private LuaCallSt FindClickCall(GameObject go, System.Object lua, System.Object luafuc /*, object data*/)
 {
     for (int i = 0; i < clicks.Count; i++)
     {
         LuaCallSt lc = clicks[i];
         if (lc.go == go && lc.luaCall == lua && luafuc == lc.luaCall /*&& lc.data == data*/)
         {
             return(lc);
         }
     }
     return(null);
 }
예제 #2
0
    private LuaCallSt RemoveClickWithData(GameObject go, System.Object lua, System.Object luafuc)
    {
        if (clicks != null)
        {
            LuaCallSt lc = null;
            lc = FindClickCall(go, lua, luafuc);
            if (null != lc)
            {
                clicks.Remove(lc);
            }
            return(lc);
        }

        return(null);
    }
예제 #3
0
    public void UnRegisterCall(CallType ct, GameObject g, LuaTable owner, LuaFunction lua_func)
    {
        if (lua_func != null)
        {
            return;
        }

        if (ct == CallType.OnClick)
        {
            LuaCallSt lc = RemoveClickWithData(g, owner, lua_func);
            if (lc != null)
            {
                GButton gb = GetComponent <GButton>();
                if (gb != null)
                {
                    gb.OnClick -= lc.OnClick;
                }
            }
        }
    }
예제 #4
0
    private LuaCallSt AddClickWithData(GameObject go, System.Object lua, System.Object luafuc, object data)
    {
        if (clicks == null)
        {
            clicks = new List <LuaCallSt>();
        }

        LuaCallSt lc = null;

        lc = FindClickCall(go, lua, luafuc);
        if (null == lc)
        {
            lc         = new LuaCallSt();
            lc.luaCall = luafuc as LuaFunction;
            lc.owner   = lua as LuaTable;
            lc.go      = go;
        }
        lc.data = data;
        clicks.Add(lc);
        return(lc);
    }