コード例 #1
0
ファイル: Server.cs プロジェクト: IMcNeany/TrackAttackClone
    private void OnDataRecieved(int client_id, int channel_id, int host_id, NetworkMessage message)
    {
        switch (message.operation)
        {
        case NetworkOperation.none:

            break;

        case NetworkOperation.set_ready:
            NWMPlayerReady ready_message = (NWMPlayerReady)message;
            if (lobby)
            {
                lobby.SetPlayerReadyState(client_id, ready_message.ready_state);
                lobby.SetPlayerName(client_id, ready_message.player_name);
            }
            else if (game)
            {
                game.ClientReady(client_id, ready_message.ready_state);
            }

            break;

        case NetworkOperation.cart_data:
            NWMCartData cart_message = (NWMCartData)message;
            game.SetPlayerCartData(cart_message);
            break;

        case NetworkOperation.grid_single:
            NWMGridData grid_message = (NWMGridData)message;
            game.SetGridTile(grid_message);
            break;

        case NetworkOperation.cart_off_tracks:
            ReceiveOffTrackInfo(client_id);
            break;
        }
    }