Beispiel #1
0
        private void SubmitPlay()
        {
            string           playerName;
            SelectableButton selected;

            if (!SelectableButton.TryGetSelected(CharSelectWindowName, out selected))
            {
                return;
            }
            if (!Button.TryGetText(selected.gameObject.name, out playerName))
            {
                return;
            }
            socket.Send("SpawnCharacter", characterServer, InputValidator.FmtAllLowercase(playerName));
            uiManager.CloseAllWindows();
        }
Beispiel #2
0
        private void SubmitCreate()
        {
            string playerName;

            if (!TextFieldInput.TryGetText(PlayerNameInput, out playerName))
            {
                return;
            }
            if (!InputValidator.IsValidPlayerName(playerName))
            {
                Debug.LogError("Character name must be letters only and be " + InputValidator.MinPlayerNameLength + " to " + InputValidator.MaxPlayerNameLength + " characters long.");
                return;
            }

            playerName = InputValidator.FmtAllLowercase(playerName);
            socket.Send("CreateCharacter", characterServer, playerName);
            uiManager.CloseAllWindows();
        }
Beispiel #3
0
 private void SetCharacterButtons(string[] names)
 {
     for (int i = 1; i < 5; i++)
     {
         if (i > names.Length)
         {
             Button.TrySetActive("Character" + i, false);
         }
         else
         {
             Button.TrySetActive("Character" + i, true);
             Button.TrySetText("Character" + i, InputValidator.FmtUppercaseFirstChar(names[i - 1]));
         }
     }
     if (names.Length >= 4)
     {
         Button.TrySetActive(NewCharButtonName, false);
     }
 }
        private void ReceiveWhisperInput(string targetName, char[] input)
        {
            if (!CanSend() || !InputValid(input))
            {
                return;
            }
            if (!InputValidator.LowercaseOnly(targetName))
            {
                return;
            }
            if (player.PlayerName == targetName)
            {
                return;
            }
            if (!PlayerCreator.Players.ContainsKey(targetName))
            {
                view.SendReliable("ReceiveWhisperFailed", RpcTarget.Controllers);
                return;
            }
            NetView playerView = PlayerCreator.Players[targetName].View;

            playerView.SendReliable("ReceiveWhisperMessage", RpcTarget.Controllers, player.PlayerName, input);
            view.SendReliable("ReceiveDeliveredWhisper", RpcTarget.Controllers, targetName, input);
        }