/// <summary> /// Updates the 5th hint. Returns true if the 5th room objective is complete. /// </summary> /// <returns></returns> private static bool CompletedHint5() { bool completedObjective = true; DemoCharacter.hints[4] = ""; foreach (var state in EditorFullscreenState.fullscreenState.window) { if (state.IsFullscreen && state.WindowType != EditorFullscreenState.MainWindowType && EditorDisplay.ClosestToPoint(state.FullscreenAtPosition).Bounds.Contains(EditorMainWindow.position.center)) { completedObjective = false; var fullscreenOption = state.FullscreenOptions; string openAtPos, keysDownString; GetInfoForFullscreenOption(fullscreenOption, out openAtPos, out keysDownString); var windowName = state.WindowType.ToString(); if (windowName.Contains(".")) { windowName = windowName.Split(".".ToCharArray())[1]; } windowName = EditorFullscreenSettings.FormatCamelCaseName(windowName); DemoCharacter.hints[4] += "Press " + keysDownString + " to close the " + windowName; if (fullscreenOption.openAtPosition == EditorFullscreenSettings.OpenFullscreenAtPosition.AtMousePosition) { DemoCharacter.hints[4] += "\n(mouse must be hovering over the window)"; } DemoCharacter.hints[4] += "\n"; } } return(completedObjective); }
private static void GetInfoForFullscreenOption(EditorFullscreenSettings.FullscreenOption fullscreenOption, out string openAtPos, out string keysDownString) { if (fullscreenOption.openAtPosition == EditorFullscreenSettings.OpenFullscreenAtPosition.AtSpecifiedPosition) { openAtPos = "at the position: " + fullscreenOption.position; } else { openAtPos = EditorFullscreenSettings.FormatCamelCaseName(fullscreenOption.openAtPosition.ToString()).ToLower().Replace("at ", "at the "); } keysDownString = EditorInput.GetKeysDownString(fullscreenOption.hotkey, fullscreenOption.modifiers); }
static void OnFullscreenEvent(object window, Type windowType, Vector2 atPosition, bool enteredFullscreen) { if (enteredFullscreen) { lastFullscreenedWindowType = windowType; } bool toggledTopToolbar = false; if (window != null) { var fullscreenOps = EditorFullscreenSettings.GetFullscreenOptionsForWindowType(windowType); EditorFullscreenState.WindowFullscreenState state = null; if (windowType == EditorFullscreenState.mainWindowType) { state = EditorFullscreenState.FindWindowState(null, windowType); } else if (window != null) { state = EditorFullscreenState.FindWindowState((EditorWindow)window); } if (state != null) { toggledTopToolbar = state.ShowTopToolbar != fullscreenOps.showToolbarByDefault; } } var character = DemoCharacter.instance; bool completedRoom = false; int currentRoom = character.enteredRooms.Count; switch (currentRoom) { case 1: if (windowType == EditorFullscreenState.mainWindowType && enteredFullscreen) { completedRoom = true; } break; case 2: if (windowType == EditorFullscreenState.gameViewType && enteredFullscreen) { completedRoom = true; } break; case 3: if (DemoCharacter.hints[2].Contains("ANOTHER")) { //Must have game view fullscreen and open fullscreens scene view on another screen. bool gameViewIsFullscreen = EditorFullscreenController.WindowTypeIsFullscreen(EditorFullscreenState.gameViewType); bool sceneViewIsFullscreen = EditorFullscreenController.WindowTypeIsFullscreen(EditorFullscreenState.sceneViewType); if (enteredFullscreen && gameViewIsFullscreen && sceneViewIsFullscreen && (windowType == EditorFullscreenState.gameViewType || windowType == EditorFullscreenState.sceneViewType)) { completedRoom = true; } } else { //Only have to open the scene view. if (windowType == EditorFullscreenState.sceneViewType && enteredFullscreen) { completedRoom = true; } } break; case 4: if (windowType == EditorFullscreenState.gameViewType && toggledTopToolbar) { completedRoom = true; } if (completedRoom || DemoCharacter.completedRooms == 4) { if (CompletedHint5() == true) { character.CompleteRoom(5, true); } } break; case 5: if (CompletedHint5() == true) { completedRoom = true; //Must have closed the window covering the main window. } break; case 8: if (enteredFullscreen && windowType == null) //windowType is null when closing all fullscreen editor windows. In this case enteredFullscreen is true if at least one fullscreen window was closed. { completedRoom = true; } break; case 9: if (!enteredFullscreen && windowType == typeof(EditorFullscreenSettingsWindow)) { completedRoom = true; } break; } if (completedRoom) { character.CompleteRoom(currentRoom); } }