private void UpdateGameClients(Protocol.BaseProtocol proto)
    {
        // TODO: prevent game clients from being set again.

        Protocol.GameClientList clientList = proto.AsType <Protocol.GameClientList>();
        clientData = new Client[clientList.client_ids.Length];

        for (int i = 0; i < clientList.client_ids.Length; i++)
        {
            if (clientList.client_ids[i] == playerData.clientId)
            {
                playerData.playerId = clientList.client_player_ids[i];
            }

            clientData[i] = new Client(clientList.client_ids[i], clientList.client_nicknames[i], clientList.client_player_ids[i]);
        }
        print(Inst.clientData.Length + " :: " + clientData.Length);
        gameClientsSet?.Invoke(clientData);

        // now that the final list of active clients have arrived
        // we can now notify the server that the scene is ready to play
        // Also to be far, we should make sure that the object list has been received as well
        // but thats a task for later. for now we'll just hope its all setup correctly :)
        // TODO: ^^^
        // TODO: Uncomment... Im going to get the relix to work first. ( it will be easier to test :) )
        Protocol.ClientStatus clientStatus = new Protocol.ClientStatus()
        {
            StatusType = Protocol.ClientStatusType.GameReady,
            ok         = true
        };

        clientStatus.Send();
    }
    public void LeaveGame()
    {
        Protocol.ClientStatus status = new Protocol.ClientStatus()
        {
            StatusType = Protocol.ClientStatusType.LeaveGame,
            ok         = true
        };

        status.Send();
    }
Esempio n. 3
0
    private void Start()
    {
        Protocol.ClientStatus status = new Protocol.ClientStatus()
        {
            StatusType = Protocol.ClientStatusType.SceneLoaded,
            ok         = true,
            message    = gameObject.scene.name
        };

        status.Send();
    }