Exemplo n.º 1
0
        Task IMultiplayerClient.RoomStateChanged(MultiplayerRoomState state)
        {
            Debug.Assert(Room != null);
            Room.State = state;

            return(Task.CompletedTask);
        }
Exemplo n.º 2
0
        Task IMultiplayerClient.RoomStateChanged(MultiplayerRoomState state)
        {
            Scheduler.Add(() =>
            {
                if (Room == null)
                {
                    return;
                }

                Debug.Assert(APIRoom != null);

                Room.State = state;

                switch (state)
                {
                case MultiplayerRoomState.Open:
                    APIRoom.Status.Value = new RoomStatusOpen();
                    break;

                case MultiplayerRoomState.Playing:
                    APIRoom.Status.Value = new RoomStatusPlaying();
                    break;

                case MultiplayerRoomState.Closed:
                    APIRoom.Status.Value = new RoomStatusEnded();
                    break;
                }

                RoomUpdated?.Invoke();
            }, false);

            return(Task.CompletedTask);
        }
 public void TestDisabledWhenClosed(MultiplayerRoomState roomState)
 {
     AddStep($"change room to {roomState}", () => Client.ChangeRoomState(roomState));
     assertSpectateButtonEnablement(false);
 }
 public void TestEnabledWhenRoomOpenOrInGameplay(MultiplayerRoomState roomState)
 {
     AddStep($"change room to {roomState}", () => Client.ChangeRoomState(roomState));
     assertSpectateButtonEnablement(true);
 }
Exemplo n.º 5
0
 public void ChangeRoomState(MultiplayerRoomState newState)
 {
     Debug.Assert(Room != null);
     ((IMultiplayerClient)this).RoomStateChanged(newState);
 }
Exemplo n.º 6
0
 private async Task changeRoomState(MultiplayerRoom room, MultiplayerRoomState newState)
 {
     room.State = newState;
     await Clients.Group(GetGroupId(room.RoomID)).RoomStateChanged(newState);
 }