From f2c78eecd49edc328225b77492e7f45e157bad02 Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期日, 28 九月 2025 23:25:25 +0800 Subject: [PATCH] 197 子 【内政】淘金系统 / 【内政】淘金系统-客户端 --- Main/Component/UI/Common/CountControler.cs | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Main/Component/UI/Common/CountControler.cs b/Main/Component/UI/Common/CountControler.cs index b5e69aa..fee49d9 100644 --- a/Main/Component/UI/Common/CountControler.cs +++ b/Main/Component/UI/Common/CountControler.cs @@ -15,6 +15,7 @@ int count; //褰撳墠鏁伴噺 int maxCount; //鏈�澶ф暟閲� + string format; Action<int> OnChangeEvent; Func<int, bool> CanAddEvent; @@ -60,13 +61,15 @@ } - public void Init(Action<int> _OnChangeEvent, int _maxCount, int _count = 1, Func<int, bool> _CanAddEvent = null, Func<int, bool> _CanDecEvent = null) + public void Init(Action<int> _OnChangeEvent, int _maxCount, int _count = 1, + Func<int, bool> _CanAddEvent = null, Func<int, bool> _CanDecEvent = null, string _format="{0}/{1}") { count = _count; maxCount = _maxCount; OnChangeEvent = _OnChangeEvent; CanAddEvent = _CanAddEvent; CanDecEvent = _CanDecEvent; + format = _format; Refresh(); @@ -99,7 +102,7 @@ decBtn.SetColorful(null, true); } - countText.text = count + "/" + maxCount; + countText.text = string.Format(format, count, maxCount); OnChangeEvent?.Invoke(count); } -- Gitblit v1.8.0