/// <summary> /// 隐藏当前UI /// </summary> public void HideUI() { if (CurrentUI == null) { return; } CurrentUI.OnClose(); }
public ImportForm() { InitializeComponent(); importerSelection.SelectedIndexChanged += ImporterSelectionChanged; Closed += ImportFormClosed; importerSelection.BeginUpdate(); Assembly assembly = Assembly.GetExecutingAssembly(); foreach (Type type in assembly.GetTypes()) { Attribute[] attributes = Attribute.GetCustomAttributes(type); foreach (var attribute in attributes.OfType <ImporterUIAttribute>()) { if (!attribute.ImporterType.GetInterfaces().Contains(typeof(IImporter <WordList>))) { continue; } var importerAttribute = (ImporterAttribute)Attribute.GetCustomAttribute(attribute.ImporterType, typeof(ImporterAttribute)); if (importerAttribute == null) { continue; } var descAttribute = (ImporterDescriptionAttribute)Attribute.GetCustomAttribute(attribute.ImporterType, typeof(ImporterDescriptionAttribute)); string name = importerAttribute.Name; string description = type.Name; if (descAttribute != null) { description = Resources.ImporterDescriptions.ResourceManager.GetString( descAttribute.ResourceIdentifier, CultureInfo.CurrentUICulture) ?? descAttribute.Description ?? description; } if (name != null) { importerSelection.Items.Add(new ImporterItem(type, name, description)); } } } importerSelection.EndUpdate(); if (importerSelection.Items.Count > 0) { importerSelection.SelectedIndex = 0; if (CurrentUI != null) { CurrentUI.Focus(); } } }
public void OffAllUnderPanels() { currentUI = CurrentUI.NONE; p_Inventory.SetActive(false); p_Growth.SetActive(false); p_Travel.SetActive(false); p_Reward.SetActive(false); p_Settings.SetActive(false); b_Growth.interactable = true; b_Reward.interactable = true; b_Travel.interactable = true; b_Settings.interactable = true; b_Inventory.interactable = true; }
/// <summary> /// 设置UI /// </summary> /// <param name="ui"></param> public void SetUI(UI_Base ui) { if (CurrentUI == ui) { return; } if (CurrentUI != null) { CurrentUI.OnClose(); } CurrentUI = ui; }
private void Awake() { if (instance == null) { instance = this; } b_Inventory.onClick.AddListener(OnInventory); b_Growth.onClick.AddListener(OnGrowth); b_Travel.onClick.AddListener(OnTravel); b_Reward.onClick.AddListener(OnReward); b_Settings.onClick.AddListener(OnSettings); currentUI = CurrentUI.NONE; }
public void OnSettings() { b_Settings.interactable = false; AnimateClose(); currentUI = CurrentUI.SETTINGS; p_Settings.SetActive(true); a_Settings.clip = c_PanelIn; a_Settings.Play(); b_Growth.interactable = true; b_Reward.interactable = true; b_Travel.interactable = true; //b_Settings.interactable = true; b_Inventory.interactable = true; //p_Inventory.SetActive(false); //p_Growth.SetActive(false); //p_Travel.SetActive(false); //p_Reward.SetActive(false); }
void CloseWindow() { CurrentUI.Closed -= CurrentUI_Closed; CurrentUI.Close(); }