Beispiel #1
0
        public void Sit()
        {
            var sitRequestData = new SitActionRequestSerializer()
            {
                PlaceTag = (int)Position
            };

            PerformServerAction("sit", sitRequestData.GetApiObject(), null, null);
            Game.AddPlayer(new Player(Position, Username));
        }
Beispiel #2
0
        public void OnPointerClick(PointerEventData eventData)
        {
            PlayerTag buttonID  = CastCharForPlayerTag(ReferencedButton.gameObject.name[0]);
            bool      available = SeatManager.CheckSeatAvailability(buttonID);

            if (available && !UserData.Sitting)
            {
                var requestData = new SitActionRequestSerializer();
                requestData.PlaceTag = (int)buttonID;
                GameManager.PerformServerAction("sit", requestData.GetApiObject(), this.OnSitRequestCallback, buttonID);
            }
        }
Beispiel #3
0
        static ClientSocket ConnectToLobbyAndSit(string username, PlayerTag position)
        {
            var clientSocket = new ClientSocket("127.0.0.1");

            clientSocket.RequestResponseReceived += OnRequestResponse;

            /*switch (username)
             * {
             *                  case "Macius":
             *                          clientSocket.SignalReceived += OnSignalMacius;
             *                          break;
             *                  case "Marcin":
             *                          clientSocket.SignalReceived += OnSignalMarcin;
             *                          break;
             *                  case "Pawelek":
             *                          clientSocket.SignalReceived += OnSignalPawelek;
             *                          break;
             *          }*/
            clientSocket.SignalReceived += OnSignal;

            var authData = new AuthData()
            {
                LobbyId       = "DEFAULT",
                Login         = username,
                LobbyPassword = ""
            };

            var authRequest = clientSocket.SendRequest(authData.GetApiObject());

            while (authRequest.RequestState != RequestState.RESPONSE_RECEIVED)
            {
                clientSocket.UpdateCommunication();
            }

            var sitAction = new SitActionRequestSerializer()
            {
                PlaceTag = (int)position
            };
            var sitActionRequestData = WrapRequestData("sit", sitAction.GetApiObject());
            var sitActionRequest     = clientSocket.SendRequest(sitActionRequestData.GetApiObject());

            while (sitActionRequest.RequestState != RequestState.RESPONSE_RECEIVED)
            {
                clientSocket.UpdateCommunication();
            }

            if (username.CompareTo("Macius") == 0)
            {
            }

            return(clientSocket);
        }