public override void SetLanguage(GameLanguageManager.SupportedLanguage language) { // Set the helper window header's language display. m_HelperWindowHeaderText.text = GameLanguageManager.GetText(GameLanguageManager.KeyWord.Help_WindowHeaderText, language); // Set the helper window categroy tip's language display. m_HelpInfoCategroyTip.text = GameLanguageManager.GetText(GameLanguageManager.KeyWord.Help_WindowCategoryText, language); // Set the dropdown menu's language diaplay. for (int index = 0; index < m_HelpInfoCategory.options.Count; index++) { m_HelpInfoCategory.options[index].text = HelperInfoManager.GetCategroyText((HelperInfoManager.HelpInfoCategory)index); } // Reset dropdown menu. m_HelpInfoCategory.value = 1; m_HelpInfoCategory.value = 0; m_CurrentSelectedCategoryIndex = 0; // Set the helper info list's language display. OnUpdateHelperInfoButtonList(m_CurrentSelectedCategoryIndex); // Set the helper window's return button's language display. m_ReturnButton.GetComponentInChildren <Text>().text = GameLanguageManager.GetText(GameLanguageManager.KeyWord.Help_ReturnButtonText, language); }
public override void InitUI() { base.InitUI(); Properties = new UIProperties( UIManager.SceneUIs.HelperWindowUI, UIManager.DisplayUIMode.HideOthers, UIManager.UITypes.AboveBlurEffect, false, true, true); #region Help info category dropdown menu if (m_HelpInfoCategory) { foreach (var item in Enum.GetValues(typeof(HelperInfoManager.HelpInfoCategory))) { m_HelpInfoCategory.options.Add(new Dropdown.OptionData() { text = HelperInfoManager.GetCategroyText((HelperInfoManager.HelpInfoCategory)item) }); } // We need this step to refresh the options list. m_HelpInfoCategory.value = 1; m_HelpInfoCategory.value = 0; // Set default values. m_CurrentSelectedCategoryIndex = 0; // Add event listener to the drop down menu. m_HelpInfoCategory.onValueChanged.AddListener((value) => OnSeletedHelperCategory(value)); } #endregion #region Help info list // Populate the help info buttons. if (HelpInfoButtonPrefab) { m_ButtonList.Clear(); for (int index = 0; index < m_HelpInfoButtonCount; index++) { HelpInfoButtonUI button = Instantiate(HelpInfoButtonPrefab).GetComponent <HelpInfoButtonUI>(); GameUtility.AddChildToParent(m_HelpInfoListRoot, button.transform); m_ButtonList.Add(button); button.Init(index); } OnUpdateHelperInfoButtonList(m_CurrentSelectedCategoryIndex); } else { #if UNITY_EDITOR Debug.LogError("HelpInfoButtonPrefab is NULL"); #endif } #endregion #region Helper info contents #if UNITY_EDITOR if (!m_HelperInfoHeader) { Debug.LogError("Helper info header is null"); } if (!m_HelperInfoImage) { Debug.LogError("Helper info image is null"); } if (!m_HelperInfoContext) { Debug.LogError("Helper info context is null"); } #endif #endregion #region Window active animation m_Animator = GetComponent <Animator>(); #if UNITY_EDITOR if (!m_Animator) { Debug.LogError("Animator component in " + this.gameObject.name + " is null."); } #endif #endregion if (!m_HelperWindowHeaderText) { Debug.LogError("Header text component in " + this.gameObject.name + " is null."); } if (!m_ReturnButton) { Debug.LogError("Return button component in " + this.gameObject.name + " is null."); } m_ReturnButton.onClick.AddListener(delegate { OnClickReturnButton(); }); SetLanguage(GameLanguageManager.CurrentLanguage); }