using System.Collections.Generic; using UnityEngine; namespace COM3D2.MeidoPhotoStudio.Plugin { using static Constants; internal class WindowManager : IManager { private Dictionary Windows = new Dictionary(); 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(); } } } }