Esempio n. 1
0
        protected new void Awake()
        {
            base.Awake();

            netCode = FindObjectOfType <NetCode>();

            NetworkClient.Lobby.GetPlayersInRoom((sucessful, reply, error) =>
            {
                if (sucessful)
                {
                    int i = 0;
                    if (reply.players != null)
                    {
                        foreach (SWPlayer player in reply.players)
                        {
                            string playerName = player.GetCustomDataString();
                            string playerId   = player.id;

                            if (playerId.Equals(NetworkClient.Instance.PlayerId))
                            {
                                localPlayer.PlayerName = playerName;
                                localPlayer.PlayerId   = playerId;
                            }
                            else
                            {
                                remotePlayer[i].PlayerName = playerName;
                                remotePlayer[i].PlayerId   = playerId;
                                i++;
                            }
                        }
                        ChoseThePlayerCardButtonPanel.GetComponent <ButtonPlayerConfiguration>().AsignPlayersToButtons(remotePlayer[0].PlayerName, remotePlayer[1].PlayerName, remotePlayer[2].PlayerName);
                    }
                    else
                    {
                        //vjv javit error
                    }
                    gameDataManager = new GameDataManager(localPlayer, remotePlayer[0], remotePlayer[1], remotePlayer[2], NetworkClient.Lobby.RoomId);
                    netCode.EnableRoomPropertyAgent();
                }
                else
                {
                    Debug.Log("Failed to get players in the room.");
                }
            });
        }
Esempio n. 2
0
        protected new void Awake()
        {
            base.Awake();
            remotePlayer.IsAI = false;

            netCode = FindObjectOfType <NetCode>();

            NetworkClient.Lobby.GetPlayersInRoom((successful, reply, error) =>
            {
                if (successful)
                {
                    foreach (SWPlayer swPlayer in reply.players)
                    {
                        string playerName = swPlayer.GetCustomDataString();
                        string playerId   = swPlayer.id;

                        if (playerId.Equals(NetworkClient.Instance.PlayerId))
                        {
                            localPlayer.PlayerId   = playerId;
                            localPlayer.PlayerName = playerName;
                        }
                        else
                        {
                            remotePlayer.PlayerId   = playerId;
                            remotePlayer.PlayerName = playerName;
                        }
                    }

                    gameDataManager = new GameDataManager(localPlayer, remotePlayer, NetworkClient.Lobby.RoomId);
                    netCode.EnableRoomPropertyAgent();
                }
                else
                {
                    Debug.Log("Failed to get players in room.");
                }
            });
        }