Exemplo n.º 1
0
    //public string userName;
    //public string userToken;


    void start()
    {
        loadBalancingClient = new LoadBalancingClient("app.exitgamescloud.com:5055", TurnbasedAppId, "1.0");
        bool connectInProccess = loadBalancingClient.ConnectToRegionMaster("eu");

        Debug.Log("Estado: " + connectInProccess);
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        loadBalancingClient = new LoadBalancingClient(null, TurnbasedAppId, "1.0"); // the master server address is not used when connecting via nameserver
        AuthenticationValues customAuth = new AuthenticationValues();

        customAuth.SetAuthParameters(UserName, UserToken);
        loadBalancingClient.AutoJoinLobby = false;
        loadBalancingClient.CustomAuthenticationValues = customAuth;
        loadBalancingClient.ConnectToRegionMaster("eu");
    }
Exemplo n.º 3
0
    public void GetRoomsInfo(Action <List <RoomInfo> > callback)
    {
        this.callback = callback;

        client = new LoadBalancingClient();
        client.AddCallbackTarget(this);
        client.StateChanged += OnStateChanged;
        client.AppId         = PhotonNetwork.PhotonServerSettings.AppSettings.AppIdRealtime;
        client.AppVersion    = PhotonNetwork.NetworkingClient.AppVersion;
        client.ConnectToRegionMaster("us");
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        loadBalancingClient = new LoadBalancingClient(null, TurnbasedAppId, "1.0"); // the master server address is not used when connecting via nameserver

        AuthenticationValues customAuth = new AuthenticationValues();

        customAuth.AddAuthParameter("username", UserName);  // expected by the demo custom auth service
        customAuth.AddAuthParameter("token", UserToken);    // expected by the demo custom auth service
        loadBalancingClient.AuthValues = customAuth;

        loadBalancingClient.ConnectToRegionMaster("eu");
    }
Exemplo n.º 5
0
    public void Connect()
    {
        _loadBalancingClient.UserId = _userToken;
        AuthenticationValues customAuth = new AuthenticationValues(_loadBalancingClient.UserId);

        customAuth.AuthType = CustomAuthenticationType.Custom;
        customAuth.AddAuthParameter("username", _userName);          // expected by the demo custom auth service
        customAuth.AddAuthParameter("token", _userToken);            // expected by the demo custom auth service
        _loadBalancingClient.AuthValues = customAuth;
        _loadBalancingClient.NickName   = _userName;

        _loadBalancingClient.AutoJoinLobby = false;
        _loadBalancingClient.ConnectToRegionMaster("eu");
    }
Exemplo n.º 6
0
    private void AutoConnectToMaster()
    {
        bool couldConnect = false;

        if (!string.IsNullOrEmpty(client.MasterServerAddress))
        {
            couldConnect = client.Connect();
        }
        else
        {
            couldConnect = client.ConnectToRegionMaster("EU");
        }

        if (!couldConnect)
        {
            client.DebugReturn(DebugLevel.ERROR, "Can't connect to: " + client.CurrentServerAddress);
        }
    }
Exemplo n.º 7
0
        protected virtual IObservable <PhotonMatchmaker> Connect()
        {
            if (_photonClient.State != ClientState.PeerCreated && _photonClient.State != ClientState.Disconnected)
            {
                return(Observable.Throw <PhotonMatchmaker>(new InvalidOperationException($"Operation failed: Invalid state '{_photonClient.State}'." +
                                                                                         " Please make sure you aren't already connected to Photon.")));
            }

            var observable = PhotonUtils.CreateObservableForExpectedStateChange(_photonClient,
                                                                                expectedState: ClientState.ConnectedToMasterserver, returnValue: this);

            State = ConnectionState.Connecting;

            if (!_photonClient.ConnectToRegionMaster(_photonSettings.Region))
            {
                return(Observable.Throw <PhotonMatchmaker>(new ConnectionException("Cannot connect to Photon.",
                                                                                   DisconnectReason.Exception)));
            }

            return(observable);
        }