Merge pull request #282 from kalilistic/logged-in

add isloggedin property
This commit is contained in:
goaaats 2021-04-03 18:57:21 +02:00 committed by GitHub
commit 9cf3fd42ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -10,3 +10,9 @@ insert_final_newline = true
# 4 space indentation # 4 space indentation
indent_style = space indent_style = space
indent_size = 4 indent_size = 4
# disable redundant style warnings
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent

View file

@ -175,16 +175,23 @@ namespace Dalamud.Game.ClientState
/// </summary> /// </summary>
public event EventHandler OnLogout; public event EventHandler OnLogout;
/// <summary>
/// Gets a value indicating whether a character is logged in.
/// </summary>
public bool IsLoggedIn { get; private set; }
private void FrameworkOnOnUpdateEvent(Framework framework) { private void FrameworkOnOnUpdateEvent(Framework framework) {
if (this.Condition.Any() && this.lastConditionNone == true) { if (this.Condition.Any() && this.lastConditionNone == true) {
Log.Debug("Is login"); Log.Debug("Is login");
this.lastConditionNone = false; this.lastConditionNone = false;
this.IsLoggedIn = true;
OnLogin?.Invoke(this, null); OnLogin?.Invoke(this, null);
} }
if (!this.Condition.Any() && this.lastConditionNone == false) { if (!this.Condition.Any() && this.lastConditionNone == false) {
Log.Debug("Is logout"); Log.Debug("Is logout");
this.lastConditionNone = true; this.lastConditionNone = true;
this.IsLoggedIn = false;
OnLogout?.Invoke(this, null); OnLogout?.Invoke(this, null);
} }
} }