Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

로컬레이어의 상태 초기화처리 수정 #5154

Merged
merged 6 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 4 additions & 31 deletions nekoyume/Assets/_Scripts/Blockchain/ActionRenderHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1014,11 +1014,6 @@ private void ResponseCombinationEquipment(
result.gold);
});

LocalLayerModifier.RemoveItem(
avatarAddress,
result.itemUsable.ItemId,
result.itemUsable.RequiredBlockIndex,
1);
LocalLayerModifier.AddNewAttachmentMail(avatarAddress, result.id);

var tableSheets = Game.Game.instance.TableSheets;
Expand Down Expand Up @@ -1189,11 +1184,6 @@ private void ResponseCombinationConsumable(
result.gold);
});

LocalLayerModifier.RemoveItem(
avatarAddress,
result.itemUsable.ItemId,
result.itemUsable.RequiredBlockIndex,
1);
LocalLayerModifier.AddNewAttachmentMail(avatarAddress, result.id);

RenderQuest(avatarAddress, renderArgs.AvatarState.questList.completedQuestIds);
Expand Down Expand Up @@ -1246,11 +1236,6 @@ private void ResponseEventConsumableItemCrafts(
result.gold);
});

LocalLayerModifier.RemoveItem(
avatarAddress,
itemUsable.ItemId,
itemUsable.RequiredBlockIndex,
1);
LocalLayerModifier.AddNewAttachmentMail(avatarAddress, result.id);

// Notify
Expand Down Expand Up @@ -1389,20 +1374,6 @@ private void ResponseItemEnhancement(
}
}

if (itemUsable.ItemSubType == ItemSubType.Aura)
{
//Because aura is a tradable item, local removal or add fails and an exception is handled.
LocalLayerModifier.RemoveNonFungibleItem(avatarAddress, itemUsable.ItemId);
}
else
{
LocalLayerModifier.RemoveItem(
avatarAddress,
itemUsable.ItemId,
itemUsable.RequiredBlockIndex,
1);
}

LocalLayerModifier.AddNewAttachmentMail(avatarAddress, result.id);

RenderQuest(avatarAddress, renderArgs.AvatarState.questList.completedQuestIds);
Expand Down Expand Up @@ -1640,7 +1611,8 @@ private async void ResponseCancelProductRegistrationAsync(
{
var row = Game.Game.instance.TableSheets.MaterialItemSheet.Values
.First(r => r.ItemSubType == ItemSubType.ApStone);
LocalLayerModifier.AddItem(eval.Action.AvatarAddress, row.ItemId);
// 액션을 스테이징한 시점에 미리 반영해둔 아이템의 레이어를 먼저 제거하고, 액션의 결과로 나온 실제 상태를 반영
LocalLayerModifier.AddItem(eval.Action.AvatarAddress, row.ItemId, 1, false);
}

if (GameConfigStateSubject.ActionPointState.ContainsKey(eval.Action.AvatarAddress))
Expand Down Expand Up @@ -1716,7 +1688,8 @@ private async void ResponseReRegisterProduct(ActionEvaluation<ReRegisterProduct>
{
var row = Game.Game.instance.TableSheets.MaterialItemSheet.Values
.First(r => r.ItemSubType == ItemSubType.ApStone);
LocalLayerModifier.AddItem(eval.Action.AvatarAddress, row.ItemId);
// 액션을 스테이징한 시점에 미리 반영해둔 아이템의 레이어를 먼저 제거하고, 액션의 결과로 나온 실제 상태를 반영
LocalLayerModifier.AddItem(eval.Action.AvatarAddress, row.ItemId, 1, false);
}

if (GameConfigStateSubject.ActionPointState.ContainsKey(eval.Action.AvatarAddress))
Expand Down
40 changes: 4 additions & 36 deletions nekoyume/Assets/_Scripts/State/LocalLayerModifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,56 +351,24 @@ long blockIndex
/// </summary>
/// <param name="avatarAddress"></param>
/// <param name="mailId"></param>
/// <param name="resetState"></param>
public static async void RemoveNewAttachmentMail(
public static void RemoveNewAttachmentMail(
Address avatarAddress,
Guid mailId,
bool resetState = true)
Guid mailId)
{
UnityEngine.Debug.Log($"[MailRead] RemoveNewAttachmentMail mailid : {mailId}");
var modifier = new AvatarAttachmentMailNewSetter(mailId);
LocalLayer.Instance.Remove(avatarAddress, modifier);

if (!resetState)
{
return;
}

await TryResetLoadedAvatarState(avatarAddress);
}

public static async void RemoveNewMail(
public static void RemoveNewMail(
Address avatarAddress,
Guid mailId,
bool resetState = true)
Guid mailId)
{
UnityEngine.Debug.Log($"[MailRead] RemoveNewMail mailid : {mailId}");
var modifier = new AvatarMailNewSetter(mailId);
LocalLayer.Instance.Remove(avatarAddress, modifier);

if (!resetState)
{
return;
}

await TryResetLoadedAvatarState(avatarAddress);
}

public static async void RemoveAttachmentResult(
Address avatarAddress,
Guid mailId,
bool resetState = true)
{
var resultModifier = new AvatarAttachmentMailResultSetter(mailId);
LocalLayer.Instance.Remove(avatarAddress, resultModifier);

if (!resetState)
{
return;
}

await TryResetLoadedAvatarState(avatarAddress);
}
#endregion

#region Avatar / Quest
Expand Down
5 changes: 3 additions & 2 deletions nekoyume/Assets/_Scripts/UI/Widget/Popup/CelebratesPopup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,11 @@ private static void UpdateLocalState(int questId, IEnumerable<Tuple<int, int>> r
LocalLayerModifier.AddItem(
avatarAddress,
materialRow.Value.ItemId,
reward.Item2);
reward.Item2,
false);
}

LocalLayerModifier.RemoveReceivableQuest(avatarAddress, questId, true);
LocalLayerModifier.RemoveReceivableQuest(avatarAddress, questId, false);
}

private void PlayEffects()
Expand Down
Loading