Skip to content

Commit

Permalink
fix arena info
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene-doobu committed May 22, 2024
1 parent b707c98 commit cd1826a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions nekoyume/Assets/_Scripts/State/RxProps.Arena.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Threading.Tasks;
using Bencodex.Types;
using Cysharp.Threading.Tasks;
using Libplanet.Action.State;
using Libplanet.Crypto;
using Nekoyume.Action;
Expand Down Expand Up @@ -323,7 +324,8 @@ private static async Task<List<ArenaParticipantModel>>
{
playerArenaInfo.Cp = cp;
playerArenaInfo.PortraitId = portraitId;
playerArenaInfo.Score = (Integer)((List)stateBulk[playerScoreAddr])[1];
var playerScoreValue = ((List)stateBulk[playerScoreAddr])?[1];
playerArenaInfo.Score = playerScoreValue == null ? 0 : (Integer)playerScoreValue;
}

// NOTE: If the [`addrBulk`] is too large, and split and get separately.
Expand Down Expand Up @@ -352,8 +354,14 @@ private static async Task<List<ArenaParticipantModel>>
: arenaInfoList[playerIndex - 1].Rank + 1;
}

_playerArenaInfo.SetValueAndForceNotify(playerArenaInfo);
SetArenaInfoOnMainThreadAsync(playerArenaInfo).Forget();
return arenaInfoList;
}

private static async UniTask SetArenaInfoOnMainThreadAsync(ArenaParticipantModel playerArenaInfo)
{
await UniTask.SwitchToMainThread();
_playerArenaInfo.SetValueAndForceNotify(playerArenaInfo);
}
}
}

0 comments on commit cd1826a

Please sign in to comment.