-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d02996
commit b0bc1f9
Showing
8 changed files
with
230 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using EOLib.Net; | ||
using EOLib.Net.Communication; | ||
|
||
namespace EOLib.Domain.Report | ||
{ | ||
public class ReportActions : IReportActions | ||
{ | ||
private readonly IPacketSendService _packetSendService; | ||
|
||
public ReportActions(IPacketSendService packetSendService) | ||
{ | ||
_packetSendService = packetSendService; | ||
} | ||
|
||
public void ReportPlayer(string player, string message) | ||
{ | ||
var packet = new PacketBuilder(PacketFamily.AdminInteract, PacketAction.Report) | ||
.AddString(player) | ||
.AddByte(255) | ||
.AddString(message) | ||
.Build(); | ||
_packetSendService.SendPacket(packet); | ||
} | ||
|
||
public void SpeakToAdmin(string message) | ||
{ | ||
var packet = new PacketBuilder(PacketFamily.AdminInteract, PacketAction.Tell) | ||
.AddString(message) | ||
.Build(); | ||
_packetSendService.SendPacket(packet); | ||
} | ||
} | ||
|
||
public interface IReportActions | ||
{ | ||
void ReportPlayer(string player, string message); | ||
|
||
void SpeakToAdmin(string message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using AutomaticTypeMapper; | ||
using EndlessClient.Dialogs.Factories; | ||
using EOLib.Domain.Report; | ||
using XNAControls; | ||
|
||
namespace EndlessClient.Dialogs.Actions | ||
{ | ||
[AutoMappedType] | ||
public class HelpActions : IHelpActions | ||
{ | ||
private readonly IReportActions _reportActions; | ||
private readonly ITextInputDialogFactory _textInputDialogFactory; | ||
|
||
public HelpActions(IReportActions reportActions, | ||
ITextInputDialogFactory textInputDialogFactory) | ||
{ | ||
_reportActions = reportActions; | ||
_textInputDialogFactory = textInputDialogFactory; | ||
} | ||
|
||
public void ResetPassword() | ||
{ | ||
// todo | ||
} | ||
|
||
public void ReportSomeone() | ||
{ | ||
// gfx002 / 157 | ||
} | ||
|
||
public void SpeakToAdmin() | ||
{ | ||
const string Prompt = "Please enter your question, and we will try to get back to you."; | ||
|
||
var dlg = _textInputDialogFactory.Create(Prompt, maxInputChars: 48); | ||
dlg.DialogClosing += (_, e) => | ||
{ | ||
if (e.Result == XNADialogResult.OK) | ||
{ | ||
_reportActions.SpeakToAdmin(dlg.ResponseText); | ||
} | ||
}; | ||
dlg.ShowDialog(); | ||
} | ||
} | ||
|
||
public interface IHelpActions | ||
{ | ||
void ResetPassword(); | ||
|
||
void ReportSomeone(); | ||
|
||
void SpeakToAdmin(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using AutomaticTypeMapper; | ||
using EndlessClient.Content; | ||
using EndlessClient.Dialogs.Actions; | ||
using EndlessClient.Dialogs.Services; | ||
using EOLib; | ||
using EOLib.Graphics; | ||
using EOLib.Localization; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace EndlessClient.Dialogs.Factories | ||
{ | ||
[AutoMappedType(IsSingleton = true)] | ||
public class HelpDialogFactory : IHelpDialogFactory | ||
{ | ||
private readonly INativeGraphicsManager _nativeGraphicsManager; | ||
private readonly IEODialogButtonService _dialogButtonService; | ||
private readonly IContentProvider _contentProvider; | ||
private readonly ILocalizedStringFinder _localizedStringFinder; | ||
private readonly IHelpActions _helpActions; | ||
|
||
public HelpDialogFactory(INativeGraphicsManager nativeGraphicsManager, | ||
IEODialogButtonService dialogButtonService, | ||
IContentProvider contentProvider, | ||
ILocalizedStringFinder localizedStringFinder, | ||
IHelpActions helpActions) | ||
{ | ||
_nativeGraphicsManager = nativeGraphicsManager; | ||
_dialogButtonService = dialogButtonService; | ||
_contentProvider = contentProvider; | ||
_localizedStringFinder = localizedStringFinder; | ||
_helpActions = helpActions; | ||
} | ||
|
||
public ScrollingListDialog Create() | ||
{ | ||
var dlg = new ScrollingListDialog(_nativeGraphicsManager, _dialogButtonService, DialogType.Help) | ||
{ | ||
Buttons = ScrollingListDialogButtons.Cancel, | ||
ListItemType = ListDialogItem.ListItemStyle.Small, | ||
}; | ||
|
||
dlg.AddTextAsListItems(_contentProvider.Fonts[Constants.FontSize08pt5], GetActions(), GetMessages()); | ||
|
||
return dlg; | ||
} | ||
|
||
private string[] GetMessages() | ||
{ | ||
return new[] | ||
{ | ||
_localizedStringFinder.GetString(EOResourceID.ENDLESS_HELP_SUMMARY_1), | ||
string.Empty, | ||
_localizedStringFinder.GetString(EOResourceID.ENDLESS_HELP_SUMMARY_2), | ||
string.Empty, | ||
_localizedStringFinder.GetString(EOResourceID.ENDLESS_HELP_LINK_RESET_PASSWORD), | ||
_localizedStringFinder.GetString(EOResourceID.ENDLESS_HELP_LINK_REPORT_SOMEONE), | ||
_localizedStringFinder.GetString(EOResourceID.ENDLESS_HELP_LINK_SPEAK_TO_ADMIN), | ||
}; | ||
} | ||
|
||
private List<Action> GetActions() | ||
{ | ||
return new List<Action> | ||
{ | ||
_helpActions.ResetPassword, | ||
_helpActions.ReportSomeone, | ||
_helpActions.SpeakToAdmin, | ||
}; | ||
} | ||
} | ||
|
||
public interface IHelpDialogFactory | ||
{ | ||
ScrollingListDialog Create(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.