public static void Update() { //Lặp trong list screen và loại bỏ những screen nào có biến Removed = true ra khỏi list int i = 0; while (i <= Screens.Count - 1) { if (Screens[i].Removed == true) { Screens.RemoveAt(i); i -= 1; } i += 1; } foreach (BaseScreen screen in NewScreens) { Screens.Add(screen); } NewScreens.Clear(); for (int j = Screens.Count - 1; j >= 0; j -= 1) { if (Screens[j].GrabFocus) { Screens[j].Focus = true; Screens[j].Active = true; FocusedScreen = Screens[j]; break; } } foreach (BaseScreen screen in Screens) { if (screen.Active) { screen.Update(); } else if (screen.Name == "World Screen") { ((WorldScreen)screen).MapName.Visible = false; } } }
public static void Update() { int i = 0; while (i <= Screens.Count - 1) { if (Screens[i].Removed == true) { Screens.RemoveAt(i); i -= 1; } i += 1; } foreach (BaseScreen screen in NewScreens) { Screens.Add(screen); } NewScreens.Clear(); for (int j = Screens.Count - 1; j >= 0; j -= 1) { if (Screens[j].GrabFocus) { Screens[j].Focus = true; Screens[j].Active = true; FocusedScreen = Screens[j]; break; } } foreach (BaseScreen screen in Screens) { if (screen != FocusedScreen) { screen.Active = false; } if (screen.Active) { screen.Update(); } } }
public static void AddScreen(BaseScreen screen) { NewScreens.Add(screen); }