Ejemplo n.º 1
0
    static void HierarchWindowOnGUI(int instanceID, Rect selectionRect)
    {
        selectionRect.x    += selectionRect.width - 30;
        selectionRect.width = 15;

        // Go through state switchers and draw on targets
        var stateSwitchers = UIStateSwitcher.GetStateSwitchers();

        for (int i = 0; i < stateSwitchers.Count; i++)
        {
            var switcher = stateSwitchers[i];

            for (int j = 0; j < switcher.Targets.Count; j++)
            {
                if (switcher.Targets[j] == null)
                {
                    continue;
                }

                if (switcher.Targets[j].GetInstanceID() != instanceID)
                {
                    continue;
                }

                // Draw button that will ping the state switcher
                if (GUI.Button(selectionRect, new GUIContent("S", "This GameObject is managed by a UIStateSwitcher"), EditorStyles.label))
                {
                    EditorGUIUtility.PingObject(switcher.GetInstanceID());
                }
            }
        }
    }
Ejemplo n.º 2
0
    void OnEnable()
    {
        stateSwitcher = target as UIStateSwitcher;

        if (stateSwitcher.states == null)
        {
            stateSwitcher.states = new List <UIStateSwitcher.State>();
        }
    }
 static int QPYX_SwitchStateUsingID_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 2);
         UIStateSwitcher QPYX_obj_YXQP  = (UIStateSwitcher)ToLua.CheckObject <UIStateSwitcher>(L_YXQP, 1);
         string          QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 2);
         QPYX_obj_YXQP.SwitchStateUsingID(QPYX_arg0_YXQP);
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
    static int QPYX_set_value_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        ComponentCache.Injection <UIStateSwitcher> QPYX_obj_YXQP = (ComponentCache.Injection <UIStateSwitcher>)QPYX_o_YXQP;
            UIStateSwitcher QPYX_arg0_YXQP = (UIStateSwitcher)ToLua.CheckObject <UIStateSwitcher>(L_YXQP, 2);
            QPYX_obj_YXQP.value = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index value on a nil value"));
        }
    }
    static int QPYX_get_value_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        ComponentCache.Injection <UIStateSwitcher> QPYX_obj_YXQP = (ComponentCache.Injection <UIStateSwitcher>)QPYX_o_YXQP;
            UIStateSwitcher QPYX_ret_YXQP = QPYX_obj_YXQP.value;
            ToLua.Push(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index value on a nil value"));
        }
    }
Ejemplo n.º 6
0
 static int SwitchStateUsingID(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UIStateSwitcher obj  = (UIStateSwitcher)ToLua.CheckObject <UIStateSwitcher>(L, 1);
         string          arg0 = ToLua.CheckString(L, 2);
         obj.SwitchStateUsingID(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Ejemplo n.º 7
0
    static int get_Targets(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIStateSwitcher obj = (UIStateSwitcher)o;
            System.Collections.Generic.List <UnityEngine.GameObject> ret = obj.Targets;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Targets on a nil value"));
        }
    }
Ejemplo n.º 8
0
    static int set_Targets(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIStateSwitcher obj = (UIStateSwitcher)o;
            System.Collections.Generic.List <UnityEngine.GameObject> arg0 = (System.Collections.Generic.List <UnityEngine.GameObject>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List <UnityEngine.GameObject>));
            obj.Targets = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Targets on a nil value"));
        }
    }
Ejemplo n.º 9
0
    static int get_CurrentStateID(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIStateSwitcher obj = (UIStateSwitcher)o;
            string          ret = obj.CurrentStateID;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index CurrentStateID on a nil value"));
        }
    }
    static int set_value(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ComponentCache.Injection <UIStateSwitcher> obj = (ComponentCache.Injection <UIStateSwitcher>)o;
            UIStateSwitcher arg0 = (UIStateSwitcher)ToLua.CheckObject <UIStateSwitcher>(L, 2);
            obj.value = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index value on a nil value"));
        }
    }
    static int get_value(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ComponentCache.Injection <UIStateSwitcher> obj = (ComponentCache.Injection <UIStateSwitcher>)o;
            UIStateSwitcher ret = obj.value;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index value on a nil value"));
        }
    }
Ejemplo n.º 12
0
 private void Awake()
 {
     m_toggle          = GetComponent <Toggle>();
     m_uiStateSwitcher = GetComponent <UIStateSwitcher>();
     m_toggle.onValueChanged.AddListener(OnValueChanged);
 }
Ejemplo n.º 13
0
    bool AddToRightList(Object obj)
    {
        Type type = m_totalTypeNameList[m_newSelectedId];

        if (type == typeof(GameObject))
        {
            GameObject value = obj as GameObject;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.GameObject_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.gameObjectList == null)
            {
                m_cache.gameObjectList = new List <ComponentCache.GameObject_Injection>();
            }
            m_cache.gameObjectList.Add(injection);
        }
        else if (type == typeof(Transform))
        {
            Transform value = obj as Transform;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.Transform_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.transformList == null)
            {
                m_cache.transformList = new List <ComponentCache.Transform_Injection>();
            }
            m_cache.transformList.Add(injection);
        }
        else if (type == typeof(RectTransform))
        {
            RectTransform value = obj as RectTransform;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.RectTransform_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.rectTransformList == null)
            {
                m_cache.rectTransformList = new List <ComponentCache.RectTransform_Injection>();
            }
            m_cache.rectTransformList.Add(injection);
        }
        else if (type == typeof(Image))
        {
            Image value = obj as Image;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.Image_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.imageList == null)
            {
                m_cache.imageList = new List <ComponentCache.Image_Injection>();
            }
            m_cache.imageList.Add(injection);
        }
        else if (type == typeof(Text))
        {
            Text value = obj as Text;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.Text_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.textList == null)
            {
                m_cache.textList = new List <ComponentCache.Text_Injection>();
            }
            m_cache.textList.Add(injection);
        }
        else if (type == typeof(Toggle))
        {
            Toggle value = obj as Toggle;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.Toggle_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.toggleList == null)
            {
                m_cache.toggleList = new List <ComponentCache.Toggle_Injection>();
            }
            m_cache.toggleList.Add(injection);
        }
        else if (type == typeof(Button))
        {
            Button value = obj as Button;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.Button_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.buttonList == null)
            {
                m_cache.buttonList = new List <ComponentCache.Button_Injection>();
            }
            m_cache.buttonList.Add(injection);
        }
        else if (type == typeof(Slider))
        {
            Slider value = obj as Slider;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.Slider_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.sliderList == null)
            {
                m_cache.sliderList = new List <ComponentCache.Slider_Injection>();
            }
            m_cache.sliderList.Add(injection);
        }
        else if (type == typeof(ToggleGroup))
        {
            ToggleGroup value = obj as ToggleGroup;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.ToggleGroup_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.toggleGroupList == null)
            {
                m_cache.toggleGroupList = new List <ComponentCache.ToggleGroup_Injection>();
            }
            m_cache.toggleGroupList.Add(injection);
        }
        else if (type == typeof(InputField))
        {
            InputField value = obj as InputField;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.InputField_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.inputFieldList == null)
            {
                m_cache.inputFieldList = new List <ComponentCache.InputField_Injection>();
            }
            m_cache.inputFieldList.Add(injection);
        }
        else if (type == typeof(Graphic))
        {
            Graphic value = obj as Graphic;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.Graphic_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.graphicList == null)
            {
                m_cache.graphicList = new List <ComponentCache.Graphic_Injection>();
            }
            m_cache.graphicList.Add(injection);
        }
        else if (type == typeof(ScrollRect))
        {
            ScrollRect value = obj as ScrollRect;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.ScrollRect_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.scrollRectList == null)
            {
                m_cache.scrollRectList = new List <ComponentCache.ScrollRect_Injection>();
            }
            m_cache.scrollRectList.Add(injection);
        }
        else if (type == typeof(Scrollbar))
        {
            Scrollbar value = obj as Scrollbar;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.Scrollbar_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.scrollbarList == null)
            {
                m_cache.scrollbarList = new List <ComponentCache.Scrollbar_Injection>();
            }
            m_cache.scrollbarList.Add(injection);
        }
        else if (type == typeof(Dropdown))
        {
            Dropdown value = obj as Dropdown;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.Dropdown_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.dropdownList == null)
            {
                m_cache.dropdownList = new List <ComponentCache.Dropdown_Injection>();
            }
            m_cache.dropdownList.Add(injection);
        }
        else if (type == typeof(GridLayoutGroup))
        {
            GridLayoutGroup value = obj as GridLayoutGroup;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.GridLayoutGroup_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.gridLayoutGroupList == null)
            {
                m_cache.gridLayoutGroupList = new List <ComponentCache.GridLayoutGroup_Injection>();
            }
            m_cache.gridLayoutGroupList.Add(injection);
        }
        else if (type == typeof(RawImage))
        {
            RawImage value = obj as RawImage;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.RawImage_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.rawImageList == null)
            {
                m_cache.rawImageList = new List <ComponentCache.RawImage_Injection>();
            }
            m_cache.rawImageList.Add(injection);
        }
        else if (type == typeof(AudioSource))
        {
            AudioSource value = obj as AudioSource;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.AudioSource_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.audioSourceList == null)
            {
                m_cache.audioSourceList = new List <ComponentCache.AudioSource_Injection>();
            }
            m_cache.audioSourceList.Add(injection);
        }
        else if (type == typeof(littlerbird.UI.QuickGrid))
        {
            littlerbird.UI.QuickGrid value = obj as littlerbird.UI.QuickGrid;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.QuickGrid_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.quickGridList == null)
            {
                m_cache.quickGridList = new List <ComponentCache.QuickGrid_Injection>();
            }
            m_cache.quickGridList.Add(injection);
        }
        else if (type == typeof(SimpleScrollView))
        {
            SimpleScrollView value = obj as SimpleScrollView;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.SimpleScrollView_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.simpleScrollViewList == null)
            {
                m_cache.simpleScrollViewList = new List <ComponentCache.SimpleScrollView_Injection>();
            }
            m_cache.simpleScrollViewList.Add(injection);
        }
        else if (type == typeof(Animation))
        {
            Animation value = obj as Animation;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.Animation_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.animationList == null)
            {
                m_cache.animationList = new List <ComponentCache.Animation_Injection>();
            }
            m_cache.animationList.Add(injection);
        }
        else if (type == typeof(Animator))
        {
            Animator value = obj as Animator;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.Animator_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.animatorList == null)
            {
                m_cache.animatorList = new List <ComponentCache.Animator_Injection>();
            }
            m_cache.animatorList.Add(injection);
        }
        else if (type == typeof(SpriteAtlas))
        {
            SpriteAtlas value = obj as SpriteAtlas;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.SpriteAtlas_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.spriteAtlasList == null)
            {
                m_cache.spriteAtlasList = new List <ComponentCache.SpriteAtlas_Injection>();
            }
            m_cache.spriteAtlasList.Add(injection);
        }
        else if (type == typeof(SpriteHolder))
        {
            SpriteHolder value = obj as SpriteHolder;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.SpriteHolder_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.spriteHolderList == null)
            {
                m_cache.spriteHolderList = new List <ComponentCache.SpriteHolder_Injection>();
            }
            m_cache.spriteHolderList.Add(injection);
        }
        else if (type == typeof(UIStateSwitcher))
        {
            UIStateSwitcher value = obj as UIStateSwitcher;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.UIStateSwitcher_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.uiStateSwitcherList == null)
            {
                m_cache.uiStateSwitcherList = new List <ComponentCache.UIStateSwitcher_Injection>();
            }
            m_cache.uiStateSwitcherList.Add(injection);
        }
        else if (type == typeof(TextWrap))
        {
            TextWrap value = obj as TextWrap;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.TextWrap_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.textWrapList == null)
            {
                m_cache.textWrapList = new List <ComponentCache.TextWrap_Injection>();
            }
            m_cache.textWrapList.Add(injection);
        }
        else if (type == typeof(UIImageAnimation))
        {
            UIImageAnimation value = obj as UIImageAnimation;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.UIImageAnimation_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.uiImageAnimList == null)
            {
                m_cache.uiImageAnimList = new List <ComponentCache.UIImageAnimation_Injection>();
            }
            m_cache.uiImageAnimList.Add(injection);
        }
        else if (type == typeof(ComponentCache))
        {
            ComponentCache value = obj as ComponentCache;
            if (value == null)
            {
                return(false);
            }
            var injection = new ComponentCache.ComponentCache_Injection();
            injection.name  = m_newObjName;
            injection.value = value;
            if (m_cache.cacheList == null)
            {
                m_cache.cacheList = new List <ComponentCache.ComponentCache_Injection>();
            }
            m_cache.cacheList.Add(injection);
        }
        else
        {
            return(false);
        }
        return(true);
    }
    static int QPYX_get_Targets_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UIStateSwitcher QPYX_obj_YXQP = (UIStateSwitcher)QPYX_o_YXQP;
            System.Collections.Generic.List <UnityEngine.GameObject> QPYX_ret_YXQP = QPYX_obj_YXQP.Targets;
            ToLua.PushSealed(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index Targets on a nil value"));
        }
    }
    static int QPYX_set_Targets_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UIStateSwitcher QPYX_obj_YXQP = (UIStateSwitcher)QPYX_o_YXQP;
            System.Collections.Generic.List <UnityEngine.GameObject> QPYX_arg0_YXQP = (System.Collections.Generic.List <UnityEngine.GameObject>)ToLua.CheckObject(L_YXQP, 2, typeof(System.Collections.Generic.List <UnityEngine.GameObject>));
            QPYX_obj_YXQP.Targets = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index Targets on a nil value"));
        }
    }
    static int QPYX_get_CurrentStateID_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UIStateSwitcher QPYX_obj_YXQP = (UIStateSwitcher)QPYX_o_YXQP;
            string QPYX_ret_YXQP = QPYX_obj_YXQP.CurrentStateID;
            LuaDLL.lua_pushstring(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index CurrentStateID on a nil value"));
        }
    }