| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 | using UnityEngine;namespace GFGGame{    public class NumberUtil    {        public static string GetChiniseNumberText(int num)        {            int numInUnit = 0;            int numInTen = 0;            string strInUnit = "";            string strInTen = "";            if (num <= 10)            {                return GameConst.CHINESE_NUMBER[num - 1];            }            else if (num < 20)            {                numInUnit = num - 10;                strInUnit = GameConst.CHINESE_NUMBER[numInUnit - 1];                return "十" + strInUnit;            }            else if (num < 100)            {                numInTen = Mathf.FloorToInt(num / 10);                strInTen = GameConst.CHINESE_NUMBER[numInTen - 1];                numInUnit = num % 10;                if (numInUnit == 0)                {                    return strInTen + "十";                }                else                {                    strInUnit = GameConst.CHINESE_NUMBER[numInUnit - 1];                    return strInTen + "十" + strInUnit;                }            }            return "未知";        }        public static string GetChiniseNumberWeekText(int num)        {            if (num >= 0 && num < GameConst.CHINESE_NUMBER.Length)            {                return GameConst.CHINESE_WEEK_NUMBER[num];            }            return "未知";        }    }}
 |