Ejemplo n.º 1
0
        public void AddCommandElements()
        {
            if (_isListConfirmation)
            {
                _commandDetails.CommandElementList.Add("endlist");
            }
            else
            {
                DbCharactersData dbData      = _characterData.GetDbData();
                LobbyCharDetails charDetails = new LobbyCharDetails()
                {
                    CharId      = dbData.CharId,
                    Name        = dbData.Name,
                    ModelCode   = dbData.ModelCode,
                    HairstyleId = dbData.HairstyleId
                };

                _commandDetails.CommandElementList.Add("position");
                _commandDetails.CommandElementList.Add(JsonConvert.SerializeObject(charDetails));
            }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public void Add(LobbyCharDetails position)
        {
            bool found = false;

            lock (_dataLock)
            {
                for (int i = 0; i < _lobbyCharList.Count; i++)
                {
                    if (_lobbyCharList[i].CharId == position.CharId)
                    {
                        _lobbyCharList[i] = position;
                        found             = true;
                        break;
                    }
                }

                if (!found)
                {
                    _lobbyCharList.Add(position);
                }
            }
        }