mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 21:07:21 +01:00
connect to api only after login, add switching secret keys and inputting secret key during intro, fix filereplacements not working properly, adjust to the new web api
This commit is contained in:
parent
2ff224243a
commit
95f7e5f867
11 changed files with 206 additions and 93 deletions
|
|
@ -13,12 +13,17 @@ namespace MareSynchronos.Utils
|
|||
{
|
||||
public delegate void PlayerChange(Character actor);
|
||||
|
||||
public delegate void LogIn();
|
||||
public delegate void LogOut();
|
||||
|
||||
public class DalamudUtil : IDisposable
|
||||
{
|
||||
private readonly ClientState _clientState;
|
||||
private readonly ObjectTable _objectTable;
|
||||
private readonly IPlayerWatcher _watcher;
|
||||
public event PlayerChange? PlayerChanged;
|
||||
public event LogIn? LogIn;
|
||||
public event LogOut? LogOut;
|
||||
|
||||
public DalamudUtil(ClientState clientState, ObjectTable objectTable, IPlayerWatcher watcher)
|
||||
{
|
||||
|
|
@ -27,8 +32,26 @@ namespace MareSynchronos.Utils
|
|||
_watcher = watcher;
|
||||
_watcher.Enable();
|
||||
_watcher.PlayerChanged += WatcherOnPlayerChanged;
|
||||
_clientState.Login += ClientStateOnLogin;
|
||||
_clientState.Logout += ClientStateOnLogout;
|
||||
if (IsLoggedIn)
|
||||
{
|
||||
ClientStateOnLogin(null, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
private void ClientStateOnLogout(object? sender, EventArgs e)
|
||||
{
|
||||
LogOut?.Invoke();
|
||||
}
|
||||
|
||||
private void ClientStateOnLogin(object? sender, EventArgs e)
|
||||
{
|
||||
LogIn?.Invoke();
|
||||
}
|
||||
|
||||
public bool IsLoggedIn => _clientState.IsLoggedIn;
|
||||
|
||||
private void WatcherOnPlayerChanged(Character actor)
|
||||
{
|
||||
PlayerChanged?.Invoke(actor);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue