private void DoHideBegin_INTERNAL(AppearanceParameters parameters) { if (this.IsStateReadyToHide() == false && parameters.GetForced(defaultValue: false) == false) { this.RefreshComponentState(); parameters.Call(); return; } this.SetComponentState(WindowObjectState.Hiding); WindowSystem.GetEvents().Raise(this, WindowEventType.OnHideBegin); 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::OnHideBegin()"); #endif WindowSystem.RunSafe(this.OnHideBegin); WindowSystem.RunSafe(this.OnHideBegin, parameters); #if DEBUGBUILD Profiler.EndSample(); #endif var includeChilds = parameters.GetIncludeChilds(defaultValue: true); #region Include Childs if (includeChilds == false) { // without childs this.DoHideBeginAnimation_INTERNAL(onResult, parameters); return; } #endregion this.RunChilds_INTERNAL(parameters, onResult, this.DoHideBeginAnimation_INTERNAL, (e, p) => e.DoHideBegin(p)); /* * var childsBehaviour = parameters.GetChildsBehaviourMode(this.childsHideMode); * if (childsBehaviour == ChildsBehaviourMode.Simultaneously) { * #region Childs Simultaneously * var counter = 0; * System.Action callback = () => { * ++counter; * if (counter < 2) return; * * onResult.Invoke(); * * }; * * this.DoHideBeginAnimation_INTERNAL(callback, parameters); * * ME.Utilities.CallInSequence(callback, this.subComponents, (e, c) => { * * e.DoHideBegin(parameters.ReplaceCallback(c)); * * }); #endregion * * } else if (childsBehaviour == ChildsBehaviourMode.Consequentially) { * #region Childs Consequentially * ME.Utilities.CallInSequence(() => { * * this.DoHideBeginAnimation_INTERNAL(onResult, parameters); * * }, this.subComponents, (e, c) => { * * e.DoHideBegin(parameters.ReplaceCallback(c)); * * }, waitPrevious: true); #endregion * * }*/ }
internal void Init(float depth, float zDepth, int raycastPriority, int orderInLayer) { this.currentState = WindowObjectState.Initializing; if (this.isReady == false) { this.currentState = WindowObjectState.NotInitialized; Debug.LogError("Can't initialize window instance because of some components were not installed properly.", this); return; } this.SetDepth(depth, zDepth); if (Application.isPlaying == true) { if (this.preferences.IsDontDestroyOnSceneChange() == true) { GameObject.DontDestroyOnLoad(this.gameObject); } } if (this.passParams == true) { if (this.parameters != null && this.parameters.Length > 0) { System.Reflection.MethodInfo methodInfo; if (WindowSystem.InvokeMethodWithParameters(out methodInfo, this, "OnParametersPass", this.parameters) == true) { // Success methodInfo.Invoke(this, this.parameters); } else { // Method not found Debug.LogWarning("Method `OnParametersPass` was not found with input parameters.", this); } } if (this.onParametersPassCall != null) { this.onParametersPassCall(this); } } else { this.OnEmptyPass(); } if (this.setup == false) { this.Setup(this); #if UNITY_EDITOR Profiler.BeginSample("WindowBase::OnPreInit()"); #endif this.OnPreInit(); #if UNITY_EDITOR Profiler.EndSample(); #endif #if UNITY_EDITOR Profiler.BeginSample("WindowBase::OnInit()"); #endif this.DoLayoutInit(depth, raycastPriority, orderInLayer); WindowSystem.ApplyToSettingsInstance(this.workCamera, this.GetCanvas()); this.OnModulesInit(); this.OnAudioInit(); this.events.DoInit(); this.OnTransitionInit(); if (WindowSystem.IsCallEventsEnabled() == true) { this.OnInit(); } #if UNITY_EDITOR Profiler.EndSample(); #endif this.setup = true; } this.activeIteration = -1; this.SetActive(); if (this.preferences.sendActiveState == true) { WindowSystem.SendInactiveStateByWindow(this); } this.currentState = WindowObjectState.Initialized; }