From 749ebb38df09abc502779647ad709013f4148421 Mon Sep 17 00:00:00 2001 From: CWX Date: Sat, 18 Jan 2025 12:54:17 +0000 Subject: [PATCH] use prim ctor and fixed warnings: DialogueCallbacks and a bit of dialogueController --- Core/Callbacks/DialogueCallbacks.cs | 33 ++++++++------------------ Core/Controllers/DialogueController.cs | 8 +++---- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/Core/Callbacks/DialogueCallbacks.cs b/Core/Callbacks/DialogueCallbacks.cs index c8f66334..626ec8e1 100644 --- a/Core/Callbacks/DialogueCallbacks.cs +++ b/Core/Callbacks/DialogueCallbacks.cs @@ -10,27 +10,14 @@ namespace Core.Callbacks; [Injectable(InjectableTypeOverride = typeof(OnUpdate), TypePriority = OnUpdateOrder.DialogueCallbacks)] [Injectable(InjectableTypeOverride = typeof(DialogueCallbacks))] -public class DialogueCallbacks : OnUpdate +public class DialogueCallbacks( + HashUtil _hashUtil, + TimeUtil _timeUtil, + HttpResponseUtil _httpResponseUtil, + DialogueController _dialogueController +) + : OnUpdate { - protected HashUtil _hashUtil; - protected TimeUtil _timeUtil; - protected HttpResponseUtil _httpResponseUtil; - protected DialogueController _dialogueController; - - public DialogueCallbacks - ( - HashUtil hashUtil, - TimeUtil timeUtil, - HttpResponseUtil httpResponseUtil, - DialogueController dialogueController - ) - { - _hashUtil = hashUtil; - _timeUtil = timeUtil; - _httpResponseUtil = httpResponseUtil; - _dialogueController = dialogueController; - } - /// /// Handle client/friend/list /// @@ -60,7 +47,7 @@ public class DialogueCallbacks : OnUpdate RegistrationId = 20, DateTime = _timeUtil.GetTimeStamp(), IsDeveloper = true, - Regions = new() { "EUR" }, + Regions = ["EUR"], VersionId = "bgkidft87ddd", Ip = "", Port = 0, @@ -335,10 +322,10 @@ public class DialogueCallbacks : OnUpdate throw new NotImplementedException(); // Not implemented in Node } - public async Task OnUpdate(long timeSinceLastRun) + public Task OnUpdate(long timeSinceLastRun) { _dialogueController.Update(); - return true; + return Task.FromResult(true); } public string GetRoute() diff --git a/Core/Controllers/DialogueController.cs b/Core/Controllers/DialogueController.cs index bc239b4a..fb43c002 100644 --- a/Core/Controllers/DialogueController.cs +++ b/Core/Controllers/DialogueController.cs @@ -150,7 +150,7 @@ public class DialogueController /// Session Id /// DialogueInfo public DialogueInfo GetDialogueInfo( - string dialogueId, + string? dialogueId, string sessionId) { var dialogs = _dialogueHelper.GetDialogsForProfile(sessionId); @@ -280,7 +280,7 @@ public class DialogueController /// id of the dialog to remove /// Player id public void RemoveDialogue( - string dialogueId, + string? dialogueId, string sessionId) { throw new NotImplementedException(); @@ -293,7 +293,7 @@ public class DialogueController /// /// public void SetDialoguePin( - string dialogueId, + string? dialogueId, bool shouldPin, string sessionId) { @@ -307,7 +307,7 @@ public class DialogueController /// Dialog ids to set as read /// Player profile id public void SetRead( - List dialogueIds, + List? dialogueIds, string sessionId) { throw new NotImplementedException();