/// @param textMesh /// The text to modify /// @param format /// The string format to use /// @param from /// The amount to start up as /// @oaram to /// The amount to mount up to /// @oaram duration /// The duration of the tween /// @oaram [optional] callback /// The function to call when the tweener finished /// /// @return The count tweener /// public static Tweener DOCount(this TMP_Text textMesh, string format, int from, int to, float duration, Action callback = null) { if (textMesh != null) { int progress = from; return(DOTween.To(() => progress, (Value) => { textMesh.SafeText(string.Format(format, TextUtils.GetNumberString(progress))); progress = Value; }, to, duration).OnComplete(() => { textMesh.SafeText(string.Format(format, TextUtils.GetNumberString(to))); callback.SafeInvoke(); })); } return(null); }
/// @param scores /// The scores to achieve /// public void InitialiseScores(List <int> scores) { m_audioService = GlobalDirector.Service <AudioService>(); m_scoreText.SafeText(TextUtils.GetFormattedCurrencyString(m_score)); m_scores = scores; foreach (var star in m_starsProgress) { star.SetProgress(0.0f); } }
/// Refresh the UI /// private void RefreshUI() { var typeString = m_objectiveData.m_type.ToString(); m_typeText.SafeText(typeString); m_stateComponent.SafeState(typeString); m_targetText.SafeText(m_objectiveData.m_target.ToString()); m_valueText.SafeText(m_objectiveData.m_value.ToString()); m_amountText.SafeText(m_objectiveData.m_amount.ToString()); }
/// Called when the objective has progressed /// private void UpdateProgressDisplay() { // Set the objective text string target = m_objectiveModel.m_data.m_target != TileColour.None ? m_objectiveModel.m_data.m_target.ToString() : m_objectiveModel.m_data.m_value.ToString(); string amount = TextUtils.GetFormattedCurrencyString(m_objectiveModel.m_data.m_amount); m_objectiveText.SafeText(string.Format(m_baseDisplay, target, amount)); // Set the objective progress bar float progress = m_objectiveModel.GetProgress(); string progressString = m_objectiveModel.GetProgressDisplay(); m_progressBar.TweenToProgress(progress, 0.5f); m_progressBar.Text.SafeText(progressString); }
/// @param tileColour /// The tile colour /// @param text /// The text to set /// public void SetTileColour(TileColour tileColour, string text) { m_tileColour = tileColour; m_tileText.SafeText(text); }
/// @param text /// The text to set /// public void SafeText(string text) { m_text.SafeText(text); }
/// @param text /// Text to set /// public void SetText(string text) { m_textComponent.SafeText(text); }
/// @param moves /// The moves to set /// public void SetMovesLeft(string moves) { m_moveText.SafeText(moves); }
/// @param name /// The name to set /// public void SetLevelName(string name) { m_levelName.SafeText(name); }
/// @param text /// The text to set /// public void SetMoves(string text) { m_moves.SafeText(text); }
/// @param text /// The text to set /// public void SetBoardSize(string text) { m_boardSize.SafeText(text); }
/// @param text /// The text to set /// public void SetLevelName(string text) { m_levelName.SafeText(text); }