Пример #1
0
 /// <summary>
 /// 隐藏当前UI
 /// </summary>
 public void HideUI()
 {
     if (CurrentUI == null)
     {
         return;
     }
     CurrentUI.OnClose();
 }
Пример #2
0
        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();
                }
            }
        }
Пример #3
0
 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;
 }
Пример #4
0
        /// <summary>
        /// 设置UI
        /// </summary>
        /// <param name="ui"></param>
        public void SetUI(UI_Base ui)
        {
            if (CurrentUI == ui)
            {
                return;
            }

            if (CurrentUI != null)
            {
                CurrentUI.OnClose();
            }

            CurrentUI = ui;
        }
Пример #5
0
    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;
    }
Пример #6
0
    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);
    }
Пример #7
0
 void CloseWindow()
 {
     CurrentUI.Closed -= CurrentUI_Closed;
     CurrentUI.Close();
 }