1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using System.Collections.Generic;
- using UnityEngine;
- namespace COM3D2.MeidoPhotoStudio.Plugin
- {
- using static Constants;
- internal class WindowManager : IManager
- {
- private Dictionary<Window, BaseWindow> Windows = new Dictionary<Window, BaseWindow>();
- public BaseWindow this[Window id]
- {
- get => Windows[id];
- set => Windows[id] = value;
- }
- public WindowManager() => InputManager.Register(MpsKey.ToggleUI, KeyCode.Tab, "Show/hide all UI");
- public void DrawWindow(BaseWindow window)
- {
- if (window.Visible)
- {
- GUIStyle windowStyle = new GUIStyle(GUI.skin.box);
- window.WindowRect = GUI.Window(window.windowID, window.WindowRect, window.GUIFunc, "", windowStyle);
- }
- }
- public void DrawWindows()
- {
- foreach (BaseWindow window in Windows.Values)
- {
- DrawWindow(window);
- }
- }
- public void Update()
- {
- foreach (BaseWindow window in Windows.Values)
- {
- window.Update();
- }
- }
- public void Activate()
- {
- foreach (BaseWindow window in Windows.Values)
- {
- window.Activate();
- }
- }
- public void Deactivate()
- {
- foreach (BaseWindow window in Windows.Values)
- {
- window.Deactivate();
- }
- }
- }
- }
|