private void DoHideBeginAnimation_INTERNAL(System.Action callback, AppearanceParameters parameters) { if (TweenerGlobal.instance == null) { return; } var resetAnimation = parameters.GetResetAnimation(defaultValue: false); var immediately = parameters.GetImmediately(defaultValue: false); var delay = parameters.GetDelay(defaultValue: 0f); System.Action callbackInner = () => { if (this.animation != null) { if (resetAnimation == true) { this.SetResetState(); } if (immediately == true) { this.animation.SetOutState(this.animationInputParams, this.GetWindow(), this); callback.Invoke(); } else { this.animation.Play(this.GetWindow(), this.animationInputParams, this, false, callback); } } else { callback.Invoke(); } }; if (TweenerGlobal.instance != null) { var tag = this.GetTag(); TweenerGlobal.instance.removeTweens(tag); if (immediately == false && delay > 0f) { TweenerGlobal.instance.addTween(this, delay, 0f, 0f).tag(tag).onComplete(() => { callbackInner.Invoke(); }).onCancel((obj) => { callbackInner.Invoke(); }); } else { callbackInner.Invoke(); } } else { callbackInner.Invoke(); } }
private void DoShowBegin_INTERNAL(AppearanceParameters parameters) { if (this.IsStateReadyToShow() == false && parameters.GetForced(defaultValue: false) == false) { this.RefreshComponentState(); parameters.Call(); return; } this.SetComponentState(WindowObjectState.Showing); WindowSystem.GetEvents().Raise(this, WindowEventType.OnShowBegin); var window = this.GetWindow(); if (window != null) { var canvas = window.GetCanvas(); if (canvas != null) { canvas.pixelPerfect = false; } } var parametersCallback = parameters.callback; System.Action onResult = () => { if (window != null) { var canvas = window.GetCanvas(); if (canvas != null) { WindowSystem.ApplyToSettingsInstance(null, canvas, this.GetWindow()); } } if (parametersCallback != null) { parametersCallback.Invoke(); } }; #if DEBUGBUILD Profiler.BeginSample("WindowComponentBase::OnShowBegin()"); #endif WindowSystem.RunSafe(this.OnShowBegin); WindowSystem.RunSafe(this.OnShowBegin, parameters); #if DEBUGBUILD Profiler.EndSample(); #endif var includeChilds = parameters.GetIncludeChilds(defaultValue: true); var childsBehaviour = parameters.GetChildsBehaviourMode(this.childsShowMode); if (childsBehaviour == ChildsBehaviourMode.Consequentially) { var resetAnimation = parameters.GetResetAnimation(defaultValue: true); if (resetAnimation == true) { if (includeChilds == true) { this.DoResetState(); } else { this.SetResetState(); } } } #region Include Childs if (includeChilds == false) { // without childs this.DoShowBeginAnimation_INTERNAL(onResult, parameters); return; } #endregion this.RunChilds_INTERNAL(parameters, onResult, this.DoShowBeginAnimation_INTERNAL, (e, p) => e.DoShowBegin(p)); /*if (childsBehaviour == ChildsBehaviourMode.Simultaneously) { * #region Childs Simultaneously * var counter = 0; * System.Action callback = () => { * ++counter; * if (counter < 2) return; * * onResult.Invoke(); * * }; * * this.DoShowBeginAnimation_INTERNAL(callback, parameters); * * ME.Utilities.CallInSequence(callback, this.subComponents, (e, c) => { * * e.DoShowBegin(parameters.ReplaceCallback(c)); * * }); #endregion * * } else if (childsBehaviour == ChildsBehaviourMode.Consequentially) { * #region Childs Consequentially * ME.Utilities.CallInSequence(() => { * * this.DoShowBeginAnimation_INTERNAL(onResult, parameters); * * }, this.subComponents, (e, c) => { * * e.DoShowBegin(parameters.ReplaceCallback(c)); * * }, waitPrevious: true); #endregion * * }*/ }
private void DoShowBegin_INTERNAL(AppearanceParameters parameters) { if ((this.GetComponentState() == WindowObjectState.Showing || this.GetComponentState() == WindowObjectState.Shown) && parameters.GetForced(defaultValue: false) == false) { parameters.Call(); return; } this.SetComponentState(WindowObjectState.Showing); WindowSystem.GetEvents().Raise(this, WindowEventType.OnShowBegin); var parametersCallback = parameters.callback; System.Action onResult = () => { if (parametersCallback != null) { parametersCallback.Invoke(); } }; #if DEBUGBUILD Profiler.BeginSample("WindowComponentBase::OnShowBegin()"); #endif WindowSystem.RunSafe(this.OnShowBegin); WindowSystem.RunSafe(this.OnShowBegin, parameters); #if DEBUGBUILD Profiler.EndSample(); #endif var includeChilds = parameters.GetIncludeChilds(defaultValue: true); var childsBehaviour = parameters.GetChildsBehaviourMode(this.childsShowMode); if (childsBehaviour == ChildsBehaviourMode.Consequentially) { var resetAnimation = parameters.GetResetAnimation(defaultValue: true); if (resetAnimation == true) { if (includeChilds == true) { this.DoResetState(); } else { this.SetResetState(); } } } #region Include Childs if (includeChilds == false) { // without childs this.DoShowBeginAnimation_INTERNAL(onResult, parameters); return; } #endregion if (childsBehaviour == ChildsBehaviourMode.Simultaneously) { #region Childs Simultaneously var counter = 0; System.Action callback = () => { ++counter; if (counter < 2) { return; } onResult.Invoke(); }; this.DoShowBeginAnimation_INTERNAL(callback, parameters); ME.Utilities.CallInSequence(callback, this.subComponents, (e, c) => { e.DoShowBegin(parameters.ReplaceCallback(c)); }); #endregion } else if (childsBehaviour == ChildsBehaviourMode.Consequentially) { #region Childs Consequentially ME.Utilities.CallInSequence(() => { this.DoShowBeginAnimation_INTERNAL(onResult, parameters); }, this.subComponents, (e, c) => { e.DoShowBegin(parameters.ReplaceCallback(c)); }, waitPrevious: true); #endregion } }
private void DoHideBeginAnimation_INTERNAL(System.Action callback, AppearanceParameters parameters) { if (TweenerGlobal.instance == null) return; var resetAnimation = parameters.GetResetAnimation(defaultValue: false); var immediately = parameters.GetImmediately(defaultValue: false); var delay = parameters.GetDelay(defaultValue: 0f); System.Action callbackInner = () => { if (this.animation != null) { if (resetAnimation == true) this.SetResetState(); if (immediately == true) { this.animation.SetOutState(this.animationInputParams, this.GetWindow(), this); callback.Invoke(); } else { this.animation.Play(this.GetWindow(), this.animationInputParams, this, false, callback); } } else { callback.Invoke(); } }; if (TweenerGlobal.instance != null) { var tag = this.GetTag(); TweenerGlobal.instance.removeTweens(tag); if (immediately == false && delay > 0f) { TweenerGlobal.instance.addTween(this, delay, 0f, 0f).tag(tag).onComplete(() => { callbackInner.Invoke(); }).onCancel((obj) => { callbackInner.Invoke(); }); } else { callbackInner.Invoke(); } } else { callbackInner.Invoke(); } }