private void Update() { if (toOpen.Count > 0) { windowIDs.AddRange(toOpen); lastID = toOpen[toOpen.Count - 1]; toOpen.Clear(); } if (toClose.Count > 0) { windowIDs.RemoveAll(id => toClose.Contains(id)); toClose.Clear(); if (!windowIDs.Contains(lastID) && windowIDs.Count > 0) { lastID = windowIDs[windowIDs.Count - 1]; } } if (windowIDs.Count == 0) { return; } foreach (string id in windowIDs) { SystemWindow window = WindowManager.WINDOWS[id]; window.OnUpdate(id.Equals(lastID)); } }