Beispiel #1
0
    // Token: 0x0600132C RID: 4908 RVA: 0x000702B4 File Offset: 0x0006E4B4
    private PhotonServer GetBestServer(bool doMobileFilter)
    {
        List <PhotonServer> list = new List <PhotonServer>(this._gameServers.Values);

        list.Sort((PhotonServer s, PhotonServer t) => s.Latency - t.Latency);
        PhotonServer photonServer = null;

        for (int i = 0; i < list.Count; i++)
        {
            PhotonServer photonServer2 = list[i];
            if (photonServer2.Latency != 0)
            {
                if (!doMobileFilter || photonServer2.UsageType == PhotonUsageType.Mobile)
                {
                    if (photonServer == null && photonServer2.CheckLatency())
                    {
                        photonServer = photonServer2;
                    }
                    else if (photonServer2.CheckLatency() && photonServer2.Latency < 200 && photonServer.Data.PlayersConnected < photonServer2.Data.PlayersConnected)
                    {
                        photonServer = photonServer2;
                    }
                }
            }
        }
        return(photonServer);
    }
Beispiel #2
0
    // Token: 0x06001AF6 RID: 6902 RVA: 0x0008BD84 File Offset: 0x00089F84
    public static ServerLoadRequest Run(PhotonServer server, Action callback)
    {
        ServerLoadRequest serverLoadRequest = new ServerLoadRequest(server, callback);

        serverLoadRequest.Run();
        return(serverLoadRequest);
    }
Beispiel #3
0
        private IEnumerator WaitConnected(ResultConnect finishHandler)
        {
            var result      = false;
            var loop        = true;
            var joinedLobby = new EventHandler((s, a) =>
            {
                loop   = false;
                result = true;
            });

            _cancelConnected = false;
            PhotonServer.JoinedLobbyEvent += joinedLobby;
            if (PhotonServer.Connect())
            {
                loop   = false;
                result = true;
            }
            while (loop)
            {
                yield return(null);

                if (!_cancelConnected)
                {
                    continue;
                }
                loop = false;
                PhotonServer.Disconnect();
            }
            PhotonServer.JoinedLobbyEvent -= joinedLobby;

            if (finishHandler != null)
            {
                finishHandler(result);
            }
        }
Beispiel #4
0
 // Use this for initialization
 void Start()
 {
     Application.runInBackground = true;
     m_photonServer = new PhotonServer();
     PhotonPeer peer = new PhotonPeer(m_photonServer, ConnectionProtocol.Udp);
     m_photonServer.Init(peer, "localhost:5055", "JustGameServer", this);
     m_isConnected = true;
 }
Beispiel #5
0
    // Token: 0x0600132B RID: 4907 RVA: 0x00070280 File Offset: 0x0006E480
    public PhotonServer GetBestServer()
    {
        PhotonServer bestServer = this.GetBestServer(ApplicationDataManager.IsMobile);

        if (ApplicationDataManager.IsMobile && bestServer == null)
        {
            bestServer = this.GetBestServer(false);
        }
        return(bestServer);
    }
Beispiel #6
0
 void Awake()
 {
     if (Instance != null)
     {
         DestroyObject(gameObject);
         return;
     }
     DontDestroyOnLoad(gameObject);
     Application.runInBackground = true;
     _instance = this;
 }
Beispiel #7
0
    void Awake()
    {
        if (PhotonServer.instance != null)
        {
            Destroy(this.gameObject);
        }

        DontDestroyOnLoad(this.gameObject);

        Application.runInBackground = true;

        PhotonServer.instance = this;
    }
Beispiel #8
0
        public HttpServer(PhotonServer server)
        {
            this.server = server;

            Authorization = new HybridAuthorization();

            Security = new HttpSecurityManager {
                Authorization = Authorization,
                CookieName    = "PHOTON.SERVER.AUTH",
            };

            Context = new HttpReceiverContext {
                SecurityMgr = Security,
            };
        }
Beispiel #9
0
        public void OnClickInputNameRoomOk()
        {
            switch (_modeInput)
            {
            case InputNameRoomMode.Create:
                PhotonServer.CreateRoom(NameRoom.text);
                break;

            case InputNameRoomMode.Join:
                PhotonServer.JoinRoom(NameRoom.text);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Lock = true;
            PanelInputNameRoom.SetActive(false);
        }
Beispiel #10
0
    // Token: 0x06001313 RID: 4883 RVA: 0x00070084 File Offset: 0x0006E284
    private IEnumerator StartCreatingOnBestGameServer()
    {
        if (Singleton <GameServerController> .Instance.SelectedServer == null)
        {
            ProgressPopupDialog _autoJoinPopup = PopupSystem.ShowProgress(LocalizedStrings.LoadingGameList, LocalizedStrings.FindingAServerToJoin, null);
            yield return(UnityRuntime.StartRoutine(Singleton <GameServerManager> .Instance.StartUpdatingLatency(delegate(float progress)
            {
                _autoJoinPopup.Progress = progress;
            })));

            PhotonServer bestServer = Singleton <GameServerManager> .Instance.GetBestServer();

            if (bestServer == null)
            {
                PopupSystem.HideMessage(_autoJoinPopup);
                PopupSystem.ShowMessage("Could not find server", "No suitable server could be located! Please try again soon.");
                yield break;
            }
            Singleton <GameServerController> .Instance.SelectedServer = bestServer;
            PopupSystem.HideMessage(_autoJoinPopup);
        }
        PanelManager.Instance.OpenPanel(PanelType.CreateGame);
        yield break;
    }
Beispiel #11
0
 // Token: 0x06001AF1 RID: 6897 RVA: 0x00011EC4 File Offset: 0x000100C4
 private ServerLoadRequest(PhotonServer server, Action callback) : base(100, false)
 {
     this._callback = callback;
     this.Server    = server;
 }
Beispiel #12
0
 // Token: 0x0600132F RID: 4911 RVA: 0x0000D147 File Offset: 0x0000B347
 public void AddTestPhotonGameServer(int id, PhotonServer photonServer)
 {
     this._gameServers[id] = photonServer;
 }
Beispiel #13
0
    void Awake()
    {
        if (Instance != null)
        {
            DestroyObject(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);

        Application.runInBackground = true;

        _instance = this;
    }