// Update is called once per frame void Update() { if (scoreText.IsDestroyed() && (gameManager.IsMenuScene() || gameManager.IsDeadScreenScene())) { scoreText = GameObject.FindGameObjectWithTag("ScoreText").GetComponent <Text>(); } else if (currentScore < infoPlayer.GetScore()) { if (scoreText.IsDestroyed()) { scoreText = GameObject.FindGameObjectWithTag("ScoreText").GetComponent <Text>(); } currentScore++; scoreText.text = currentScore.ToString(); } }
internal void SetMaxCubeNumber(int max) { if (!maxNumberOfCubes.IsDestroyed()) { maxNumberOfCubes.text = max.ToString(); } }
public static void Bingding(this Text ui, string name, INotifyPropertyChanged x) { PropertyChangedEventHandler foo = null; var prop = x.GetType().GetProperty(name); foo = delegate(object sender, PropertyChangedEventArgs e) { if (ui.IsDestroyed()) { x.PropertyChanged -= foo; return; } if (e.PropertyName == name) { ui.text = prop.GetValue(x, null).ToString(); } }; if (prop == null) { Debug.LogError("can't find property :" + name); return; } x.PropertyChanged += foo; ui.text = prop.GetValue(x, null).ToString(); }
private void OnQualityChanged(ImageTargetBuilder.FrameQuality quality) { if (_frameQualityText.IsDestroyed()) { return; } switch (quality) { case ImageTargetBuilder.FrameQuality.FRAME_QUALITY_NONE: case ImageTargetBuilder.FrameQuality.FRAME_QUALITY_LOW: _frameQualityText.text = "识别度:低"; _frameQualityText.color = Color.red; break; case ImageTargetBuilder.FrameQuality.FRAME_QUALITY_MEDIUM: _frameQualityText.text = "识别度:中"; _frameQualityText.color = Color.yellow; break; case ImageTargetBuilder.FrameQuality.FRAME_QUALITY_HIGH: _frameQualityText.text = "识别度:高"; _frameQualityText.color = Color.green; break; default: throw new ArgumentOutOfRangeException("quality", quality, null); } }
private void UpdateSpiritsUiCounter() { if (!SpiritsAmountText.IsDestroyed()) { SpiritsAmountText.text = _spiritsAlive.ToString() + " / " + StartAmount.ToString(); } }
public void AddTechnology(float points) { if (technologyText.IsDestroyed()) { return; } techPoints += points; technologyText.text = techPoints.ToString(CultureInfo.InvariantCulture); }
private void OnDestroy() { UIlist.Clear(); LoonImg.Clear(); Rune1_item_bt.Clear(); Rune2_item_bt.Clear(); Rune3_item_bt.Clear(); Dungeon_Energy.IsDestroyed(); Town_Energy.IsDestroyed(); }
async void Update() { position = client.Increment(position); position = await client.IncrementAsync(position, new CallOptions()); if (!text.IsDestroyed()) { text.text = position.Value.ToString(); } }
public void UpdateScore() { GameSessionData.Instance.Score++; UpdateGameBehaviour(); if (!_score.IsDestroyed()) { _score.text = GameSessionData.Instance.Score.ToString(); } }
private void handleStringChanged(string s) { if (textDisplay.IsDestroyed()) { kb.OnStringChanged -= handleStringChanged; return; } textDisplay.text = s + '|'; }
private void _playerDefeatedCallback() { if (gameOverText.IsDestroyed()) { // исправляет ошибку при закрытии // MissingReferenceException: The object of type 'Text' has been destroyed but you are still trying to access it return; } gameOverText.text = $"GameOver{Environment.NewLine}Score: {_gameScore.GetScore()}{Environment.NewLine}Restart? Y/N"; // если включать/выключать только компонент Text, а gameObject сделать постоянно активным // то будет всегда работать компонент EventTrigger, из-за чего нажатие на Submit и Cancel будет срабатывать даже когда корабль не уничтожен // проще включать/выключать сам gameObject gameOverText.gameObject.SetActive(true); }
IEnumerator MoveUpward(Text text) { Debug.Log("Move Upward"); float elapsedTime = 0f; Vector2 startPos = text.transform.position; Vector2 endPos = new Vector2(startPos.x, startPos.y + 0.5f); while(elapsedTime < 0.2f) { if (text == null || text.IsDestroyed()) break; elapsedTime += Time.deltaTime; text.transform.position = EasingUtil.EaseVector2(EasingUtil.easeOutQuad, startPos, endPos, elapsedTime / 0.2f); yield return null; } }
private IEnumerator PlayCoroutine() { isPlaying = true; for (int i = 0; i < subtitleAsset.subtitles.Count; i++) { SubtitleInfo s = subtitleAsset.subtitles[i]; if (isPause) { yield return(new WaitUntil(() => !isPause)); } if (destoryText) { if (!text.IsDestroyed()) { Destroy(text.gameObject); } text = SubtitleManager.Instance.CreateText(Vector3.zero, 14, Color.white); } currentSubtileContent = s.Content; #region Set Format SubtitleFormat fmt = subtitleAsset.GetFormatByMsg(s); text.font = SubtitleUtility.GetFontByFontName(fmt.FontData.Font.FontName); text.fontSize = fmt.FontData.FontSize; text.fontStyle = fmt.FontData.FontStyle; text.lineSpacing = fmt.FontData.LineSpacing; text.supportRichText = fmt.FontData.RichText; text.alignment = fmt.FontData.Alignment; text.alignByGeometry = fmt.FontData.AlignByGeometry; text.horizontalOverflow = fmt.FontData.HorizontalWrapMode; text.verticalOverflow = fmt.FontData.VerticalWrapMode; text.resizeTextForBestFit = fmt.FontData.BestFit; text.color = fmt.GetUnityColor(); text.raycastTarget = fmt.RaycastTarget; #endregion #region Set Subtitle if (s.FadeInDuration > 0) { currentSubtitle = new Subtitle(string.Empty, s.GetVector2(), fmt.FontData.FontSize, fmt.GetUnityColor(), fmt.FontData.Font.FontName, s.Duration + s.FadeInDuration + s.FadeOutDuration); } else { currentSubtitle = new Subtitle(s.Content, s.GetVector2(), fmt.FontData.FontSize, fmt.GetUnityColor(), fmt.FontData.Font.FontName, s.Duration + s.FadeInDuration + s.FadeOutDuration); } currentSubtitle.Text = text; currentSubtitle.destoryTextOnComplete = destoryText; currentSubtitle.SetDirect(s.IsVertical ? SubtitleDirect.Vertical : SubtitleDirect.Horizontal); currentSubtitle.OnPlay = (t, d) => { //如果Text未销毁,新的Subtitle播放的时候应该先把原先的所有Tween杀掉防止出现某些Tween未执行出预期的效果 if (!destoryText) { t.DOKill(); } if (s.FadeInDuration > 0) { t.color = new Color(t.color.r, t.color.g, t.color.b, 0); t.text = s.Content; } t.DOColor(new Color(t.color.r, t.color.g, t.color.b, 1), s.FadeInDuration) .OnComplete(() => { float tmp = 0; DOTween.To(() => tmp, (x) => tmp = x, 0, s.Duration) .OnComplete(() => { t.DOColor(new Color(t.color.r, t.color.g, t.color.b, 0), s.FadeOutDuration) .OnComplete(() => t.color = new Color(t.color.r, t.color.g, t.color.b, 1)); }); }); }; currentSubtitle.OnUpdate = (t, c) => { if (!currentSubtitle.IsPause) { currentProgress = c; } }; #endregion if (!isPause) { currentSubtitle.Play(); } else { currentSubtitle.Pause(); } yield return(currentSubtitle.WaitForCompletion()); } text.text = string.Empty; currentSubtileContent = string.Empty; currentProgress = 0f; isPlaying = false; isPause = false; currentSubtitle = null; onComplete.Invoke(); }