public async void Deselect() { var AM = AppManager.Instance; if (login.text == "") { mail.color = new Color32(61, 61, 61, 255); login.GetComponent <Image>().color = new Color32(246, 249, 244, 255); invalid.SetActive(false); confirmed.SetActive(false); } else { await WebHandler.Instance.GetDataWrapper((repl) => { JsonUtility.FromJsonOverwrite(repl, AM); for (int i = 0; i < AM.res.emails.Count; i++) { if (AM.res.emails[i] == login.text) { confirmed.SetActive(true); invalid.SetActive(false); } } }); } }
/// <summary> /// Checks input from given input field and displays information to player /// or sets input withing proper range when input is invalid /// </summary> /// <returns>True if input is correct otherwise false</returns> private bool CheckAndSetNumericInput(TMP_InputField input, TextMeshProUGUI helperText, Slider inputSlider, int minValue, int maxValue) { bool result = false; string regexPattern = @"^ *[0-9]+ *\$? *$"; Match regexMatch = Regex.Match(input.text, regexPattern); if (true == regexMatch.Success) { string regexReplacePattern = @"[^0-9]"; string valueStr = Regex.Replace(input.text, regexReplacePattern, string.Empty); int value = int.Parse(valueStr); value = Mathf.Clamp(value, minValue, maxValue); input.text = value.ToString(); inputSlider.value = value; helperText.gameObject.SetActive(false); input.GetComponent <Image>().color = InputFieldNormalColor; result = true; } else { input.GetComponent <Image>().color = InputFieldInvalidColor; helperText.gameObject.SetActive(true); } return(result); }
private void recuperarSenha() { if (TxtEmailRecSenha.text == string.Empty) { TxtEmailRecSenha.GetComponent <InputRequired>().AtivarDesativarAlerta(TxtEmailRecSenha.text == string.Empty); AlertaManager.Instance.ChamarAlertaMensagem(AlertaManager.MsgAlerta.PreenchaOsCampos, false); return; } TxtEmailRecSenha.GetComponent <InputRequired>().AtivarDesativarAlerta(false); Dictionary <string, object> form = new Dictionary <string, object> { { "email", TxtEmailRecSenha.text } }; StartCoroutine(ClienteAPI.ClienteRecuperarSenha(form, (response, error) => { if (error != null) { Debug.Log(error); AppManager.Instance.DesativarLoaderAsync(); AlertaManager.Instance.ChamarAlertaMensagem(error, false); return; } AlertaManager.Instance.ChamarAlertaMensagem(response, true); fecharPnlRecuperarSenha(); })); }
private void UsernameAvaliable() { isUsernameUnique = true; inputField_Username.GetComponent <Outline>().effectColor = color_Green; text_UsernameWarning.gameObject.SetActive(false); SetInteractableSignUpButton(); }
public void CalculateExptoLevel() { int currentLevel = 0; if (Exp.GetComponent <TMP_InputField>().text != null) { inputExp = Convert.ToInt32(Exp.GetComponent <TMP_InputField>().text); } if (inputExp < 0) { Error.SetActive(true); return; } for (int currentExp = inputExp; currentExp >= 0; currentLevel++) { if (currentLevel <= 15) { if (currentExp < ((2 * currentLevel) + 7)) { OutputLevel = currentLevel; break; } } else if (currentLevel > 15 && currentLevel <= 30) { if (currentExp < ((5 * currentLevel) - 38)) { OutputLevel = currentLevel; break; } } else if (currentLevel > 30) { if (currentExp < ((9 * currentLevel) - 158)) { OutputLevel = currentLevel; break; } } if (currentLevel <= 15) { currentExp -= (2 * currentLevel) + 7; } else if (currentLevel > 15 && currentLevel <= 30) { currentExp -= (5 * currentLevel) - 38; } else if (currentLevel > 30) { currentExp -= (9 * currentLevel) - 158; } } Error.SetActive(false); Level.text = OutputLevel.ToString(); }
//TODO: Add a way to select this Line #if UNITY_ANDROID public void TouchSelect() { pointFeatureCanvas.SetActive(true); if (vertexSelector.lineFeatures.Contains(feature)) { title.GetComponent <TMP_InputField>().text = feature.Attributes["Title"].ToString(); description.GetComponent <TMP_InputField>().text = feature.Attributes["Description"].ToString(); } }
public void SetPlayerName(string nameInput) { playerName = playerInput.GetComponent <TMP_InputField>().text; Debug.Log(playerName); //playerName = nameInput; if (!string.IsNullOrEmpty(playerName)) { PlayerPrefs.SetString("Name", playerName); PlayerPrefs.SetInt("highscore", 1); } PlayerPrefs.Save(); }
public void Changed() { if (login.text.Length > 0) { mail.color = new Color32(101, 143, 32, 255); login.GetComponent <Image>().color = new Color32(255, 255, 255, 255); } else { mail.color = new Color32(61, 61, 61, 255); login.GetComponent <Image>().color = new Color32(246, 249, 244, 255); } }
void Start() { registerButton.onClick.AddListener(() => { StartCoroutine(Main.Instance.Web.Register( inputUsername.GetComponent <TMP_InputField>().text, inputPassword.GetComponent <TMP_InputField>().text, inputEmail.GetComponent <TMP_InputField>().text)); Invoke("ShowMessage", 0.5f); Invoke("ClearField", 0.5f); }); }
void PlusButtonClick() { // Increment font size when smaller than defined maximum if (font_size < FONT_SIZE_MAX) { font_size += 1; SetFontSize(font_size); // Increase width of input field accordingly RectTransform rt = inputField.GetComponent(typeof(RectTransform)) as RectTransform; SetInputFieldSize(inputFieldWidth += WIDTH_SCALE); } }
void Start() { Vector3 defaultPos; defaultPos.x = 0; defaultPos.y = 0; defaultPos.z = -10.0f; gameObject.GetComponent <RectTransform>().localPosition = defaultPos; gameObject.GetComponent <CanvasGroup>().alpha = 0.0f; gameObject.SetActive(false); dynamicBpmInput.GetComponent <TMP_InputField>().onSubmit.AddListener(delegate { AddDynamicBPM(); }); //dynamicBpmInput.GetComponent<TMP_InputField>().onEndEdit.AddListener(delegate {Deactivate(); }); }
public void LoadSceen() { //If there is player prefs already if (PlayerPrefs.HasKey("cameraSpeed")) { scroleSpeed.GetComponent <TMP_InputField>().text = PlayerPrefs.GetInt("cameraSpeed").ToString(); diceInflate.isOn = bool.Parse(PlayerPrefs.GetString("diceInflate")); } else { scroleSpeed.GetComponent <TMP_InputField>().text = GlobalVariables.data.CAMERA_ROTATION_SPEED.ToString(); diceInflate.isOn = GlobalVariables.data.SHOW_DICE_INFLATE_ANIMATION; zoomControl.value = gameControl.mainCamera.transform.position.y; } }
void OnMouseDown() { if (IsEditaNome) { textao.SetActive(true); } else { ArmazenaInfo_Login.NomeJogador = Textinho.GetComponent <TMP_InputField>().text; PlayerPrefs.SetString("nome", Textinho.GetComponent <TMP_InputField>().text); Debug.Log(ArmazenaInfo_Login.NomeJogador); Câmera.TagTela = "TelaMenu"; Fundos.PlayOneShot(AbreTela); } }
private void logar() { if (TxtEmail.text == string.Empty || TxtSenha.text == string.Empty) { TxtEmail.GetComponent <InputRequired>().AtivarDesativarAlerta(TxtEmail.text == string.Empty); TxtSenha.GetComponent <InputRequired>().AtivarDesativarAlerta(TxtSenha.text == string.Empty); AlertaManager.Instance.ChamarAlertaMensagem(AlertaManager.MsgAlerta.PreenchaOsCampos, false); return; } Dictionary <string, object> form = new Dictionary <string, object> { { "email", TxtEmail.text }, { "password", Util.GerarHashMd5(TxtSenha.text) }, { "tipoLogin", tipoLogin }, { "socialId", socialId }, { "deviceId", AppManager.Instance.deviceId }, { "tokenFirebase", AppManager.Instance.tokenFirebase } }; TxtEmail.GetComponent <InputRequired>().AtivarDesativarAlerta(false); TxtSenha.GetComponent <InputRequired>().AtivarDesativarAlerta(false); AppManager.Instance.AtivarLoader(); StartCoroutine(ClienteAPI.ClienteLogin(form, (response, error) => { if (error != null) { Debug.Log(error); AppManager.Instance.DesativarLoaderAsync(); AlertaManager.Instance.ChamarAlertaMensagem(error, false); return; } AppManager.Instance.GravarSession(response.token, response._id, JsonConvert.SerializeObject(new Cliente.Credenciais { email = TxtEmail.text, password = Util.GerarHashMd5(TxtSenha.text), tipoLogin = tipoLogin })); buscarClienteNoFireBase(); })); }
// Start is called before the first frame update void Start() { mapDetails = GetComponent <MapDetails>(); mapCanvas = mapDetails.mapCanvas; mapTile = mapDetails.mapTile; width = gameObject.GetComponent <RectTransform>().rect.width; height = gameObject.GetComponent <RectTransform>().rect.height; //Debug.Log(height); columns = int.Parse(width.ToString()) / 50; rows = int.Parse(height.ToString()) / 50; if (editorMode == true) { //RandomMap(); codeInput.GetComponent <TMP_InputField>(); } else { } }
private void OnItemBeginEdit(object sender, VirtualizingTreeViewItemDataBindingArgs e) { ProjectItem item = e.Item as ProjectItem; if (item != null) { TMP_InputField inputField = e.EditorPresenter.GetComponentInChildren <TMP_InputField>(true); inputField.text = item.Name; inputField.ActivateInputField(); inputField.Select(); Image image = e.EditorPresenter.GetComponentInChildren <Image>(true); if (m_project.IsStatic(item)) { image.sprite = ExposedFolderIcon; } else { image.sprite = FolderIcon; } image.sprite = FolderIcon; image.gameObject.SetActive(true); LayoutElement layout = inputField.GetComponent <LayoutElement>(); TextMeshProUGUI text = e.ItemPresenter.GetComponentInChildren <TextMeshProUGUI>(true); text.text = item.Name; RectTransform rt = text.GetComponent <RectTransform>(); layout.preferredWidth = rt.rect.width; } }
/*Public consts fields*/ /*Public fields*/ /*Private methods*/ private void Start() { InputFieldRoomName.characterLimit = PlayerInfo.COMPANY_NAME_MAX_LENGHT; InputFieldNormalColor = InputFieldRoomName.GetComponent <Image>().color; SliderTargetBalance.minValue = SimulationSettings.MIN_TARGET_BALANCE; SliderTargetBalance.maxValue = SimulationSettings.MAX_TARGET_BALANCE; SliderTargetBalance.value = SliderTargetBalance.maxValue / 2.0f; SliderInitialBalance.minValue = SimulationSettings.MIN_INITIAL_BALANCE; SliderInitialBalance.maxValue = SliderTargetBalance.value - 1; SliderInitialBalance.value = SliderTargetBalance.value - 50000; SliderNumberOfPlayers.minValue = MainGameManager.MIN_NUMBER_OF_PLAYERS_PER_ROOM; SliderNumberOfPlayers.maxValue = MainGameManager.MAX_NUMBER_OF_PLAYERS_PER_ROOM; SliderMinimalBalance.maxValue = SimulationSettings.MAX_MINIMAL_BALANCE; SliderMinimalBalance.minValue = SimulationSettings.MIN_MINIMAL_BALANCE; SliderMinimalBalance.value = SliderInitialBalance.value - 100000; TextInputFieldInitialBalanceHelper.gameObject.SetActive(false); TextInputFieldMinimalBalanceHelper.gameObject.SetActive(false); TextInputFieldTargetBalanceHelper.gameObject.SetActive(false); TextNumberOfPlayers.text = "Maximum number of players " + SliderNumberOfPlayers.value; TextTargetBalance.text = "Target balance " + SliderTargetBalance.value + " $"; TextInitialBalance.text = "Initial balance " + SliderInitialBalance.value + " $"; TextMinimalBalance.text = "Minimal balance " + SliderMinimalBalance.value + " $"; }
// Make the setName Button interacatable only when user input is valid public void OnTFChange() { // Declare a reference to the TMP_InputField TMP_InputField inputField = nameTF.GetComponent <TMP_InputField>(); // Get the value of the text within the input field string value = inputField.text; // if the inputfield is empty, make the readyRoomBtn non-interactable if (string.IsNullOrEmpty(value)) { readyRoomBtn.interactable = false; Debug.LogError("Player Name is empty"); } // make sure that the readyRoomBtn is only interactable if the length of the user input is less than five chars else if (value.Length < 5) { readyRoomBtn.interactable = true; Debug.Log(PlayerPrefs.GetString(playerNamePrefKey)); PhotonNetwork.NickName = value; } else { readyRoomBtn.interactable = false; } }
private void Start() { onStartingServerPanel.gameObject.SetActive(false); //First, clear the maps dropdown mapsDropdown.ClearOptions(); //Then get all online scenes onlineTCScenes = TCScenesManager.GetAllEnabledOnlineScenesInfo().ToList(); //And all the scenes to the map dropdown List <string> scenes = onlineTCScenes.Select(scene => scene.DisplayNameLocalized).ToList(); mapsDropdown.AddOptions(scenes); mapsDropdown.RefreshShownValue(); //Get active network manager netManager = TCNetworkManager.Instance; //Get the images that are in the input fields gameNameImage = gameNameText.GetComponent <Image>(); maxPlayersImage = maxPlayersText.GetComponent <Image>(); //Get the existing colors of the input fields gameNameImageColor = gameNameImage.color; maxPlayersImageColor = maxPlayersImage.color; }
void Update() { #if UNITY_EDITOR if (Application.isEditor) { m_scope.SetVariable("selected", UnityEditor.Selection.activeGameObject); } #endif if (!input.isFocused) { return; } HandleSelectPreviousCommand(); if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { input.lineType = TMP_InputField.LineType.MultiLineNewline; } else { input.lineType = TMP_InputField.LineType.MultiLineSubmit; } input.GetComponent <LayoutElement> ().preferredHeight = input.textComponent.preferredHeight + 8; }
public void OnFrontierChange(int newValue) { UI_InputFieldCommand.interactable = newValue == 0 || newValue == 1; UI_ButtonCommand.interactable = UI_InputFieldCommand.interactable; UI_InputFieldCommand.GetComponent <TooltipContent>().enabled = !UI_InputFieldCommand.interactable; UI_ButtonCommand.GetComponent <TooltipContent>().enabled = !UI_InputFieldCommand.interactable; }
private void OpenNotesArea() { Debug.Log("OpenNotesArea"); RectTransform rt = InputFieldforNotes.GetComponent <RectTransform>(); rt.sizeDelta = new Vector2(rt.sizeDelta.x, Screen.height / 5); }
private void Start() { onStartingServerPanel.gameObject.SetActive(false); //First, clear the maps dropdown mapsDropdown.ClearOptions(); //Then get all online scenes onlineTCScenes = TCScenesManager.GetAllOnlineScenes().ToList(); //And all the scenes to the map dropdown List <string> scenes = onlineTCScenes.Select(scene => scene.DisplayNameLocalized).ToList(); mapsDropdown.AddOptions(scenes); mapsDropdown.RefreshShownValue(); //Get active network manager netManager = TCNetworkManager.Instance; //Get the images that are in the input fields gameNameImage = gameNameText.GetComponent <Image>(); //Get the existing colors of the input fields gameNameImageColor = gameNameImage.color; maxPlayersImageColor = maxPlayersImage.color; menuController = GetComponentInParent <MenuController>(); string[] names = Enum.GetNames(typeof(UserProvider)); authModeDropdown.ClearOptions(); authModeDropdown.AddOptions(names.ToList()); authModeDropdown.RefreshShownValue(); }
public RectTransform RectTransform() { // 表示範囲 // MEMO : // TMP では textComponent を移動させてクリッピングするため、 // 表示範囲外になる場合があるので、自分の範囲を返す return(input.GetComponent <RectTransform>()); }
private void UpdateContentSize() { float curContentHeight = ScoreLinePrefab.GetComponent <RectTransform>().rect.height *(_lines.Count + 1); float contentY = Mathf.Max(curContentHeight - _contentHeight, 0f); Content.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, curContentHeight); Content.transform.localPosition = new Vector3(0f, contentY); }
void Start() { //change color input fild Inputfild_Form_contact.onSelect.AddListener((Text) => { Inputfild_Form_contact.GetComponent <Image>().color = Color_select; }); Inputfild_Form_contact.onValueChanged.AddListener((Text) => { messege = Text; Inputfild_Form_contact.GetComponent <Image>().color = Color_select; }); Inputfild_Form_contact.onDeselect.AddListener((Text) => { messege = Text; Inputfild_Form_contact.GetComponent <Image>().color = Color_deselect; }); BTN_Send_form.onClick.AddListener(() => { string ID = GameObject.Find("Canvas_menu").GetComponent <Menu>().ID_player; Chilligames_SDK.API_Client.Send_contact_us(new Req_contact_us { NameApp = "Venomic", Messege = Inputfild_Form_contact.text, Email_admin = "*****@*****.**", Data_use = ID }, () => { Inputfild_Form_contact.text = "Message Send"; print("send here"); }, err => { }); }); BTN_Send_rate.onClick.AddListener(() => { Chilligames_SDK.API_Client.Rate_to_game(new Req_rate_to_game { Name_app = "Venomic", Rate = Slider_rate_us.value.ToString(), _id = _id }, () => { BTN_Send_rate.GetComponentInChildren <TextMeshProUGUI>().text = "Rate send"; }, ERRORS => { }); }); BTN_close.onClick.AddListener(() => { Destroy(gameObject); }); }
public void CloseWindow() { window.GetComponent <CanvasGroup> ().DOFade(0.0f, 0.3f); inputField.GetComponent <TMP_InputField> ().ReleaseSelection(); ResetColor(); PresetScrollWindow.Hide(); window.SetActive(false); }
public void makeNidaVisible(TMP_InputField field) { Color red; ColorUtility.TryParseHtmlString("#FF0000", out red); field.GetComponent <Image>().color = red; field.transform.GetChild(2).gameObject.SetActive(true); //activates the child which is a red nida, "!". }
//Save animation to file and memory public void SaveAnimation() { scriptCode.GetComponent <CodeHighlighter>().RemoveColors(); Anim newAnim = new Anim("", scriptCode.text); fileLoader.SaveAnimation(newAnim); Animation.Instance.UnhighlightAll(); EndAnimate(); }
private void Awake() { currentBuildLevel = SceneManager.GetActiveScene().buildIndex; usernameInputField = usernameInputField.GetComponent <TMP_InputField>(); passwordInputField = passwordInputField.GetComponent <TMP_InputField>(); repeatPasswordInputField = repeatPasswordInputField.GetComponent <TMP_InputField>(); emailInputField = emailInputField.GetComponent <TMP_InputField>(); playerDataSaver = GetComponent <PlayerDataSaver>(); }