public override void OnDrawGui(VOGController ctrl) { BeginWindow(); //Header Heading("Really?"); Body("It's a lot more fun to sign up - that way you'll get a customisable avatar you can use across multiple games."); SetBackButton(); if (BackButton("Oh, go on then!", ctrl.InputEnabled(this))) { ctrl.StartBackTransition(); ; } Body("If you really prefer not to, we won't hold it against you ;-)\nYou can continue as a guest by choosing a gender for your avatar:"); GUILayout.BeginHorizontal(); SetDefaultControl(); SetDefaultButton(); if (BackButton("Male", ctrl.InputEnabled(this), GUILayout.Width(SplitButtonWidth))) { StartCoroutine(OnNewGuest(ctrl as VOGControllerAuth, AvatarGender.Male)); } if (Button("Female", ctrl.InputEnabled(this), GUILayout.Width(SplitButtonWidth))) { StartCoroutine(OnNewGuest(ctrl as VOGControllerAuth, AvatarGender.Female)); } GUILayout.EndHorizontal(); EndWindow(); }
public override void OnDrawGui(VOGController ctrl) { BeginWindow(); //Header Heading("Welcome back!"); Body("Please enter your vostopia password and we'll fetch your avatar for you:"); SetDefaultControl(); Password = PasswordField(Password, ctrl.InputEnabled(this)); GUILayout.BeginHorizontal(); SetBackButton(); if (BackButton("Back", ctrl.InputEnabled(this), GUILayout.Width(SplitButtonWidth))) { ctrl.StartBackTransition(); } SetDefaultButton(); if (Button("Continue", ctrl.InputEnabled(this), GUILayout.Width(SplitButtonWidth))) { StartCoroutine(OnAuthenticate(ctrl as VOGControllerAuth)); } GUILayout.EndHorizontal(); Heading("Oops!"); Body("Forgotten or never received your password? No problem."); if (Button("Send me a new password", ctrl.InputEnabled(this))) { StartCoroutine(OnSendNewPassword(ctrl as VOGControllerAuth)); } EndWindow(); }
public override void OnStateEnable(VOGController ctrl) { base.OnStateEnable(ctrl); if (Data == null) { Debug.LogError("VOGMessageDialog without DialogData"); } }
public override void OnStateDisable(VOGController ctrl) { base.OnStateDisable(ctrl); if (Data != null && Data.Callback != null) { Data.Callback(); } Data = null; }
public override void OnDrawGui(VOGController ctrl) { BeginWindow(); //Header Heading("Hi and welcome back!"); Body("You've been here before haven't you?\nJust click the button below to sign in again."); //Profile Picture GUILayout.BeginHorizontal(); //Image var imageStyle = GUI.skin.FindStyle("image"); GUILayout.Label(ctrl.GetTexture(ProfilePictureBackground), imageStyle); var imageRect = GUILayoutUtility.GetLastRect(); if (profilePicture != null) { float sizeOffset = 4; GUI.Label(new Rect(imageRect.xMin + sizeOffset, imageRect.yMin + sizeOffset, imageRect.width - 2 * sizeOffset, imageRect.height - 2 * + sizeOffset), profilePicture, imageStyle); } else { GUI.Label(imageRect, ctrl.GetTexture(ProfilePictureMissing), imageStyle); } GUI.Label(imageRect, ctrl.GetTexture(ProfilePictureFrame), imageStyle); //Username GUILayout.Label(UserAuth.DisplayName, GUI.skin.FindStyle("label-profilepicture")); GUILayout.EndHorizontal(); SetDefaultControl(); SetDefaultButton(); if (Button("Sweet, sign me in", ctrl.InputEnabled(this))) { StartCoroutine(OnSignIn(ctrl as VOGControllerAuth)); } SetBackButton(); if (BackButton("I'm someone else!", ctrl.InputEnabled(this))) { OnAnotherUser(ctrl); } //Footer logo GUILayout.FlexibleSpace(); GUILayout.Label(ctrl.GetTexture(VostopiaLogo), GUI.skin.FindStyle("image"), GUILayout.ExpandWidth(true)); EndWindow(); }
public virtual void OnBeforeDrawGui(VOGController ctrl) { ScreenSizeMultiplier = ctrl.CurrentScreenSize.ScreenMultiplier; //GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(0.5f, 0.5f, 1)) * GUI.matrix; lastControl = currentControl; currentControl = 0; bool changed = false; if (Event.current.Equals(Event.KeyboardEvent("up")) || Event.current.Equals(Event.KeyboardEvent("#tab"))) { Event.current.Use(); changed = true; activeControl--; } else if (Event.current.Equals(Event.KeyboardEvent("down")) || Event.current.Equals(Event.KeyboardEvent("tab"))) { Event.current.Use(); changed = true; activeControl++; } keyboardBack = false; if (Event.current.Equals(Event.KeyboardEvent("escape"))) { keyboardBack = true; } keyboardForward = false; if (Event.current.Equals(Event.KeyboardEvent("return"))) { keyboardForward = true; } if (activeControl < 0) { activeControl = 0; } if (activeControl >= lastControl) { activeControl = lastControl - 1; } if (changed || !GUI.GetNameOfFocusedControl().StartsWith("Ctrl_" + name)) { GUI.FocusControl(ControlName(activeControl)); } //GUI.Label(new Rect(0, 0, 100, 20), "Active: " + GUI.GetNameOfFocusedControl()); }
private IEnumerator Continue(VOGController ctrl) { try { ctrl.DisableInput(); //wait for connection while (!VostopiaClient.HasSessionKey) { yield return null; } //See if user exists ApiCall call = VostopiaClient.Authentication.BeginFindUser(Email); IEnumerator e = call.Wait(); while (e.MoveNext()) { yield return e.Current; } VostopiaUser user = VostopiaClient.Authentication.EndFindUser(call); if (user != null) { var passwordData = new VOGStateAuthPassword.PasswordData(); passwordData.CancelOnBack = false; passwordData.User = user; ctrl.StartTransition(PasswordState, passwordData); } else { if (!ValidateEmail(Email)) { ctrl.ShowMessageDialog("Oops!", "Please enter a valid email address.", () => { }); yield break; } else { ctrl.StartTransition(NewUserState, Email); } } } finally { ctrl.EnableInput(); } }
public override void OnDrawGui(VOGController ctrl) { BeginWindow(); //Header Heading("Did you know?"); Body("The avatar you've just created can be used in multiple games. Look out for the Vostopia logo in other games!"); GUILayout.Space(LogoVerticalSpace); GUILayout.Label(ctrl.GetTexture(VostopiaLogo), GUI.skin.FindStyle("image"), GUILayout.ExpandWidth(true)); GUILayout.Space(LogoVerticalSpace); SetDefaultControl(); SetDefaultButton(); if (BackButton("Awesome, let's go!", ctrl.InputEnabled(this))) { (ctrl as VOGControllerAuth).AuthenticationCompleted(); } EndWindow(); }
public override void OnDrawGui(VOGController ctrl) { if (Data == null) { Data = new DialogData(); } ShadeScreen(); BeginWindow(280, 150); HeadingCentered(Data.Header ?? ""); BodyCentered(Data.Body ?? ""); GUILayout.FlexibleSpace(); if (Button("Ok", ctrl.InputEnabled(this))) { ctrl.StartBackTransition(); } EndWindow(); }
public override void OnDrawGui(VOGController ctrl) { BeginWindow(); //Header Heading("Please enter your email address:"); Body("(or your pre-existing Vostopia username)"); SetDefaultControl(); Email = TextField(Email, ctrl.InputEnabled(this)); GUILayout.BeginHorizontal(); SetBackButton(); if (BackButton("Back", ctrl.InputEnabled(this), GUILayout.Width(SplitButtonWidth))) { ctrl.StartBackTransition(); } SetDefaultButton(); if (Button("Continue", ctrl.InputEnabled(this), GUILayout.Width(SplitButtonWidth))) { StartCoroutine(Continue(ctrl)); } GUILayout.EndHorizontal(); Body("By continuing you agree to the Vostopia"); if (LinkButton("terms and conditions", ctrl.InputEnabled(this))) { Application.OpenURL("http://vostopia.com/en/vossa/legal/tos/"); } //Footer logo GUILayout.FlexibleSpace(); GUILayout.Label(ctrl.GetTexture(VostopiaLogo), GUI.skin.FindStyle("image"), GUILayout.ExpandWidth(true)); EndWindow(); }
public override void OnDrawGui(VOGController ctrl) { BeginWindow(); //Header Heading("Hi and welcome!"); Body("This game uses Vostopia avatars!\nThey exist across multiple games and apps, and you can use the same avatar everywhere that uses the Vostopia system.\n\nIn order to find your avatar, we need a way to remember you by:"); //Ok button SetDefaultControl(); SetDefaultButton(); if (Button("Cool, let's do this", ctrl.InputEnabled(this))) { ctrl.StartTransition(EmailState); } //Cancel button SetBackButton(); if (CurrentAuthSelectData.EnableCancel) { if (BackButton("Cancel", ctrl.InputEnabled(this))) { OnCancel(ctrl as VOGControllerAuth); } } else { if (BackButton("I don't wish to be remembered!", ctrl.InputEnabled(this))) { StartCoroutine(OnSignInGuest(ctrl as VOGControllerAuth)); } } //Footer logo GUILayout.FlexibleSpace(); GUILayout.Label(ctrl.GetTexture(VostopiaLogo), GUI.skin.FindStyle("image"), GUILayout.ExpandWidth(true)); EndWindow(); }
public override void OnDrawGui(VOGController ctrl) { BeginWindow(); //Header Heading("Welcome!"); Body("Please choose what gender you'd like your avatar to be:"); SetDefaultControl(); GUILayout.BeginHorizontal(); SetDefaultButton(); if (Button("Male", ctrl.InputEnabled(this), GUILayout.Width(SplitButtonWidth))) { StartCoroutine(OnNewUser(ctrl as VOGControllerAuth, AvatarGender.Male)); } if (Button("Female", ctrl.InputEnabled(this), GUILayout.Width(SplitButtonWidth))) { StartCoroutine(OnNewUser(ctrl as VOGControllerAuth, AvatarGender.Male)); } GUILayout.EndHorizontal(); Body("Don't worry, you can change this later if you wish."); KeepInTouch = Toggle(KeepInTouch, "Keep in touch about avatar games", ctrl.InputEnabled(this)); GUILayout.FlexibleSpace(); SetBackButton(); if (BackButton("Back", ctrl.InputEnabled(this))) { ctrl.StartBackTransition(); } EndWindow(); }
public virtual void OnStateEnable(VOGController ctrl) { GUI.FocusControl("disabled"); }
public abstract void OnDrawGui(VOGController ctrl);
public IEnumerator OnSendNewPassword(VOGController ctrl) { try { ctrl.DisableInput(); if (CurrentPasswordData == null || CurrentPasswordData.User == null) { ctrl.ShowMessageDialog("Doh!", "An error occurred during authentication. Please try again", () => { }); yield break; } ApiCall call = VostopiaClient.Authentication.BeginRecoverPassword(CurrentPasswordData.User.Username); IEnumerator e = call.Wait(); while (e.MoveNext()) { yield return e.Current; } if (VostopiaClient.Authentication.EndRecoverPassword(call)) { ctrl.ShowMessageDialog("Email Sent", "Alright! We've sent out your new password. Please check your email in a few minutes and return here to enter your password.", () => { }); } else { ctrl.ShowMessageDialog("Doh!", "An error occurred during sending recovery email. Please try again", () => { }); } } finally { ctrl.EnableInput(); } }
public void OnAnotherUser(VOGController ctrl) { var authSelectData = new VOGStateAuthSelect.AuthSelectData(); authSelectData.EnableCancel = false; ctrl.StartTransition(AuthSelectorScreen, authSelectData); }
public override void OnStateEnable(VOGController ctrl) { base.OnStateEnable(ctrl); StartCoroutine(LoadProfilePicture()); }
public override void OnStateDisable(VOGController ctrl) { base.OnStateDisable(ctrl); if (profilePicture != null) { Object.Destroy(profilePicture); profilePicture = null; } if (profilePictureDownload != null) { profilePictureDownload.Dispose(); profilePictureDownload = null; } }