Пример #1
0
        private void SetToggleGroup(ToggleGroup newGroup, bool setMemberValue)
        {
            ToggleGroup oldGroup = m_Group;

            // Sometimes IsActive returns false in OnDisable so don't check for it.
            // Rather remove the toggle too oftem than too little.
            if (m_Group != null)
            {
                m_Group.UnregisterToggle(this);
            }

            // At runtime the group variable should be set but not when calling this method from OnEnable or OnDisable.
            // That's why we use the setMemberValue parameter.
            if (setMemberValue)
            {
                m_Group = newGroup;
            }

            // Only register to the new group if this Toggle is active.
            if (m_Group != null && IsActive())
            {
                m_Group.RegisterToggle(this);
            }

            // If we are in a new group, and this toggle is on, notify group.
            // Note: Don't refer to m_Group here as it's not guaranteed to have been set.
            if (newGroup != null && newGroup != oldGroup && isOn && IsActive())
            {
                m_Group.NotifyToggleOn(this);
            }
        }
Пример #2
0
    static int NotifyToggleOn(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                UnityEngine.UI.ToggleGroup obj  = (UnityEngine.UI.ToggleGroup)ToLua.CheckObject <UnityEngine.UI.ToggleGroup>(L, 1);
                UnityEngine.UI.Toggle      arg0 = (UnityEngine.UI.Toggle)ToLua.CheckObject <UnityEngine.UI.Toggle>(L, 2);
                obj.NotifyToggleOn(arg0);
                return(0);
            }
            else if (count == 3)
            {
                UnityEngine.UI.ToggleGroup obj  = (UnityEngine.UI.ToggleGroup)ToLua.CheckObject <UnityEngine.UI.ToggleGroup>(L, 1);
                UnityEngine.UI.Toggle      arg0 = (UnityEngine.UI.Toggle)ToLua.CheckObject <UnityEngine.UI.Toggle>(L, 2);
                bool arg1 = LuaDLL.luaL_checkboolean(L, 3);
                obj.NotifyToggleOn(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.UI.ToggleGroup.NotifyToggleOn"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 static public int NotifyToggleOn(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.UI.ToggleGroup self = (UnityEngine.UI.ToggleGroup)checkSelf(l);
         UnityEngine.UI.Toggle      a1;
         checkType(l, 2, out a1);
         self.NotifyToggleOn(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Пример #4
0
        void Set(bool value, bool sendCallback)
        {
            if (m_IsOn == value)
            {
                return;
            }

            // if we are in a group and set to true, do group logic
            m_IsOn = value;
            if (m_Group != null && IsActive())
            {
                if (m_IsOn || (!m_Group.AnyTogglesOn() && !m_Group.allowSwitchOff))
                {
                    m_IsOn = true;
                    m_Group.NotifyToggleOn(this);
                }
            }

            // Always send event when toggle is clicked, even if value didn't change
            // due to already active toggle in a toggle group being clicked.
            // Controls like Dropdown rely on this.
            // It's up to the user to ignore a selection being set to the same value it already was, if desired.
            PlayEffect(toggleTransition == ToggleTransition.None);
            if (sendCallback)
            {
                UISystemProfilerApi.AddMarker("Toggle.value", this);
                onValueChanged.Invoke(m_IsOn);
            }
        }
Пример #5
0
 static int NotifyToggleOn(IntPtr L)
 {
     LuaScriptMgr.CheckArgsCount(L, 2);
     UnityEngine.UI.ToggleGroup obj  = (UnityEngine.UI.ToggleGroup)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UnityEngine.UI.ToggleGroup");
     UnityEngine.UI.Toggle      arg0 = (UnityEngine.UI.Toggle)LuaScriptMgr.GetUnityObject(L, 2, typeof(UnityEngine.UI.Toggle));
     obj.NotifyToggleOn(arg0);
     return(0);
 }
Пример #6
0
        private void SetToggleGroup(ToggleGroup newGroup, bool setMemberValue)
        {
            ToggleGroup group = m_Group;

            if (m_Group != null)
            {
                m_Group.UnregisterToggle(this);
            }
            if (setMemberValue)
            {
                m_Group = newGroup;
            }
            if (m_Group != null && IsActive())
            {
                m_Group.RegisterToggle(this);
            }
            if (newGroup != null && newGroup != group && isOn && IsActive())
            {
                m_Group.NotifyToggleOn(this);
            }
        }
Пример #7
0
 static public int NotifyToggleOn(IntPtr l)
 {
     try {
         UnityEngine.UI.ToggleGroup self = (UnityEngine.UI.ToggleGroup)checkSelf(l);
         UnityEngine.UI.Toggle      a1;
         checkType(l, 2, out a1);
         self.NotifyToggleOn(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static int QPYX_NotifyToggleOn_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 2);
         UnityEngine.UI.ToggleGroup QPYX_obj_YXQP  = (UnityEngine.UI.ToggleGroup)ToLua.CheckObject <UnityEngine.UI.ToggleGroup>(L_YXQP, 1);
         UnityEngine.UI.Toggle      QPYX_arg0_YXQP = (UnityEngine.UI.Toggle)ToLua.CheckObject <UnityEngine.UI.Toggle>(L_YXQP, 2);
         QPYX_obj_YXQP.NotifyToggleOn(QPYX_arg0_YXQP);
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
Пример #9
0
 static int NotifyToggleOn(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.UI.ToggleGroup obj  = (UnityEngine.UI.ToggleGroup)ToLua.CheckObject(L, 1, typeof(UnityEngine.UI.ToggleGroup));
         UnityEngine.UI.Toggle      arg0 = (UnityEngine.UI.Toggle)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.UI.Toggle));
         obj.NotifyToggleOn(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #10
0
 private void Set(bool value, bool sendCallback)
 {
     if (m_IsOn != value)
     {
         m_IsOn = value;
         if (m_Group != null && IsActive() && (m_IsOn || (!m_Group.AnyTogglesOn() && !m_Group.allowSwitchOff)))
         {
             m_IsOn = true;
             m_Group.NotifyToggleOn(this);
         }
         PlayEffect(toggleTransition == ToggleTransition.None);
         if (sendCallback)
         {
             onValueChanged.Invoke(m_IsOn);
         }
     }
 }
Пример #11
0
        private void SetToggleGroup(ToggleGroup newGroup, bool setMemberValue)
        {
            ToggleGroup group = this.m_Group;

            if (this.m_Group != null)
            {
                this.m_Group.UnregisterToggle(this);
            }
            if (setMemberValue)
            {
                this.m_Group = newGroup;
            }
            if ((newGroup != null) && this.IsActive())
            {
                newGroup.RegisterToggle(this);
            }
            if (((newGroup != null) && (newGroup != group)) && (this.isOn && this.IsActive()))
            {
                newGroup.NotifyToggleOn(this);
            }
        }