Example #1
0
 public object GetOpenWindowData(WindowEnum windowEnum)
 {
     if (!m_OpenWindowDatas.ContainsKey(windowEnum))
     {
         return(null);
     }
     return(m_OpenWindowDatas[windowEnum]);
 }
Example #2
0
 /// <summary>
 /// 查找界面
 /// </summary>
 /// <param name="windowEnum"></param>
 /// <returns></returns>
 public WindowBaseView GetWindow(WindowEnum windowEnum)
 {
     foreach (WindowGroupComponent windowGroupComponent in m_WindowGroupComponents.Values)
     {
         WindowBaseView windowBase = windowGroupComponent.GetWindow((int)windowEnum);
         if (windowBase != null)
         {
             return(windowBase);
         }
     }
     return(null);
 }
Example #3
0
        public Window CreateWindow(WindowEnum winEnum)
        {
            object vm;

            switch (winEnum)
            {
            case WindowEnum.StartWindow:
                vm = viewModels.FirstOrDefault <object>(x => x.GetType() == typeof(StartWindow_ViewModel));
                if (vm == null)
                {
                    vm = new StartWindow_ViewModel(core);
                    viewModels.Add(vm);
                }
                return(new StartWindow(vm as StartWindow_ViewModel));

            case WindowEnum.ProjectView:
                vm = viewModels.FirstOrDefault <object>(x => x.GetType() == typeof(ProjectViewer_ViewModel));
                if (vm == null)
                {
                    vm = new ProjectViewer_ViewModel(core);
                    viewModels.Add(vm);
                }
                return(new ProjectViewer(vm as ProjectViewer_ViewModel));

            case WindowEnum.NewFile:
                vm = viewModels.FirstOrDefault <object>(x => x.GetType() == typeof(NewFile_ViewModel));
                if (vm == null)
                {
                    vm = new NewFile_ViewModel(core);
                    viewModels.Add(vm);
                }
                return(new NewFile(vm as NewFile_ViewModel));

            case WindowEnum.Editor:
                vm = viewModels.FirstOrDefault <object>(x => x.GetType() == typeof(Editor_ViewModel));
                if (vm == null)
                {
                    vm = new Editor_ViewModel(core);
                    viewModels.Add(vm);
                }
                return(new Editor(vm as Editor_ViewModel));

            default:
                return(null);
            }
        }
Example #4
0
    /// <summary>
    /// 打开界面
    /// </summary>
    /// <param name="windowEnum"></param>
    /// <param name="userData"></param>
    public void OpenWindow(WindowEnum windowEnum, object userData = null)
    {
        WindowConfig         config = WindowConfigList.Instance.GetConfig((int)windowEnum);
        WindowGroupComponent windowGroupComponent = m_WindowGroupComponents[config.WindowGroup];

        if (config.Singleton)
        {
            WindowBaseView windowBase = GetWindow(windowEnum);
            if (windowBase != null)
            {
                return;
            }
        }

        windowModel.AddOpenWindowData(windowEnum, userData);

        string assetPath = AssetPathUtil.GetWindowAssetPath(config.AssetName);

        Addressables.InstantiateAsync(assetPath, windowGroupComponent.transform, false).Completed += (aoh) =>
        {
            Debug.LogWarning("111");
            WindowBaseView baseWindow = aoh.Result.GetOrAddComponent <WindowBaseView>();
            baseWindow.config = config;

            if (config.PauseCovered)
            {
                LinkedList <WindowBaseView> allWindows = windowGroupComponent.GetAllWindows();
                foreach (WindowBaseView window in allWindows)
                {
                    if (window.isActiveAndEnabled)
                    {
                        window.gameObject.SetActive(false);
                    }
                }
            }

            windowGroupComponent.AddWindow(baseWindow);
            MobiusMediator mobiusMediator = aoh.Result.GetComponent <MobiusMediator>();
            mobiusMediator.windowEnum = windowEnum;
            Debug.LogWarning("222");
        };
    }
Example #5
0
    /// <summary>
    /// 关闭界面
    /// </summary>
    /// <param name="windowEnum"></param>
    public void CloseWindow(WindowEnum windowEnum)
    {
        WindowBaseView windowBase = GetWindow(windowEnum);

        if (windowBase == null)
        {
            return;
        }
        WindowConfig         config = WindowConfigList.Instance.GetConfig((int)windowEnum);
        WindowGroupComponent windowGroupComponent = m_WindowGroupComponents[config.WindowGroup];
        WindowBaseView       windowPrevious       = windowGroupComponent.GetWindowToLast(1);

        if (windowPrevious != null)
        {
            if (!windowPrevious.isActiveAndEnabled)
            {
                windowPrevious.gameObject.SetActive(true);
            }
        }
        Addressables.ReleaseInstance(windowBase.gameObject);
        windowGroupComponent.RemoveWindow(windowBase);
    }
 public static void transTo(WindowEnum transToenum, SceneEnum newScene = SceneEnum.None)
 {
     isFiristInitDone = true;
     if (newScene != SceneEnum.None)
     {
         ignoreNextOnHideCompleteEvent = true;
         currentWindow.hide();
         //lastTransToenum = transToenum;
         CustomSceneLoader._inst.loadScene(newScene);
     }
     else
     {
         foreach (var win in UIWindow.windows)
         {
             if (win.window == transToenum)
             {
                 targetWindow = win;
             }
         }
         SoundManager._inst.playSoundOnce(SoundEnum.UISwipe);
         currentWindow.hide();
     }
 }
Example #7
0
 public void CreateWindow(WindowEnum winEnum)
 {
     windowFactory.CreateWindow(winEnum).Show();
 }
Example #8
0
 public bool?CreateWindowDialog(WindowEnum winEnum)
 {
     return(windowFactory.CreateWindow(winEnum).ShowDialog());
 }
Example #9
0
 public void AddOpenWindowData(WindowEnum windowEnum, object userData)
 {
     m_OpenWindowDatas[windowEnum] = userData;
 }