public void Quit() { MainMenuHandler.DisableInputReceive(); string title = "QUIT"; string message = "Do you really want to quit?"; if (Network.isServer) { message += " Other players will immediately get disconnected."; } UnityAction yesAction = () => { FindObjectOfType <GameManager>().LoadLevel("Main Menu", 0); Network.Disconnect(200); }; UnityAction noAction = () => { Destroy(confirmDialogInstance); confirmDialogInstance = null; MainMenuHandler.EnableInputReceive(); }; confirmDialogInstance = Instantiate(confirmDialogPrefab); ConfirmBox confirmDialogInfo = confirmDialogInstance.GetComponent <ConfirmBox>(); confirmDialogInfo.title.text = title; confirmDialogInfo.message.text = message; confirmDialogInfo.yesButton.onClick.AddListener(yesAction); confirmDialogInfo.noButton.onClick.AddListener(noAction); }
public void BackToMainMenu() { if (gameSettings.valueChanged) { string title = "UNSAVED CHANGES"; string message = "There are unsaved changes in the settings. Would you like to apply them first?"; UnityAction yesAction = () => { ApplySettings(); mainMenuHandler.GoToMainMenu(); Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); }; UnityAction noAction = () => { ResetSettings(); mainMenuHandler.GoToMainMenu(); Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); }; mainMenuHandler.ShowConfirmDialog(title, message, yesAction, noAction); } else { mainMenuHandler.GoToMainMenu(); } }
void OnEnable() { mainMenuHandler = GetComponent <MainMenuHandler>(); mainMenuCanvas = mainMenuHandler.mainMenuCanvas; MainMenuHandler.DisableAllCanvases(); mainMenuCanvas.enabled = true; }
void OnDisconnectedFromServer(NetworkDisconnection info) { foreach (NetworkView networkView in FindObjectsOfType <NetworkView>()) { if (networkView.stateSynchronization != NetworkStateSynchronization.Off) { Destroy(networkView.gameObject); } } if (Network.isClient) { if (info == NetworkDisconnection.Disconnected) { MainMenuHandler.DisableAllCanvases(); string title = "SERVER CLOSED"; string message = "The host left the game."; UnityAction okAction = () => { Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); mainMenuHandler.GoToMainMenu(); }; mainMenuHandler.ShowErrorDialog(title, message, okAction); } } }
public void Awake() { menuState = transform.parent.GetComponent <MainMenuHandler>(); anim = GetComponent <Animator>(); bg = GetComponentInChildren <Image>(); mainMenuHandler = transform.parent.GetComponent <IMainMenuHandler>(); }
void OnEnable() { mainMenuHandler = GetComponent<MainMenuHandler>(); joinGameCanvas = mainMenuHandler.joinGameCanvas; MainMenuHandler.DisableAllCanvases(); joinGameCanvas.enabled = true; }
public void OnTaskCompleted(int index) { PlaySound(taskCompletedSFX); if (menuHandlerClass == null) { menuHandlerClass = FindObjectOfType <MainMenuHandler>().GetComponent <MainMenuHandler>(); } menuHandlerClass.CompleteTask(index); }
public void OnPrevChapterArrowClicked() { PlaySound(buttonClick); if (menuHandlerClass == null) { menuHandlerClass = FindObjectOfType <MainMenuHandler>().GetComponent <MainMenuHandler>(); } menuHandlerClass.LeftArrowClicked(); }
public void LoadChapter() { PlaySound(wooshSFX); if (menuHandlerClass == null) { menuHandlerClass = FindObjectOfType <MainMenuHandler>().GetComponent <MainMenuHandler>(); } menuHandlerClass.LoadChapter(); }
void OnConnectedToServer() { Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); enabled = false; GetComponent <LobbyManager>().enabled = true; GetComponent <MenuLobby>().enabled = true; Network.Instantiate(mainMenuHandler.playerInfoPrefab, Vector3.zero, Quaternion.identity, 0); }
public void PlayerNameOK() { if (mainMenuHandler.dialogInstance.GetComponent <TextInputBox>().inputField.text != "") { ApplyPlayerName(mainMenuHandler.dialogInstance.GetComponent <TextInputBox>().inputField.text); Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); } }
void OnEnable() { mainMenuHandler = GetComponent<MainMenuHandler>(); createGameCanvas = mainMenuHandler.createGameCanvas; selectedGameMode = null; gameModeTitle.text = ""; gameModeDesc.text = ""; MainMenuHandler.DisableAllCanvases(); createGameCanvas.enabled = true; }
private void ErrorTeamNotSelected() { string title = "ERROR"; string message = "Not all players are in a team. Wait for them to choose a team."; UnityAction okAction = () => { MainMenuHandler.EnableInputReceive(); Destroy(mainMenuHandler.dialogInstance); }; mainMenuHandler.ShowErrorDialog(title, message, okAction); }
void OnEnable() { mainMenuHandler = GetComponent <MainMenuHandler>(); createGameCanvas = mainMenuHandler.createGameCanvas; selectedGameMode = null; gameModeTitle.text = ""; gameModeDesc.text = ""; MainMenuHandler.DisableAllCanvases(); createGameCanvas.enabled = true; }
public static void Main() { // Resolved deps. var output = new ConsoleOutput(); var characterService = new CharacterService(); var textGenerator = new TextGenerator(); var dialogModalScreenHandler = new DialogModalScreenHandler(textGenerator, output); var screenNavigation = new ScreenNavigation(dialogModalScreenHandler); var connectionManager = new ConnectionManager(); var mainMenuHandler = new MainMenuHandler(screenNavigation, connectionManager); var mainMenuPrinter = new MainMenuPrinter(output, characterService); var mainMenuScreenHandler = new MainMenuScreenHandler(textGenerator, mainMenuHandler, mainMenuPrinter); var characterCreationHandler = new CharacterCreationHandler(screenNavigation); var characterCreationPrinter = new CharacterCreationPrinter(output, characterService); var characterCreationScreenHandler = new CharacterCreationScreenHandler(textGenerator, characterCreationHandler, characterCreationPrinter); var screenProvider = new ScreenHandlerProvider(screenNavigation, mainMenuScreenHandler, characterCreationScreenHandler, dialogModalScreenHandler); // Authenticated and got list of characters from API. var characters = new[] { "1", "2", "ivan-id" }; mainMenuScreenHandler.UpdateState(new MainMenuState(characters)); while (true) { Console.Clear(); var screen = screenProvider.GetCurrentScreenHandler(); screen.PrintState(); var key = Console.ReadKey(); switch (key.Key) { case ConsoleKey.Escape: screen.Escape(); break; case ConsoleKey.Backspace: screen.Backspace(); break; case ConsoleKey.Tab: screen.Tab(); break; default: screen.Type(key.KeyChar); break; } } }
// Start is called before the first frame update void Start() { sounds = GetComponent <SoundHandler>(); containerRect = container.GetComponent <RectTransform>(); instance = this; perks = new UIPerksList(perkList, perkDescPrefab); perks.LoadPerks((perk, title, desc) => { perk.LevelUp(); title.text = $"{perk.Name} lvl {perk.Level}"; desc.text = perk.Description; }); }
public void StartButton() { if (ReservesCount() > 0) { ErrorTeamNotSelected(); return; } if (!CheckIfAllSelected()) { ErrorKartNotSelected(); return; } MainMenuHandler.DisableInputReceive(); StartCoroutine(CountDownToStart()); }
public void OnEnabled() { try { Log.Info("Attempting to patch Cities: Skylines using Harmony..."); _harmony = new Harmony("com.citiesskylinesmultiplayer"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); Log.Info("Successfully patched Cities: Skylines!"); } catch (Exception ex) { Log.Error("Patching failed", ex); } MainMenuHandler.CreateOrUpdateJoinGameButton(); Log.Info("Construction Complete!"); }
public void OnEnabled() { try { _logger.Info("Attempting to patch Cities: Skylines using Harmony..."); _harmony = new Harmony("net.gridentertainment.csm"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); _logger.Info("Successfully patched Cities: Skylines!"); } catch (Exception ex) { _logger.Error(ex, "Patching failed"); } MainMenuHandler.CreateOrUpdateJoinGameButton(); _logger.Info("Construction Complete!"); }
public void BackToPauseMenu() { if (gameSettings.valueChanged) { string title = "UNSAVED CHANGES"; string message = "There are unsaved changes in the settings. Would you like to apply them first?"; UnityAction yesAction = () => { ApplySettings(); FindObjectOfType <UIPauseMenu>().pauseCanvas.enabled = true; settingsCanvas.enabled = false; Destroy(dialogInstance); dialogInstance = null; MainMenuHandler.EnableInputReceive(); }; UnityAction noAction = () => { ResetSettings(); FindObjectOfType <UIPauseMenu>().pauseCanvas.enabled = true; settingsCanvas.enabled = false; Destroy(dialogInstance); dialogInstance = null; MainMenuHandler.EnableInputReceive(); }; MainMenuHandler.DisableInputReceive(); dialogInstance = Instantiate(confirmDialogBox); ConfirmBox confirmDialogInfo = dialogInstance.GetComponent <ConfirmBox>(); confirmDialogInfo.title.text = title; confirmDialogInfo.message.text = message; confirmDialogInfo.yesButton.onClick.AddListener(yesAction); confirmDialogInfo.noButton.onClick.AddListener(noAction); } else { FindObjectOfType <UIPauseMenu>().pauseCanvas.enabled = true; settingsCanvas.enabled = false; } }
private void ErrorTooManyOfSameKart(GameModeTeams teams) { string title = "ERROR"; string message = ""; switch (teams) { case GameModeTeams.None: message = "Two other players have already selected this kart. Choose something else."; break; case GameModeTeams.Two: message = "Your teammate has already selected this kart. Choose something else."; break; } UnityAction okAction = () => { MainMenuHandler.EnableInputReceive(); Destroy(mainMenuHandler.dialogInstance); }; mainMenuHandler.ShowErrorDialog(title, message, okAction); }
void OnEnable() { if (GetComponent <MainMenuHandler>() != null) { mainMenuHandler = GetComponent <MainMenuHandler>(); MainMenuHandler.DisableAllCanvases(); mainMenuHandler.settingsCanvas.enabled = true; } gameSettings = FindObjectOfType <GameSettings>(); fullScreenToggle.isOn = gameSettings.currentFS; vSyncToggle.isOn = gameSettings.currentVsync; SetResolutionText(); SetTextureQualityText(); SetAntiAliasingText(); motionBlurToggle.isOn = gameSettings.currentMotionBlur; audioVolumeSlider.value = gameSettings.currentAudioVolume; SetAudioVolumeText(); mouseSensitivitySlider.value = gameSettings.currentMouseSensitivity; SetMouseSensitivityText(); dialogInstance = null; }
void OnEnable() { mainMenuHandler = GetComponent <MainMenuHandler>(); lobbyCanvas = mainMenuHandler.lobbyCanvas; lobbyManager = GetComponent <LobbyManager>(); MainMenuHandler.DisableAllCanvases(); lobbyCanvas.enabled = true; lobbyManager.enabled = true; KartHelpClose(); countdownText.text = ""; reservePlayersText.text = ""; ClearPlayerList(playerListNoTeamText); ClearPlayerList(playerListWithTeamText); SetGameMode(); SetIPAddress(); SetPlayerListView(); EnableKartSelection(); EnableNonKartSelectionButtons(); EnableTeamSelection(); if (Network.isServer) { startGameButton.SetActive(true); } else if (Network.isClient) { startGameButton.SetActive(false); } kartPreview = null; previousKartVariation = 0; }
public void ConnectionFailedConfirm() { Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); }
public void GameModeNotSelectedOK() { Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); }
public void ExitDecline() { Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); }
// Use this for initialization void Start() { MH = canvas.transform.GetChild(1).GetComponent <MainMenuHandler> (); instance = this; }
void OnEnable() { if (GetComponent<MainMenuHandler>() != null) { mainMenuHandler = GetComponent<MainMenuHandler>(); MainMenuHandler.DisableAllCanvases(); mainMenuHandler.settingsCanvas.enabled = true; } gameSettings = FindObjectOfType<GameSettings>(); fullScreenToggle.isOn = gameSettings.currentFS; vSyncToggle.isOn = gameSettings.currentVsync; SetResolutionText(); SetTextureQualityText(); SetAntiAliasingText(); motionBlurToggle.isOn = gameSettings.currentMotionBlur; audioVolumeSlider.value = gameSettings.currentAudioVolume; SetAudioVolumeText(); mouseSensitivitySlider.value = gameSettings.currentMouseSensitivity; SetMouseSensitivityText(); dialogInstance = null; }
public void PlayerNameCancel() { Destroy(mainMenuHandler.dialogInstance); MainMenuHandler.EnableInputReceive(); }
void Start() { mainMenuHandler = GetComponent<MainMenuHandler>(); }
void Start() { mainMenuHandler = GetComponent <MainMenuHandler>(); }
IEnumerator AsyncLoadLevel(string level, int levelPrefix) { AsyncOperation loadLevel = Application.LoadLevelAsync(levelPrefix); if (FindObjectOfType <MainMenuHandler>() != null) { MainMenuHandler.DisableAllCanvases(); FindObjectOfType <MainMenuHandler>().loadingScreenCanvas.enabled = true; FindObjectOfType <MainMenuHandler>().lobbyCanvas.enabled = false; while (!loadLevel.isDone) { yield return(loadLevel.isDone); if (FindObjectOfType <MenuLoadingScreen>() != null) { FindObjectOfType <MenuLoadingScreen>().SetProgressBar(loadLevel); } } } foreach (PlayerInfo playerInfo in FindObjectsOfType <PlayerInfo>()) { if (playerInfo.GetComponent <NetworkView>().isMine) { playerInfo.loadingFinished = true; break; } } while (true) { bool allFinished = true; foreach (PlayerInfo playerInfo in FindObjectsOfType <PlayerInfo>()) { if (!playerInfo.loadingFinished) { allFinished = false; break; } } if (allFinished) { break; } yield return(null); } if (levelPrefix > 0) { currentGameState = GameState.Game; } else { currentGameState = GameState.MainMenu; } if (FindObjectOfType <MainMenuHandler>() != null) { FindObjectOfType <MenuLoadingScreen>().enabled = false; } foreach (GameManager gameManager in FindObjectsOfType <GameManager>()) { if (gameManager != this) { Destroy(gameManager); } } }
public Arena(MainMenuHandler menu, MapHandler map) : base(menu, map, new Dictionary <string, (float, string[])>() {