private void SetWindowActive(Archetype window, bool value) { if (value == true && window.EnableComponent.Enable || value == false && !window.EnableComponent.Enable) { return; } switch (window.EnableComponent.TransitionType) { case WindowTransitionType.Fade: window.SetActive(true); float startAlpha = value == true ? 0 : 1; window.CanvasGroup.alpha = startAlpha; float targetAlpha = value == true ? 1 : 0; window.CanvasGroup.DOFade(targetAlpha, windowsSettingsRuntime.FadeTransitionDuration / 2) .OnComplete(() => FadeCompleteAction(window, value)); break; case WindowTransitionType.None: default: window.SetActive(value); break; } }
private void FadeCompleteAction(Archetype window, bool value) { void action() { window.SetActive(value); } if (value == false) { Invoke(action, windowsSettingsRuntime.TransitionDelay); } else { action(); } }