public bool Execute() { bool executed = false; try { LobbyCharactersHandler handler = MainGameHandler.GetLobbyCharactersHandler(); if (handler == null) { throw new Exception("lobby char. handler is NULL!"); } if (_cmdElements.Length == 2 && _cmdElements[1].Equals("endlist", GlobalData.InputDataStringComparison)) { handler.ListConfirmed = true; if (MainGameHandler.CheckIfSceneActive(MainGameHandler.SceneType.CharLobby, SceneManager.GetActiveScene())) { CharacterListPanelHandler.Reload(); } MainGameHandler.HideLoadingScreen(); executed = true; } else if (_cmdElements.Length > 2 && _cmdElements[1].Equals("position", GlobalData.InputDataStringComparison)) { string discardedText = $"{_keyWord} position"; LobbyCharDetails charDetails = JsonConvert.DeserializeObject <LobbyCharDetails>(_rawText.Substring(discardedText.Length)); handler.Add(charDetails); executed = true; } } catch (Exception exception) { _chat.UpdateLog($"Lobby char. command execution error: {exception.Message}"); } return(executed); }
void Start() { _lastInstance = this; }