Exemplo n.º 1
0
        public async Task <UIComponent> Open(string winName, GameObject go = null)
        {
            UIComponent component = Get(winName) ?? await AddWindow(winName, go);

            if (!OpenItems.Contains(component))
            {
                OpenItems.Add(component);
            }
            else
            {
                Debug.LogWarning($"{winName} is already open");
                return(component);
            }

            if (component.AutoShow)
            {
                component.rectTransform.gameObject.Show();
            }

            if (component.ModuleUI)
            {
                if (!ModuleUiItems.Contains(component))
                {
                    ModuleUiItems.Add(component);
                    component.AddComponent <TopViewComponent>();
                }

                component.rectTransform.SetAsLastSibling();
            }
            else
            {
                component.SetWindowLayer(Transform.childCount - 1 - ModuleUiItems.Count);
            }

            if (component.rectTransform.gameObject.activeSelf)
            {
                RunSystemAndChild <IUIOpen>(component);
            }
            else
            {
                World.Instance.RunSystemOfTag <IUIOpen>(component);
            }

            if (!component.ModuleUI)
            {
                TopView = component;
            }

            if (component.TryGetComponent <UIAnimaComponent>(out var anima))
            {
                World.Instance.RunSystemOfTag <IUIOpen>(anima);
                await anima.Open();
            }

            return(component);
        }
Exemplo n.º 2
0
 public void OpenFile(string path)
 {
     try
     {
         FileTypeTabItemViewModelBase item = Utility.GetViewModelForFile(path);
         OpenItems.Add(item);
         SelectedItem = item;
     }
     catch (Exception ex)
     {
         Log.Error(ex.Message);
         MessageBox.Show(ex.Message, "Error");
     }
 }