/// <summary> /// Fade out or fade in the checkmark and notify the target of OnChecked event. /// </summary> void Set(bool state) { if (!mStarted) { mChecked = state; startsChecked = state; if (checkSprite != null) { checkSprite.alpha = state ? 1f : 0f; } } else if (mChecked != state) { // Uncheck all other checkboxes if (radioButtonRoot != null && state) { UICheckbox[] cbs = radioButtonRoot.GetComponentsInChildren <UICheckbox>(true); for (int i = 0, imax = cbs.Length; i < imax; ++i) { UICheckbox cb = cbs[i]; if (cb != this && cb.radioButtonRoot == radioButtonRoot) { cb.Set(false); } } } // Remember the state mChecked = state; // Tween the color of the checkmark if (checkSprite != null) { TweenAlpha.Begin(checkSprite.gameObject, 0.15f, mChecked ? 1f : 0f); } current = this; // Notify the delegate if (onStateChange != null) { onStateChange(mChecked); } // Send out the event notification if (eventReceiver != null && !string.IsNullOrEmpty(functionName)) { eventReceiver.SendMessage(functionName, mChecked, SendMessageOptions.DontRequireReceiver); } current = null; // Play the checkmark animation if (checkAnimation != null) { ActiveAnimation.Play(checkAnimation, state ? Direction.Forward : Direction.Reverse); } } }
private void Set(bool state) { if (!mStarted) { mChecked = state; startsChecked = state; if (checkSprite != null) { checkSprite.alpha = ((!state) ? 0f : 1f); } } else { if (mChecked == state) { return; } if (radioButtonRoot != null && state) { UICheckbox[] componentsInChildren = radioButtonRoot.GetComponentsInChildren <UICheckbox>(includeInactive: true); int i = 0; for (int num = componentsInChildren.Length; i < num; i++) { UICheckbox uICheckbox = componentsInChildren[i]; if (uICheckbox != this && uICheckbox.radioButtonRoot == radioButtonRoot) { uICheckbox.Set(state: false); } } } mChecked = state; if (checkSprite != null) { if (instantTween) { checkSprite.alpha = ((!mChecked) ? 0f : 1f); } else { TweenAlpha.Begin(checkSprite.gameObject, 0.15f, (!mChecked) ? 0f : 1f); } } current = this; if (onStateChange != null) { onStateChange(mChecked); } if (eventReceiver != null && !string.IsNullOrEmpty(functionName)) { eventReceiver.SendMessage(functionName, mChecked, SendMessageOptions.DontRequireReceiver); } current = null; if (checkAnimation != null) { ActiveAnimation.Play(checkAnimation, state ? Direction.Forward : Direction.Reverse); } } }
private void Set(bool state) { if (!this.mStarted) { this.mChecked = state; this.startsChecked = state; if (this.checkSprite != null) { this.checkSprite.alpha = !state ? 0f : 1f; } } else if (this.mChecked != state) { if ((this.radioButtonRoot != null) && state) { UICheckbox[] componentsInChildren = this.radioButtonRoot.GetComponentsInChildren <UICheckbox>(true); int index = 0; int length = componentsInChildren.Length; while (index < length) { UICheckbox checkbox = componentsInChildren[index]; if ((checkbox != this) && (checkbox.radioButtonRoot == this.radioButtonRoot)) { checkbox.Set(false); } index++; } } this.mChecked = state; if (this.checkSprite != null) { if (this.instantTween) { this.checkSprite.alpha = !this.mChecked ? 0f : 1f; } else { TweenAlpha.Begin(this.checkSprite.gameObject, 0.15f, !this.mChecked ? 0f : 1f); } } current = this; if (this.onStateChange != null) { this.onStateChange(this.mChecked); } if ((this.eventReceiver != null) && !string.IsNullOrEmpty(this.functionName)) { this.eventReceiver.SendMessage(this.functionName, this.mChecked, SendMessageOptions.DontRequireReceiver); } current = null; if (this.checkAnimation != null) { ActiveAnimation.Play(this.checkAnimation, !state ? AnimationOrTween.Direction.Reverse : AnimationOrTween.Direction.Forward); } } }
// Token: 0x06000080 RID: 128 RVA: 0x00017704 File Offset: 0x00015904 private void Set(bool state) { if (!this.mStarted) { this.mChecked = state; this.startsChecked = state; if (this.checkSprite != null) { this.checkSprite.alpha = ((!state) ? 0f : 1f); } } else if (this.mChecked != state) { if (this.radioButtonRoot != null && state) { UICheckbox[] componentsInChildren = this.radioButtonRoot.GetComponentsInChildren <UICheckbox>(true); int i = 0; int num = componentsInChildren.Length; while (i < num) { UICheckbox uicheckbox = componentsInChildren[i]; if (uicheckbox != this && uicheckbox.radioButtonRoot == this.radioButtonRoot) { uicheckbox.Set(false); } i++; } } this.mChecked = state; if (this.checkSprite != null) { if (this.instantTween) { this.checkSprite.alpha = ((!this.mChecked) ? 0f : 1f); } else { TweenAlpha.Begin(this.checkSprite.gameObject, 0.15f, (!this.mChecked) ? 0f : 1f); } } UICheckbox.current = this; if (this.onStateChange != null) { this.onStateChange(this.mChecked); } if (this.eventReceiver != null && !string.IsNullOrEmpty(this.functionName)) { this.eventReceiver.SendMessage(this.functionName, this.mChecked, SendMessageOptions.DontRequireReceiver); } UICheckbox.current = null; if (this.checkAnimation != null) { ActiveAnimation.Play(this.checkAnimation, (!state) ? Direction.Reverse : Direction.Forward); } } }
private void Set(bool state) { if (!this.mStarted) { this.mChecked = state; this.startsChecked = state; if (this.checkSprite != null) { this.checkSprite.alpha = (!state ? 0f : 1f); } } else if (this.mChecked != state) { if (this.radioButtonRoot != null && state) { UICheckbox[] componentsInChildren = this.radioButtonRoot.GetComponentsInChildren <UICheckbox>(true); int num = 0; int length = (int)componentsInChildren.Length; while (num < length) { UICheckbox uICheckbox = componentsInChildren[num]; if (uICheckbox != this && uICheckbox.radioButtonRoot == this.radioButtonRoot) { uICheckbox.Set(false); } num++; } } this.mChecked = state; if (this.checkSprite != null) { Color color = this.checkSprite.color; color.a = (!this.mChecked ? 0f : 1f); TweenColor.Begin(this.checkSprite.gameObject, 0.2f, color); } if (this.eventReceiver != null && !string.IsNullOrEmpty(this.functionName)) { UICheckbox.current = this; this.eventReceiver.SendMessage(this.functionName, this.mChecked, SendMessageOptions.DontRequireReceiver); } if (this.checkAnimation != null) { ActiveAnimation.Play(this.checkAnimation, (!state ? Direction.Reverse : Direction.Forward)); } } }