Ejemplo n.º 1
0
        public bool AddCommandToOutgoingQueue(GHCommandFromServer command)
        {
            bool send_success = false;

            lock (_outGoingServerCommandQueueLock)
            {
                for (int i = 0; i < 20; i++)
                {
                    if (!_updatingOutGoingServerCommandQueue)
                    {
                        _updatingOutGoingServerCommandQueue = true;
                        BroadcastServerCommand(command);
                        send_success = true;
                        _updatingOutGoingServerCommandQueue = false;
                        break;
                    }
                    else
                    {
                        Thread.Sleep(5);
                        Debug.WriteLine("AddMessageToOutGoingQueue: Trying Again - Count: " + i);
                    }
                }

                if (send_success)
                {
                    Debug.WriteLine("AddMessageToOutGoingQueue Successful");
                }
                else
                {
                    Debug.WriteLine("AddMessageToOutGoingQueue Failed!");
                }
            }

            return(send_success);
        }
Ejemplo n.º 2
0
        protected async void ClientPlayerSelectionResponse(GHCommandFromServer command, int selectedRole, int selectedRace, int selectedGender, int selectedAlignment)
        {
            GHResponseFromClient response = new GHResponseFromClient(command.Id);

            response.ReturnValues.Add("selectedRole", selectedRole);
            response.ReturnValues.Add("selectedRace", selectedRace);
            response.ReturnValues.Add("selectedGender", selectedGender);
            response.ReturnValues.Add("selectedAlignment", selectedAlignment);
            await connection.InvokeAsync("ResponseFromClient", response);
        }
Ejemplo n.º 3
0
 private async void BroadcastServerCommand(GHCommandFromServer command)
 {
     await Clients.All.SendAsync("CommandFromServer", command);
 }