void Awake() { // Get Reference to TextMeshPro Component m_textMeshPro = GetComponent<TMP_Text>(); m_textMeshPro.text = label01; m_textMeshPro.enableWordWrapping = true; m_textMeshPro.alignment = TextAlignmentOptions.Top; //if (GetComponentInParent(typeof(Canvas)) as Canvas == null) //{ // GameObject canvas = new GameObject("Canvas", typeof(Canvas)); // gameObject.transform.SetParent(canvas.transform); // canvas.GetComponent<Canvas>().renderMode = RenderMode.ScreenSpaceOverlay; // // Set RectTransform Size // gameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(500, 300); // m_textMeshPro.fontSize = 48; //} }
void Awake() { m_TextComponent = GetComponent<TMP_Text>(); }
// Use this for initialization void Start() { GM = GameObject.Find("GameManager").GetComponent <GameManager>(); playerName = GameObject.Find("Player Name HUD").GetComponentInChildren <TMP_Text>(); }
protected override void AddListenerForPanelFields() { base.AddListenerForPanelFields(); // place the panel a little bit upside. var parentSize = transform.parent.GetComponent <RectTransform>().rect; Panel.GetComponent <RectTransform>().anchoredPosition = new Vector2(parentSize.width, 200); var panel = Panel.transform; var elements = new Dictionary <string, Selectable>(); // 1. bind select projector external parameter button. var selectProjectorExternalParameterButton = panel.GetChild(0).GetComponent <Button>(); selectProjectorExternalParameterButton.onClick.AddListener(() => StartCoroutine(Coroutine_LoadProjectorExternalParameters(panel, elements))); elements.Add("selectProjectorExternalParameterButton", selectProjectorExternalParameterButton); // 2. bind the selected projector external parameter button. m_selectProjectorExternalParameterText = panel.GetChild(1).GetComponent <TMP_Text>(); m_selectProjectorExternalParameterText.text = "---"; // 3. bind the projector positions var projectorPosition = panel.GetChild(2); #region projector positions // 3-1. bind the projector position x var positionXInputField = projectorPosition.GetChild(0).GetComponent <TMP_InputField>(); positionXInputField.onValueChanged.AddListener( (string val) => { if (float.TryParse(val, out var result)) { m_externalData.projectorPosition.x = result; onProjectorPositionXUpdate?.Invoke(result); } } ); elements.Add("positionXInputField", positionXInputField); // 3-2. bind the projector position y var positionYInputField = projectorPosition.GetChild(1).GetComponent <TMP_InputField>(); positionYInputField.onValueChanged.AddListener( (string val) => { if (float.TryParse(val, out var result)) { m_externalData.projectorPosition.y = result; onProjectorPositionYUpdate?.Invoke(result); } } ); elements.Add("positionYInputField", positionYInputField); // 3-3. bind the projector position z var positionZInputField = projectorPosition.GetChild(2).GetComponent <TMP_InputField>(); positionZInputField.onValueChanged.AddListener( (string val) => { if (float.TryParse(val, out var result)) { m_externalData.projectorPosition.z = result; onProjectorPositionZUpdate?.Invoke(result); } } ); elements.Add("positionZInputField", positionZInputField); #endregion projector positions // 4. bind the x axis var xAxis = panel.GetChild(3); #region x axis // 4-1. bind the x of xAxis var xOfxAxisInputField = xAxis.GetChild(0).GetComponent <TMP_InputField>(); xOfxAxisInputField.onValueChanged.AddListener( (string val) => { if (float.TryParse(val, out float result)) { m_externalData.xAxis.x = result; onProjectorXAxisXUpdate?.Invoke(result); } } ); elements.Add("xOfxAxisInputField", xOfxAxisInputField); // 4-2. bind the y of xAxis var yOfxAxisInputField = xAxis.GetChild(1).GetComponent <TMP_InputField>(); yOfxAxisInputField.onValueChanged.AddListener( (string val) => { if (float.TryParse(val, out var result)) { m_externalData.xAxis.y = result; onProjectorXAxisYUpdate?.Invoke(result); } } ); elements.Add("yOfxAxisInputField", yOfxAxisInputField); // 4-3. bind the z of xAxis var zOfxAxisInputField = xAxis.GetChild(2).GetComponent <TMP_InputField>(); zOfxAxisInputField.onValueChanged.AddListener( (string val) => { if (float.TryParse(val, out var result)) { m_externalData.xAxis.z = result; onProjectorXAxisZUpdate?.Invoke(result); } } ); elements.Add("zOfxAxisInputField", zOfxAxisInputField); #endregion x axis // 5. bind the y axis var yAxis = panel.GetChild(4); #region y axis // 5-1. bind the x of y axis var xOfyAxisInputField = yAxis.GetChild(0).GetComponent <TMP_InputField>(); xOfyAxisInputField.onValueChanged.AddListener( (string val) => { if (float.TryParse(val, out var result)) { m_externalData.yAxis.x = result; onProjectorYAxisXUpdate?.Invoke(result); } } ); elements.Add("xOfyAxisInputField", xOfyAxisInputField); // 5-2. bind the y of y axis var yOfyAxisInputField = yAxis.GetChild(1).GetComponent <TMP_InputField>(); yOfyAxisInputField.onValueChanged.AddListener( (string val) => { if (float.TryParse(val, out var result)) { m_externalData.yAxis.y = result; onProjectorYAxisYUpdate?.Invoke(result); } } ); elements.Add("yOfyAxisInputField", yOfyAxisInputField); // 5-3. bind the z of y axis var zOfyAxisInputField = yAxis.GetChild(2).GetComponent <TMP_InputField>(); zOfyAxisInputField.onValueChanged.AddListener( (string val) => { if (float.TryParse(val, out var result)) { m_externalData.yAxis.z = result; onProjectorYAxisZUpdate?.Invoke(result); } } ); elements.Add("zOfyAxisInputField", zOfyAxisInputField); #endregion y axis // 6. bind the z axis var zAxis = panel.GetChild(5); #region z axis // 6-1. bind the x of z axis var xOfzAxisInputField = zAxis.GetChild(0).GetComponent <TMP_InputField>(); xOfzAxisInputField.onValueChanged.AddListener( (string val) => { if (float.TryParse(val, out var result)) { m_externalData.zAxis.x = result; onProjectorZAxisXUpdate?.Invoke(result); } } ); elements.Add("xOfzAxisInputField", xOfzAxisInputField); // 6-2. bind the y of z axis var yOfzAxisInputField = zAxis.GetChild(1).GetComponent <TMP_InputField>(); yOfzAxisInputField.onValueChanged.AddListener( (string val) => { if (float.TryParse(val, out var result)) { m_externalData.zAxis.y = result; onProjectorZAxisYUpdate?.Invoke(result); } } ); elements.Add("yOfzAxisInputField", yOfzAxisInputField); // 6-3. bind the z of z axis var zOfzAxisInputField = zAxis.GetChild(2).GetComponent <TMP_InputField>(); zOfzAxisInputField.onValueChanged.AddListener( (string val) => { if (float.TryParse(val, out var result)) { m_externalData.zAxis.z = result; onProjectorZAxisZUpdate?.Invoke(result); } } ); elements.Add("zOfzAxisInputField", zOfzAxisInputField); #endregion z axis // 7. bind save projector external parameters button var saveProjectorExternalParametersButton = panel.GetChild(6).GetComponent <Button>(); saveProjectorExternalParametersButton.onClick.AddListener(() => StartCoroutine(Coroutine_SaveProjectorExtneralParameters())); elements.Add("saveProjectorExternalParametersButton", saveProjectorExternalParametersButton); LoadPreviousValues(elements.Values.ToArray()); }
private void Awake() { text = GetComponent <TMP_Text>(); EventManager.Instance.AddListener <InputChangedEvent>(ChangeCityName); ChangeCityName(); }
void Awake() { m_TextComponent = gameObject.GetComponent <TMP_Text>(); }
private void spawnBlock() { if ((maxCount == 0 || cnt > 0) && blockGrid.childCount == 0 && !gameManager.isDraging) { Transform block = Instantiate(blockPrefab).transform; blocks.Add(block); block.SetParent(blockGrid); block.localScale = Vector3.one; foreach (CanvasGroup cg in block.GetComponentsInChildren <CanvasGroup>()) { cg.blocksRaycasts = false; } block.GetComponent <CanvasGroup>().blocksRaycasts = true; if (args.ContainsKey("direction")) { BlockInfo bi = block.GetComponent <BlockInfo>(); bi.refField[0].GetComponent <TMP_Dropdown>().value = int.Parse(args["direction"]); TMP_Text valueText = bi.extraRefField[0].GetComponent <TMP_Text>(); switch (args["direction"]) { case "0": valueText.text = "向前移動"; break; case "1": valueText.text = "向右移動"; break; case "2": valueText.text = "向後移動"; break; case "3": valueText.text = "向左移動"; break; } } if (args.ContainsKey("repeat_n")) { BlockInfo bi = block.GetComponent <BlockInfo>(); Transform valueContainer = bi.refField[1]; valueContainer.gameObject.SetActive(false); valueContainer.GetComponent <ValueBlockSwap>().inputField.GetComponent <TMP_InputField>().text = (args["repeat_n"] == "0") ? "infinity" : args["repeat_n"]; Transform valueText = bi.extraRefField[0]; valueText.gameObject.SetActive(true); valueText.GetComponent <TMP_Text>().text = (args["repeat_n"] == "0") ? "無限" : args["repeat_n"]; } //if ( args.ContainsKey( "direction" ) ) { //} //if ( args.ContainsKey( "direction" ) ) { //} //if ( args.ContainsKey( "direction" ) ) { //} } if (args.ContainsKey("value_name")) { foreach (Transform block in blocks) { if (block == null) { continue; } BlockSizeManage vbm = block.GetComponent <BlockSizeManage>(); if (vbm != null) { vbm.ChangeText(args["value_name"]); } //Transform inputField = block.GetComponent<BlockInfo>().refField[0]; //if ( inputField != null ) { // inputField.GetComponent<TMP_Text>().text = args["value_name"]; // inputField.GetComponent<TMP_Text>().text = args["value_name"]; //} } } if (!args.ContainsKey("value_name") || args["value_name"].Length == 0) { blockGrid.GetComponent <RectTransform>().sizeDelta = Vector2.zero; } else if (!dontTransform) { blockGrid.GetComponent <BlockGridDropZone>().Resize(); } }
private void Start() { CheckForExistingCheckpointManager(); checkpointText = GetComponentInChildren <TMP_Text>(); }
private static void ResolveDependencies(TMP_Text scoreDisplay) { _scoreDisplay = scoreDisplay; }
public static void Initialise(TMP_Text scoreDisplay) { ResolveDependencies(scoreDisplay); Reset(); }
static void DuplicateMaterial(MenuCommand command) { // Get the type of text object // If material is not a base material, we get material leaks... Material source_Mat = (Material)command.context; if (!EditorUtility.IsPersistent(source_Mat)) { Debug.LogWarning("Material is an instance and cannot be converted into a persistent asset."); return; } string assetPath = AssetDatabase.GetAssetPath(source_Mat).Split('.')[0]; if (assetPath.IndexOf("Assets/", System.StringComparison.InvariantCultureIgnoreCase) == -1) { Debug.LogWarning("Material Preset cannot be created from a material that is located outside the project."); return; } Material duplicate = new Material(source_Mat); // Need to manually copy the shader keywords duplicate.shaderKeywords = source_Mat.shaderKeywords; AssetDatabase.CreateAsset(duplicate, AssetDatabase.GenerateUniqueAssetPath(assetPath + ".mat")); GameObject[] selectedObjects = Selection.gameObjects; // Assign new Material Preset to selected text objects. for (int i = 0; i < selectedObjects.Length; i++) { TMP_Text textObject = selectedObjects[i].GetComponent <TMP_Text>(); if (textObject != null) { textObject.fontSharedMaterial = duplicate; } else { TMP_SubMesh subMeshObject = selectedObjects[i].GetComponent <TMP_SubMesh>(); if (subMeshObject != null) { subMeshObject.sharedMaterial = duplicate; } else { TMP_SubMeshUI subMeshUIObject = selectedObjects[i].GetComponent <TMP_SubMeshUI>(); if (subMeshUIObject != null) { subMeshUIObject.sharedMaterial = duplicate; } } } } // Ping newly created Material Preset. EditorUtility.FocusProjectWindow(); EditorGUIUtility.PingObject(duplicate); }
private void OnEnable() { text = GetComponent <TMP_Text>(); SetValue(); }
private void Start() { t = gameObject.GetComponent <TMP_Text>(); baseText = t.text; }
void Start() { header = GetComponentInChildren <TMP_Text>(); }
private void Reset() { #if dUI_TextMeshPro TextMeshPro = GetComponent <TMP_Text>(); #endif }
public void ClickPromote() { if (points.numPoints > 0) { if (transform.parent.parent.tag == "PlanterPromote") { planter = GameObject.FindGameObjectWithTag("Planter"); planterPlayer = planter.GetComponent <Player>(); planterAnimator = planter.GetComponent <Animator>(); planterLevelText = GameObject.FindGameObjectWithTag("PlanterLevel").GetComponent <TMP_Text>(); planterPlayer.currentRank++; planterLevelText.text = (planterPlayer.currentRank + 1).ToString(); } else if (transform.parent.parent.tag == "LumberjackPromote") { lumberjack = GameObject.FindGameObjectWithTag("Lumberjack"); lumberjackPlayer = lumberjack.GetComponent <Player>(); lumberjackAnimator = lumberjack.GetComponent <Animator>(); lumberjackLevelText = GameObject.FindGameObjectWithTag("LumberjackLevel").GetComponent <TMP_Text>(); lumberjackPlayer.currentRank++; lumberjackLevelText.text = (lumberjackPlayer.currentRank + 1).ToString(); } switch (type) { case PromoteType.chop: lumberjackPlayer.animatorChopSpeed += 0.25f; lumberjackAnimator.SetFloat("ChopSpeed", lumberjackPlayer.animatorChopSpeed); break; case PromoteType.dig: lumberjackPlayer.animatorDigSpeed += 0.25f; lumberjackAnimator.SetFloat("DigSpeed", lumberjackPlayer.animatorDigSpeed); break; case PromoteType.lumberJump: lumberjackPlayer.animatorLumberjackJumpSpeed += 0.25f; lumberjackAnimator.SetFloat("JumpSpeed", lumberjackPlayer.animatorLumberjackJumpSpeed); lumberjackPlayer.jumpSpeed += 0.05f; //more here break; case PromoteType.plant: //Debug.Log("Planting Speed Upgraded"); planterPlayer.animatorPlantSpeed += 0.25f; planterAnimator.SetFloat("PlantSpeed", planterPlayer.animatorPlantSpeed); break; case PromoteType.plantJump: planterPlayer.animatorPlanterJumpSpeed += 0.25f; planterAnimator.SetFloat("JumpSpeed", planterPlayer.animatorPlanterJumpSpeed); planterPlayer.jumpSpeed += 0.05f; //more here break; case PromoteType.water: planterPlayer.animatorWaterSpeed += 0.25f; planterAnimator.SetFloat("WaterSpeed", planterPlayer.animatorWaterSpeed); break; case PromoteType.stamina: if (planterPlayer != null) { planterPlayer.fatigueIncrement -= 0.02f; planterPlayer.recoverFatigueRate += 0.0005f; } else if (lumberjackPlayer != null) { lumberjackPlayer.fatigueIncrement -= 0.02f; lumberjackPlayer.recoverFatigueRate += 0.0005f; } break; } } }
// Start is called before the first frame update void Start() { scoreText = GetComponent <TextMeshProUGUI>(); gameSession = FindObjectOfType <GameSession>(); }
public void SetText(string text) { this.text.text = text; }
void Start() { healthText = GetComponent <TMP_Text>(); player = FindObjectOfType <Player>(); }
void OnEnable() { m_TextComponent = gameObject.GetComponent <TMP_Text>(); theCoroutine = StartCoroutine(FadeIn(m_TextComponent)); }
void Start() { _combatLog = GetComponent <TMP_Text>(); _fadeManager = GetComponent <FadeInText>(); EventManager.StartListening(EventList.DISPLAY_TEXT.ToString(), OnDisplayText); }
private void Awake() { _text = GetComponent <TMP_Text>(); }
public static M_InGameResourcesManager GetInstance(TMP_Text foodText, TMP_Text yearText, TMP_Text researchText) { lock (s_lock) { if (s_instance == null) { s_instance = new M_InGameResourcesManager(); } s_instance.m_foodText = foodText; s_instance.m_dayText = yearText; s_instance.m_researchText = researchText; return(s_instance); } }
public void LoadLevel(TMP_Text name) { LoadScenes.Instance.SetFolder("PlayerLevels"); LoadScenes.Instance.SetupLevelName(name.text); LoadScenes.Instance.LoadLevel(); }
private static void SetupRelationPanel() { try { LogDebug("SetupRelationPanel"); var dm = UIManager.Instance.dataManager; var prefabName = UIManager.Instance.GetPrefabName <SGEventPanel>(""); var uiModule = (UIModule)dm.PooledInstantiate( prefabName, BattleTechResourceType.UIModulePrefabs, null, null) .GetComponent(typeof(SGEventPanel)); uiModule.SetPrefabName("GaW RelationPanel"); UIManager.Instance.AddModule(uiModule, UIManager.Instance.popupNode, -1, false); eventPanel = (SGEventPanel)uiModule; eventPanel.gameObject.SetActive(true); var go = eventPanel.gameObject.FindFirstChildNamed("Representation"); go.FindFirstChildNamed("event_ResponseOptions").SetActive(false); go.FindFirstChildNamed("label_chevron").SetActive(false); go.FindFirstChildNamed("uixPrfPanl_spotIllustration_750-MANAGED").SetActive(false); go.FindFirstChildNamed("event_TopBar").SetActive(false); go.FindFirstChildNamed("T_brackets_cap").SetActive(false); go.FindFirstChildNamed("event_ResponseOptions").SetActive(false); go.FindFirstChildNamed("results_buttonContainer").SetActive(false); go.FindFirstChildNamed("choiceCrumb").SetActive(false); go.FindFirstChildNamed("resultTagsContent").SetActive(false); go.FindFirstChildNamed("B_brackets_results").SetActive(false); go.FindFirstChildNamed("label_Text").SetActive(false); var event_OverallLayoutVlg = go.FindFirstChildNamed("event_OverallLayout").GetComponent <VerticalLayoutGroup>(); event_OverallLayoutVlg.childControlHeight = true; event_OverallLayoutVlg.childForceExpandHeight = true; var event_OverallLayout = (RectTransform)go.FindFirstChildNamed("event_OverallLayout").transform; event_OverallLayout.sizeDelta = new Vector2(750, 580); var results_TextllLayout = (RectTransform)go.FindFirstChildNamed("results_TextllLayout").transform; results_TextllLayout.sizeDelta = new Vector2(750, 900); // jebus there is a space after "Viewport" var viewport = go.GetComponentsInChildren <RectTransform>().First(x => x.name == "Viewport "); viewport.sizeDelta = new Vector2(0, 500); foreach (var tmpText in eventPanel.gameObject.GetComponentsInChildren <TMP_Text>(true)) { switch (tmpText.name) { case "title_week-day": tmpText.text = Globals.Sim.CurrentDate.ToLongDateString(); break; case "event_titleText": tmpText.text = "Relationship Summary"; tmpText.alignment = TextAlignmentOptions.Center; break; case "descriptionText": descriptionText = tmpText; tmpText.text = BuildRelationString(); tmpText.alignment = TextAlignmentOptions.Center; break; } } eventPanel.gameObject.SetActive(false); LogDebug("RelationPanel created"); } catch (Exception ex) { Error(ex); } }
void Start() { textObject = GetComponent <TMP_Text>(); }
// Start is called before the first frame update void Start() { sphereMovementScript = FindObjectOfType(typeof(SphereMovement)) as SphereMovement; coins_text = GetComponentInChildren <TMP_Text>(); }
protected void Reset() { m_text = GetComponent <TMP_Text>(); }
void Awake() { m_TextComponent = GetComponent <TMP_Text>(); }
// Start is called before the first frame update void Start() { resources = GameObject.FindGameObjectWithTag("StateMachine").GetComponent <Resources>(); statusText = GetComponent <TMP_Text>(); UpdateStatus(); }
// Start is called before the first frame update void Start() { _text = GetComponent <TMP_Text>(); _transform = GetComponent <RectTransform>(); }
private void Reset() { versionText = GetComponent <TMP_Text>(); }