public void Refresh() { if (textMesh == null) { return; } var systemLanguage = HyperSaveData.GetLanguage(); if (LocalizedTextData == null) { textMesh.SetText("LocalizedTextDataが設定されてないよ"); } else if (Key == null || Key == "") { textMesh.SetText("テキストキーが設定されてないよ"); } else { var texts = LocalizedTextData.texts.FirstOrDefault(_ => _.key == Key); if (texts != null) { textMesh.SetText(texts.Get(systemLanguage)); } else { textMesh.SetText("テキストデータが定義されてないよ"); } } }
void CalculateREMHours() { int crnthour = System.DateTime.Now.Hour; int crntminute = System.DateTime.Now.Minute; //Hour/minute input to calculator hourvalue = hrvalue.value; minutevalue = mntvalue.value; sleephr = ((MDNIGHT - crnthour) + hourvalue) - 1; sleepmin = ((HOUR - crntminute) + (minutevalue * 5)); //Checks to see if its past 60 if (sleepmin > HOUR) { sleepmin = sleepmin - HOUR; sleephr = sleephr + 1; } //Checks to see if its after midnight (00.30) if (sleephr > MDNIGHT) { sleephr = sleephr - MDNIGHT; } //Calculates rem cycles accounting for average fall asleep cycles = (((sleephr * HOUR) + (sleepmin - 14)) / REM); rechours.SetText("If you go to bed now," + " you will get " + cycles + " REM cycles"); }
private void OnDragStart(GameObject obj) { CritterController critter = obj.GetComponent <CritterController>(); ItemDescriptor itemDescriptor = obj.GetComponent <ItemDescriptor>(); if (critter != null) { CreatureDescriptor dna = critter.GetDNA(); StringBuilder descStringBuilder = new StringBuilder(); descStringBuilder.AppendLine(string.Format("Shape: {0}", CritterConstants.GetCreatureShapeDisplayString(dna.Shape))); descStringBuilder.AppendLine(string.Format("Color: {0}", CritterConstants.GetCreatureColorDisplayString(dna.Color))); descStringBuilder.AppendLine(string.Format("Size: {0}", CritterConstants.GetCreatureSizeDisplayString(dna.Size))); var attachmentCountMap = dna.GetAttachmentTypeCounts(); foreach (var countPair in attachmentCountMap) { if (countPair.Value > 0) { descStringBuilder.AppendLine(string.Format("{0}: {1}", countPair.Key.AttachmentType, countPair.Value)); } } _itemDescText.SetText(descStringBuilder); } else if (itemDescriptor != null) { _itemDescText.SetText(itemDescriptor.Description); } }
// Update is called once per frame void Update() { currentValue = CardInteraction.currentSide; if (currentValue != previousValue) { string [] decisionsText = cardClass.GetDecisionsText(); animation.clip = animation.GetClip("showDecision"); if (currentValue == Card.Side.none) { animation.clip = animation.GetClip("hideDecision"); } else if (currentValue == Card.Side.left) { decisionText.SetText((cardClass.GetDecisionsText())[0]); } else { decisionText.SetText((cardClass.GetDecisionsText())[1]); } animation.Play(); } previousValue = currentValue; }
public void Set(Vector2 start, Vector2 end, string s, StateMachineData.Transition t) { transitions.Add(t); // Self Transition? if (t.from == t.to) { lineRenderer.enabled = false; selfTransitionArrow.SetActive(true); normalTransitionArrow.SetActive(false); transform.position = start; // set ref coll = selfColl; text = selfText; } else { // Line Pos Vector2 e = Vector2.MoveTowards(end, start, Appdata.circleSize + (Appdata.arrowSize / 2f)); lineRenderer.positionCount = 2; lineRenderer.SetPositions(new Vector3[] { start, e }); lineRenderer.sortingOrder = -10; // Arrow Pos e = Vector2.MoveTowards(e, start, Appdata.arrowSize / 2f); arrow.transform.position = e; // Arrow Rot arrow.transform.rotation = Quaternion.Euler(0f, 0f, Vector2.SignedAngle(Vector2.up, end - start)); // Text Pos Vector2 ts = Vector2.MoveTowards(start, end, Appdata.circleSize); text.gameObject.transform.position = Vector2.Lerp(ts, e, 0.5f); // Text Rot float textRot = (arrow.transform.rotation.eulerAngles.z + 90f) % 360; if (textRot > 90f && textRot < 270f) { text.gameObject.transform.rotation = Quaternion.Euler(0f, 0f, textRot + 180f); ((RectTransform)text.gameObject.transform).pivot = new Vector2(0.5f, 0.85f); } else { text.gameObject.transform.rotation = Quaternion.Euler(0f, 0f, textRot); } // Coll Pos coll.gameObject.transform.position = ts; ((BoxCollider2D)coll).size = new Vector2(Vector2.Distance(start, end) - (Appdata.circleSize * 2f), 0.35f); coll.offset = new Vector2(((BoxCollider2D)coll).size.x / 2f, 0f); // Coll Rot coll.gameObject.transform.rotation = Quaternion.Euler(0f, 0f, textRot); } text.SetText(s); }
void Start() { // Create the string array textData = new char[(width + 1) * height]; ClearBoard(); // Initialize the text area text.SetText(textData); }
// Update is called once per frame void Update() { if (_qtdMoedaMax > m_frame) { m_textMeshPro.SetText(label, (int)m_frame); m_frame += 1;// * Time.deltaTime; } else { m_textMeshPro.SetText(label, (int)_qtdMoedaMax); } }
private void ChangeEditMode(EditMode editMode, bool deselect = true) { if (deselect) { smc.DeselectState(selectedState); selectedState = null; smc.DeselectTransition(selectedTransition); selectedTransition = null; } if (editMode != EditMode.Test && this.editMode == EditMode.Test) { NextButtonText.SetText("Test"); fileNameText.SetText(smc.stateMachineData.meta_name); smc.TestClear(); } switch (editMode) { case EditMode.Edit: this.editMode = EditMode.Edit; animator.SetTrigger("Cancle"); tooltip.SetText("Tap to select a state or transition."); break; case EditMode.AddState: this.editMode = EditMode.AddState; animator.SetTrigger("AddState"); tooltip.SetText("Tap to add a new state."); break; case EditMode.AddTransition: this.editMode = EditMode.AddTransition; animator.SetTrigger("AddTransition"); tooltip.SetText("Tap to add a new transition."); break; case EditMode.SelectState: this.editMode = EditMode.SelectState; animator.SetTrigger("SelectState"); tooltip.SetText("Drag the selected state to move."); break; case EditMode.SelectTransition: this.editMode = EditMode.SelectTransition; animator.SetTrigger("SelectTransition"); tooltip.SetText(""); break; case EditMode.Test: this.editMode = EditMode.Test; animator.SetTrigger("Test"); tooltip.SetText(""); NextButtonText.SetText("Run"); fileNameText.SetText(smc.stateMachineData.meta_name + testTopPanelText); break; default: break; } }
public void LoadPanda(PandaStats stats) { pandaName.text = stats.name; gender.text = stats.gender.ToString(); primaryColor.SetText(stats.Phenotype.primaryBodyColorTrait.ToString()); secendaryColor.SetText(stats.Phenotype.secondaryColorTrait.ToString()); eyeColor.SetText(stats.Phenotype.eyeColorTrait.ToString()); eyeType.SetText(stats.Phenotype.eyesTypeTrait.ToString()); earType.SetText(stats.Phenotype.earTypeTrait.ToString()); mouthNoseType.SetText(stats.Phenotype.noseMouthTypeTrait.ToString()); tailType.SetText(stats.Phenotype.tailTypeTrait.ToString()); bodyType.SetText(stats.Phenotype.bodyTypeTrait.ToString()); specialType.SetText(stats.Phenotype.specialTrait.ToString()); }
void Start() { versionLabel.SetText("v" + Application.version); #if UNITY_WEBGL exitMainMenu.SetActive(false); #endif }
public virtual void Init(IConsumable consumable) { this.Consumable = consumable; m_name.SetText(consumable.GetName()); m_sprite.sprite = consumable.GetIcon(); m_button.onClick.AddListener(DoAction); }
public void Setup(string text) { _textMeshPro.SetText(text); _translateDir = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), 0).normalized; Destroy(gameObject, lifeTime); _started = true; }
private void LoadCharacter() { GameObject LBG = GameObject.Find("LocationBasedGame"); int charType = gameManager.charType; if (charType == 0) { player = Instantiate(character1, new Vector3(0, 0, 0), Quaternion.identity); } else { player = Instantiate(character2, new Vector3(0, 0, 0), Quaternion.identity); } player.AddComponent(typeof(ImmediatePositionWithLocationProvider)); player.AddComponent(typeof(RotateWithLocationProvider)); player.transform.parent = LBG.transform; // set a tag for the user's player character player.tag = "UserCharacter"; // Slime model tiny - using this to increase size player.transform.localScale += new Vector3(3.0f, 3.0f, 3.0f); mainCamera.transform.parent = player.transform; TMPro.TMP_Text avatarNameField = GameObject.Find("AvatarName").GetComponent <TMPro.TMP_Text>(); string displayName = gameManager.displayName; if (displayName != null) { avatarNameField.SetText(gameManager.displayName); } }
void SetFinishScreen() { float fullTime = dayCount * dayInMinutes * 60f; salaryTxt.SetText(""); taxesTxt.SetText(""); timeOfDayTxt.SetText(""); var resume = string.Format("Current Salary: {0}$\nCurrent Taxes: {1}\nTotal Earned: {2}$\nScore: {3}\n\nPress Space to continue ...", salary.ToString("0.00"), (taxes * 100f).ToString("0.00"), totalEarnigs.ToString("0.00"), Mathf.FloorToInt((totalEarnigs * taxes + salary) * 0.1562f) * (timeOfDaySeconds / fullTime)); resumeTxt.SetText(resume); }
private void Update() { PlaneText.SetText("Planes Added = " + numPlanesAdded + " Planes Updated = " + numPlanesUpdated + " Planes Removed = " + numPlanesRemoved + " Point Clouds Updated = " + numPointsUpdated); if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) { Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); var hits = new List <ARRaycastHit>(); aRRaycastManager.Raycast(ray, hits, UnityEngine.XR.ARSubsystems.TrackableType.Planes); if (hits.Count > 0) { var pos = hits[0].pose.position; if (go != null) { go.gameObject.transform.position = pos; } else { go = Instantiate(robot, pos, Quaternion.identity) as GameObject; Rigidbody rigidbody = go.GetComponent <Rigidbody>(); rigidbody.isKinematic = true; rigidbody.velocity = Vector3.zero; rigidbody.angularVelocity = Vector3.zero; } } } }
public void NewGame() { Debug.Log("Resetting the game board."); turn = Random.Range(1, 10) > 5; gameover = false; row1 = ""; row2 = ""; row3 = ""; col1 = ""; col2 = ""; col3 = ""; forw = ""; back = ""; var go = GameObject.FindObjectsOfType <Button>(); if (go != null) { foreach (Button b in go) { if (b.name.Length == 2) { TMPro.TMP_Text text = b.GetComponentInChildren <TMPro.TMP_Text>(); text.SetText(" "); } } } }
public void ShowNewRound(int roundNum) { StopAllCoroutines(); m_CanvasGroup.alpha = 0; m_RoundNumText.SetText(roundNum.ToString()); StartCoroutine(ShowMessage()); }
void Update() { gunHeatSlider.value = CalculateGunHeatPercent(); currencyText.SetText(GameManager.instance.currency.ToString()); healthSlider.value = CalculateHealthPercent(); healthSliderGhost.value = Mathf.MoveTowards(previousHealthPercent, CalculateHealthPercent(), (1f / 5f) * Time.deltaTime); previousHealthPercent = healthSliderGhost.value; }
private void OnMouseDown() { //When clicked open upgrade menu GameController.gameController.menuOpen = true; lodgeOptionsPanel.gameObject.SetActive(true); //Updates text to level levelText.SetText("Level " + GameController.gameController.level.ToString()); }
public IEnumerator Timer(int seconds) { for (int secs = seconds; secs >= 0; secs--) { string text = TimeSpan.FromSeconds(secs).ToString().Remove(0, 3); Text.SetText(text); yield return(new WaitForSeconds(1)); } BuildController.ForceOtherPlayerReady(); }
private void Awake() { // Znam che cqlata taz arhitektura e gnusna ama me murzi da gledam. resolutionSlider.onValueChanged.AddListener(OnResolitionValueChanged); frequencySlider.onValueChanged.AddListener(OnFrequencyValueChanged); strengthSlider.onValueChanged.AddListener(OnStrengthValueChanged); refreshButton.onClick.AddListener(Generate); int resolutionSqrt = (int)Mathf.Sqrt(resolution); resolutionSlider.SetValueWithoutNotify(resolutionSqrt); resolutionValueText.SetText(resolution + ""); frequencySlider.SetValueWithoutNotify((int)frequency); frequencyValueText.SetText(frequency + ""); strengthSlider.SetValueWithoutNotify((int)strength); strengthValueText.SetText(strength + ""); }
public void ShowDetailsFor(IConsumable consumable) { currentConsumable = consumable; if (consumable as BaseEroConsumable) { consumableRange.SetText($"Range: { consumable.GetRange()} \n Ero value: {(consumable as BaseEroConsumable).MEroNutritionalValue } \n Time working: {(consumable as BaseEroConsumable).TimeGivingNutrition }"); } else if (consumable as BaseFoodConsumable) { consumableRange.SetText($"Range: { consumable.GetRange()} \n Food value: {(consumable as BaseFoodConsumable).m_foodNutritionalValue } \n Time working: {(consumable as BaseFoodConsumable).timeGivingNutrition }"); } else { consumableRange.SetText($"Type: {(consumable as BaseDrugConsumable).drugType} \n Potency: { (consumable as BaseDrugConsumable).m_drugValue}"); } consumablePrice.SetText($"Price: {consumable.GetPrice()}"); consumableName.SetText(consumable.GetName()); buyButon.interactable = true; }
private void Initialize() { questionText.SetText(question.GetText()); for (int index = 0; index < question.GetChoiceLength(); index++) { ChoiceController c = ChoiceController.AddChoiceButton(choiceButton, question.GetChoice(index), index); choiceControllers.Add(c); } choiceButton.gameObject.SetActive(false); }
private void Update() { AnimalCount.SetText(LevelManager.Instance.KoalasSaved.ToString()); FireCount.SetText(LevelManager.Instance.TreeObjects.Count.ToString()); if (Input.GetKeyDown(KeyCode.Escape)) { _isPaused = !_isPaused; } TogglePauseMenu(_isPaused); Cursor.visible = _isPaused; }
IEnumerator LoadAsynchronously(int sceneIndex) { AsyncOperation operation = SceneManager.LoadSceneAsync(sceneIndex); while (!operation.isDone) { float progress = Mathf.Clamp01(operation.progress / .9f); loadingSlider.value = progress; loadingText.SetText(Mathf.Round(progress * 100f).ToString() + "%"); yield return(null); } }
public void GiveBlob(UtilsEnum.attribute blob) { GameManager.instance.ui_manager.SpawnThis(scoreUI, this.transform.position + Vector3.up); TMPro.TMP_Text text = scoreUI.GetComponentInChildren <TMPro.TMP_Text>(); //Compare food blob &= need; int scoreCounter = UtilsEnum.howManyFlag(blob); //Add score : Debug.Log("scoreCounter = " + scoreCounter); text.SetText("+" + scoreCounter); GameManager.instance.AddScore(scoreCounter); }
public void UpdateStaticTime(int setTimer) { if (setTimer <= 0) { txtTimer.SetText("--:--"); return; } txtTimer.SetText(UpdateManager.TimeToStr(setTimer)); //txtTimer.SetText(setTimer); }
private void DisplayMessage(string errorText, GameObject returnWindow) { // Toggle error window returnWindow.SetActive(false); errorWindow.SetActive(true); // Assign window switch & error text. errorLbl.SetText(errorText); errorBtn.onClick.RemoveAllListeners(); errorBtn.onClick.AddListener(delegate() { errorWindow.SetActive(false); returnWindow.SetActive(true); }); }
public void ability_button_clicked(Button button, TMPro.TMP_Text score_output, char flag) { List <int> rolls = new List <int>(5); for (int i = 0; i < 5; i++) { rolls.Add(Random.Range(1, 7)); } rolls.Sort(); int ability_score = rolls[rolls.Count - 1] + rolls[rolls.Count - 2] + rolls[rolls.Count - 3]; switch (flag) { case 's': this.strength = ability_score; break; case 'd': this.dexterity = ability_score; break; case 'c': this.constitution = ability_score; break; case 'i': this.intelligence = ability_score; break; case 'w': this.wisdom = ability_score; break; case 'm': //m is a flag for charisma this.charisma = ability_score; break; default: break; } score_output.SetText(ability_score.ToString()); button.interactable = false; //button.transform.gameObject.SetActive(false); }
private void Update() { foreach (var player in players) { if (!player.KingAlive) { winCondition = true; winningId = GetOtherPlayer(player.PlayerId).PlayerId; m_gameOverUI.SetActive(true); m_winningPlayerText.SetText($"Player {winningId} wins!"); } } if (winCondition) { timer.Tick(Time.deltaTime); } }