예제 #1
0
    static int DoAllHandle(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 3);
            UI.StateHandle            obj       = (UI.StateHandle)ToLua.CheckObject(L, 1, typeof(UI.StateHandle));
            bool                      arg0      = LuaDLL.luaL_checkboolean(L, 2);
            System.Action <UI.Handle> arg1      = null;
            LuaTypes                  funcType3 = LuaDLL.lua_type(L, 3);

            if (funcType3 != LuaTypes.LUA_TFUNCTION)
            {
                arg1 = (System.Action <UI.Handle>)ToLua.CheckObject(L, 3, typeof(System.Action <UI.Handle>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 3);
                arg1 = DelegateFactory.CreateDelegate(typeof(System.Action <UI.Handle>), func) as System.Action <UI.Handle>;
            }

            obj.DoAllHandle(arg0, arg1);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #2
0
    static int ExecuteBeginDrag(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UI.StateHandle)))
            {
                UI.StateHandle obj = (UI.StateHandle)ToLua.ToObject(L, 1);
                obj.ExecuteBeginDrag();
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UI.StateHandle), typeof(UnityEngine.Vector2)))
            {
                UI.StateHandle      obj  = (UI.StateHandle)ToLua.ToObject(L, 1);
                UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2);
                obj.ExecuteBeginDrag(arg0);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UI.StateHandle.ExecuteBeginDrag"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #3
0
    static int AddDragEnd(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 3);
            UI.StateHandle obj = (UI.StateHandle)ToLua.CheckObject(L, 1, typeof(UI.StateHandle));
            System.Action <UnityEngine.EventSystems.PointerEventData> arg0 = null;
            LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (System.Action <UnityEngine.EventSystems.PointerEventData>)ToLua.CheckObject(L, 2, typeof(System.Action <UnityEngine.EventSystems.PointerEventData>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.EventSystems.PointerEventData>), func) as System.Action <UnityEngine.EventSystems.PointerEventData>;
            }

            bool arg1 = LuaDLL.luaL_checkboolean(L, 3);
            obj.AddDragEnd(arg0, arg1);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #4
0
        public void OnSel(StateHandle selStateHandle, bool isDuration, bool byStateHandle)
        {
            if (m_cached == false)//初始化中的话不用处理
            {
                return;
            }

            //类型状态机
            bool selSuccess = true;

            switch (m_ctrlType)
            {
            case CtrlType.none: m_curStateHandle = selStateHandle; break;

            case CtrlType.tab: selSuccess = OnSelTab(selStateHandle, isDuration, byStateHandle); break;

            default: Debuger.LogError(string.Format("未作处理的控件类型", m_ctrlType)); break;
            }

            if (selSuccess && m_onSel != null)
            {
                m_onSel(selStateHandle, CurIdx);

                if (ms_globalStateHook != null)
                {
                    ms_globalStateHook(this, CurIdx);
                }
            }
        }
예제 #5
0
        public void OnCacheTab()
        {
            //如果是tab控件,确保有且只有一个处于选中状态
            StateHandle sNeedSet = null;//需要设置到提起状态的控件
            bool        needSet  = true;

            foreach (var s in m_stateHandles)
            {
                if (s == null)
                {
                    continue;
                }
                s.EnableCtrlState = false;                //让状态控件,自己不能控制状态
                if (s.m_curState == 0 && needSet == true) //找到需要设置为提起状态的控件
                {
                    sNeedSet = s;
                }
                if (s.m_curState == 1 && needSet == false)//只有一个控件能为提起状态,其他控件要设置为0
                {
                    s.SetState(0, false);
                }
                if (s.m_curState == 1 && needSet == true)//找到一个已经设置为提起状态的控件的话,记录下
                {
                    needSet  = false;
                    sNeedSet = s;
                }
            }
            if (needSet && sNeedSet != null)//设置为选中状态
            {
                sNeedSet.SetState(1, false);
            }
            m_curStateHandle = sNeedSet;//当前选中的状态控件
        }
예제 #6
0
    static int OnSel(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UI.StateGroup), typeof(UI.StateHandle)))
            {
                UI.StateGroup  obj  = (UI.StateGroup)ToLua.ToObject(L, 1);
                UI.StateHandle arg0 = (UI.StateHandle)ToLua.ToObject(L, 2);
                obj.OnSel(arg0);
                return(0);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(UI.StateGroup), typeof(UI.StateHandle), typeof(bool), typeof(bool)))
            {
                UI.StateGroup  obj  = (UI.StateGroup)ToLua.ToObject(L, 1);
                UI.StateHandle arg0 = (UI.StateHandle)ToLua.ToObject(L, 2);
                bool           arg1 = LuaDLL.lua_toboolean(L, 3);
                bool           arg2 = LuaDLL.lua_toboolean(L, 4);
                obj.OnSel(arg0, arg1, arg2);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UI.StateGroup.OnSel"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #7
0
    static int AddClick(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            UI.StateHandle obj       = (UI.StateHandle)ToLua.CheckObject(L, 1, typeof(UI.StateHandle));
            System.Action  arg0      = null;
            LuaTypes       funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (System.Action)ToLua.CheckObject(L, 2, typeof(System.Action));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(System.Action), func) as System.Action;
            }

            obj.AddClick(arg0);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #8
0
    static int AddLuaClickEx(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 3);
            UI.StateHandle obj = (UI.StateHandle)ToLua.CheckObject(L, 1, typeof(UI.StateHandle));
            System.Action <LuaInterface.LuaTable, UI.StateHandle> arg0 = null;
            LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (System.Action <LuaInterface.LuaTable, UI.StateHandle>)ToLua.CheckObject(L, 2, typeof(System.Action <LuaInterface.LuaTable, UI.StateHandle>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(System.Action <LuaInterface.LuaTable, UI.StateHandle>), func) as System.Action <LuaInterface.LuaTable, UI.StateHandle>;
            }

            LuaTable arg1 = ToLua.CheckLuaTable(L, 3);
            obj.AddLuaClickEx(arg0, arg1);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #9
0
 void OnEnable()
 {
     m_cur = target as StateHandle;
     if (Application.isEditor && !EditorApplication.isPlaying)
     {
         EditorApplication.update = m_cur.LateUpdate;
     }
 }
예제 #10
0
 //不在运行中时,Handle的类型或者m_go改变的时候会刷新值
 public override void OnReset(Handle h, bool resetBegin = true, bool resetEnd = false)
 {
     if (h.m_go)
     {
         StateHandle s = h.m_go.GetComponent <StateHandle>();
         if (s)
         {
             h.m_iBegin = s.CurStateIdx;
         }
     }
 }
예제 #11
0
        public override void OnEnd(Handle h)
        {
            if (h.m_go == null)
            {
                return;
            }
            StateHandle s = h.m_go.GetComponent <StateHandle>();

            if (s == null)
            {
                return;
            }
            s.SetState(h.m_iBegin, true);
        }
예제 #12
0
 static int ExecuteHold(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UI.StateHandle obj = (UI.StateHandle)ToLua.CheckObject(L, 1, typeof(UI.StateHandle));
         obj.ExecuteHold();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #13
0
 static int AddPublicHandle(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UI.StateHandle obj  = (UI.StateHandle)ToLua.CheckObject(L, 1, typeof(UI.StateHandle));
         UI.Handle.Type arg0 = (UI.Handle.Type)ToLua.CheckObject(L, 2, typeof(UI.Handle.Type));
         obj.AddPublicHandle(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #14
0
 static int RemovePublicHandle(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UI.StateHandle obj  = (UI.StateHandle)ToLua.CheckObject(L, 1, typeof(UI.StateHandle));
         int            arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         obj.RemovePublicHandle(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #15
0
 static int OnPointerUp(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UI.StateHandle obj = (UI.StateHandle)ToLua.CheckObject(L, 1, typeof(UI.StateHandle));
         UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2, typeof(UnityEngine.EventSystems.PointerEventData));
         obj.OnPointerUp(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #16
0
 static int GetState(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UI.StateHandle       obj  = (UI.StateHandle)ToLua.CheckObject(L, 1, typeof(UI.StateHandle));
         int                  arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         UI.StateHandle.State o    = obj.GetState(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #17
0
 static int AddPrivateHandle(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UI.StateHandle obj  = (UI.StateHandle)ToLua.CheckObject(L, 1, typeof(UI.StateHandle));
         int            arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         UI.Handle.Type arg1 = (UI.Handle.Type)ToLua.CheckObject(L, 3, typeof(UI.Handle.Type));
         obj.AddPrivateHandle(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #18
0
 static int get_Item(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UI.StateGroup  obj  = (UI.StateGroup)ToLua.CheckObject(L, 1, typeof(UI.StateGroup));
         int            arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         UI.StateHandle o    = obj[arg0];
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #19
0
 static int MoveState(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UI.StateHandle obj  = (UI.StateHandle)ToLua.CheckObject(L, 1, typeof(UI.StateHandle));
         int            arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         bool           arg1 = LuaDLL.luaL_checkboolean(L, 3);
         obj.MoveState(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #20
0
    static int set_EnableCtrlState(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.StateHandle obj  = (UI.StateHandle)o;
            bool           arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.EnableCtrlState = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index EnableCtrlState on a nil value" : e.Message));
        }
    }
예제 #21
0
    static int set_m_itemTemplate(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.StateGroup  obj  = (UI.StateGroup)o;
            UI.StateHandle arg0 = (UI.StateHandle)ToLua.CheckUnityObject(L, 2, typeof(UI.StateHandle));
            obj.m_itemTemplate = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_itemTemplate on a nil value" : e.Message));
        }
    }
예제 #22
0
    static int get_CurStateHandle(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.StateGroup  obj = (UI.StateGroup)o;
            UI.StateHandle ret = obj.CurStateHandle;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index CurStateHandle on a nil value" : e.Message));
        }
    }
예제 #23
0
    static int get_CurStateIdx(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.StateHandle obj = (UI.StateHandle)o;
            int            ret = obj.CurStateIdx;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index CurStateIdx on a nil value" : e.Message));
        }
    }
예제 #24
0
    static int get_Duration(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.StateHandle obj = (UI.StateHandle)o;
            float          ret = obj.Duration;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Duration on a nil value" : e.Message));
        }
    }
예제 #25
0
    static int set_Duration(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.StateHandle obj  = (UI.StateHandle)o;
            float          arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.Duration = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Duration on a nil value" : e.Message));
        }
    }
예제 #26
0
    static int get_m_states(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.StateHandle obj = (UI.StateHandle)o;
            System.Collections.Generic.List <UI.StateHandle.State> ret = obj.m_states;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_states on a nil value" : e.Message));
        }
    }
예제 #27
0
    static int get_StateName(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.StateHandle obj = (UI.StateHandle)o;
            string[]       ret = obj.StateName;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index StateName on a nil value" : e.Message));
        }
    }
예제 #28
0
    static int set_m_states(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.StateHandle obj = (UI.StateHandle)o;
            System.Collections.Generic.List <UI.StateHandle.State> arg0 = (System.Collections.Generic.List <UI.StateHandle.State>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List <UI.StateHandle.State>));
            obj.m_states = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_states on a nil value" : e.Message));
        }
    }
예제 #29
0
    static int get_EnableCtrlState(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UI.StateHandle obj = (UI.StateHandle)o;
            bool           ret = obj.EnableCtrlState;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index EnableCtrlState on a nil value" : e.Message));
        }
    }
예제 #30
0
 static int OnSelTab(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 4);
         UI.StateGroup  obj  = (UI.StateGroup)ToLua.CheckObject(L, 1, typeof(UI.StateGroup));
         UI.StateHandle arg0 = (UI.StateHandle)ToLua.CheckUnityObject(L, 2, typeof(UI.StateHandle));
         bool           arg1 = LuaDLL.luaL_checkboolean(L, 3);
         bool           arg2 = LuaDLL.luaL_checkboolean(L, 4);
         bool           o    = obj.OnSelTab(arg0, arg1, arg2);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }