Пример #1
0
        /// <summary>
        /// Start the connection process.
        /// - If already connected, we attempt to join a random room.
        /// - Esle, connect this application instance to Photon Cloud Network
        /// </summary>
        public void Connect(string pseudo, string token)
        {
            progressLabel.SetActive(true);
            controlPanel.SetActive(false);

            // We try to connect to server
            PhotonNetwork.PhotonServerSettings.HostType = ServerSettings.HostingOption.BestRegion;
            PhotonNetwork.ConnectToBestCloudServer(GameVersion);

            // - set up DatabaseRequester
            DatabaseRequester.SetDBToken(token);
            DatabaseRequester.GetInstance().PingServer();
            DatabaseRequester.SetPseudo(pseudo);
        }
Пример #2
0
        public void Authenticate()
        {
            int    status;
            string response;

            DatabaseRequester.Authenticate(connectPseudo.text, connectPassword.text, out status, out response);

            // - player authenticate successfully
            if (status == 200)
            {
                Connect(connectPseudo.text, response);
            }

            // - can't add player
            else
            {
                lastPanel = controlPanel;
                GoToErrorPanel(response);
            }
        }
Пример #3
0
        public void Create()
        {
            int    status;
            string response;

            DatabaseRequester.AddPlayer(createPseudo.text, createPassword.text, out status, out response);

            // - player is add successfully
            if (status == 200)
            {
                createPanel.SetActive(false);
                Connect(createPseudo.text, response);
            }

            // - can't add player
            else
            {
                lastPanel = createPanel;
                GoToErrorPanel(response);
            }
        }