Esempio n. 1
0
    public void SendAllClientsScoreUpdate(int playerId, int playerScore)
    {
        NWMScoreUpdate _playerUpdate = new NWMScoreUpdate();

        _playerUpdate.playerId      = playerId;
        _playerUpdate.playerIdScore = playerScore;
        SendAllClientsMessage(host_id, reliable, _playerUpdate);
    }
Esempio n. 2
0
 public void ReceiveScoreUpdate(NWMScoreUpdate scoreUpdate)
 {
     // go throug the player manager and update the current list of players
     playerManager.UpdatePlayerScore(scoreUpdate.playerId, scoreUpdate.playerIdScore);
     network_GM.clientGoldManager.UpdateLeaderboard();
 }
Esempio n. 3
0
    private void OnDataReceived(int channel_id, int host_id, NetworkMessage message)
    {
        switch (message.operation)
        {
        case NetworkOperation.none:

            break;

        case NetworkOperation.set_ready:
            break;

        case NetworkOperation.cart_data:
            NWMCartData cart_data = (NWMCartData)message;
            ReceiveCartData(cart_data);
            break;

        case NetworkOperation.grid_single:
            NWMGridData grid_data = (NWMGridData)message;
            ReceiveSingleGridData(grid_data);
            break;

        case NetworkOperation.user_counter:
            NWMUserCount user_counter = (NWMUserCount)message;
            ReceiveUserCount(user_counter);
            break;

        case NetworkOperation.scene_load:
            NWMSceneLoad scene_load = (NWMSceneLoad)message;
            ReceiveSceneToLoad(scene_load);
            break;

        case NetworkOperation.assign_num:
            NWMAssignPlayerNum assigner = (NWMAssignPlayerNum)message;
            player_id = assigner.num;
            Debug.Log(client_id);
            break;

        case NetworkOperation.gold_pos:
            NWMGoldUpdate goldUpdate = (NWMGoldUpdate)message;
            ReceiveGoldPositionUpdate(goldUpdate);
            break;

        case NetworkOperation.player_score:
            NWMScoreUpdate scoreUpdate = (NWMScoreUpdate)message;
            ReceiveScoreUpdate(scoreUpdate);
            break;

        case NetworkOperation.player_info:
            NWMPlayerIDUpdate idUpdate = (NWMPlayerIDUpdate)message;
            ReceivePlayerDataUpdate(idUpdate);
            break;

        case NetworkOperation.game_start:
            NWMGameStart start_msg = (NWMGameStart)message;
            SetClientGameStarted(start_msg);

            break;

        case NetworkOperation.player_respawn:
            NWMPlayerRespawn respawn_data = (NWMPlayerRespawn)message;
            ReceivePlayerRepsawnData(respawn_data);
            break;

        case NetworkOperation.timer_seconds:
            NWMTimerUpdate timer_data = (NWMTimerUpdate)message;
            ReceiveUpdateTimer(timer_data);
            break;

        case NetworkOperation.game_finished:
            NWMGameFinishedSendInfo game_finished_info = (NWMGameFinishedSendInfo)message;
            ReceiveGameFinishedInfo(game_finished_info);
            break;
        }
    }