Skip to content

Commit

Permalink
Delete item layer in render & mail read
Browse files Browse the repository at this point in the history
  • Loading branch information
ipdae committed Jun 24, 2024
1 parent 7d8ac43 commit 19c4ed9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 212 deletions.
29 changes: 0 additions & 29 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
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
Loading

0 comments on commit 19c4ed9

Please sign in to comment.