Skip to content

Commit

Permalink
Don't show craft icon if there is nothing to craft in the shop
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Apr 5, 2022
1 parent d434e89 commit 5f4eda4
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions EndlessClient/Dialogs/ShopDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ private void SetState(ShopState state)

return;
}

if (state == ShopState.Selling && _sellItems.Count == 0)
else if (state == ShopState.Selling && _sellItems.Count == 0)
{
var msg = _messageBoxFactory.CreateMessageBox(DialogResourceID.SHOP_NOT_BUYING_YOUR_ITEMS);
msg.ShowDialog();
Expand Down Expand Up @@ -167,21 +166,25 @@ private void SetState(ShopState state)
sellItem.LeftClick += (_, _) => SetState(ShopState.Selling);
sellItem.Initialize();

var craftItem = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large)
{
PrimaryText = _localizedStringFinder.GetString(EOResourceID.DIALOG_SHOP_CRAFT_ITEMS),
SubText = $"{_craftItems.Count} {_localizedStringFinder.GetString(EOResourceID.DIALOG_SHOP_ITEMS_ACCEPTED)}",
IconGraphic = _dialogIconService.IconSheet,
IconGraphicSource = _dialogIconService.GetDialogIconSource(DialogIcon.Craft),
ShowIconBackGround = false,
OffsetY = 45,
};
craftItem.LeftClick += (_, _) => SetState(ShopState.Crafting);
craftItem.Initialize();

AddItemToList(buyItem, sortList: false);
AddItemToList(sellItem, sortList: false);
AddItemToList(craftItem, sortList: false);

if (_craftItems.Count > 0)
{
var craftItem = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large)
{
PrimaryText = _localizedStringFinder.GetString(EOResourceID.DIALOG_SHOP_CRAFT_ITEMS),
SubText = $"{_craftItems.Count} {_localizedStringFinder.GetString(EOResourceID.DIALOG_SHOP_ITEMS_ACCEPTED)}",
IconGraphic = _dialogIconService.IconSheet,
IconGraphicSource = _dialogIconService.GetDialogIconSource(DialogIcon.Craft),
ShowIconBackGround = false,
OffsetY = 45,
};
craftItem.LeftClick += (_, _) => SetState(ShopState.Crafting);
craftItem.Initialize();

AddItemToList(craftItem, sortList: false);
}

Buttons = ScrollingListDialogButtons.Cancel;
}
Expand Down

0 comments on commit 5f4eda4

Please sign in to comment.