public void OnOkButton() { var value = inputName.text.CleanFromCode().CleanForPersian(); if (value.Length < 3 || BadWordsFinder.HasBadWord(value)) { inputName.text = gameManager.PlayerName; return; } okButton.SetInteractable(false); gameManager.PlayerName = value; Popup_Leaderboard.SendScore(res => { Back(); callbackFunc(); }); }
private void Start() { OpenState <State_Loading>(); if (PlayerName.Length < 3) { PlayerName = "player" + Random.Range(1000, 9999); Popup_Leaderboard.SendScore(p => { #if DATABEEN DelayCall(10, () => { Debug.Log("Registered player"); DataBeen.SendCustomEventData("Registered", new DataBeenConnection.CustomEventInfo[] { new DataBeenConnection.CustomEventInfo() { key = "id", value = p.id } }); }); #endif }); } BadWordsFinder.Initialize(badnames.text.Split(new char[] { '\n' }, System.StringSplitOptions.RemoveEmptyEntries)); }
// Use this for initialization private IEnumerator Start() { UiShowHide.ShowAll(transform); avatar.Setup(Profile.Avatar.Current); nicknameInput.text = Profile.HasNickname ? Profile.Nickname : Profile.Username; nicknamePrice.transform.parent.gameObject.SetActive(Profile.HasNickname); nicknamePrice.SetText(GlobalConfig.Shop.nicknamePrice.ToString()); nicknameButton.onClick.AddListener(() => { if (nicknameInput.text.ComputeMD5(Core.Salt) != "AC9CD53769E38CBBD8707CA1108BA10D") { var nickname = nicknameInput.text.Trim().CleanFromCode().CleanForPersian(); #if UNITY_EDITOR_off SendNickname(nickname); #else if (nickname != Profile.Username && nickname.HasContent(3) && nickname.IsLetterOrDigit() && BadWordsFinder.HasBadWord(nickname) == false) { if (Profile.HasNickname) { Game.SpendGems(GlobalConfig.Shop.nicknamePrice, () => SendNickname(nickname)); } else { SendNickname(nickname); } } else { Game.Instance.OpenPopup <Popup_Confirm>().Setup(111001, false, true, null); } #endif } else { GlobalConfig.DebugMode = true; } }); statusInput.text = Profile.Status; statusPrice.transform.parent.gameObject.SetActive(Profile.HasStatus); statusPrice.SetText(GlobalConfig.Shop.statusPrice.ToString()); statusButton.onClick.AddListener(() => { var status = statusInput.text.Trim().CleanFromCode().CleanForPersian(); #if UNITY_EDITOR_off SendStatus(status); #else if (status.HasContent(3) && status.IsLetterOrDigit() && BadWordsFinder.HasBadWord(status) == false) { if (Profile.HasStatus) { Game.SpendGems(GlobalConfig.Shop.statusPrice, () => SendStatus(status)); } else { SendStatus(status); } } else { Game.Instance.OpenPopup <Popup_Confirm>().Setup(111002, false, true, null); } #endif }); hairSlider.minValue = 0; hairSlider.maxValue = 360; hairSlider.value = Profile.Avatar.Angle; hairSlider.onValueChanged.AddListener(value => { Profile.Avatar.Angle = value.ToInt(); avatar.Setup(Profile.Avatar.Current); Game.Instance.CurrentState.Broadcast(Messages.Type.AvatarChanged, Profile.Avatar.Current); }); for (int i = 0; i < GlobalFactory.Balls.Count; i++) { if (GlobalFactory.Balls.GetSprite(i) != null) { itemPrefab.Clone <UiProfileBallItem>().Setup(i).gameObject.SetActive(true); } } yield return(new WaitForSeconds(0.1f)); ballsScroller.content.anchoredPosition = Vector2.down * (UiProfileBallItem.unlockedPosition.y + 100); }