void OnEnable() { if (isFirstTime_) { EnableFirstTimeUI(); } else { // show/hide logout button based on the player's login status logoutButton.SetActive(Authentication.IsLoggedIn()); } charIndices = new int[3]; // read in existing name if any string tag = GamerTagManager.GetGamerTag(); if (tag != null) { for (int i = 0; i < 3; i++) { charIndices[i] = VALID_CHARS.IndexOf(tag[i]); } } // update three UI text elements at one go UpdateTextUI(); }
// public method to handle back button behaviour public void BackButtonHandler() { // save the current gamer tag GamerTagManager.SetGamerTag(GetName()); UIStateMachine.instance.GoTo(UIState.MainMenu); }
/// submit a score to the leaderboards, /// updating the client on a response static void SubmitScore(float time) { // The Leaderboards to submit our time to Leaderboards leaderboards = new Leaderboards(); // The score to submit string ourName = GamerTagManager.GetGamerTag(); string theirName = MultiPlayerController.Instance.theirName; int tenthSeconds = ClockController.SecondsToTenthsOfSeconds(time); Score score = new Score(tenthSeconds, ourName, theirName); // Submit the time the the leaderboards, and send a message // to the client upon response leaderboards.SubmitScoreAsync(SceneManager.opts.level, score, delegate(SubmissionResponse r, ServerException e) { if (e != null) { UILogger.Log(e.Message); } position = (byte)r.position; positionSet = true; updateManager.SendLeaderboardsUpdate(position); }); }
public void SendGamerTag() { List <byte> gamerTagUpdate = new List <byte> (); gamerTagUpdate.AddRange(Encoding.ASCII.GetBytes(GamerTagManager.GetGamerTag())); ApplyHeader(gamerTagUpdate, GAMER_TAG); MultiPlayerController.Instance.SendMyReliable(gamerTagUpdate); }
void OnEnable() { // Set gamer tag text to the player's actual gamer tag string tag = GamerTagManager.GetGamerTag(); if (tag != null) { gamerTag.text = tag; } // If the player isn't logged in, try to log in RestoreTapText(); LoginToGooglePlay(false); }
void Start() { // check gamer tag existance and prompt if not present if (GamerTagManager.GetGamerTag() == null) { GamerTagMenuController.IsFirstTime(); currentState = UIState.GamerTagMenu; } // make sure each foreach (UIState state in System.Enum.GetValues(typeof(UIState))) { Close(state); } // Open the initial state Open(currentState); }