From 42f871ca328e4c1d876278a55e19e6aa8ebc43cc Mon Sep 17 00:00:00 2001 From: Yang Chun Ung Date: Wed, 8 Jan 2025 21:19:04 +0900 Subject: [PATCH 1/2] Enable error popup when stage transaction failed --- .../Assets/_Scripts/Blockchain/RPCAgent.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/nekoyume/Assets/_Scripts/Blockchain/RPCAgent.cs b/nekoyume/Assets/_Scripts/Blockchain/RPCAgent.cs index c7c465be42..ded6ef51df 100644 --- a/nekoyume/Assets/_Scripts/Blockchain/RPCAgent.cs +++ b/nekoyume/Assets/_Scripts/Blockchain/RPCAgent.cs @@ -98,6 +98,8 @@ public class RPCAgent : MonoBehaviour, IAgent, IActionEvaluationHubReceiver public readonly Subject<(RPCAgent, int retryCount)> OnRetryAttempt = new(); + public readonly Subject OnTxStageEnded = new (); + public BlockHash BlockTipHash { get; private set; } public HashDigest BlockTipStateRootHash { get; private set; } @@ -719,6 +721,19 @@ Dictionary GetPlayerAddressForLogging() .ObserveOnMainThread() .Subscribe() .AddTo(_disposables); + OnTxStageEnded + .ObserveOnMainThread() + .Subscribe(result => + { + if (!result) + { + var popup = Widget.Find(); + popup.Show(L10nManager.Localize("UI_ERROR"), + "banned", L10nManager.Localize("UI_OK"), false); + popup.SetConfirmCallbackToExit(); + } + }) + .AddTo(_disposables); Game.Event.OnUpdateAddresses.AddListener(UpdateSubscribeAddresses); cancellationTokenSource = new CancellationTokenSource(); @@ -886,7 +901,8 @@ private async Task MakeTransaction(List actions) $" Actions=[{actionsText}]"); _onMakeTransactionSubject.OnNext((tx, actions)); - await _service.PutTransaction(tx.Serialize()); + var result = await _service.PutTransaction(tx.Serialize()); + OnTxStageEnded.OnNext(result); foreach (var action in actions) { if (action is GameAction gameAction) From ca7324ac922b56c2fe38334d7cee16950e55c696 Mon Sep 17 00:00:00 2001 From: Yang Chun Ung Date: Thu, 9 Jan 2025 18:32:53 +0900 Subject: [PATCH 2/2] Use l10n key --- nekoyume/Assets/_Scripts/Blockchain/RPCAgent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nekoyume/Assets/_Scripts/Blockchain/RPCAgent.cs b/nekoyume/Assets/_Scripts/Blockchain/RPCAgent.cs index ded6ef51df..00118f8ccd 100644 --- a/nekoyume/Assets/_Scripts/Blockchain/RPCAgent.cs +++ b/nekoyume/Assets/_Scripts/Blockchain/RPCAgent.cs @@ -729,7 +729,7 @@ Dictionary GetPlayerAddressForLogging() { var popup = Widget.Find(); popup.Show(L10nManager.Localize("UI_ERROR"), - "banned", L10nManager.Localize("UI_OK"), false); + L10nManager.Localize("UI_TX_STAGE_FAILED"), L10nManager.Localize("UI_OK")); popup.SetConfirmCallbackToExit(); } })