void UpdateBackground(bool anyScreenVisible, bool force) { if (m_Background == null) { return; } bool display = m_BackgroundCustomVisibility && anyScreenVisible; float tweenFrom = m_Background.FadeAlpha; float tweenTo = 0.0f; m_Tweener.StopTweens(false); if (display == true) { tweenTo = 1.0f; if (m_Background.Visible == false) { m_Background.ShowImmediate(true); } } else if (display == false) { tweenTo = 0.0f; if (force == true) { m_Background.ShowImmediate(false); } } if (force == true) { m_Background.SetFadeAlpha(tweenTo, true); } else { m_BackgroundAlpha = tweenFrom; m_Tweener.TweenTo(this, "m_BackgroundAlpha", tweenTo, 0.15f, Tween.Easing.Linear.EaseNone, (tween, finished) => { m_Background.SetFadeAlpha(m_BackgroundAlpha, true); if (finished == true && m_Background.FadeAlpha == 0.0f) { m_Background.ShowImmediate(false); } }); } }
void Suspend(bool suspend) { if (m_Initialised && m_Visible) { //m_Pivot.Show(!suspend); m_Layout.ShowImmediate(!suspend, false); m_Suspended = suspend; } }
//--------------------------------------------------------- void LateUpdate() { if (m_UiCamera.enabled == false) { return; } #if UNITY_EDITOR // AX : Debug code for testing localizations... if (Input.GetKeyDown(KeyCode.Keypad0)) { Debug.Log("Input.GetKeyDown(KeyCode.Keypad0) -> English.Old"); TextDatabase.instance.Reload(SystemLanguage.English); OnLanguageChanged("English.Old"); } else if (Input.GetKeyDown(KeyCode.Keypad1)) { Debug.Log("Input.GetKeyDown(KeyCode.Keypad1) -> English"); TextDatabase.instance.Reload(SystemLanguage.English); OnLanguageChanged("English"); } else if (Input.GetKeyDown(KeyCode.Keypad2)) { Debug.Log("Input.GetKeyDown(KeyCode.Keypad2) -> German"); TextDatabase.instance.Reload(SystemLanguage.German); OnLanguageChanged("German"); } else if (Input.GetKeyDown(KeyCode.Keypad3)) { Debug.Log("Input.GetKeyDown(KeyCode.Keypad3) -> French"); TextDatabase.instance.Reload(SystemLanguage.French); OnLanguageChanged("French"); } else if (Input.GetKeyDown(KeyCode.Keypad4)) { Debug.Log("Input.GetKeyDown(KeyCode.Keypad4) -> Italian"); TextDatabase.instance.Reload(SystemLanguage.Italian); OnLanguageChanged("Italian"); } else if (Input.GetKeyDown(KeyCode.Keypad5)) { Debug.Log("Input.GetKeyDown(KeyCode.Keypad5) -> Spanish"); TextDatabase.instance.Reload(SystemLanguage.Spanish); OnLanguageChanged("Spanish"); } else if (Input.GetKeyDown(KeyCode.Keypad6)) { Debug.Log("Input.GetKeyDown(KeyCode.Keypad6) -> Russian"); TextDatabase.instance.Reload(SystemLanguage.Russian); OnLanguageChanged("Russian"); } else if (Input.GetKeyDown(KeyCode.Keypad7)) { Debug.Log("Input.GetKeyDown(KeyCode.Keypad7) -> Chinese"); TextDatabase.instance.Reload(SystemLanguage.Chinese); OnLanguageChanged("Chinese"); } else if (Input.GetKeyDown(KeyCode.Keypad8)) { Debug.Log("Input.GetKeyDown(KeyCode.Keypad8) -> Japanese"); TextDatabase.instance.Reload(SystemLanguage.Japanese); OnLanguageChanged("Japanese"); } else if (Input.GetKeyDown(KeyCode.Keypad9)) { Debug.Log("Input.GetKeyDown(KeyCode.Keypad9) -> Korean"); TextDatabase.instance.Reload(SystemLanguage.Korean); OnLanguageChanged("Korean"); } #endif //UNITY_EDITOR // update layouts foreach (var layout in m_Layouts) { if (layout == null) { continue; } if (layout.IsVisible() == true || layout.IsDirty == true) { layout.GUIUpdate(1.0f); } } // Show/Hide widgets (in order of demands) if (m_ObjectsToChangeVisibility != null && m_ObjectsToChangeVisibility.Count > 0) { List <S_ObjectToChangeVisibility> objectsToChangeVisibility = new List <S_ObjectToChangeVisibility>(m_ObjectsToChangeVisibility.Count); objectsToChangeVisibility.AddRange(m_ObjectsToChangeVisibility); m_ObjectsToChangeVisibility.RemoveRange(0, m_ObjectsToChangeVisibility.Count); foreach (var vObj in objectsToChangeVisibility) { GUIBase_Layout layout = vObj.m_GObj.GetComponent <GUIBase_Layout>(); if (layout != null) { layout.ShowImmediate(vObj.m_Visible); } else { GUIBase_Widget widget = vObj.m_GObj.GetComponent <GUIBase_Widget>(); if (widget != null) { widget.ShowImmediate(vObj.m_Visible, vObj.m_Recursive); } } } } // activate / deactivate GUI renderers acording to its active sprites if (m_RenderersForActivation.Count > 0) { foreach (MFGuiRenderer renderer in m_RenderersForActivation) { if (renderer == null) { continue; } bool shouldBeActive = renderer.IsAnySpriteActive(); GameObject renderObj = renderer.gameObject; if (shouldBeActive != renderObj.activeSelf) { renderObj.SetActive(shouldBeActive); } } m_RenderersForActivation.Clear(); } }