protected virtual void OnConnectedToMasterServerEventHandler()
 {
     MsfTimer.WaitForEndOfFrame(() =>
     {
         MirrorRoomClient.Instance.StartClient();
     });
 }
示例#2
0
        protected override void Initialize()
        {
            signinView            = ViewsManager.GetView <SignIn_View>("SigninView");
            signupView            = ViewsManager.GetView <SignUp_View>("SignupView");
            passwordResetView     = ViewsManager.GetView <PasswordReset_View>("PasswordResetView");
            passwordResetCodeView = ViewsManager.GetView <PasswordResetCode_View>("PasswordResetCodeView");
            emailConfirmationView = ViewsManager.GetView <EmailConfirmation_View>("EmailConfirmationView");

            MsfTimer.WaitForEndOfFrame(() =>
            {
                if (useDefaultCredentials && Application.isEditor)
                {
                    signinView.SetInputFieldsValues(defaultUsername, defaultPassword);
                    signupView.SetInputFieldsValues(defaultUsername, defaultEmail, defaultPassword);
                }

                if (IsConnected)
                {
                    Msf.Events.Invoke(Event_Keys.hideLoadingInfo);
                    signinView.Show();
                }
                else
                {
                    Msf.Events.Invoke(Event_Keys.showLoadingInfo, "Connecting to master server... Please wait!");
                }
            });
        }
示例#3
0
        protected override void OnBeforeClientConnectedToServer()
        {
            signinView            = ViewsManager.GetView <SignInView>("SigninView");
            signupView            = ViewsManager.GetView <SignUpView>("SignupView");
            passwordResetView     = ViewsManager.GetView <PasswordResetView>("PasswordResetView");
            passwordResetCodeView = ViewsManager.GetView <PasswordResetCodeView>("PasswordResetCodeView");
            emailConfirmationView = ViewsManager.GetView <EmailConfirmationView>("EmailConfirmationView");

            Msf.Client.Auth.RememberMe = rememberUser;

            MsfTimer.WaitForEndOfFrame(() =>
            {
                if (useDefaultCredentials && Application.isEditor)
                {
                    signinView.SetInputFieldsValues(defaultUsername, defaultPassword);
                    signupView.SetInputFieldsValues(defaultUsername, defaultEmail, defaultPassword);
                }

                //if (IsConnected)
                //{
                //    Msf.Events.Invoke(EventKeys.hideLoadingInfo);
                //    signinView.Show();
                //}
                //else
                //{
                //    Msf.Events.Invoke(EventKeys.showLoadingInfo, "Connecting to master server... Please wait!");
                //}
            });
        }
        /// <summary>
        /// Start connection to master
        /// </summary>
        private void ConnectToMaster()
        {
            // Start room connection to master
            if (!masterConnection.IsConnected)
            {
                masterConnection.Connect(masterIp, masterPort);
            }

            // Wait a result of client connection
            masterConnection.WaitForConnection((clientSocket) =>
            {
                if (!clientSocket.IsConnected)
                {
                    logger.Error("Failed to connect room server to master server");
                }
                else
                {
                    logger.Info("Room server is successfuly connected to master server");

                    // Start the server on next frame
                    MsfTimer.WaitForEndOfFrame(() =>
                    {
                        StartServer(roomOptions.RoomIp, roomOptions.RoomPort);
                    });
                }
            }, 4f);
        }
示例#5
0
 protected virtual void Start()
 {
     if (Msf.Runtime.IsEditor && autoStartInEditor)
     {
         // Start the server on next frame
         MsfTimer.WaitForEndOfFrame(() => {
             StartServer();
         });
     }
 }
 protected virtual void Start()
 {
     // Start master server at start
     if (Msf.Args.StartMaster || (Msf.Runtime.IsEditor && autoStartInEditor))
     {
         // Start the master server on next frame
         MsfTimer.WaitForEndOfFrame(() => {
             StartServer(port);
         });
     }
 }
        protected override void Start()
        {
            base.Start();

            // Start master server at start
            if (Msf.Args.StartMaster && !Msf.Runtime.IsEditor)
            {
                // Start the server on next frame
                MsfTimer.WaitForEndOfFrame(() => {
                    StartServer();
                });
            }
        }
示例#8
0
        protected override void Start()
        {
            base.Start();

            // If master is allready running then return function
            if (IsRunning)
            {
                return;
            }

            // Start the server on next frame
            MsfTimer.WaitForEndOfFrame(() =>
            {
                StartServer();
            });
        }
        protected override void Start()
        {
            if (Msf.Runtime.IsEditor && autoStartInEditor && !Msf.Options.Has(MsfDictKeys.autoStartRoomClient))
            {
                MsfTimer.WaitForEndOfFrame(() => {
                    StartRoomServer(true);
                });
            }

            // Start room server at start
            if (Msf.Args.StartClientConnection && !Msf.Runtime.IsEditor)
            {
                MsfTimer.WaitForEndOfFrame(() => {
                    StartRoomServer();
                });
            }
        }
        protected override void OnBeforeClientConnectedToServer()
        {
            // Register handler to listen to client access validation request
            NetworkServer.RegisterHandler <ValidateRoomAccessRequestMessage>(ValidateRoomAccessRequestHandler, false);

            if (Msf.Runtime.IsEditor && autoStartInEditor && !Msf.Options.Has(MsfDictKeys.autoStartRoomClient))
            {
                MsfTimer.WaitForEndOfFrame(() => {
                    StartRoomServer(true);
                });
            }

            // Start room server at start
            if (Msf.Args.StartClientConnection && !Msf.Runtime.IsEditor)
            {
                MsfTimer.WaitForEndOfFrame(() => {
                    StartRoomServer();
                });
            }
        }
示例#11
0
        protected override void Initialize()
        {
            loginView               = ViewsManager.GetView <Login_View>("LoginView");
            createAccountView       = ViewsManager.GetView <CreateAccount_View>("CreateAccount");
            resetPassword_View      = ViewsManager.GetView <ResetPasswordRequest_View>("ResetPasswordRequest");
            passwordResetEntry_View = ViewsManager.GetView <PasswordResetEntry_View>("PasswordResetEntry");
            emailConfirmationView   = ViewsManager.GetView <EmailConfirmation_View>("EmailConfirmationView");

            rememberToggle = GameObject.Find("RememberToggle").GetComponent <Toggle>();

            MsfTimer.WaitForEndOfFrame(() =>
            {
                CheckPlayerPrefs();

                if (IsConnected)
                {
                    Msf.Events.Invoke(Event_Keys.hideLoadingInfo);
                }
            });
        }
        protected override void OnInitialize()
        {
            FindOrCreateMasterConnector();

            signinView            = ViewsManager.GetView <SignInView>("SigninView");
            signupView            = ViewsManager.GetView <SignUpView>("SignupView");
            passwordResetView     = ViewsManager.GetView <PasswordResetView>("PasswordResetView");
            passwordResetCodeView = ViewsManager.GetView <PasswordResetCodeView>("PasswordResetCodeView");
            emailConfirmationView = ViewsManager.GetView <EmailConfirmationView>("EmailConfirmationView");

            Msf.Client.Auth.RememberMe = rememberUser;

            MsfTimer.WaitForEndOfFrame(() =>
            {
                if (useDefaultCredentials && Application.isEditor)
                {
                    if (signinView)
                    {
                        signinView.SetInputFieldsValues(defaultUsername, defaultPassword);
                    }

                    if (signupView)
                    {
                        signupView.SetInputFieldsValues(defaultUsername, defaultEmail, defaultPassword);
                    }
                }

                Connection.AddConnectionListener(OnClientConnectedToServer);
                Connection.AddDisconnectionListener(OnClientDisconnectedFromServer, false);

                if (!Connection.IsConnected && !Connection.IsConnecting)
                {
                    Msf.Events.Invoke(MsfEventKeys.showLoadingInfo, "Connecting to master... Please wait!");
                    clientToMasterConnector.StartConnection();
                }
            });
        }