/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="pText"></param> /// <param name="iNumberStart"></param> /// <param name="iNumberDest"></param> /// <param name="fSeekPos_0_1"></param> /// <param name="strFormat"></param> /// <param name="GetLerp"></param> /// <param name="ToString"></param> private static void SeekTweenText <T>(Text pText, T iNumberStart, T iNumberDest, float fSeekPos_0_1, string strFormat, GetLerp <T> GetLerp, ToString <T> ToString) { int iVAlue = 1000; iVAlue.ToString(); // =1000 iVAlue.ToString("n0"); //=1,000 pText.text = ToString(GetLerp(iNumberStart, iNumberDest, fSeekPos_0_1), strFormat); }
/// <summary> /// 텍스트 애니메이션 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="pText">애니메이션 타겟</param> /// <param name="iNumberStart">시작 숫자</param> /// <param name="iNumberDest">끝 숫자</param> /// <param name="fDuration">애니메이션 총 걸리는 시간</param> /// <param name="strFormat">텍스트를 출력할 포멧</param> /// <param name="GetLerp">보간 로직</param> /// <param name="ToString">텍스트 출력 함수</param> private static IEnumerator TweenText <T>(Text pText, T iNumberStart, T iNumberDest, float fDuration, string strFormat, GetLerp <T> GetLerp, ToString <T> ToString) { float fProgress_0_1 = 0f; while (fProgress_0_1 < 1f) { SeekTweenText(pText, iNumberStart, iNumberDest, fProgress_0_1, strFormat, GetLerp, ToString); fProgress_0_1 += Time.deltaTime / fDuration; yield return(null); } pText.text = ToString(iNumberDest, strFormat); }