public unsafe static long $Invoke3(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ActiveAnimation.Play((Animation)GCHandledObjects.GCHandleToObject(*args), (Direction)(*(int *)(args + 1))))); }
private void Update() { float deltaTime = RealTime.deltaTime; if (deltaTime == 0f) { return; } if (this.mAnimator != null) { this.mAnimator.Update((this.mLastDirection != Direction.Reverse) ? deltaTime : (-deltaTime)); if (this.isPlaying) { return; } this.mAnimator.enabled = false; base.enabled = false; } else { if (!(this.mAnim != null)) { base.enabled = false; return; } bool flag = false; foreach (AnimationState animationState in this.mAnim) { if (this.mAnim.IsPlaying(animationState.name)) { float num = animationState.speed * deltaTime; animationState.time += num; if (num < 0f) { if (animationState.time > 0f) { flag = true; } else { animationState.time = 0f; } } else if (animationState.time < animationState.length) { flag = true; } else { animationState.time = animationState.length; } } } this.mAnim.Sample(); if (flag) { return; } base.enabled = false; } if (this.mNotify) { this.mNotify = false; if (ActiveAnimation.current == null) { ActiveAnimation.current = this; EventDelegate.Execute(this.onFinished); if (this.eventReceiver != null && !string.IsNullOrEmpty(this.callWhenFinished)) { this.eventReceiver.SendMessage(this.callWhenFinished, SendMessageOptions.DontRequireReceiver); } ActiveAnimation.current = null; } if (this.mDisableDirection != Direction.Toggle && this.mLastDirection == this.mDisableDirection) { NGUITools.SetActive(base.gameObject, false); } } }
public void Set(bool state) { if (this.validator != null && !this.validator(state)) { return; } if (!this.mStarted) { this.mIsActive = state; this.startsActive = state; if (this.activeSprite != null) { this.activeSprite.alpha = ((!state) ? 0f : 1f); } } else if (this.mIsActive != state) { if (this.group != 0 && state) { int i = 0; int size = UIToggle.list.size; while (i < size) { UIToggle uIToggle = UIToggle.list[i]; if (uIToggle != this && uIToggle.group == this.group) { uIToggle.Set(false); } if (UIToggle.list.size != size) { size = UIToggle.list.size; i = 0; } else { i++; } } } this.mIsActive = state; if (this.activeSprite != null) { if (this.instantTween || !NGUITools.GetActive(this)) { this.activeSprite.alpha = ((!this.mIsActive) ? 0f : 1f); } else { TweenAlpha.Begin(this.activeSprite.get_gameObject(), 0.15f, (!this.mIsActive) ? 0f : 1f); } } if (UIToggle.current == null) { UIToggle uIToggle2 = UIToggle.current; UIToggle.current = this; if (EventDelegate.IsValid(this.onChange)) { EventDelegate.Execute(this.onChange); } else if (this.eventReceiver != null && !string.IsNullOrEmpty(this.functionName)) { this.eventReceiver.SendMessage(this.functionName, this.mIsActive, 1); } if (this.value && EventDelegate.IsValid(this.onActive)) { EventDelegate.Execute(this.onActive); } UIToggle.current = uIToggle2; } if (this.animator != null) { ActiveAnimation activeAnimation = ActiveAnimation.Play(this.animator, null, (!state) ? Direction.Reverse : Direction.Forward, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (activeAnimation != null && (this.instantTween || !NGUITools.GetActive(this))) { activeAnimation.Finish(); } } else if (this.activeAnimation != null) { ActiveAnimation activeAnimation2 = ActiveAnimation.Play(this.activeAnimation, null, (!state) ? Direction.Reverse : Direction.Forward, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (activeAnimation2 != null && (this.instantTween || !NGUITools.GetActive(this))) { activeAnimation2.Finish(); } } } }
public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection) { return(ActiveAnimation.Play(anim, clipName, playDirection, EnableCondition.DoNothing, DisableCondition.DoNotDisable)); }
private void Set(bool state) { if (!mStarted) { mIsActive = state; startsActive = state; if (activeSprite != null) { activeSprite.alpha = ((!state) ? 0f : 1f); } } else if (mIsActive != state) { if (group != 0 && state) { int num = 0; int size = list.size; while (num < size) { UIToggle uIToggle = list[num]; if (uIToggle != this && uIToggle.group == group) { uIToggle.Set(state: false); } if (list.size != size) { size = list.size; num = 0; } else { num++; } } } mIsActive = state; if (activeSprite != null) { if (instantTween || !NGUITools.GetActive(this)) { activeSprite.alpha = ((!mIsActive) ? 0f : 1f); } else { TweenAlpha.Begin(activeSprite.gameObject, 0.15f, (!mIsActive) ? 0f : 1f); } } if (current == null) { UIToggle uIToggle2 = current; current = this; if (EventDelegate.IsValid(onChange)) { EventDelegate.Execute(onChange); } else if (eventReceiver != null && !string.IsNullOrEmpty(functionName)) { eventReceiver.SendMessage(functionName, mIsActive, SendMessageOptions.DontRequireReceiver); } current = uIToggle2; } if (this.activeAnimation != null) { ActiveAnimation activeAnimation = ActiveAnimation.Play(this.activeAnimation, null, state ? Direction.Forward : Direction.Reverse, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (activeAnimation != null && (instantTween || !NGUITools.GetActive(this))) { activeAnimation.Finish(); } } } }
public void Play(bool forward, bool onlyIfDifferent) { if (this.target || this.animator) { if (onlyIfDifferent) { if (this.mActivated == forward) { return; } this.mActivated = forward; } if (this.clearSelection && UICamera.selectedObject == base.gameObject) { UICamera.selectedObject = null; } int num = (int)(-(int)this.playDirection); Direction direction = forward ? this.playDirection : ((Direction)num); ActiveAnimation activeAnimation = this.target ? ActiveAnimation.Play(this.target, this.clipName, direction, this.ifDisabledOnPlay, this.disableWhenFinished) : ActiveAnimation.Play(this.animator, this.clipName, direction, this.ifDisabledOnPlay, this.disableWhenFinished); if (activeAnimation != null) { if (this.resetOnPlay) { activeAnimation.Reset(); } for (int i = 0; i < this.onFinished.Count; i++) { EventDelegate.Add(activeAnimation.onFinished, new EventDelegate.Callback(this.OnFinished), true); } } } }
/// <summary> /// Fade out or fade in the active sprite and notify the OnChange event listener. /// If setting the initial value, call Start() first. /// </summary> public void Set(bool state, bool notify = true) { if (validator != null && !validator(state)) { return; } if (!mStarted) { mIsActive = state; startsActive = state; if (activeSprite != null) { activeSprite.alpha = invertSpriteState ? (state ? 0f : 1f) : (state ? 1f : 0f); } } else if (mIsActive != state) { // Uncheck all other toggles if (group != 0 && state) { for (int i = 0, imax = list.size; i < imax;) { var cb = list.buffer[i]; if (cb != this && cb.group == group) { cb.Set(false); } if (list.size != imax) { imax = list.size; i = 0; } else { ++i; } } } // Remember the state mIsActive = state; // Tween the color of the active sprite if (activeSprite != null) { if (instantTween || !NGUITools.GetActive(this)) { activeSprite.alpha = invertSpriteState ? (mIsActive ? 0f : 1f) : (mIsActive ? 1f : 0f); } else { TweenAlpha.Begin(activeSprite.gameObject, 0.15f, invertSpriteState ? (mIsActive ? 0f : 1f) : (mIsActive ? 1f : 0f)); } } if (notify && current == null) { var tog = current; current = this; if (EventDelegate.IsValid(onChange)) { EventDelegate.Execute(onChange); } else if (eventReceiver != null && !string.IsNullOrEmpty(functionName)) { // Legacy functionality support (for backwards compatibility) eventReceiver.SendMessage(functionName, mIsActive, SendMessageOptions.DontRequireReceiver); } current = tog; } // Play the checkmark animation if (animator != null) { var aa = ActiveAnimation.Play(animator, null, state ? Direction.Forward : Direction.Reverse, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (aa != null && (instantTween || !NGUITools.GetActive(this))) { aa.Finish(); } } if (activeAnimation != null) { var aa = ActiveAnimation.Play(activeAnimation, null, state ? Direction.Forward : Direction.Reverse, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (aa != null && (instantTween || !NGUITools.GetActive(this))) { aa.Finish(); } } if (tween != null) { var isActive = NGUITools.GetActive(this); tween.Play(state); if (instantTween || !isActive) { tween.tweenFactor = state ? 1f : 0f; } if (tween.tweenGroup != 0) { var tws = gameObject.GetComponentsInChildren <UITweener>(true); for (int i = 0, imax = tws.Length; i < imax; ++i) { var t = tws[i]; if (t != tween && t.tweenGroup == tween.tweenGroup) { t.Play(state); if (instantTween || !isActive) { t.tweenFactor = state ? 1f : 0f; } } } } } } }
/// <summary> /// Notify the target when the animation finishes playing. /// </summary> void Update() { float delta = RealTime.deltaTime; if (delta == 0f) { return; } if (mAnimator != null) { mAnimator.Update((mLastDirection == Direction.Reverse) ? -delta : delta); if (isPlaying) { return; } mAnimator.enabled = false; enabled = false; } else if (mAnim != null) { bool playing = false; foreach (AnimationState state in mAnim) { if (!mAnim.IsPlaying(state.name)) { continue; } float movement = state.speed * delta; state.time += movement; if (movement < 0f) { if (state.time > 0f) { playing = true; } else { state.time = 0f; } } else { if (state.time < state.length) { playing = true; } else { state.time = state.length; } } } mAnim.Sample(); if (playing) { return; } enabled = false; } else { enabled = false; return; } if (mNotify) { mNotify = false; if (current == null) { current = this; EventDelegate.Execute(onFinished); // Deprecated functionality, kept for backwards compatibility if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished)) { eventReceiver.SendMessage(callWhenFinished, SendMessageOptions.DontRequireReceiver); } current = null; } if (mDisableDirection != Direction.Toggle && mLastDirection == mDisableDirection) { NGUITools.SetActive(gameObject, false); } } }
public void dismissController(ControllerDelegate onDisappear, ControllerDelegate onDisappeared) { if (controllerStacks.Count == 0) { Debug.LogWarning("Controller Stacks is 0"); return; } var current = controllerStacks.Count > 0 ? controllerStacks.Pop() : null; var previous = controllerStacks.Count > 0 ? controllerStacks.Peek() : null; AnimationClip showAnimClip = null, hideAnimClip = null; /*if (current != null) * { * GetNavigationAnimation(current.viewController, false, out showAnimClip, out hideAnimClip); * }*/ if (current != null) { GetNavigationAnimation(current.viewController, false, out showAnimClip, out hideAnimClip); } if (previous != null) { previous.viewController.animation.AddClip(showAnimClip, showAnimClip.name); } if (current != null && previous != null) { Animation currentTarget = current.viewController.GetComponent <Animation>(); if (currentTarget != null && hideAnimClip != null) { var anim = ActiveAnimation.Play(currentTarget, hideAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.DoNothing, AnimationOrTween.DisableCondition.DisableAfterForward); if (onDisappear != null) { onDisappear(current.viewController); } current.viewController.OnDissapear(); anim.onFinished = (a) => { if (onDisappeared != null) { onDisappeared(current.viewController); } current.viewController.OnDisappeared(); }; } } if (previous != null) { Animation oldTarget = previous.viewController.GetComponent <Animation>(); if (oldTarget != null && showAnimClip != null) { var anim = ActiveAnimation.Play(oldTarget, showAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DoNotDisable); if (string.IsNullOrEmpty(current.parameter) == false) { var param = GetControllerPathParams(previous.parameter); previous.viewController.controllerParameters = param;//.OnControllerParams(param); } previous.viewController.OnAppear(); anim.onFinished = (a) => { previous.viewController.OnAppeared(); }; } currentController = previous.viewController; } PrintControllerStacks(); }
public void backTransitionExitFinished() { Debug.Log("currentButton: " + currentButton); if (currentButton != null) { if (currentButton.name == "button market") { marketClass.instance.gameObject.SetActive(true); marketClass.instance.marketMainMenu.SetActive(true); GetComponent <Animation>().Play("back transition open"); } else if (currentButton.name == "button settings") { GameObject.Find("settings folder").transform.GetChild(0).gameObject.SetActive(true); GetComponent <Animation>().Play("back transition open"); } else if (currentButton.name == "button settings back") { GameObject.Find("settings").SetActive(false); GetComponent <Animation>().Play("back transition open"); } else if (currentButton.name == "button market back") { if (marketClass.instance.coinsMenu.activeSelf) { marketClass.instance.coinsMenu.SetActive(false); marketClass.instance.marketMainMenu.SetActive(true); } else if (marketClass.instance.hintsMenu.activeSelf) { marketClass.instance.hintsMenu.SetActive(false); marketClass.instance.marketMainMenu.SetActive(true); } else if (marketClass.instance.customizationMenu.activeSelf) { marketClass.instance.customizationMenu.SetActive(false); marketClass.instance.marketMainMenu.SetActive(true); } else { marketClass.instance.gameObject.SetActive(false); } GetComponent <Animation>().Play("back transition open"); } else if (currentButton.name == "special" || currentButton.name == "coins" || currentButton.name == "hints" || currentButton.name == "customization") { marketClass.instance.marketMainMenu.SetActive(false); marketClass.instance.specialMenu.SetActive(false); marketClass.instance.hintsMenu.SetActive(false); marketClass.instance.notCoinsMenu.SetActive(false); marketClass.instance.coinsMenu.SetActive(false); marketClass.instance.customizationMenu.SetActive(false); GetComponent <Animation>().Play("back transition open"); if (currentButton.name == "special") { marketClass.instance.specialMenu.SetActive(true); //отмечаем, если комплект куплен if (initClass.progress["complect"] == 1) { //убираем label price и label currency [0] и [2] marketClass.instance.specialMenu.transform.GetChild(0).GetChild(0).GetChild(0).gameObject.SetActive(false); marketClass.instance.specialMenu.transform.GetChild(0).GetChild(0).GetChild(1).gameObject.SetActive(false); //добавляем accept [3] marketClass.instance.specialMenu.transform.GetChild(0).GetChild(0).GetChild(2).gameObject.SetActive(true); } ActiveAnimation.Play(marketClass.instance.specialMenu.transform.GetChild(0).GetChild(0).GetComponent <Animation>(), AnimationOrTween.Direction.Forward); ActiveAnimation.Play(marketClass.instance.specialMenu.transform.GetChild(0).GetChild(1).GetComponent <Animation>(), AnimationOrTween.Direction.Forward); } else if (currentButton.name == "coins") { marketClass.instance.gameObject.SetActive(true); Debug.Log(marketClass.instance.enabled); Destroy(GameObject.Find("root/Camera/UI Root/not coins menu")); marketClass.instance.coinsMenu.SetActive(true); ActiveAnimation.Play(marketClass.instance.coinsMenu.transform.GetChild(0).GetChild(0).GetComponent <Animation>(), AnimationOrTween.Direction.Forward); ActiveAnimation.Play(marketClass.instance.coinsMenu.transform.GetChild(0).GetChild(1).GetComponent <Animation>(), AnimationOrTween.Direction.Forward); } else if (currentButton.name == "hints") { Debug.Log(555); marketClass.instance.gameObject.SetActive(true); marketClass.instance.hintsMenu.SetActive(true); ActiveAnimation.Play(marketClass.instance.hintsMenu.transform.GetChild(0).GetChild(0).GetComponent <Animation>(), AnimationOrTween.Direction.Forward); ActiveAnimation.Play(marketClass.instance.hintsMenu.transform.GetChild(0).GetChild(1).GetComponent <Animation>(), AnimationOrTween.Direction.Forward); } else if (currentButton.name == "customization") { marketClass.instance.customizationMenu.SetActive(true); for (int j = 1; j <= 2; j++) { //отмечаем купленные скины if (initClass.progress["skin" + j] > 0) { //убираем label price и icon price [0] и [2] marketClass.instance.customizationMenu.transform.GetChild(0).GetChild(j - 1).GetChild(0).gameObject.SetActive(false); marketClass.instance.customizationMenu.transform.GetChild(0).GetChild(j - 1).GetChild(2).gameObject.SetActive(false); //добавляем accept [3] marketClass.instance.customizationMenu.transform.GetChild(0).GetChild(j - 1).GetChild(3).gameObject.SetActive(true); //красим accept в белый if (initClass.progress["skin" + j] == 2) { marketClass.instance.customizationMenu.transform.GetChild(0).GetChild(j - 1).GetChild(3).GetComponent <UISprite>().color = new Color32(255, 255, 255, 255); } } } ActiveAnimation.Play(marketClass.instance.customizationMenu.transform.GetChild(0).GetChild(0).GetComponent <Animation>(), AnimationOrTween.Direction.Forward); ActiveAnimation.Play(marketClass.instance.customizationMenu.transform.GetChild(0).GetChild(1).GetComponent <Animation>(), AnimationOrTween.Direction.Forward); } } } }
public NavigationData pushController(UIViewController controller, ControllerDelegate onAppear, ControllerDelegate onAppeared) { AnimationClip showAnimClip = null, hideAnimClip = null; if (controller != null) { GetNavigationAnimation(controller, true, out showAnimClip, out hideAnimClip); } if (currentController != null) { currentController.animation.AddClip(hideAnimClip, hideAnimClip.name); } NavigationData navData = null; if (controller != null) { if (currentController != null) { Animation currentTarget = currentController.GetComponent <Animation>(); if (currentTarget != null && hideAnimClip != null) { //Debug.Log("currentTarget: " + currentTarget); //Debug.Log("hideAnim: " + hideAnimClip); var anim = ActiveAnimation.Play(currentTarget, hideAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.DoNothing, AnimationOrTween.DisableCondition.DisableAfterForward); currentController.OnDissapear(); if (anim != null) { anim.onFinished = (a) => { currentController.OnDisappeared(); }; } } } Animation target = controller.GetComponent <Animation>(); if (target != null && showAnimClip != null) { ActiveAnimation animation = ActiveAnimation.Play(target, showAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DoNotDisable); if (onAppear != null) { onAppear(controller); } controller.OnAppear(); animation.onFinished = (anim) => { if (onAppeared != null) { onAppeared(controller); } controller.OnAppeared(); }; } currentController = controller; navData = PushToStack(controller, ""); } PrintControllerStacks(); return(navData); }
static public int Play_s(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 2) { UnityEngine.Animation a1; checkType(l, 1, out a1); AnimationOrTween.Direction a2; checkEnum(l, 2, out a2); var ret = ActiveAnimation.Play(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 3) { UnityEngine.Animation a1; checkType(l, 1, out a1); System.String a2; checkType(l, 2, out a2); AnimationOrTween.Direction a3; checkEnum(l, 3, out a3); var ret = ActiveAnimation.Play(a1, a2, a3); pushValue(l, true); pushValue(l, ret); return(2); } else if (matchType(l, argc, 1, typeof(UnityEngine.Animator), typeof(string), typeof(AnimationOrTween.Direction), typeof(AnimationOrTween.EnableCondition), typeof(AnimationOrTween.DisableCondition))) { UnityEngine.Animator a1; checkType(l, 1, out a1); System.String a2; checkType(l, 2, out a2); AnimationOrTween.Direction a3; checkEnum(l, 3, out a3); AnimationOrTween.EnableCondition a4; checkEnum(l, 4, out a4); AnimationOrTween.DisableCondition a5; checkEnum(l, 5, out a5); var ret = ActiveAnimation.Play(a1, a2, a3, a4, a5); pushValue(l, true); pushValue(l, ret); return(2); } else if (matchType(l, argc, 1, typeof(UnityEngine.Animation), typeof(string), typeof(AnimationOrTween.Direction), typeof(AnimationOrTween.EnableCondition), typeof(AnimationOrTween.DisableCondition))) { UnityEngine.Animation a1; checkType(l, 1, out a1); System.String a2; checkType(l, 2, out a2); AnimationOrTween.Direction a3; checkEnum(l, 3, out a3); AnimationOrTween.EnableCondition a4; checkEnum(l, 4, out a4); AnimationOrTween.DisableCondition a5; checkEnum(l, 5, out a5); var ret = ActiveAnimation.Play(a1, a2, a3, a4, a5); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
private void Update() { float deltaTime = RealTime.deltaTime; if (deltaTime == 0f) { return; } if (mAnimator != null) { mAnimator.Update((mLastDirection == Direction.Reverse) ? (0f - deltaTime) : deltaTime); if (isPlaying) { return; } mAnimator.enabled = false; base.enabled = false; } else { if (!(mAnim != null)) { base.enabled = false; return; } bool flag = false; foreach (AnimationState item in mAnim) { if (!mAnim.IsPlaying(item.name)) { continue; } float num = item.speed * deltaTime; item.time += num; if (num < 0f) { if (item.time > 0f) { flag = true; } else { item.time = 0f; } } else if (item.time < item.length) { flag = true; } else { item.time = item.length; } } mAnim.Sample(); if (flag) { return; } base.enabled = false; } if (!mNotify) { return; } mNotify = false; if (current == null) { current = this; EventDelegate.Execute(onFinished); if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished)) { eventReceiver.SendMessage(callWhenFinished, SendMessageOptions.DontRequireReceiver); } current = null; } if (mDisableDirection != 0 && mLastDirection == mDisableDirection) { NGUITools.SetActive(base.gameObject, state: false); } }
public void Set(Boolean state) { if (this.validator != null && !this.validator(state)) { return; } if (!this.mStarted) { this.mIsActive = state; this.startsActive = state; if (this.activeSprite != (UnityEngine.Object)null) { this.activeSprite.alpha = ((!state) ? 0f : this.activeSpriteAlpha); } if (this.idleSprite != (UnityEngine.Object)null) { this.idleSprite.alpha = (state ? 0f : this.activeSpriteAlpha); } } else if (this.mIsActive != state) { if (this.group != 0 && state) { Int32 i = 0; Int32 size = UIToggle.list.size; while (i < size) { UIToggle uitoggle = UIToggle.list[i]; if (uitoggle != this && uitoggle.group == this.group) { uitoggle.Set(false); } if (UIToggle.list.size != size) { size = UIToggle.list.size; i = 0; } else { i++; } } } this.mIsActive = state; if (this.activeSprite != (UnityEngine.Object)null) { if (this.instantTween || !NGUITools.GetActive(this)) { this.activeSprite.alpha = ((!this.mIsActive) ? 0f : this.activeSpriteAlpha); } else { TweenAlpha.Begin(this.activeSprite.gameObject, 0.15f, (!this.mIsActive) ? 0f : this.activeSpriteAlpha); } } if (this.idleSprite != (UnityEngine.Object)null) { if (this.instantTween || !NGUITools.GetActive(this)) { this.idleSprite.alpha = (this.mIsActive ? 0f : this.activeSpriteAlpha); } else { TweenAlpha.Begin(this.idleSprite.gameObject, 0.15f, this.mIsActive ? 0f : this.activeSpriteAlpha); } } if (UIToggle.current == (UnityEngine.Object)null) { UIToggle uitoggle2 = UIToggle.current; UIToggle.current = this; if (EventDelegate.IsValid(this.onChange)) { EventDelegate.Execute(this.onChange); } else if (this.eventReceiver != (UnityEngine.Object)null && !String.IsNullOrEmpty(this.functionName)) { this.eventReceiver.SendMessage(this.functionName, this.mIsActive, SendMessageOptions.DontRequireReceiver); } UIToggle.current = uitoggle2; } if (this.animator != (UnityEngine.Object)null) { ActiveAnimation activeAnimation = ActiveAnimation.Play(this.animator, (String)null, (Direction)((!state) ? Direction.Reverse : Direction.Forward), EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (activeAnimation != (UnityEngine.Object)null && (this.instantTween || !NGUITools.GetActive(this))) { activeAnimation.Finish(); } } else if (this.activeAnimation != (UnityEngine.Object)null) { ActiveAnimation activeAnimation2 = ActiveAnimation.Play(this.activeAnimation, (String)null, (Direction)((!state) ? Direction.Reverse : Direction.Forward), EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (activeAnimation2 != (UnityEngine.Object)null && (this.instantTween || !NGUITools.GetActive(this))) { activeAnimation2.Finish(); } } } }
public void Update() { if (!HighLogic.LoadedSceneIsFlight) { return; } try { switch (CurrentState) { // System is inactive, and playing the inactive animation if present case State.Inactive: if (ConvertersEnabled()) { if (waitForComplete) { DeployWait(); } else { DeployStart(); } } break; // System is inactive, but waiting for the animation to end before deploying case State.InactiveWaiting: if (!waitForComplete || !_inactiveAnimationPresent) { this.LogError( "Invalid state! waitForComplete not enabled or inactive animation not present."); CurrentState = State.Inactive; } else if (!ConvertersEnabled()) { RetractEnd(); } else if (!InactiveAnimation.IsPlaying(inactiveAnimationName)) { DeployStart(); } break; // System is deploying case State.Deploying: if (!_deployAnimationPresent) { this.LogError("Invalid state! Deploying without an animation present."); CurrentState = State.Active; } else if (!ConvertersEnabled()) { RetractStart(); } else if (!DeployAnimation.IsPlaying(deployAnimationName)) { DeployEnd(); } break; // System is active, and playing the active animation if present case State.Active: if (!ConvertersEnabled()) { if (waitForComplete) { RetractWait(); } else { RetractStart(); } } break; // System is active, but waiting for the animation to finish before retracting case State.ActiveWaiting: if (!waitForComplete || !_activeAnimationPresent) { this.LogError( "Invalid state! waitForComplete not enabled or active animation not present."); CurrentState = State.Active; } else if (ConvertersEnabled()) { DeployEnd(); } else if (!ActiveAnimation.IsPlaying(activeAnimationName)) { RetractStart(); } break; // System is retracting case State.Retracting: if (!_retractAnimationPresent && !_deployAnimationPresent) { this.LogError("Invalid state! Retracting without an animation present."); CurrentState = State.Inactive; } else if (ConvertersEnabled()) { DeployStart(); } else if (_retractAnimationPresent) { if (!RetractAnimation.IsPlaying(retractAnimationName)) { RetractEnd(); } } else if (_deployAnimationPresent) { if (!DeployAnimation.IsPlaying(deployAnimationName)) { RetractEnd(); } } break; default: throw new ArgumentOutOfRangeException(); } } catch (Exception e) { this.LogException("Failed to update animation module", e); } }
public void Set(bool state, bool notify = true) { if (this.validator != null && !this.validator(state)) { return; } if (!this.mStarted) { this.mIsActive = state; this.startsActive = state; if (this.activeSprite != null) { this.activeSprite.alpha = ((!this.invertSpriteState) ? ((!state) ? 0f : 1f) : ((!state) ? 1f : 0f)); } } else if (this.mIsActive != state) { if (this.group != 0 && state) { int i = 0; int size = UIToggle.list.size; while (i < size) { UIToggle uIToggle = UIToggle.list[i]; if (uIToggle != this && uIToggle.group == this.group) { uIToggle.Set(false, true); } if (UIToggle.list.size != size) { size = UIToggle.list.size; i = 0; } else { i++; } } } this.mIsActive = state; if (this.activeSprite != null) { if (this.instantTween || !NGUITools.GetActive(this)) { this.activeSprite.alpha = ((!this.invertSpriteState) ? ((!this.mIsActive) ? 0f : 1f) : ((!this.mIsActive) ? 1f : 0f)); } else { TweenAlpha.Begin(this.activeSprite.gameObject, 0.15f, (!this.invertSpriteState) ? ((!this.mIsActive) ? 0f : 1f) : ((!this.mIsActive) ? 1f : 0f), 0f); } } if (notify && UIToggle.current == null) { UIToggle uIToggle2 = UIToggle.current; UIToggle.current = this; if (EventDelegate.IsValid(this.onChange)) { EventDelegate.Execute(this.onChange); } else if (this.eventReceiver != null && !string.IsNullOrEmpty(this.functionName)) { this.eventReceiver.SendMessage(this.functionName, this.mIsActive, SendMessageOptions.DontRequireReceiver); } UIToggle.current = uIToggle2; } if (this.animator != null) { ActiveAnimation activeAnimation = ActiveAnimation.Play(this.animator, null, (!state) ? Direction.Reverse : Direction.Forward, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (activeAnimation != null && (this.instantTween || !NGUITools.GetActive(this))) { activeAnimation.Finish(); } } else if (this.activeAnimation != null) { ActiveAnimation activeAnimation2 = ActiveAnimation.Play(this.activeAnimation, null, (!state) ? Direction.Reverse : Direction.Forward, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (activeAnimation2 != null && (this.instantTween || !NGUITools.GetActive(this))) { activeAnimation2.Finish(); } } else if (this.tween != null) { bool active = NGUITools.GetActive(this); if (this.tween.tweenGroup != 0) { UITweener[] componentsInChildren = this.tween.GetComponentsInChildren <UITweener>(true); int j = 0; int num = componentsInChildren.Length; while (j < num) { UITweener uITweener = componentsInChildren[j]; if (uITweener.tweenGroup == this.tween.tweenGroup) { uITweener.Play(state); if (this.instantTween || !active) { uITweener.tweenFactor = ((!state) ? 0f : 1f); } } j++; } } else { this.tween.Play(state); if (this.instantTween || !active) { this.tween.tweenFactor = ((!state) ? 0f : 1f); } } } } }
private void Update() { float deltaTime = RealTime.deltaTime; if (deltaTime != 0f) { if (this.mAnim != null) { bool flag = false; IEnumerator enumerator = this.mAnim.GetEnumerator(); try { while (enumerator.MoveNext()) { AnimationState current = (AnimationState) enumerator.Current; if (this.mAnim.IsPlaying(current.name)) { float num2 = current.speed * deltaTime; current.time += num2; if (num2 < 0f) { if (current.time > 0f) { flag = true; } else { current.time = 0f; } } else if (current.time < current.length) { flag = true; } else { current.time = current.length; } } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable == null) { } disposable.Dispose(); } this.mAnim.Sample(); if (!flag) { base.enabled = false; if (this.mNotify) { this.mNotify = false; ActiveAnimation.current = this; EventDelegate.Execute(this.onFinished); if ((this.eventReceiver != null) && !string.IsNullOrEmpty(this.callWhenFinished)) { this.eventReceiver.SendMessage(this.callWhenFinished, SendMessageOptions.DontRequireReceiver); } ActiveAnimation.current = null; if ((this.mDisableDirection != AnimationOrTween.Direction.Toggle) && (this.mLastDirection == this.mDisableDirection)) { NGUITools.SetActive(base.gameObject, false); } } } } else { base.enabled = false; } } }
/// <summary> /// Fade out or fade in the active sprite and notify the OnChange event listener. /// </summary> public virtual void Set(bool state) { if (validator != null && !validator(state)) { return; } if (!mStarted) { mIsActive = state; startsActive = state; if (activeSprite != null) { activeSprite.alpha = state ? 1f : 0f; } } else if (mIsActive != state) { // Uncheck all other toggles if (group != 0 && state) { for (int i = 0, imax = list.size; i < imax;) { UIToggle cb = list[i]; if (cb != this && cb.group == group) { cb.Set(false); } if (list.size != imax) { imax = list.size; i = 0; } else { ++i; } } } // Remember the state mIsActive = state; // Tween the color of the active sprite if (activeSprite != null) { if (instantTween || !NGUITools.GetActive(this)) { activeSprite.alpha = mIsActive ? 1f : 0f; } else { TweenAlpha.Begin(activeSprite.gameObject, 0.15f, mIsActive ? 1f : 0f); } } if (current == null) { UIToggle tog = current; current = this; if (EventDelegate.IsValid(onChange)) { EventDelegate.Execute(onChange); } else if (eventReceiver != null && !string.IsNullOrEmpty(functionName)) { // Legacy functionality support (for backwards compatibility) eventReceiver.SendMessage(functionName, mIsActive, SendMessageOptions.DontRequireReceiver); } current = tog; } // Play the checkmark animation if (animator != null) { ActiveAnimation aa = ActiveAnimation.Play(animator, null, state ? Direction.Forward : Direction.Reverse, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (aa != null && (instantTween || !NGUITools.GetActive(this))) { aa.Finish(); } } else if (activeAnimation != null) { ActiveAnimation aa = ActiveAnimation.Play(activeAnimation, null, state ? Direction.Forward : Direction.Reverse, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (aa != null && (instantTween || !NGUITools.GetActive(this))) { aa.Finish(); } } } }
private void Update() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Expected O, but got Unknown float deltaTime = RealTime.deltaTime; if (deltaTime != 0f) { if (mAnimator != null) { mAnimator.Update((mLastDirection != Direction.Reverse) ? deltaTime : (0f - deltaTime)); if (isPlaying) { return; } mAnimator.set_enabled(false); this.set_enabled(false); } else { if (!(mAnim != null)) { this.set_enabled(false); return; } bool flag = false; foreach (AnimationState item in mAnim) { AnimationState val = item; if (mAnim.IsPlaying(val.get_name())) { float num = val.get_speed() * deltaTime; AnimationState obj = val; obj.set_time(obj.get_time() + num); if (num < 0f) { if (val.get_time() > 0f) { flag = true; } else { val.set_time(0f); } } else if (val.get_time() < val.get_length()) { flag = true; } else { val.set_time(val.get_length()); } } } mAnim.Sample(); if (flag) { return; } this.set_enabled(false); } if (mNotify) { mNotify = false; if (current == null) { current = this; EventDelegate.Execute(onFinished); if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished)) { eventReceiver.SendMessage(callWhenFinished, 1); } current = null; } if (mDisableDirection != 0 && mLastDirection == mDisableDirection) { NGUITools.SetActive(this.get_gameObject(), false); } } } }
/// <summary> /// Fade out or fade in the active sprite and notify the OnChange event listener. /// </summary> void Set(bool state) { if (!mStarted) { mIsActive = state; startsActive = state; if (activeSprite != null) { activeSprite.alpha = state ? 1f : 0f; } } else if (mIsActive != state) { // Uncheck all other toggles if (group != 0 && state) { for (int i = 0, imax = list.size; i < imax;) { UIToggle cb = list[i]; if (cb != this && cb.group == group) { cb.Set(false); } if (list.size != imax) { imax = list.size; i = 0; } else { ++i; } } } // Remember the state mIsActive = state; // Tween the color of the active sprite if (activeSprite != null) { if (instantTween) { activeSprite.alpha = mIsActive ? 1f : 0f; } else { TweenAlpha.Begin(activeSprite.gameObject, 0.15f, mIsActive ? 1f : 0f); } } current = this; if (EventDelegate.IsValid(onChange)) { EventDelegate.Execute(onChange); } else if (eventReceiver != null && !string.IsNullOrEmpty(functionName)) { // Legacy functionality support (for backwards compatibility) eventReceiver.SendMessage(functionName, mIsActive, SendMessageOptions.DontRequireReceiver); } current = null; // Play the checkmark animation if (activeAnimation != null) { ActiveAnimation.Play(activeAnimation, state ? Direction.Forward : Direction.Reverse); } } }
private void Set(bool state) { if (!this.mStarted) { this.mIsActive = state; this.startsActive = state; if (this.activeSprite != null) { this.activeSprite.alpha = ((!state) ? 0f : 1f); } } else if (this.mIsActive != state) { if (this.group != 0 && state) { int i = 0; int size = UIToggle.list.size; while (i < size) { UIToggle uIToggle = UIToggle.list[i]; if (uIToggle != this && uIToggle.group == this.group) { uIToggle.Set(false); } if (UIToggle.list.size != size) { size = UIToggle.list.size; i = 0; } else { i++; } } } this.mIsActive = state; if (this.activeSprite != null) { if (this.instantTween) { this.activeSprite.alpha = ((!this.mIsActive) ? 0f : 1f); } else { TweenAlpha.Begin(this.activeSprite.gameObject, 0.1f, (!this.mIsActive) ? 0f : 1f); } } if (UIToggle.current == null) { UIToggle.current = this; if (EventDelegate.IsValid(this.onChange)) { EventDelegate.Execute(this.onChange); } else if (this.eventReceiver != null && !string.IsNullOrEmpty(this.functionName)) { this.eventReceiver.SendMessage(this.functionName, this.mIsActive, SendMessageOptions.DontRequireReceiver); } UIToggle.current = null; } if (this.activeAnimation != null) { ActiveAnimation activeAnimation = ActiveAnimation.Play(this.activeAnimation, (!state) ? Direction.Reverse : Direction.Forward); if (this.instantTween) { activeAnimation.Finish(); } } } }
public void Set(bool state) { //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown if (validator == null || validator(state)) { if (!mStarted) { mIsActive = state; startsActive = state; if (activeSprite != null) { activeSprite.alpha = ((!state) ? 0f : 1f); } } else if (mIsActive != state) { if (group != 0 && state) { int num = 0; int size = list.size; while (num < size) { UIToggle uIToggle = list[num]; if (uIToggle != this && uIToggle.group == group) { uIToggle.Set(false); } if (list.size != size) { size = list.size; num = 0; } else { num++; } } } mIsActive = state; if (activeSprite != null) { if (instantTween || !NGUITools.GetActive(this)) { activeSprite.alpha = ((!mIsActive) ? 0f : 1f); } else { TweenAlpha.Begin(activeSprite.get_gameObject(), 0.15f, (!mIsActive) ? 0f : 1f); } } if (current == null) { UIToggle uIToggle2 = current; current = this; if (EventDelegate.IsValid(onChange)) { EventDelegate.Execute(onChange); } else if (eventReceiver != null && !string.IsNullOrEmpty(functionName)) { eventReceiver.SendMessage(functionName, (object)mIsActive, 1); } current = uIToggle2; } if (animator != null) { ActiveAnimation activeAnimation = ActiveAnimation.Play(animator, null, state ? Direction.Forward : Direction.Reverse, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (activeAnimation != null && (instantTween || !NGUITools.GetActive(this))) { activeAnimation.Finish(); } } else if (this.activeAnimation != null) { ActiveAnimation activeAnimation2 = ActiveAnimation.Play(this.activeAnimation, null, state ? Direction.Forward : Direction.Reverse, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (activeAnimation2 != null && (instantTween || !NGUITools.GetActive(this))) { activeAnimation2.Finish(); } } } } }
private void Update() { float deltaTime = RealTime.deltaTime; if (deltaTime != 0f) { if (mAnimator != null) { mAnimator.Update((mLastDirection != Direction.Reverse) ? deltaTime : (0f - deltaTime)); if (isPlaying) { return; } mAnimator.enabled = false; base.enabled = false; } else { if (!(mAnim != null)) { base.enabled = false; return; } bool flag = false; IEnumerator enumerator = mAnim.GetEnumerator(); try { while (enumerator.MoveNext()) { AnimationState animationState = (AnimationState)enumerator.Current; if (mAnim.IsPlaying(animationState.name)) { float num = animationState.speed * deltaTime; animationState.time += num; if (num < 0f) { if (animationState.time > 0f) { flag = true; } else { animationState.time = 0f; } } else if (animationState.time < animationState.length) { flag = true; } else { animationState.time = animationState.length; } } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } mAnim.Sample(); if (flag) { return; } base.enabled = false; } if (mNotify) { mNotify = false; if (current == null) { current = this; EventDelegate.Execute(onFinished); if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished)) { eventReceiver.SendMessage(callWhenFinished, SendMessageOptions.DontRequireReceiver); } current = null; } if (mDisableDirection != 0 && mLastDirection == mDisableDirection) { NGUITools.SetActive(base.gameObject, state: false); } } } }
private void Update() { float deltaTime = RealTime.deltaTime; if (deltaTime == 0f) { return; } if (this.mAnimator != null) { this.mAnimator.Update((this.mLastDirection == Direction.Reverse) ? (-deltaTime) : deltaTime); if (this.isPlaying) { return; } this.mAnimator.enabled = false; base.enabled = false; } else { if (!(this.mAnim != null)) { base.enabled = false; return; } bool flag = false; using (IEnumerator enumerator = this.mAnim.GetEnumerator()) { while (enumerator.MoveNext()) { AnimationState animationState = (AnimationState)enumerator.get_Current(); if (this.mAnim.IsPlaying(animationState.name)) { float num = animationState.speed * deltaTime; animationState.time += num; if (num < 0f) { if (animationState.time > 0f) { flag = true; } else { animationState.time = 0f; } } else if (animationState.time < animationState.length) { flag = true; } else { animationState.time = animationState.length; } } } } this.mAnim.Sample(); if (flag) { return; } base.enabled = false; } if (this.mNotify) { this.mNotify = false; if (ActiveAnimation.current == null) { ActiveAnimation.current = this; EventDelegate.Execute(this.onFinished); if (this.eventReceiver != null && !string.IsNullOrEmpty(this.callWhenFinished)) { this.eventReceiver.SendMessage(this.callWhenFinished, SendMessageOptions.DontRequireReceiver); } ActiveAnimation.current = null; } if (this.mDisableDirection != Direction.Toggle && this.mLastDirection == this.mDisableDirection) { NGUITools.SetActive(base.gameObject, false); } } }
public void Play(bool forward, bool onlyIfDifferent) { if ((bool)target || (bool)animator) { if (onlyIfDifferent) { if (mActivated == forward) { return; } mActivated = forward; } if (clearSelection && UICamera.selectedObject == base.gameObject) { UICamera.selectedObject = null; } int num = 0 - playDirection; Direction direction = (Direction)((!forward) ? num : ((int)playDirection)); ActiveAnimation activeAnimation = (!(bool)target) ? ActiveAnimation.Play(animator, clipName, direction, ifDisabledOnPlay, disableWhenFinished) : ActiveAnimation.Play(target, clipName, direction, ifDisabledOnPlay, disableWhenFinished); if (activeAnimation != null) { if (resetOnPlay) { activeAnimation.Reset(); } for (int i = 0; i < onFinished.Count; i++) { EventDelegate.Add(activeAnimation.onFinished, OnFinished, oneShot: true); } } } }
public static ActiveAnimation Play(Animation anim, Direction playDirection) { return(ActiveAnimation.Play(anim, null, playDirection, EnableCondition.DoNothing, DisableCondition.DoNotDisable)); }
/// <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) { if (instantTween) { checkSprite.alpha = mChecked ? 1f : 0f; } else { 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); } } }
public unsafe static long $Invoke4(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ActiveAnimation.Play((Animation)GCHandledObjects.GCHandleToObject(*args), Marshal.PtrToStringUni(*(IntPtr *)(args + 1)), (Direction)(*(int *)(args + 2))))); }
private void Set(bool state) { if (!mStarted) { mIsActive = state; startsActive = state; if (activeSprite != null) { activeSprite.alpha = (state ? 1f : 0f); } } else { if (mIsActive == state) { return; } if (group != 0 && state) { int num = 0; int size = list.size; while (num < size) { UIToggle uIToggle = list[num]; if (uIToggle != this && uIToggle.group == group) { uIToggle.Set(state: false); } if (list.size != size) { size = list.size; num = 0; } else { num++; } } } mIsActive = state; if (activeSprite != null) { if (instantTween) { activeSprite.alpha = (mIsActive ? 1f : 0f); } else { TweenAlpha.Begin(activeSprite.gameObject, 0.15f, mIsActive ? 1f : 0f); } } if (current == null) { current = this; if (EventDelegate.IsValid(onChange)) { EventDelegate.Execute(onChange); } else if (eventReceiver != null && !string.IsNullOrEmpty(functionName)) { eventReceiver.SendMessage(functionName, mIsActive, SendMessageOptions.DontRequireReceiver); } current = null; } if (this.activeAnimation != null) { ActiveAnimation activeAnimation = ActiveAnimation.Play(this.activeAnimation, state ? Direction.Forward : Direction.Reverse); if (instantTween) { activeAnimation.Finish(); } } } }
/// <summary> /// Notify the target when the animation finishes playing. /// </summary> void Update () { float delta = RealTime.deltaTime; if (delta == 0f) return; if (mAnim != null) { bool isPlaying = false; foreach (AnimationState state in mAnim) { if (!mAnim.IsPlaying(state.name)) continue; float movement = state.speed * delta; state.time += movement; if (movement < 0f) { if (state.time > 0f) isPlaying = true; else state.time = 0f; } else { if (state.time < state.length) isPlaying = true; else state.time = state.length; } } mAnim.Sample(); if (isPlaying) return; enabled = false; if (mNotify) { mNotify = false; current = this; EventDelegate.Execute(onFinished); // Deprecated functionality, kept for backwards compatibility if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished)) eventReceiver.SendMessage(callWhenFinished, SendMessageOptions.DontRequireReceiver); current = null; if (mDisableDirection != Direction.Toggle && mLastDirection == mDisableDirection) NGUITools.SetActive(gameObject, false); } } else enabled = false; }
/// <summary> /// Fade out or fade in the active sprite and notify the OnChange event listener. /// </summary> public void Set(bool state) { if (validator != null && !validator(state)) { return; } if (!mStarted) { mIsActive = state; startsActive = state; if (activeSprite != null) { activeSprite.alpha = state ? 1f : 0f; } } else if (mIsActive != state) { // Uncheck all other toggles if (group != 0 && state) { for (int i = 0, imax = list.size; i < imax;) { UIToggle cb = list[i]; if (cb != this && cb.group == group) { cb.Set(false); } if (list.size != imax) { imax = list.size; i = 0; } else { ++i; } } } // Remember the state mIsActive = state; // Tween the color of the active sprite if (activeSprite != null) { if (instantTween || !NGUITools.GetActive(this)) { activeSprite.alpha = mIsActive ? 1f : 0f; } else { TweenAlpha.Begin(activeSprite.gameObject, 0.15f, mIsActive ? 1f : 0f); } } // llm: 2017-10-17不进行 Current 判断,让 Toggle 能递归执行 //if (current == null) { UIToggle tog = current; current = this; if (EventDelegate.IsValid(onChange)) { EventDelegate.Execute(onChange); // add by llm 2017-12-7 //SendMessage("OnToggled", SendMessageOptions.DontRequireReceiver); } else if (eventReceiver != null && !string.IsNullOrEmpty(functionName)) { // Legacy functionality support (for backwards compatibility) eventReceiver.SendMessage(functionName, mIsActive, SendMessageOptions.DontRequireReceiver); // add by jinghong 2016-11-12 //SendMessage("OnToggled", SendMessageOptions.DontRequireReceiver); } // add by llm 2017-12-14 //SendMessage("OnToggled", SendMessageOptions.DontRequireReceiver); current = tog; } // Play the checkmark animation if (animator != null) { ActiveAnimation aa = ActiveAnimation.Play(animator, null, state ? Direction.Forward : Direction.Reverse, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (aa != null && (instantTween || !NGUITools.GetActive(this))) { aa.Finish(); } } else if (activeAnimation != null) { ActiveAnimation aa = ActiveAnimation.Play(activeAnimation, null, state ? Direction.Forward : Direction.Reverse, EnableCondition.IgnoreDisabledState, DisableCondition.DoNotDisable); if (aa != null && (instantTween || !NGUITools.GetActive(this))) { aa.Finish(); } } else if (tween != null) { bool isActive = NGUITools.GetActive(this); if (tween.tweenGroup != 0) { UITweener[] tws = tween.GetComponentsInChildren <UITweener>(); for (int i = 0, imax = tws.Length; i < imax; ++i) { UITweener t = tws[i]; if (t.tweenGroup == tween.tweenGroup) { t.Play(state); if (instantTween || !isActive) { t.tweenFactor = state ? 1f : 0f; } } } } else { tween.Play(state); if (instantTween || !isActive) { tween.tweenFactor = state ? 1f : 0f; } } } } }