Example #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);
            }
        }
 static public int RegisterToggle(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.RegisterToggle(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
 }
Example #3
0
 static int RegisterToggle(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.RegisterToggle(arg0);
     return(0);
 }
Example #4
0
 static public int RegisterToggle(IntPtr l)
 {
     try {
         UnityEngine.UI.ToggleGroup self = (UnityEngine.UI.ToggleGroup)checkSelf(l);
         UnityEngine.UI.Toggle      a1;
         checkType(l, 2, out a1);
         self.RegisterToggle(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static int QPYX_RegisterToggle_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.RegisterToggle(QPYX_arg0_YXQP);
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
Example #6
0
 static int RegisterToggle(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 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.RegisterToggle(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #7
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);
            }
        }