// Start is called before the first frame update void Start() { // Enable the correct treasure size object switch (Size) { case TreasureSize.PILE: // PILE PileObject.SetActive(true); PointValueMultiplier = 10; break; case TreasureSize.HORDE: // HORDE HordeObject.SetActive(true); PointValueMultiplier = 50; break; default: // COINE CoinsObject.SetActive(true); PointValueMultiplier = 5; break; } // Set the point value based on the treasure size int min = Mathf.Max(0, AveragePointValue - 2); PointValue = Random.Range(min, AveragePointValue + 2) * PointValueMultiplier; // Set the point value label PointLabel?.SetText("+" + PointValue); }
// Start is called before the first frame update private void Start() { Animator = GetComponent <Animator>(); // Set the point value label Label?.SetText("+" + PointValue); }
public void SetSortLabelText(ref TMP_Text label, string text) { var sortLabelText = $"<size=80%><sprite={SpriteHelper.Instance.GetSpriteIndex_YButton_Gray()}> <size=60%><b>Sort By:</b> " + text.Replace('_', ' '); //var defaultLabelText = $"<size=60%><voffset=0.25em><sprite={GetSpriteIndex_XButton()}></voffset> <b>Set Default</b>"; label?.SetText(sortLabelText); //+ defaultLabelText); }
void Start() { // set animators spriteDoremy = GameObject.Find("Doremy").GetComponent <Animator>(); spriteSagume = GameObject.Find("Sagume").GetComponent <Animator>(); spriteBackground = GameObject.Find("Background").GetComponent <Animator>(); // find the GameObjects we're going to be putting the text in // TODO: is there a 'better' way to do this? QuestionText = GameObject.Find("QuestionText").GetComponent <TMP_Text>(); Answer1 = GameObject.Find("AnswerText1").GetComponent <TMP_Text>(); Answer2 = GameObject.Find("AnswerText2").GetComponent <TMP_Text>(); // placeholder question text // TODO: get question from the question list & randomize QuestionText.SetText("This is a test question! It exists to show that I can change the text from the code. " + "Isn't that neat? I'm going to make it really long so that I can see what happens if the question is way too long."); // TEMPORARY // select which slot the correct answer will be in // this is just to show it can be randomized // if there's a better way, i'd love to know! sagumeCorrectAnswer = Random.Range(1, 3); // placeholder answers if (sagumeCorrectAnswer == 1) { Answer1.SetText("Correct Answer!"); Answer2.SetText("Incorrect Answer!"); } else if (sagumeCorrectAnswer == 2) { Answer1.SetText("Incorrect Answer!"); Answer2.SetText("Correct Answer!"); } }
/// <summary> /// Sets the amount of the asset that was traded in this transaction. /// </summary> /// <param name="transaction"> The info of this transaction. </param> /// <param name="tradableAsset"> The asset that was traded. </param> private void SetAmount(TransactionInfo transaction, TradableAsset tradableAsset) { var send = transaction.Type == TransactionInfo.TransactionType.Send; var start = send ? "-" : "+"; var amount = start + SolidityUtils.ConvertFromUInt(transaction.Value, tradableAsset.AssetDecimals); var symbol = tradableAsset.AssetSymbol; amountText.SetText(amount.LimitEnd(18 - symbol.Length, "...") + "<style=Symbol> " + symbol + "</style>"); amountText.color = send ? UIColors.Red : UIColors.Green; }
void Awake() { levelInt = GameManager.GetLatestLevel(); level = LevelFormat + levelInt; highScoreText.SetText(GameManager.GetHighScore(level).ToString()); levelDisplay.text = LevelFormat + " " + levelInt; SetEnemySprite(levelInt); string lastLevel = LevelFormat + (levelInt - 1); if (levelInt == 1 || GameManager.GetHighScore(lastLevel) != 0 || GameManager.GetHighScore(LevelFormat + levelInt) != 0) { _unlocked = true; } else { _unlocked = false; _lockSymbol.SetActive(true); } }
private void Update() { SetExpText(); coinsText.SetText(charManager.coins + ""); ArcherText.SetText("x " + ArcherCounter); KnightText.SetText("x " + knightCounter); HealerText.SetText("x " + HealerCounter); TankText.SetText("x " + TankCounter); MageText.SetText("x " + MageCounter); }
public void NextQuestion() { questionText.SetText(questionList[questionCounter].question); for (int i = 0, n = questionList[questionCounter].answerTexts.Length; i < n; i++) { answerTexts[i].SetText(questionList[questionCounter].answerTexts[i]); } AnswerButtonsEnabled(true); }
private void OnValidate() { _text = GetComponentInChildren <TMP_Text>(); int index = transform.GetSiblingIndex() + 1; _text.SetText(index.ToString()); gameObject.name = "Slot " + index; }
private void Refresh() { Scene active = SceneManager.GetActiveScene(); string name = active.name; if (m_SceneNameText) { m_SceneNameText.SetText(name); } }
// Update is called once per frame void Update() { int currentLevel = Global.currentLevel; if (prevLevel != currentLevel) { levelText.SetText("LEVEL = " + currentLevel); prevLevel = currentLevel; } }
void Update() { energyLevel = GameObject.Find("Score").GetComponent <Score>().energyScore; if (!isStatic) { // Set text m_text.SetText(k_label, (int)energyLevel); } }
private void OnTriggerEnter(Collider other) { if ((GameManager.completedLevels[thisLevelNum] || GameManager.completedLevels[thisLevelNum - 1])) { if (myPrompt.IsActive() == false) { myPrompt.SetText("Press Space to Enter"); myPrompt.gameObject.SetActive(true); } } else { if (myPrompt.IsActive() == false) { myPrompt.SetText("Complete Previous Level to Enter"); myPrompt.gameObject.SetActive(true); } } }
// Update is called once per frame void Update() { int currentScore = Global.playerScore; if (prevScore != currentScore) { scoreText.SetText("SCORE = " + currentScore); prevScore = currentScore; } }
//In: //Out: void //Desc: ends the turn and plays the animation public void endTurn() { if (TMS.selectedUnit == null) { switchCurrentPlayer(); if (currentTeam == 1) { playerPhaseAnim.SetTrigger("slideLeftTrigger"); playerPhaseText.SetText("Player 2 Phase"); } else if (currentTeam == 0) { playerPhaseAnim.SetTrigger("slideRightTrigger"); playerPhaseText.SetText("Player 1 Phase"); } teamHealthbarColorUpdate(); setCurrentTeamUI(); } }
public void SetupItem(string itemName, Sprite icon, int itemAmt, float weight, float value, InventoryUI inventoryUIRef, ItemInstance itemInstance) { nameText.SetText(itemName); itemIcon.sprite = icon; amountText.SetText(itemAmt.ToString()); weightText.SetText(weight.ToString()); valueText.SetText(value.ToString()); this.inventoryUIRef = inventoryUIRef; itemInstanceRef = itemInstance; }
private void UpdateETA() { double eta = gameController.gameClock + sleepTime; string etaHoursStr; string etaMinutesStr; if (eta >= 24) { eta = eta % 24; AddDayText.SetText("(+1 day)"); } else { AddDayText.SetText(""); } etaHoursStr = Math.Truncate(eta).ToString("00"); etaMinutesStr = Math.Truncate((eta - Math.Truncate(eta)) * 60).ToString("00"); ETAText.SetText(etaHoursStr + "h" + etaMinutesStr); }
void Update() { hungerLevel = GameObject.Find("Score").GetComponent <Score>().hungerScore; if (!isStatic) { // Set text m_text.SetText(k_label, (int)hungerLevel); } }
private void Start() { if (!healthBar) { Debug.LogError("HEALTH BAR IS EMPTY"); } currentHp = maxHp; currentArmor = maxArmor; healthBar.maxValue = maxHp; healthBar.value = maxHp; if (armorBar) { armorBar.maxValue = maxArmor; armorBar.value = maxArmor; armorText?.SetText("100%"); healthText?.SetText("100%"); } }
public void updateButton() { if (shopIteam == -1) { buttonText.SetText("Purchase: " + getWage(cost)); } else { buttonText.SetText("Purchase: " + getWage(cost)); } if (mainControl.getMoney() > cost) { button.interactable = true; } else { button.interactable = false; } }
public void SpawnUnit(int gold1, int cost1, int gold2, int cost2, GameObject unit1, GameObject unit2, TMP_Text goldUI) { posX = GMS.building.GetComponent <Cell>().spawnX; posY = GMS.building.GetComponent <Cell>().spawnY; units = GameObject.FindGameObjectsWithTag("Unit"); unitOnSpawnPoint = SpawnPointOccupied(posX, posY); if (!unitOnSpawnPoint) { if (GMS.currentTeam == 0) { if (gold1 >= cost1) { gold1 -= cost1; goldUI.SetText("GOLD: " + gold1.ToString()); GameObject newUnit = Instantiate(unit1, new Vector3(posX, 0.75f, posY), Quaternion.identity); newUnit.GetComponent <UnitScript>().tileBeingOccupied = map.tiles[posX, posY].tileOnMap; newUnit.transform.parent = Team1.transform; newUnit.GetComponent <UnitScript>().changeHealthBarColour(0); newUnit.GetComponent <UnitScript>().setMovementState(3); newUnit.GetComponent <UnitScript>().holder2D.GetComponent <SpriteRenderer>().color = Color.gray; map.tiles[posX, posY].tileOnMap.GetComponent <Cell>().unitOnTile = newUnit; } } else if (GMS.currentTeam == 1) { if (gold2 >= cost2) { gold2 -= cost2; goldUI.SetText("GOLD: " + gold2.ToString()); GameObject newUnit = Instantiate(unit2, new Vector3(posX, 0.75f, posY), Quaternion.identity); newUnit.GetComponent <UnitScript>().teamNum = 1; newUnit.GetComponent <UnitScript>().tileBeingOccupied = map.tiles[posX, posY].tileOnMap; newUnit.transform.parent = Team2.transform; newUnit.GetComponent <UnitScript>().changeHealthBarColour(0); newUnit.GetComponent <UnitScript>().holder2D.GetComponent <SpriteRenderer>().flipX = true; newUnit.GetComponent <UnitScript>().setMovementState(3); newUnit.GetComponent <UnitScript>().holder2D.GetComponent <SpriteRenderer>().color = Color.gray; map.tiles[posX, posY].tileOnMap.GetComponent <Cell>().unitOnTile = newUnit; } } } }
public void setUp(int place, int training, int location) { business = player.business; this.place = place; this.training = training; this.location = location; this.active = true; NameText.SetText(business.trainingList[training].name); InfoText.SetText(business.trainingList[training].description); updateButton(false); }
private void Refresh() { var isUnlocked = _constructionType.unlockedAfterCount <= LdGame.blocksCleared; _constructionImage.color = Color.white.With(a: isUnlocked ? 1 : .3f); _unlockedGameObject.SetActive(isUnlocked); _lockedGameObject.SetActive(!isUnlocked); _unlockConditionText.SetText($"Dig {_constructionType.unlockedAfterCount - LdGame.blocksCleared} more blocks to unlock"); _button.interactable = isUnlocked; _costText.color = LdGame.gold >= _constructionType.cost ? Color.black : Color.red; }
public void ShowText(string text, float duration) { helping = false; Debug.Log(text); Text.SetText(text); Background.CrossFadeAlpha(1.0f, 0.3f, true); Text.CrossFadeAlpha(1.0f, 0.3f, true); Displaying = true; DisplayTime = duration; }
// Start is called before the first frame update void Start() { // Set Dead count DeadCountLabel?.SetText(FindObjectOfType <DataCollector>()?.DeadPatients.ToString("D3")); // Set recovered list string[] patientNames = FindObjectOfType <DataCollector>()?.RecoveredPatients.Select(patient => patient.Name).ToArray(); string recoveredPatients = string.Join("\n", patientNames); RecoveredList?.SetText(recoveredPatients); }
private void Update() { // Waiting until we get back any type of error message, if there's none we load main menu if (!(errorMessage is null)) { errorScreen.SetActive(true); outputPort.SetText(errorMessage); outputLand.SetText(errorMessage); loadingScreen.SetActive(false); } }
public void ganar() { string movi = ""; for (int i = 0; i < movimientosList.Count; i++) { movi = movi + "\n" + movimientosList[i]; } Pasos.SetText(movi); }
private IEnumerator PoolTimer() { while (true) { timeOutCount.enabled = true; var proc = ContextControler.Procedure; var time = ExportProcedure.TimeOutMax - proc.TimeOutCount; timeOutCount.SetText(string.Format("TIMEOUT_COUNT".Translated(), time.ToString())); yield return(null); } }
/// <summary> /// 处理普通文字 /// </summary> /// <param name="chr"></param> /// <returns></returns> private bool progressNormalText(string chr) { //Debug.Log(string.Format("create Label {0}, size {1}", chr, this._currentFontSize)); GameObject node = Instantiate <GameObject>(Resources.Load <GameObject>("prefabs/ui/messages/MessagChar")); node.name = chr; TMP_Text uiText = node.GetComponent <TMP_Text>(); uiText.SetText(chr); RectTransform uiTextTransform = uiText.GetComponent <RectTransform>(); uiText.fontSize = (int)(this._currentFontSize); uiTextTransform.sizeDelta = new Vector2(uiText.fontSize, uiText.fontSize); //float s = Util.getWidthScale(); //uiTextTransform.localScale = new Vector3(s, s, uiTextTransform.localScale.z); uiText.color = this.getColor(this._currentColor); uiText.color = new Color(uiText.color.r, uiText.color.g, uiText.color.b, 0.0f); // 初始隐藏 node.transform.SetParent(this.container.transform); node.transform.localScale = new Vector3(1, 1, node.transform.localScale.z); if (!this.isSingleLine && uiTextTransform.sizeDelta.x > this._width) { node.transform.localScale = new Vector3(this._width / uiTextTransform.sizeDelta.x, this._width / uiTextTransform.sizeDelta.x, 1); } if (!this.isSingleLine) { //Debug.Log(string.Format("curr x {0} {1}", chr, this._renderPos.x + uiTextTransform.sizeDelta.x / 2)); if (this._renderPos.x - (-rectTransform.sizeDelta.x / 2 + OffsetX) + uiTextTransform.sizeDelta.x > this._width) { this.nextLine(); } } this._renderPos.lastHeight = this._currentFontSize; this._renderPos.x += this._currentFontSize / 2; float lastMaxHeight = this._renderPos.maxHeight; this._renderPos.maxHeight = (this._renderPos.maxHeight > this._currentFontSize) ? this._renderPos.maxHeight : this._currentFontSize; if (lastMaxHeight != this._renderPos.maxHeight) { this._renderPos.y = this._renderPos.baseY + lastMaxHeight / 2 - this._renderPos.maxHeight / 2; } this.setElemPosition(node, this._renderPos.x, this._renderPos.y); this._renderPos.x += this._currentFontSize / 2; if (this.isSingleLine) { this._width = Mathf.Max(this._width, this._renderPos.x); } this._texts.Add(node); this._contents.Add(node); this._currentLine.Add(node); return(true); }
public void setUp(int shopIteam, int location, bool playerSelected) { business = player.business; this.playerSelected = playerSelected; this.shopIteam = shopIteam; this.location = location; if (shopIteam == -1) { NameText.SetText("Focus"); InfoText.SetText("Makes employees faster"); cost = 50000; } else { NameText.SetText(business.iteamList[shopIteam].name); InfoText.SetText(business.iteamList[shopIteam].description); cost = business.iteamList[shopIteam].cost; } updateButton(); }