ok
This commit is contained in:
parent
ea4875c297
commit
d5ffdd41e7
|
@ -55,7 +55,7 @@ internal class Messages : IDisposable {
|
|||
this.SpawnVfx();
|
||||
}
|
||||
|
||||
private void SpawnVfx() {
|
||||
internal void SpawnVfx() {
|
||||
var territory = this.Plugin.ClientState.TerritoryType;
|
||||
if (territory == 0) {
|
||||
return;
|
||||
|
|
|
@ -24,6 +24,11 @@ internal class MessageList : ITab {
|
|||
|
||||
foreach (var message in this.Messages) {
|
||||
ImGui.TextUnformatted(message.Text);
|
||||
ImGui.TextUnformatted($"Likes: {message.PositiveVotes}");
|
||||
ImGui.TextUnformatted($"Dislikes: {message.NegativeVotes}");
|
||||
if (ImGui.Button($"Delete##{message.Id}")) {
|
||||
this.Delete(message.Id);
|
||||
}
|
||||
}
|
||||
|
||||
this.MessagesMutex.Release();
|
||||
|
@ -45,6 +50,21 @@ internal class MessageList : ITab {
|
|||
});
|
||||
}
|
||||
|
||||
private void Delete(Guid id) {
|
||||
Task.Run(async () => {
|
||||
var resp = await ServerHelper.SendRequest(
|
||||
this.Plugin.Config.ApiKey,
|
||||
HttpMethod.Delete,
|
||||
$"/messages/{id}"
|
||||
);
|
||||
|
||||
if (resp.IsSuccessStatusCode) {
|
||||
this.Refresh();
|
||||
this.Plugin.Messages.SpawnVfx();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
internal void Add(MessageWithTerritory message) {
|
||||
this.Messages.Clear();
|
||||
this.Messages.Add(message);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Utility.Signatures;
|
||||
|
||||
namespace OrangeGuidanceTomestone;
|
||||
|
@ -21,37 +20,22 @@ internal unsafe class Vfx : IDisposable {
|
|||
private delegate* unmanaged<VfxStruct*, void> _staticVfxRemove;
|
||||
|
||||
private List<IntPtr> Spawned { get; } = new();
|
||||
private Queue<IntPtr> NeedToRun { get; } = new();
|
||||
|
||||
internal Vfx(Plugin plugin) {
|
||||
this.Plugin = plugin;
|
||||
SignatureHelper.Initialise(this);
|
||||
|
||||
this.Plugin.Framework.Update += this.Run;
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
this.Plugin.Framework.Update -= this.Run;
|
||||
this.RemoveAll();
|
||||
}
|
||||
|
||||
private void Run(Framework framework) {
|
||||
if (!this.NeedToRun.TryDequeue(out var ptr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._staticVfxRun((VfxStruct*) ptr, 0.0f, 0xFFFFFFFF) != 0) {
|
||||
this.NeedToRun.Enqueue(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
internal void RemoveAll() {
|
||||
foreach (var spawned in this.Spawned) {
|
||||
this.RemoveStatic((VfxStruct*) spawned);
|
||||
}
|
||||
|
||||
this.Spawned.Clear();
|
||||
this.NeedToRun.Clear();
|
||||
}
|
||||
|
||||
internal VfxStruct* SpawnStatic(string path, Vector3 pos) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user