Skip to content

Commit

Permalink
Change ScrollingListDialogSize -> DialogType with enum values represe…
Browse files Browse the repository at this point in the history
…nting which dialog it actually is
  • Loading branch information
ethanmoffat committed May 18, 2023
1 parent b7f911f commit 13a9322
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 79 deletions.
2 changes: 1 addition & 1 deletion EndlessClient/Dialogs/Actions/InGameDialogActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public void ShowMessageDialog(string title, IReadOnlyList<string> messages)
{
_activeDialogRepository.MessageDialog.MatchNone(() =>
{
var dlg = _scrollingListDialogFactory.Create(ScrollingListDialogSize.Large);
var dlg = _scrollingListDialogFactory.Create(DialogType.Message);
dlg.DialogClosed += (_, _) => _activeDialogRepository.MessageDialog = Option.None<ScrollingListDialog>();
dlg.ListItemType = ListDialogItem.ListItemStyle.Small;
Expand Down
2 changes: 1 addition & 1 deletion EndlessClient/Dialogs/BankAccountDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class BankAccountDialog : ScrollingListDialog
IBankDataProvider bankDataProvider,
ICharacterInventoryProvider characterInventoryProvider,
IEIFFileProvider eifFileProvider)
: base(nativeGraphicsManager, dialogButtonService, dialogSize: ScrollingListDialogSize.SmallNoScroll)
: base(nativeGraphicsManager, dialogButtonService, dialogType: DialogType.BankAccountDialog)
{
_bankActions = bankActions;
_localizedStringFinder = localizedStringFinder;
Expand Down
16 changes: 8 additions & 8 deletions EndlessClient/Dialogs/BoardDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private enum BoardDialogState
ICharacterProvider characterProvider,
IContentProvider contentProvider,
IHudControlProvider hudControlProvider)
: base(nativeGraphicsManager, dialogButtonService, ScrollingListDialogSize.Medium)
: base(nativeGraphicsManager, dialogButtonService, DialogType.Board)
{
_localizedStringFinder = localizedStringFinder;
_eoMessageBoxFactory = eoMessageBoxFactory;
Expand Down Expand Up @@ -164,12 +164,12 @@ private void SetState(BoardDialogState state, int postId = -1)
_state = state;

_titleText.DrawArea = _state == BoardDialogState.ViewList
? GetTitleDrawArea(DialogSize)
: GetTitleDrawArea(DialogSize).WithPosition(new Vector2(150, _titleText.DrawArea.Y));
? GetTitleDrawArea(DialogType)
: GetTitleDrawArea(DialogType).WithPosition(new Vector2(150, _titleText.DrawArea.Y));

BackgroundTextureSource = _state == BoardDialogState.ViewList
? GetBackgroundSourceRectangle(BackgroundTexture, DialogSize)
: GetBackgroundSourceRectangle(BackgroundTexture, DialogSize).Value.WithPosition(new Vector2(0, BackgroundTexture.Height / 2));
? GetBackgroundSourceRectangle(BackgroundTexture, DialogType)
: GetBackgroundSourceRectangle(BackgroundTexture, DialogType).Value.WithPosition(new Vector2(0, BackgroundTexture.Height / 2));

_scrollBar.LinesToRender = _state == BoardDialogState.ViewList
? 12
Expand All @@ -187,7 +187,7 @@ private void SetState(BoardDialogState state, int postId = -1)

_scrollBar.DrawArea = new Rectangle(
_scrollBar.DrawArea.X, 44,
_scrollBar.DrawArea.Width, GetScrollBarHeight(DialogSize));
_scrollBar.DrawArea.Width, GetScrollBarHeight(DialogType));

break;

Expand All @@ -206,7 +206,7 @@ private void SetState(BoardDialogState state, int postId = -1)

_scrollBar.DrawArea = new Rectangle(
_scrollBar.DrawArea.X, 74,
_scrollBar.DrawArea.Width, GetScrollBarHeight(DialogSize) - 30);
_scrollBar.DrawArea.Width, GetScrollBarHeight(DialogType) - 30);

ClearItemList();
_cachedPostInfo.Clear();
Expand Down Expand Up @@ -235,7 +235,7 @@ private void SetState(BoardDialogState state, int postId = -1)

_scrollBar.DrawArea = new Rectangle(
_scrollBar.DrawArea.X, 74,
_scrollBar.DrawArea.Width, GetScrollBarHeight(DialogSize) - 30);
_scrollBar.DrawArea.Width, GetScrollBarHeight(DialogType) - 30);

ClearItemList();
_cachedPostInfo.Clear();
Expand Down
2 changes: 1 addition & 1 deletion EndlessClient/Dialogs/ChestDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class ChestDialog : ScrollingListDialog
IChestDataProvider chestDataProvider,
IEIFFileProvider eifFileProvider,
ICharacterProvider characterProvider)
: base(nativeGraphicsManager, dialogButtonService, dialogSize: ScrollingListDialogSize.LargeNoScroll)
: base(nativeGraphicsManager, dialogButtonService, dialogType: DialogType.Chest)
{
_chestActions = chestActions;
_messageBoxFactory = messageBoxFactory;
Expand Down
4 changes: 2 additions & 2 deletions EndlessClient/Dialogs/Factories/ScrollingListDialogFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ public class ScrollingListDialogFactory : IScrollingListDialogFactory
_dialogButtonService = dialogButtonService;
}

public ScrollingListDialog Create(ScrollingListDialogSize size)
public ScrollingListDialog Create(DialogType size)
{
return new ScrollingListDialog(_nativeGraphicsManager, _dialogButtonService, size);
}
}

public interface IScrollingListDialogFactory
{
ScrollingListDialog Create(ScrollingListDialogSize size);
ScrollingListDialog Create(DialogType size);
}
}
2 changes: 1 addition & 1 deletion EndlessClient/Dialogs/FriendIgnoreListDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class FriendIgnoreListDialog : ScrollingListDialog
public FriendIgnoreListDialog(INativeGraphicsManager nativeGraphicsManager,
IEODialogButtonService dialogButtonService,
IOnlinePlayerProvider onlinePlayerProvider)
: base(nativeGraphicsManager, dialogButtonService, ScrollingListDialogSize.Large)
: base(nativeGraphicsManager, dialogButtonService, DialogType.FriendIgnore)
{
_onlinePlayerProvider = onlinePlayerProvider;
_cachedOnlinePlayers = new HashSet<OnlinePlayerInfo>();
Expand Down
2 changes: 1 addition & 1 deletion EndlessClient/Dialogs/LockerDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class LockerDialog : ScrollingListDialog
ILockerDataProvider lockerDataProvider,
IHudControlProvider hudControlProvider,
IEIFFileProvider eifFileProvider)
: base(nativeGraphicsManager, dialogButtonService, dialogSize: ScrollingListDialogSize.Large)
: base(nativeGraphicsManager, dialogButtonService, dialogType: DialogType.Locker)
{
_lockerActions = lockerActions;
_localizedStringFinder = localizedStringFinder;
Expand Down
2 changes: 1 addition & 1 deletion EndlessClient/Dialogs/QuestDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class QuestDialog : ScrollingListDialog
IQuestDataProvider questDataProvider,
IENFFileProvider enfFileProvider,
IContentProvider contentProvider)
: base(nativeGraphicsManager, dialogButtonService, dialogSize: ScrollingListDialogSize.Small)
: base(nativeGraphicsManager, dialogButtonService, dialogType: DialogType.NpcQuestDialog)
{
_questActions = questActions;
_questDataProvider = questDataProvider;
Expand Down
2 changes: 1 addition & 1 deletion EndlessClient/Dialogs/QuestStatusDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class QuestStatusDialog : ScrollingListDialog
ILocalizedStringFinder localizedStringFinder,
IQuestDataProvider questDataProvider,
ICharacterProvider characterProvider)
: base(nativeGraphicsManager, dialogButtonService, ScrollingListDialogSize.Medium)
: base(nativeGraphicsManager, dialogButtonService, DialogType.QuestProgressHistory)
{
ListItemType = ListDialogItem.ListItemStyle.Small;
Buttons = ScrollingListDialogButtons.HistoryOk;
Expand Down

0 comments on commit 13a9322

Please sign in to comment.