示例#1
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);
                    }
                });
            });
        }
示例#2
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);
                    }
                });
            });
        }
        /// <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);
                });
            }
        }
示例#4
0
        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);
                    }
                });
            });
        }
        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);
                });
            });
        }
示例#6
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);
                    }
                });
            });
        }
示例#7
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);
                    }
                });
            });
        }
示例#8
0
        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);
                    }
                });
            });
        }
        /// <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");
                }
            });
        }
        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);
                    }
                });
            });
        }
        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();
                }
            }
        }
示例#12
0
        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");
                }
            });
        }
 /// <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());
     }
 }
 protected override void OnClientConnectedToServer()
 {
     MsfTimer.WaitForSeconds(1f, () =>
     {
         if (!Msf.Client.Auth.IsSignedIn)
         {
             Msf.Client.Auth.SignInAsGuest(OnSignedInAsGuest);
         }
         else
         {
             mainView?.Show();
         }
     });
 }
示例#15
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);
            });
        }
示例#16
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 = "";
 }
        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);
                    }
                });
            });
        }
示例#18
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);
            });
        }
        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);
                    }
                });
            });
        }
        protected override void OnInitialize()
        {
            // Listen to disconnection from master
            Connection.AddDisconnectionListener(OnDisconnectedFromMasterEvent, false);

            MsfTimer.WaitForSeconds(1f, () =>
            {
                if (IsInTestMode())
                {
                    StartRoomClient(true);
                }

                if (Msf.Options.Has(MsfDictKeys.autoStartRoomClient) || Msf.Args.StartClientConnection)
                {
                    StartRoomClient();
                }
            });
        }
示例#21
0
 public void OpenSearch()
 {
     if (!searchOpen)
     {
         searchAddButton.GetComponentInChildren <TMP_Text>().text = "Add";
         LeanTween.scale(searchBar, new Vector2(1, 1), 0.1f);
         MsfTimer.WaitForSeconds(0.2f, () =>
         {
             searchOpen = true;
             searchInput.ActivateInputField(); //So we can type right after opening searchbar
             return;
         });
     }
     else
     {
         SearchFriends(searchInput.text);
     }
 }
        public void FindGames()
        {
            Msf.Events.Invoke(EventKeys.showLoadingInfo, "Finding rooms... Please wait!");

            MsfTimer.WaitForSeconds(1f, () =>
            {
                Msf.Client.Matchmaker.FindGames((games) =>
                {
                    Msf.Events.Invoke(EventKeys.hideLoadingInfo);

                    if (games.Count == 0)
                    {
                        Msf.Events.Invoke(EventKeys.showOkDialogBox, new OkDialogBoxViewEventMessage("No games found!"));
                        return;
                    }

                    DrawGamesList(games);
                });
            });
        }
示例#23
0
        public void LoadProfile()
        {
            Msf.Events.Invoke(Event_Keys.showLoadingInfo, "Loading profile... please wait!");

            MsfTimer.WaitForSeconds(1, () =>
            {
                Msf.Client.Profiles.GetProfileValues(Profile, (successful, error) =>
                {
                    if (successful)
                    {
                        Msf.Events.Invoke(Event_Keys.hideLoadingInfo);
                        OnProfileLoadedEvent?.Invoke();
                    }
                    else
                    {
                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, $"An error has occured whilst retrieving your profile: " + error);
                    }
                });
            });
        }
        public void LoadProfile()
        {
            Msf.Events.Invoke(EventKeys.showLoadingInfo, "Loading profile... Please wait!");

            MsfTimer.WaitForSeconds(1f, () =>
            {
                Msf.Client.Profiles.GetProfileValues(Profile, (isSuccessful, error) =>
                {
                    if (isSuccessful)
                    {
                        Msf.Events.Invoke(EventKeys.hideLoadingInfo);
                        OnProfileLoadedEvent?.Invoke();
                    }
                    else
                    {
                        Msf.Events.Invoke(EventKeys.showOkDialogBox,
                                          new OkDialogBoxViewEventMessage($"When requesting profile data an error occurred. [{error}]"));
                    }
                });
            });
        }
示例#25
0
        public void SignIn()
        {
            Msf.Events.Invoke(Event_Keys.showLoadingInfo, "Signing in... Please wait!");

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

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

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

                        if (accountInfo.IsEmailConfirmed)
                        {
                            OnSignedInEvent?.Invoke();

                            //Use this to create a message when a user logs in
                            //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
                        {
                            emailConfirmationView.Show();
                        }
                    }
                    else
                    {
                        outputMessage = $"An error occurred while signing in: {error}";
                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, new OkDialogBox_ViewEventMessage(outputMessage, null));
                        logger.Error(outputMessage);
                    }
                });
            });
        }
示例#26
0
        public void OpenCloseList()
        {
            if (!isOpen)
            {
                LeanTween.scale(friendsList, new Vector2(1, 1), 0.1f);
                MsfTimer.WaitForSeconds(0.2f, () =>
                {
                    isOpen = true;
                    return;
                });
            }

            if (isOpen)
            {
                LeanTween.scale(friendsList, new Vector2(0, 0), 0.1f);
                MsfTimer.WaitForSeconds(0.2f, () =>
                {
                    isOpen = false;
                    return;
                });
            }
        }
示例#27
0
        public void RequestEmailConfirmationCode()
        {
            Msf.Events.Invoke(Event_Keys.showLoadingInfo, "Sending confirmation code... please wait!");

            MsfTimer.WaitForSeconds(1, () =>
            {
                Msf.Client.Auth.RequestEmailConfirmationCode((successful, error) =>
                {
                    Msf.Events.Invoke(Event_Keys.hideLoadingInfo);

                    if (successful)
                    {
                        emailConfirmationView.Show();
                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, "We have sent and email with your confirmation code to your address: " + Msf.Client.Auth.AccountInfo.Email);
                    }
                    else
                    {
                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, "An error occured whilst requesting confirmation code: " + error);
                    }
                });
            });
        }
        /// <summary>
        /// Get profile data from master
        /// </summary>
        public void LoadProfile()
        {
            Msf.Events.Invoke(MsfEventKeys.showLoadingInfo, "Loading profile... Please wait!");

            MsfTimer.WaitForSeconds(0.2f, () =>
            {
                Msf.Client.Profiles.GetProfileValues(Profile, (isSuccessful, error) =>
                {
                    Msf.Events.Invoke(MsfEventKeys.hideLoadingInfo);

                    if (isSuccessful)
                    {
                        OnProfileLoadedEvent?.Invoke();
                    }
                    else
                    {
                        logger.Error("Could not load user profile");
                        OnProfileLoadFailedEvent?.Invoke();
                    }
                });
            });
        }
示例#29
0
        public void SignIn()
        {
            Msf.Events.Invoke(Event_Keys.showLoadingInfo, "Signing in.. please wait!");

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

                    if (accountInfo != null)
                    {
                        loginView.Hide();
                        SetPlayerPrefs(); //Save username if checkbox is ticked

                        //If we want email verification
                        if (accountInfo.IsEmailConfirmed)
                        {
                            OnSignedInEvent?.Invoke();

                            //Use this to create a message when a user logs in
                            //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
                        {
                            RequestEmailConfirmationCode();
                        }
                    }
                    else
                    {
                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, "An error has occured whilst signing in: " + error);
                    }
                });
            });
        }
示例#30
0
        public void ConfirmAccount()
        {
            Msf.Events.Invoke(Event_Keys.showLoadingInfo, "Confirming your account.. please wait!");

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

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

                    if (successful)
                    {
                        emailConfirmationView.Hide();
                        OnEmailConfirmedEvent?.Invoke();
                    }
                    else
                    {
                        Msf.Events.Invoke(Event_Keys.showOkDialogBox, "An error occured whilst confirming your account: " + error);
                    }
                });
            });
        }