From b7aacb61e45973da6a5de8fe9cfe7fe3c19ca415 Mon Sep 17 00:00:00 2001 From: huyufei Date: Thu, 27 Jun 2024 18:47:36 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20=E4=BF=AE=E5=A4=8D=20AdStatus=20?= =?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA=20BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyufei --- .../AdsStatus/MVP/AdStatusPresenter.Ads.cs | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Runtime/GuruDebugger/Runtime/AdsStatus/MVP/AdStatusPresenter.Ads.cs b/Runtime/GuruDebugger/Runtime/AdsStatus/MVP/AdStatusPresenter.Ads.cs index 8ae3439..2f74917 100644 --- a/Runtime/GuruDebugger/Runtime/AdsStatus/MVP/AdStatusPresenter.Ads.cs +++ b/Runtime/GuruDebugger/Runtime/AdsStatus/MVP/AdStatusPresenter.Ads.cs @@ -99,22 +99,22 @@ namespace Guru UpdateView(); // 刷新视图 } - + // 字段缓冲 + private StringBuilder _infoBuff; private string CreateMonitorInfo() { string msg = ""; bool loaded = false; - - - StringBuilder sb = new StringBuilder(); - if (!ADService.Instance.IsInitialized) { msg = ColoredText("AdService not initialized...", Consts.ColorRed); return msg; } + if (_infoBuff == null) _infoBuff = new StringBuilder(); + _infoBuff.Clear(); + if (_curBadsInfo == null) { msg = $"BADS: {ColoredText("not ready", Consts.ColorRed)}\n"; @@ -137,7 +137,7 @@ namespace Guru msg = $"BADS: {ColoredText("loading...", Consts.ColorYellow)}\n\tformat: {_curBadsInfo.format}\n"; break; case AdStatusType.Paid: - msg = $"BADS: {ColoredText("display", Consts.ColorGreen)}\n\tnetwork: {_curIadsInfo.network}\n\trevenue: {_curBadsInfo.revenue}\n"; + msg = $"BADS: {ColoredText("display", Consts.ColorGreen)}\n\tnetwork: {_curBadsInfo.network}\n\trevenue: {_curBadsInfo.revenue}\n"; break; case AdStatusType.NotReady: msg = $"BADS: {ColoredText("not ready", Consts.ColorGray)}\n\t{ColoredText("---", Consts.ColorGray)}\n"; @@ -147,7 +147,7 @@ namespace Guru break; } } - sb.Append(msg); + _infoBuff.Append(msg); if (_curIadsInfo == null) @@ -159,7 +159,7 @@ namespace Guru switch (_curIadsInfo.status) { case AdStatusType.Loaded: - msg = $"IADS: {ColoredText("loaded", Consts.ColorGreen)}\n\tnetwork: {_curIadsInfo.network}\n\twaterfall: {_curBadsInfo.waterfall}\n"; + msg = $"IADS: {ColoredText("loaded", Consts.ColorGreen)}\n\tnetwork: {_curIadsInfo.network}\n\twaterfall: {_curIadsInfo.waterfall}\n"; break; case AdStatusType.LoadFailed: msg = $"IADS: {ColoredText("loading failed", Consts.ColorRed)}\n\tmessage: {_curIadsInfo.info}\n"; @@ -181,7 +181,7 @@ namespace Guru break; } } - sb.Append(msg); + _infoBuff.Append(msg); if (_curRadsInfo == null) @@ -215,10 +215,11 @@ namespace Guru break; } } - sb.Append(msg); + _infoBuff.Append(msg); - return sb.ToString(); + return _infoBuff.ToString(); + }