From 68a38bbef67dd9488aaa7def6d1598fdb810f4cb Mon Sep 17 00:00:00 2001 From: yangjing Date: Wed, 16 Feb 2022 18:53:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E5=AD=97=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Const/Const.Path.cs | 10 +++++----- Assets/Scripts/UI/CustomControl/ImageNum.cs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/Const/Const.Path.cs b/Assets/Scripts/Const/Const.Path.cs index 184795db..ee381cb4 100644 --- a/Assets/Scripts/Const/Const.Path.cs +++ b/Assets/Scripts/Const/Const.Path.cs @@ -13,28 +13,28 @@ public partial class Const public static string GetLevelIconBig(int pLevelID) { - return string.Format("Image/LevelIcon_Big/{0}", (pLevelID + 1).ToString().PadLeft(3, '0')); + return string.Format("Image/LevelIcon_Big/{0}", (pLevelID + 1).ToString("D3")); } public static string GetLevelIconSmall(int pLevelID) { - return string.Format("Image/LevelIcon_Small/{0}", (pLevelID + 1).ToString().PadLeft(3, '0')); + return string.Format("Image/LevelIcon_Small/{0}", (pLevelID + 1).ToString("D3")); } public static string GetLevelLogo(int pLevelID) { - return string.Format("Image/LevelLogo/{0}", (pLevelID + 1).ToString().PadLeft(3, '0')); + return string.Format("Image/LevelLogo/{0}", (pLevelID + 1).ToString("D3")); } public static string GetSoundPic(int pLevelID, int pSoundIndex) { - string tLevelIDStr = (pLevelID + 1).ToString().PadLeft(3, '0'); + string tLevelIDStr = (pLevelID + 1).ToString("D3"); return string.Format("Image/SoundPic/{0}/{1}", tLevelIDStr, tLevelIDStr + "_" + (pSoundIndex + 1).ToString()); } public static string GetSound(int pLevelID, int pSoundIndex) { - string tLevelIDStr = (pLevelID + 1).ToString().PadLeft(3, '0'); + string tLevelIDStr = (pLevelID + 1).ToString("D3"); return string.Format("Audio/GameSound/{0}/{1}", tLevelIDStr, tLevelIDStr + "_" + (pSoundIndex + 1).ToString()); } diff --git a/Assets/Scripts/UI/CustomControl/ImageNum.cs b/Assets/Scripts/UI/CustomControl/ImageNum.cs index c2329dc9..a9ba3251 100644 --- a/Assets/Scripts/UI/CustomControl/ImageNum.cs +++ b/Assets/Scripts/UI/CustomControl/ImageNum.cs @@ -12,7 +12,7 @@ public class ImageNum : MonoBehaviour public void SetNum(int pNum) { pNum = pNum % 1000; - string tNumStr = pNum.ToString().PadLeft(3, '0'); + string tNumStr = pNum.ToString("D3"); mImgHundreds.sprite = ResourceManager.Instance.LoadRes(Const.Path.GetNumPicA(tNumStr[0].ToString())); mImgTens.sprite = ResourceManager.Instance.LoadRes(Const.Path.GetNumPicA(tNumStr[1].ToString()));