private void Update() //checks if current party can start campaign { //if all characters are finished and party is 2+ characters, party is finished if (!campaignName.GetComponentsInChildren <Text>()[1].text.Equals("") && !partyName.GetComponentsInChildren <Text>()[1].text.Equals("")) { if (charFinished && char4.activeSelf && !char4.GetComponentInChildren <InputField>().GetComponentsInChildren <Text>()[1].text.Equals("") && !char3.GetComponentInChildren <InputField>().GetComponentsInChildren <Text>()[1].text.Equals("") && !char2.GetComponentInChildren <InputField>().GetComponentsInChildren <Text>()[1].text.Equals("") && !char1.GetComponentInChildren <InputField>().GetComponentsInChildren <Text>()[1].text.Equals("")) { partyFinished = true; } else if (charFinished && char3.activeSelf && !char3.GetComponentInChildren <InputField>().GetComponentsInChildren <Text>()[1].text.Equals("") && !char2.GetComponentInChildren <InputField>().GetComponentsInChildren <Text>()[1].text.Equals("") && !char1.GetComponentInChildren <InputField>().GetComponentsInChildren <Text>()[1].text.Equals("")) { partyFinished = true; } else if (charFinished && char2.activeSelf && !char2.GetComponentInChildren <InputField>().GetComponentsInChildren <Text>()[1].text.Equals("") && !char1.GetComponentInChildren <InputField>().GetComponentsInChildren <Text>()[1].text.Equals("")) { partyFinished = true; } else { partyFinished = false; } } else { partyFinished = false; } //can't make a new character while one is still being made startButton.interactable = partyFinished; dropdown.interactable = charFinished; }
void GetValues() { if (totalSugar.GetComponentsInChildren <Text>()[1].text == "") { totalSugar.GetComponent <TextMeshProUGUI>().color = Color.red; } else { totalSugars = Convert.ToDouble(totalSugar.GetComponentsInChildren <Text>()[1].text); } if (inputField.GetComponentsInChildren <Text>()[1].text == "") { gameObject.GetComponent <TextMeshProUGUI>().color = Color.red; } else { nutrientValueStr = inputField.GetComponentsInChildren <Text>()[1].text; gameObject.GetComponent <TextMeshProUGUI>().color = Color.white; } if (nutrientValueStr != null) { convertedValue = Convert.ToDouble(nutrientValueStr); } nutrientUnitStr = inputDD.GetComponentInChildren <Text>().text; }
public void updateMasterInputs(bool value) { Text secondsValue = secondsToProcessPuzzleRequestInput.GetComponentsInChildren <Text> () [0]; Text secondsTitle = secondsToProcessPuzzleRequestInput.GetComponentsInChildren <Text> () [1]; Text humansValue = numberOfHumanTeamsInput.GetComponentsInChildren <Text> () [0]; Text humansTitle = numberOfHumanTeamsInput.GetComponentsInChildren <Text> () [1]; secondsToProcessPuzzleRequestInput.interactable = autoMasterOfShipsInput.isOn; numberOfHumanTeamsInput.interactable = !autoMasterOfShipsInput.isOn; if (autoMasterOfShipsInput.isOn) { secondsValue.color = Color.black; secondsTitle.color = Color.black; humansValue.color = Color.gray; humansTitle.color = Color.gray; } else { secondsValue.color = Color.gray; secondsTitle.color = Color.gray; humansValue.color = Color.black; humansTitle.color = Color.black; } }
void GetValues() { if (inputField.GetComponentsInChildren <Text>()[1].text == "") { gameObject.GetComponent <TextMeshProUGUI>().color = Color.red; } else { nutrientValueStr = inputField.GetComponentsInChildren <Text>()[1].text; gameObject.GetComponent <TextMeshProUGUI>().color = Color.white; } }
public void EditBtnCkicked() { InputField[] InputFields = GameObject.FindObjectsOfType <InputField>(); InputField nameInputField = null; //get nameUnputField = "NameValue" inputField for (int i = 0; i < InputFields.Length; i++) { if (InputFields[i].name == "NameValue") { nameInputField = InputFields[i]; break; } } //set nameInputField, if new Name entered, change ame and save if (nameInputField.IsInteractable()) { GameObject.Find("EditBtn").GetComponentInChildren <Text>().text = "Edit"; string t = nameInputField.GetComponentsInChildren <Text>()[0].text; print("Input name :" + t); dragon.DragonName = t; dragon.Save(); nameInputField.interactable = false; dragon.RenderPanel(); } else { nameInputField.interactable = true; GameObject.Find("EditBtn").GetComponentInChildren <Text>().text = "OK"; } }
public void AbilitiesImport() { string file_path = abilities_input.GetComponentsInChildren <Text>()[1].text; string full_path = Path.Combine(import_path, file_path); imported_abilities = new List <Ability>(); try { StreamReader input_stream = new StreamReader(full_path); while (!input_stream.EndOfStream) { string line = input_stream.ReadLine().Replace(@"\", ""); // Line is a comment if (line[0] == '#') { } // Line is an ability else { Ability current_ability = ScriptableObject.CreateInstance <Ability>(); string[] parts = line.Split(','); int line_length = parts.Length; current_ability.name = parts[2]; // Handle commas in description int description_parts = line_length - 4; string description = parts[3].TrimStart('"'); for (int i = 0; i < description_parts; i++) { description += "," + parts[4 + i]; } current_ability.description = description.TrimEnd('"'); imported_abilities.Add(current_ability); } } } catch (Exception e) { Debug.Log(e); return; } string abilities_path = Settings.ABILITIES_FILE_PATH; for (int i = 0; i < imported_abilities.Count; i++) { Ability new_ability = imported_abilities[i]; AssetDatabase.CreateAsset(new_ability, Path.Combine(abilities_path, new_ability.name) + ".asset"); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); EditorUtility.FocusProjectWindow(); Selection.activeObject = new_ability; } }
public void ChangeHighscorePlaceholder(string text) { InputField input = highscore.GetComponentInChildren <InputField>(); Text[] textFields = input.GetComponentsInChildren <Text>(); textFields[0].text = text; }
public UITextbox(Rect pos, GameObject parent, string placeholder = "", string name = "", UnityAction <string> endeditaction = null, int fontsize = 15, bool isPassword = false) : base(pos, parent) { InputField field = WindowManager.SpawnInputbox(); if (endeditaction != null) { field.onEndEdit.AddListener(endeditaction); } if (name != "") { field.name = name; } var texts = field.GetComponentsInChildren <Text>(); field.text = ""; if (isPassword) { field.contentType = InputField.ContentType.Password; } texts[0].resizeTextForBestFit = true; texts[0].alignment = TextAnchor.MiddleCenter; texts[0].text = placeholder; texts[1].fontSize = fontsize; texts[1].alignment = TextAnchor.MiddleCenter; Place(field.gameObject); obj = field; }
protected override bool Validate(string currentInput, bool isSecondcheck = false) { if (requiredMatchUI != null) { if (!isSecondcheck) { foreach (InputFieldValidation validation in requiredMatchUI.GetComponentsInChildren <InputFieldValidation>()) { validation.IsValidCheck(true); } } if (requiredMatchUI.text != currentInput) { return(false); } } if (string.IsNullOrEmpty(currentInput)) { return(false); } if (currentInput.Length < passwordRequiredLength) { return(false); } return(true); }
// Update is called once per frame void Update() { // Propagate text changes from the Text Input to the CodeEditor. This only needs to happen while running if (Application.isPlaying && InputField) { Code = InputField.text; } if (InputField == null) { return; } var textElements = InputField.GetComponentsInChildren <Text>(); // Adjust the font size for the preview and display text objects foreach (var text in textElements) { text.fontSize = LineHeight; } // For sizing take first and assume all are the same size var textElement = textElements.First(); var textRect = textElement.GetComponent <RectTransform>(); var highlightTransform = LineHighlight.transform; // Adjust the element line highlights vertical size to match the font size LineHighlight.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, LineHeight); // Position the LineHighlight behind the correct line number highlightTransform.localPosition = new Vector3(highlightTransform.localPosition.x, (-LineHeight * CurrentHighlightedLine) - (LineHeight * 0.5f) - textRect.rect.yMin, 1); }
public string GetHighscoreName() { InputField input = highscore.GetComponentInChildren <InputField>(); Text[] textFields = input.GetComponentsInChildren <Text>(); return(textFields[1].text); }
void Start() { parseUser = GameObject.Find("Parse_User").GetComponent <Parse_User>(); scale_A = parseUser.scale_A; scale_B = parseUser.scale_B; scale_X = parseUser.scale_X; scale_Y = parseUser.scale_Y; lastV = parseUser.numVButton; if (GameObject.Find("InputField_A")) { inputField_A = GameObject.Find("InputField_A").GetComponent <InputField>(); text_A = inputField_A.GetComponentsInChildren <Text>(); } if (GameObject.Find("InputField_B")) { inputField_B = GameObject.Find("InputField_B").GetComponent <InputField>(); text_B = inputField_B.GetComponentsInChildren <Text>(); } if (GameObject.Find("Slider_X")) { slider_X = GameObject.Find("Slider_X").GetComponent <Slider>(); slider_X.value = scale_X; } if (GameObject.Find("Slider_Y")) { slider_Y = GameObject.Find("Slider_Y").GetComponent <Slider>(); slider_Y.value = scale_Y; } parseUser.SaveValue("lastV", lastV); }
private bool editingAngleField; // bool to check if angle field is being edited // Start is called before the first frame update void Start() { lm = FindObjectOfType <LabManager>(); draggingAngleSlider = false; editingAngleField = false; foreach (Text text in refractionField.GetComponentsInChildren <Text>()) { text.enabled = false; } var indexesOfRefraction = Enum.GetValues(typeof(RefractableMaterial.IndexesOfRefraction)); this.indexesOfRefraction = new List <string>(); foreach (RefractableMaterial.IndexesOfRefraction index in indexesOfRefraction) { this.indexesOfRefraction.Add(index.ToString()); } this.indexesOfRefraction.RemoveAt(this.indexesOfRefraction.Count - 1); indexesMenu.AddOptions(this.indexesOfRefraction); worldIndexesMenu.AddOptions(this.indexesOfRefraction); }
private void SetInputFieldRaycast(InputField inputField, bool raycastTarget) { inputField.GetComponent <Image>().raycastTarget = raycastTarget; foreach (Text text in inputField.GetComponentsInChildren <Text>()) { text.raycastTarget = raycastTarget; } }
void createUser() { WWWForm phpform = new WWWForm(); phpform.AddField("user_id", id.GetComponentsInChildren <Text>()[1].text); phpform.AddField("user_name", username.GetComponentsInChildren <Text>()[1].text); new WWW(serverlink + "collectData", phpform); //Debug.Log("create"); }
public bool IsValidCheck(bool isSecondcheck = false) { if (Validate(uiInput.text, isSecondcheck)) { foreach (Text sprite in uiInput.GetComponentsInChildren <Text>()) { sprite.color = Color.white; } return(true); } else { foreach (Text sprite in uiInput.GetComponentsInChildren <Text>()) { sprite.color = Color.red; } return(false); } }
// Setup search filter private void SetupSearchInputField() { // Find search input field and get input field component // and hook up onValueChanged listener to update search results on value change _searchInputField = Utilities.FindGameObjectOrError("SearchInputField").GetComponent <InputField>(); foreach (Text textComponent in _searchInputField.GetComponentsInChildren <Text>()) { textComponent.fontSize = PanelTextFontSize; } _searchInputField.onValueChanged.AddListener(_fileBrowser.UpdateSearchFilter); }
void DisplayError(InputField fields, string errorText = "") { Text[] texts = fileNameInputfield.GetComponentsInChildren <Text>(); for (int i = 0; i < texts.Length; i++) { if (texts[i].tag == "errorField") { texts[i].text = errorText; break; } } }
void Fitness(string text) { foreach (Text inputText in fitness.GetComponentsInChildren <Text>()) { inputText.color = Color.black; } }
public string getPlayerName() { // Array is: placeholder, name Text[] inputs = username.GetComponentsInChildren <Text> (); if (inputs [1].text.Equals("")) { return(inputs [0].text); } else { return(inputs [1].text); } }
// Start is called before the first frame update void Start() { state = 1; vergebeneRessourcen = new bool[ressourcen.Length]; clickedRessourcenButtons = new bool[ressourcenButton.Length]; for (int i = 0; i < ressourcenButton.Length; i++) { ressourcenButton[i].GetComponentInChildren <Text>(true).text = ressourcen[i].name; vergebeneRessourcen[i] = false; clickedRessourcenButtons[i] = false; } foreach (Button b in ressourcenButton) { var colors = b.colors; colors.selectedColor = selectedColor; colors.normalColor = normalColor; colors.pressedColor = pressedColor; colors.highlightedColor = highlightColor; b.colors = colors; b.GetComponentInChildren <Text>().color = fontColor; b.GetComponentInChildren <Text>().font = font; b.GetComponentInChildren <Text>().fontSize = fontSize; } var colorsB = bestaetigenButton.colors; colorsB.selectedColor = selectedColor; colorsB.normalColor = normalColor; colorsB.pressedColor = pressedColor; colorsB.highlightedColor = highlightColor; plusButton.colors = colorsB; plusButton.GetComponentInChildren <Text>().color = fontColor; plusButton.GetComponentInChildren <Text>().fontSize = fontSize; plusButton.GetComponentInChildren <Text>().font = font; minusButton.colors = colorsB; minusButton.GetComponentInChildren <Text>().color = fontColor; minusButton.GetComponentInChildren <Text>().fontSize = fontSize; minusButton.GetComponentInChildren <Text>().font = font; bestaetigenButton.colors = colorsB; bestaetigenButton.GetComponentInChildren <Text>().color = fontColor; bestaetigenButton.GetComponentInChildren <Text>().fontSize = fontSize; bestaetigenButton.GetComponentInChildren <Text>().font = font; zurueckButton.colors = colorsB; zurueckButton.GetComponentInChildren <Text>().color = fontColor; zurueckButton.GetComponentInChildren <Text>().fontSize = fontSize; zurueckButton.GetComponentInChildren <Text>().font = font; aufforderungsText.font = font; aufforderungsText.color = fontColor; inputField.GetComponentsInChildren <Text>()[0].font = font; inputField.GetComponentsInChildren <Text>()[0].fontSize = fontSize; inputField.GetComponentsInChildren <Text>()[0].color = fontColor; inputField.GetComponentsInChildren <Text>()[1].font = font; inputField.GetComponentsInChildren <Text>()[1].fontSize = fontSize; inputField.GetComponentsInChildren <Text>()[1].color = fontColor; nummerText.GetComponentInChildren <Text>().font = font; nummerText.GetComponentInChildren <Text>().color = fontColor; nummerText.GetComponentInChildren <Text>().fontSize = fontSize; UpdateState(true); }
public void SetName() { Text[] textArray = inputField.GetComponentsInChildren <Text>(); foreach (Text t in textArray) { if (t.gameObject.name == "Text_UserName") { vars.SetPlayerName(t.text); } } Debug.Log(vars.GetPlayerName()); // Activate Button }
private void CheckResultSetInputField(InputField input, bool result) { input.GetComponentsInChildren <Text>(true) .ToList() .ForEach(t => { if (t.gameObject.name.Equals("OKText")) { t.gameObject.SetActive(result); } else if (t.gameObject.name.Equals("NGText")) { t.gameObject.SetActive(!result); } }); }
public void UpdateSkinSettings() { background.color = skin.backgroundColor; text.color = skin.textColor; sidePanel.background.color = skin.sidePanelColor; List <Text> texts = new List <Text>(); texts.AddRange(inputField.GetComponentsInChildren <Text>()); texts.AddRange(sidePanel.GetComponentsInChildren <Text>()); foreach (Text t in texts) { t.color = skin.playerTextColor; } }
public void StartButton() { if (OAuth.text == "" || Channel.text == "") { if (TwitchSettingsOpen == true) { TwitchSettings(); } else if (CreditsOpen == true) { Credits(); } else if (SettingsOpen == true) { Settings(); } InfoBox.gameObject.SetActive(true); InfoBox.GetComponentInChildren <TextMeshProUGUI>().text = "Please insert your Twitch Settings. Find your aouth using twitch chat oauth\n " + " password generator."; } else { PlayerPrefs.SetString("OAuth", OAuth.text); PlayerPrefs.SetString("Channel", Channel.text); PlayerPrefs.SetString("ChannelTwo", ChannelTwo.text); int.TryParse(Bots.GetComponentsInChildren <Text>()[1].text, out botsInt); PlayerPrefs.SetInt("Bots", botsInt); int.TryParse(Rounds.GetComponentsInChildren <Text>()[1].text, out roundsInt); if (roundsInt == 0) { roundsInt = Consts.DEFAULT_ROUNDS; } PlayerPrefs.SetInt("Rounds", roundsInt); int.TryParse(RoundDuration.GetComponentsInChildren <Text>()[1].text, out durationInt); if (durationInt == 0) { durationInt = Consts.DEFAULT_DECIDING_DURATION; } PlayerPrefs.SetInt("Duration", durationInt); PlayerPrefs.SetInt("Endless", EndlessRounds); PlayerPrefs.SetInt("Gamemode", Team); SceneManager.LoadScene(1); } }
private void Awake() { m_cd = FindObjectOfType <CharacterDummy>(); m_cm = FindObjectOfType <CharacterManager>(); m_cnm = FindObjectOfType <CustomNetworkManager>(); m_colorfulText = m_NameInputField.GetComponentsInChildren <Text>().Where(o => o.gameObject.name == "Colorful Text").SingleOrDefault(); m_NameInputField.characterLimit = m_characterMax; m_NameInputField.onValueChanged.AddListener(DisplayColorfulString); m_SelectedLast = null; m_awake = true; }
public void StoreName() { playerName = inputField.GetComponentsInChildren <Text>()[1].text; if (!Stored()) { return; } if (playerName.Length > 10) { TooLong(); playerName = null; return; } print(playerName == ""); inputField.enabled = false; savingText.text = "Saving " + playerName; StartCoroutine(Fadeout(fadeOutTime, true)); }
// Use this for initialization void Start() { text = GetComponent<Text>(); if ("Score slider value" == name) { inputField = FindObjectOfType<InputField> (); if (inputField) { Debug.Log ("Input Field found"); } Text[] inputFieldTextArray = inputField.GetComponentsInChildren<Text>(); foreach (Text inputFieldText in inputFieldTextArray) { if ("Placeholder" == inputField.name && "" == inputField.text) { inputField.text = slider.value.ToString (); } if ("Text" == inputFieldText.name) { inputField.text = inputFieldText.text; } } inputField.text = slider.value.ToString(); } }
//This is required because content size fitter doesn't work with beta unity if inside panel groupings. public static void SetInputFieldTextHackyResize(InputField inputText, string newText, bool displayVisually) { //inputText.text = newText; if (displayVisually) { inputText.text = newText; } else { string fileNameBeforePrefix = "resultsData"; string extension = ".txt"; fileNameBeforePrefix = FileWriting.WriteString(fileNameBeforePrefix, extension, newText); SetInputFieldTextHackyResize(inputText, "The text was too long for Unity to display. Open filename " + Application.dataPath + "/" + fileNameBeforePrefix + extension, true); return; } //inputText.text = newText; Canvas.ForceUpdateCanvases(); Text[] texts = inputText.GetComponentsInChildren <Text>(); if (texts != null) { foreach (Text text in texts) { if (text != null) { //Not sure why this all of a sudden gives wrong line counts when addition of new panel. +10 for buffer. int lineCount = text.cachedTextGenerator.lineCount + 10; RectTransform t = text.rectTransform; Vector2 dimension = t.sizeDelta; dimension.y = (16 * lineCount) + 15; t.sizeDelta = dimension; } } } }
public void DeleteBtnClicked() { InputField inputField = GameObject.Find("DeleteInputField").GetComponent <InputField>(); Text placeholder = inputField.GetComponentsInChildren <Text>()[1]; string input = inputField.text; print("Delete :" + input); string content = IsPassword(input); ItemList itemList = GetItemList(content); inputField.text = ""; // if enter wrong pw, show "Wrong Password" if (content == null || itemList == null) { placeholder.text = "Wrong Password"; } // if enter right pw, pass to dragon.DeleteItem() else if (itemList.part == "Item") { bool delSuc = false; delSuc = dragon.DeleteItem(content); if (delSuc) { placeholder.text = "Delete " + content; } else { placeholder.text = "Cant Find " + content; } } else { placeholder.text = "Cant delete " + content; } }
private Vector2 dimensions10; // dimensions pour orthographicSize = 10 public void SetIndicePlacing(int i) { if (!saved && lastObject != null) { AddData(); } // on met l'objet qu'on vient de placer puis on passe au suivant saved = true; // on a saved le dernier truc index = i; creating = true; slider.minValue = limits[index, 0]; slider.maxValue = limits[index, 1]; slider.value = 1; slider.interactable = false; slider.GetComponentInChildren <Text>().text = objectsInfo[i, 1]; sliderInput.GetComponentsInChildren <Text>()[1].text = ((objectsInfo[i, 1] != "") ? objectsInfo[i, 1] + " -->" : ""); // on met la flèche que si quelque chose sliderInput.interactable = false; slider1.minValue = limits[index, 2]; slider1.maxValue = limits[index, 3]; slider1.value = 1; slider1.interactable = false; slider1.GetComponentInChildren <Text>().text = objectsInfo[i, 2]; slider1Input.GetComponentsInChildren <Text>()[1].text = ((objectsInfo[i, 2] != "") ? "<-- " + objectsInfo[i, 2]: ""); slider1Input.interactable = false; }