コード例 #1
0
        public void GetPasswordResetCode()
        {
            Msf.Events.Invoke(Event_Keys.showLoadingInfo, "Sending reset password code... Please wait!");

            MsfTimer.WaitForSeconds(1f, () =>
            {
                Msf.Client.Auth.RequestPasswordReset(passwordResetCodeView.Email, (isSuccessful, error) =>
                {
                    Msf.Events.Invoke(Event_Keys.hideLoadingInfo);

                    if (isSuccessful)
                    {
                        passwordResetCodeView.Hide();
                        passwordResetView.Show();

                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, new OkDialogBox_ViewEventMessage($"We have sent an email with reset code to your address '{passwordResetCodeView.Email}'", null));
                    }
                    else
                    {
                        outputMessage = $"An error occurred while password reset code: {error}";
                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, new OkDialogBox_ViewEventMessage(outputMessage, null));
                        logger.Error(outputMessage);
                    }
                });
            });
        }
コード例 #2
0
        /// <summary>
        /// This is called on the Server when a Mirror Client disconnects from the Server
        /// </summary>
        /// <param name="obj"></param>
        private void OnMirrorClientDisconnectedEvent(NetworkConnection connection)
        {
            MsfTimer.WaitForSeconds(0.2f, () =>
            {
                // Try to find player in filtered list
                if (roomPlayersByMirrorPeerId.TryGetValue(connection.connectionId, out MirrorRoomPlayer player))
                {
                    logger.Debug($"Room server player {player.Username} with room client Id {connection.connectionId} left the room");

                    // Remove thisplayer from filtered list
                    roomPlayersByMirrorPeerId.Remove(player.MirrorPeer.connectionId);
                    roomPlayersByMsfPeerId.Remove(player.MsfPeerId);
                    roomPlayersByUsername.Remove(player.Username);

                    // Notify master server about disconnected player
                    if (CurrentRoomController.IsActive)
                    {
                        CurrentRoomController.NotifyPlayerLeft(player.MsfPeerId);
                    }

                    // Inform subscribers about this bad guy
                    OnPlayerLeftRoomEvent?.Invoke(player);

                    // If we need to terminate empty room
                    if (terminateRoomWhenLastPlayerQuits && roomPlayersByMirrorPeerId.Count <= 0 && !Msf.Runtime.IsEditor)
                    {
                        Msf.Runtime.Quit();
                    }
                }
                else
                {
                    logger.Debug($"Room server client {connection.connectionId} left the room");
                }
            });
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        protected virtual void JoinTheRoom()
        {
            Msf.Events.Invoke(MsfEventKeys.showLoadingInfo, $"Joinig room {roomAccess.RoomId}... Please wait!");

            // Wait for connection to mirror server
            MsfTimer.WaitWhile(() => !NetworkClient.isConnected, isSuccessful =>
            {
                Msf.Events.Invoke(MsfEventKeys.hideLoadingInfo);

                if (!isSuccessful)
                {
                    logger.Error("We could not connect to room. Please try again later or contact to administrator");
                    MirrorNetworkManager.StopClient();
                }
                else
                {
                    OnConnectedToMirrorServerEventHandler(NetworkClient.connection);
                }
            }, roomConnectionTimeout);

            // If we are not connected to mirror server
            if (!NetworkClient.isConnected)
            {
                // Let's set the IP before we start connection
                SetAddress(roomAccess.RoomIp);

                // Let's set the port before we start connection
                SetPort(roomAccess.RoomPort);

                logger.Debug("Connecting to mirror server...");

                // Start mirror client
                MirrorNetworkManager.StartClient();
            }
        }
コード例 #5
0
        public void SignInAsGuest()
        {
            Msf.Events.Invoke(Event_Keys.showLoadingInfo, "Signing in... Please wait!");

            MsfTimer.WaitForSeconds(1f, () =>
            {
                Msf.Client.Auth.SignInAsGuest((accountInfo, error) =>
                {
                    Msf.Events.Invoke(Event_Keys.hideLoadingInfo);

                    if (accountInfo != null)
                    {
                        signinView.Hide();

                        OnSignedInEvent?.Invoke();

                        Msf.Events.Invoke(Event_Keys.showOkDialogBox,
                                          new OkDialogBox_ViewEventMessage($"You have successfuly signed in as {Msf.Client.Auth.AccountInfo.Username} and now you can create another part of your cool game!"));

                        logger.Debug($"You are successfully logged in as {Msf.Client.Auth.AccountInfo.Username}");
                    }
                    else
                    {
                        outputMessage = $"An error occurred while signing in: {error}";
                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, new OkDialogBox_ViewEventMessage(outputMessage, null));
                        logger.Error(outputMessage);
                    }
                });
            });
        }
コード例 #6
0
ファイル: Account_Manager.cs プロジェクト: GeeJD85/MSF_Custom
        public void PasswordResetEntry()
        {
            Msf.Events.Invoke(Event_Keys.showLoadingInfo, "Resetting your password.. please wait!");

            MsfTimer.WaitForSeconds(1, () =>
            {
                Msf.Client.Auth.ChangePassword(new PasswordChangeData()
                {
                    Email       = resetPassword_View.Email,
                    Code        = passwordResetEntry_View.Code,
                    NewPassword = passwordResetEntry_View.NewPassword
                }, (successful, error) =>
                {
                    Msf.Events.Invoke(Event_Keys.hideLoadingInfo);

                    if (successful)
                    {
                        passwordResetEntry_View.Hide();
                        loginView.Show();

                        OnPasswordChangedEvent?.Invoke();

                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, "Password changed successfully!");
                    }
                    else
                    {
                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, "There was an error changing your password: " + error);
                    }
                });
            });
        }
コード例 #7
0
        protected virtual void OnClientConnectedToServer()
        {
            Msf.Events.Invoke(MsfEventKeys.hideLoadingInfo);

            if (Msf.Client.Auth.IsSignedIn)
            {
                OnSignedInEvent?.Invoke();
            }
            else
            {
                if (Msf.Client.Auth.HasAuthToken())
                {
                    MsfTimer.WaitForSeconds(0.2f, () => {
                        SignInWithToken();
                    });
                }
                else
                {
                    if (!signinView)
                    {
                        ViewsManager.NotifyNoViewFound("SigninView");
                        return;
                    }

                    signinView.Show();
                }
            }
        }
コード例 #8
0
        public void ResetPassword()
        {
            Msf.Events.Invoke(Event_Keys.showLoadingInfo, "Changing password... Please wait!");

            MsfTimer.WaitForSeconds(1f, () =>
            {
                Msf.Client.Auth.ChangePassword(new PasswordChangeData()
                {
                    Email       = passwordResetCodeView.Email,
                    Code        = passwordResetView.ResetCode,
                    NewPassword = passwordResetView.NewPassword
                },
                                               (isSuccessful, error) =>
                {
                    Msf.Events.Invoke(Event_Keys.hideLoadingInfo);

                    if (isSuccessful)
                    {
                        passwordResetView.Hide();
                        signinView.Show();

                        OnPasswordChangedEvent?.Invoke();

                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, new OkDialogBox_ViewEventMessage("You have successfuly changed your password. Now you can sign in.", null));
                    }
                    else
                    {
                        outputMessage = $"An error occurred while changing password: {error}";
                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, new OkDialogBox_ViewEventMessage(outputMessage, null));
                        logger.Error(outputMessage);
                    }
                });
            });
        }
コード例 #9
0
        /// <summary>
        /// Loads player profile
        /// </summary>
        /// <param name="successCallback"></param>
        public void LoadPlayerProfile(string username, SuccessCallback successCallback)
        {
            if (roomPlayersByUsername.ContainsKey(username))
            {
                MirrorRoomPlayer player = roomPlayersByUsername[username];

                Msf.Server.Profiles.FillProfileValues(player.Profile, (isSuccess, error) =>
                {
                    if (!isSuccess)
                    {
                        logger.Error("Room server cannot retrieve player profile from master server");
                        successCallback?.Invoke(false, "Room server cannot retrieve player profile from master server");

                        if (disconnectIfProfileFailed)
                        {
                            MsfTimer.WaitForSeconds(1f, () => player.MirrorPeer.Disconnect());
                        }

                        return;
                    }

                    logger.Debug($"Profile of player {username} is successfully loaded. Player info: {player}");
                    successCallback?.Invoke(true, string.Empty);
                });
            }
        }
コード例 #10
0
 protected virtual void OnConnectedToMasterServerEventHandler()
 {
     MsfTimer.WaitForEndOfFrame(() =>
     {
         MirrorRoomClient.Instance.StartClient();
     });
 }
コード例 #11
0
        public void ConfirmAccount()
        {
            Msf.Events.Invoke(Event_Keys.showLoadingInfo, "Confirming your account... Please wait!");

            MsfTimer.WaitForSeconds(1f, () =>
            {
                string confirmationCode = emailConfirmationView.ConfirmationCode;

                Msf.Client.Auth.ConfirmEmail(confirmationCode, (isSuccessful, error) =>
                {
                    Msf.Events.Invoke(Event_Keys.hideLoadingInfo);

                    if (isSuccessful)
                    {
                        emailConfirmationView.Hide();
                        OnEmailConfirmedEvent?.Invoke();
                    }
                    else
                    {
                        outputMessage = $"An error occurred while confirming yor account: {error}";
                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, new OkDialogBox_ViewEventMessage(outputMessage, null));
                        logger.Error(outputMessage);
                    }
                });
            });
        }
コード例 #12
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!");
                //}
            });
        }
コード例 #13
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!");
                }
            });
        }
コード例 #14
0
ファイル: Account_Manager.cs プロジェクト: GeeJD85/MSF_Custom
        public void SignUp()
        {
            Msf.Events.Invoke(Event_Keys.showLoadingInfo, "Creating account.. please wait!");

            MsfTimer.WaitForSeconds(1, () =>
            {
                string username = createAccountView.Username;
                string email    = createAccountView.Email;
                string password = createAccountView.Password;

                var credentials = new Dictionary <string, string>
                {
                    { "username", username },
                    { "email", email },
                    { "password", password }
                };

                Msf.Client.Auth.SignUp(credentials, (successful, error) =>
                {
                    Msf.Events.Invoke(Event_Keys.hideLoadingInfo);

                    if (successful)
                    {
                        createAccountView.Hide();
                        loginView.SetInputFieldsValues(username, password);
                        loginView.Show();
                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, "Account created successfully!");
                    }
                    else
                    {
                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, "An error has occured whilst creating account: " + error);
                    }
                });
            });
        }
コード例 #15
0
        public void FindGames()
        {
            ClearGamesList();

            canvasGroup.interactable = false;

            if (statusInfoText)
            {
                statusInfoText.text = "Finding rooms... Please wait!";
                statusInfoText.gameObject.SetActive(true);
            }

            MsfTimer.WaitForSeconds(0.2f, () =>
            {
                Msf.Client.Matchmaker.FindGames((games) =>
                {
                    canvasGroup.interactable = true;

                    if (games.Count == 0)
                    {
                        statusInfoText.text = "No games found! Try to create your own.";
                        return;
                    }

                    statusInfoText.gameObject.SetActive(false);
                    DrawGamesList(games);
                });
            });
        }
コード例 #16
0
        public void RequestConfirmationCode()
        {
            Msf.Events.Invoke(MsfEventKeys.showLoadingInfo, "Sending confirmation code... Please wait!");

            if (!emailConfirmationView)
            {
                ViewsManager.NotifyNoViewFound("EmailConfirmationView");
                return;
            }

            MsfTimer.WaitForSeconds(1f, () =>
            {
                Msf.Client.Auth.RequestEmailConfirmationCode((isSuccessful, error) =>
                {
                    Msf.Events.Invoke(MsfEventKeys.hideLoadingInfo);

                    if (isSuccessful)
                    {
                        emailConfirmationView.Show();
                        Msf.Events.Invoke(MsfEventKeys.showOkDialogBox, new OkDialogBoxEventMessage($"We have sent an email with confirmation code to your address '{Msf.Client.Auth.AccountInfo.Email}'", null));
                    }
                    else
                    {
                        outputMessage = $"An error occurred while requesting confirmation code: {error}";
                        Msf.Events.Invoke(MsfEventKeys.showOkDialogBox, new OkDialogBoxEventMessage(outputMessage, null));
                        logger.Error(outputMessage);
                    }
                });
            });
        }
コード例 #17
0
ファイル: RoomController.cs プロジェクト: GeeJD85/MSF_Custom
        private void HandleProvideRoomAccessCheck(IIncommingMessage message)
        {
            var data = message.Deserialize(new RoomAccessProvideCheckPacket());

            var roomController = Msf.Server.Rooms.GetRoomController(data.RoomId);

            if (roomController == null)
            {
                message.Respond("There's no room controller with room id " + data.RoomId, ResponseStatus.NotHandled);
                return;
            }

            var accessProvider = roomController._accessProvider ?? DefaultAccessProvider;
            var isProviderDone = false;

            var requester = new UsernameAndPeerIdPacket()
            {
                PeerId   = data.PeerId,
                Username = data.Username
            };

            // Invoke the access provider
            accessProvider.Invoke(requester, (access, error) =>
            {
                // In case provider timed out
                if (isProviderDone)
                {
                    return;
                }

                isProviderDone = true;

                if (access == null)
                {
                    // If access is not provided
                    message.Respond(error ?? "", ResponseStatus.Failed);
                    return;
                }

                message.Respond(access, ResponseStatus.Success);

                if (Logger.IsLogging(LogLevel.Trace))
                {
                    Logger.Trace("Room controller gave address to peer " + data.PeerId + ":" + access);
                }
            });

            // Timeout the access provider
            MsfTimer.WaitForSeconds(Msf.Server.Rooms.AccessProviderTimeout, () =>
            {
                if (!isProviderDone)
                {
                    isProviderDone = true;
                    message.Respond("Timed out", ResponseStatus.Timeout);
                    Logger.Error("Access provider took longer than " + Msf.Server.Rooms.AccessProviderTimeout + " seconds to provide access. " +
                                 "If it's intended, increase the threshold at Msf.Server.Rooms.AccessProviderTimeout");
                }
            });
        }
コード例 #18
0
        public void CreateNewRoom()
        {
            if (!createNewRoomView)
            {
                ViewsManager.NotifyNoViewFound("CreateNewRoomView");
                return;
            }

            createNewRoomView.Hide();

            Msf.Events.Invoke(MsfEventKeys.showLoadingInfo, "Starting room... Please wait!");

            // Spawn options for spawner controller
            var spawnOptions = new DictionaryOptions();

            spawnOptions.Add(MsfDictKeys.maxPlayers, createNewRoomView.MaxConnections);
            spawnOptions.Add(MsfDictKeys.roomName, createNewRoomView.RoomName);
            spawnOptions.Add(MsfDictKeys.roomPassword, createNewRoomView.Password);

            // Custom options that will be given to room directly
            var customSpawnOptions = new DictionaryOptions();

            customSpawnOptions.Add(Msf.Args.Names.StartClientConnection, string.Empty);

            Msf.Client.Spawners.RequestSpawn(spawnOptions, customSpawnOptions, createNewRoomView.RegionName, (controller, error) =>
            {
                if (controller == null)
                {
                    Msf.Events.Invoke(MsfEventKeys.hideLoadingInfo);
                    Msf.Events.Invoke(MsfEventKeys.showOkDialogBox, new OkDialogBoxEventMessage(error, null));
                    return;
                }

                Msf.Events.Invoke(MsfEventKeys.showLoadingInfo, "Room started. Finalizing... Please wait!");

                MsfTimer.WaitWhile(() =>
                {
                    return(controller.Status != SpawnStatus.Finalized);
                }, (isSuccess) =>
                {
                    Msf.Events.Invoke(MsfEventKeys.hideLoadingInfo);

                    if (!isSuccess)
                    {
                        Msf.Client.Spawners.AbortSpawn(controller.SpawnTaskId);
                        logger.Error("Failed spawn new room. Time is up!");
                        Msf.Events.Invoke(MsfEventKeys.showOkDialogBox, new OkDialogBoxEventMessage("Failed spawn new room. Time is up!", null));
                        return;
                    }

                    OnRoomStartedEvent?.Invoke();

                    logger.Info("You have successfully spawned new room");
                }, 60f);
            });
        }
コード例 #19
0
 protected virtual void Start()
 {
     if (Msf.Runtime.IsEditor && autoStartInEditor)
     {
         // Start the server on next frame
         MsfTimer.WaitForEndOfFrame(() => {
             StartServer();
         });
     }
 }
コード例 #20
0
 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);
         });
     }
 }
コード例 #21
0
 /// <summary>
 /// This will start server in test mode
 /// </summary>
 protected virtual void StartServerInEditor()
 {
     if (startServerAsHost)
     {
         MirrorNetworkManager.StopHost();
         MsfTimer.WaitForSeconds(0.2f, () => MirrorNetworkManager.StartHost());
     }
     else
     {
         MirrorNetworkManager.StopServer();
         MsfTimer.WaitForSeconds(0.2f, () => MirrorNetworkManager.StartServer());
     }
 }
コード例 #22
0
        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();
                });
            }
        }
コード例 #23
0
 public void CloseSearch()
 {
     if (searchOpen)
     {
         searchAddButton.GetComponentInChildren <TMP_Text>().text = "Find friends";
         LeanTween.scale(searchBar, new Vector2(0, 1), 0.1f);
         MsfTimer.WaitForSeconds(0.2f, () =>
         {
             searchOpen = false;
             return;
         });
     }
     searchInput.text = "";
 }
コード例 #24
0
        //Sends message to CustomProfiles_Module to update a given value
        public void UpdateProfileValues(string profileValue, float value, MsfMessageCodes msfMessageCodes)
        {
            Msf.Events.Invoke(Event_Keys.showLoadingInfo, "Updating profile data... Please wait!");

            MsfTimer.WaitForSeconds(1f, () =>
            {
                var data = new Dictionary <string, float>
                {
                    { profileValue, value },
                };

                Connection.SendMessage((short)msfMessageCodes, data.ToBytes(), OnSaveProfileResponseCallback);
            });
        }
コード例 #25
0
 protected override void OnClientConnectedToServer()
 {
     MsfTimer.WaitForSeconds(1f, () =>
     {
         if (!Msf.Client.Auth.IsSignedIn)
         {
             Msf.Client.Auth.SignInAsGuest(OnSignedInAsGuest);
         }
         else
         {
             mainView?.Show();
         }
     });
 }
コード例 #26
0
        public void SignUp()
        {
            Msf.Events.Invoke(MsfEventKeys.showLoadingInfo, "Signing up... Please wait!");

            if (!signinView)
            {
                ViewsManager.NotifyNoViewFound("SigninView");
                return;
            }

            if (!signupView)
            {
                ViewsManager.NotifyNoViewFound("SignUpView");
                return;
            }

            MsfTimer.WaitForSeconds(1f, () =>
            {
                string username = signupView.Username;
                string email    = signupView.Email;
                string password = signupView.Password;

                var credentials = new Dictionary <string, string>
                {
                    { "username", username },
                    { "email", email },
                    { "password", password }
                };

                Msf.Client.Auth.SignUp(credentials, (isSuccessful, error) =>
                {
                    Msf.Events.Invoke(MsfEventKeys.hideLoadingInfo);

                    if (isSuccessful)
                    {
                        signupView.Hide();
                        signinView.SetInputFieldsValues(username, password);
                        signinView.Show();

                        logger.Debug($"You have successfuly signed up. Now you may sign in");
                    }
                    else
                    {
                        outputMessage = $"An error occurred while signing up: {error}";
                        Msf.Events.Invoke(MsfEventKeys.showOkDialogBox, new OkDialogBoxEventMessage(outputMessage, null));
                        logger.Error(outputMessage);
                    }
                });
            });
        }
コード例 #27
0
        public void UpdateProfile()
        {
            Msf.Events.Invoke(MsfEventKeys.showLoadingInfo, "Saving profile data... Please wait!");

            MsfTimer.WaitForSeconds(1f, () =>
            {
                var data = new Dictionary <string, string>
                {
                    { "displayName", profileSettingsView.DisplayName },
                    { "avatarUrl", profileSettingsView.AvatarUrl }
                };

                Connection.SendMessage((short)MsfMessageCodes.UpdateDisplayNameRequest, data.ToBytes(), OnSaveProfileResponseCallback);
            });
        }
コード例 #28
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();
            });
        }
コード例 #29
0
        public void SignIn()
        {
            Msf.Events.Invoke(MsfEventKeys.showLoadingInfo, "Signing in... Please wait!");

            logger.Debug("Signing in... Please wait!");

            if (!signinView)
            {
                ViewsManager.NotifyNoViewFound("SigninView");
                return;
            }

            if (!emailConfirmationView)
            {
                ViewsManager.NotifyNoViewFound("EmailConfirmationView");
                return;
            }

            MsfTimer.WaitForSeconds(1f, () =>
            {
                Msf.Client.Auth.SignIn(signinView.Username, signinView.Password, (accountInfo, error) =>
                {
                    Msf.Events.Invoke(MsfEventKeys.hideLoadingInfo);

                    if (accountInfo != null)
                    {
                        signinView.Hide();

                        if (accountInfo.IsEmailConfirmed)
                        {
                            OnSignedInEvent?.Invoke();
                            logger.Debug($"You are successfully logged in as {Msf.Client.Auth.AccountInfo}");
                        }
                        else
                        {
                            emailConfirmationView.Show();
                        }
                    }
                    else
                    {
                        outputMessage = $"An error occurred while signing in: {error}";
                        Msf.Events.Invoke(MsfEventKeys.showOkDialogBox, new OkDialogBoxEventMessage(outputMessage, null));
                        logger.Error(outputMessage);
                    }
                });
            });
        }
コード例 #30
0
        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();
                });
            }
        }