| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 | 
							- using System;
 
- 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 == 0)
 
-             {
 
-                 return "零";
 
-             }
 
-             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 GetOldChiniseNumberText(int num)
 
-         {
 
-             int numInUnit = 0;
 
-             int numInTen = 0;
 
-             string strInUnit = "";
 
-             string strInTen = "";
 
-             if (num == 0)
 
-             {
 
-                 return "零";
 
-             }
 
-             if (num <= 10)
 
-             {
 
-                 return GameConst.CHINESE_NUMBER_OLD[num - 1];
 
-             }
 
-             else if (num < 20)
 
-             {
 
-                 numInUnit = num - 10;
 
-                 strInUnit = GameConst.CHINESE_NUMBER_OLD[numInUnit - 1];
 
-                 return "拾" + strInUnit;
 
-             }
 
-             else if (num < 100)
 
-             {
 
-                 numInTen = Mathf.FloorToInt(num / 10);
 
-                 strInTen = GameConst.CHINESE_NUMBER_OLD[numInTen - 1];
 
-                 numInUnit = num % 10;
 
-                 if (numInUnit == 0)
 
-                 {
 
-                     return strInTen + "拾";
 
-                 }
 
-                 else
 
-                 {
 
-                     strInUnit = GameConst.CHINESE_NUMBER_OLD[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 "未知";
 
-         }
 
-         public static string ChangeNumberUnit(int num, int unit = 10000)
 
-         {
 
-             int count = num / unit;
 
-             if (count > 0)
 
-             {
 
-                 return string.Format("{0}万", count);
 
-             }
 
-             return num.ToString();
 
-         }
 
-         /// <summary>
 
-         /// 计算折扣-- 一位小数向上取整
 
-         /// </summary>
 
-         /// <param name="originalPrice">原始的价格</param>
 
-         /// <param name="discountedPrice">现在的价格</param>
 
-         /// <returns></returns>
 
-         public static string CalculateDiscount(double originalPrice, double discountedPrice)
 
-         {
 
-             double discountRate = discountedPrice / originalPrice;
 
-             double doubleNum = Math.Ceiling(discountRate * 100) / 10;
 
-             var roundedNumStr = doubleNum.ToString("0.0");
 
-             return roundedNumStr;
 
-         }
 
-     }
 
- }
 
 
  |