Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: moving highlight.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jun 20, 2023
1 parent c0e8a48 commit 0571ae9
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 12 deletions.
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class PluginConfiguration : IPluginConfiguration
public bool CanAttackMarkAOE = true;
public bool FilterStopMark = true;
public bool TeachingMode = true;
public Vector3 TeachingModeColor = new(0f, 1f, 0.8f);
public Vector4 TeachingModeColor = new(0f, 1f, 0.8f, 1f);
public Vector4 MovingTargetColor = new(0f, 1f, 0.8f, 0.6f);
public Vector4 TargetColor = new(1f, 0.2f, 0f, 0.8f);
public Vector4 SubTargetColor = new(1f, 0.9f, 0f, 0.8f);
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver/TextureItems/TerritoryTypeTexture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public TerritoryTypeTexture(uint id)
{
}

public TerritoryTypeTexture(TerritoryType status)
public TerritoryTypeTexture(TerritoryType territory)
{
_territory = status;
_territory = territory;
}
}
22 changes: 17 additions & 5 deletions RotationSolver/UI/PainterManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using RotationSolver.Updaters;
using XIVPainter;
using XIVPainter.Element3D;
using XIVPainter.ElementSpecial;

namespace RotationSolver.UI;

Expand Down Expand Up @@ -190,14 +191,28 @@ public override void UpdateOnFrame(XIVPainter.XIVPainter painter)
}

internal static XIVPainter.XIVPainter _painter;
static PositionalDrawing _positional;
static PositionalDrawing _positional = new ();
static DrawingHightlightHotbar _highLight = new ();

public static uint ActionId
{
get => _highLight.ActionId;
set => _highLight.ActionId = value;
}

public static Vector4 HighlightColor
{
get => _highLight.Color;
set => _highLight.Color = value;
}

public static void Init()
{
_painter = Svc.PluginInterface.Create<XIVPainter.XIVPainter>("RotationSolverOverlay");

_painter.DrawingHeight = Service.Config.DrawingHeight;
_painter.SampleLength = Service.Config.SampleLength;
HighlightColor = Service.Config.TeachingModeColor;

var annulus = new Drawing3DAnnulusO(Player.Object, 3, 3 + Service.Config.MeleeRangeOffset, 0, 2);
annulus.InsideColor = ImGui.ColorConvertFloat4ToU32(new Vector4(0.8f, 0.3f, 0.2f, 0.15f));
Expand All @@ -215,8 +230,6 @@ public static void Init()
}
};

_positional = new PositionalDrawing();

var color = ImGui.GetColorU32(Service.Config.MovingTargetColor);
var movingTarget = new Drawing3DHighlightLine(default, default, 0, color, 3);
movingTarget.UpdateEveryFrame = () =>
Expand All @@ -237,10 +250,9 @@ public static void Init()
movingTarget.To = tar.Value;
};

_painter.AddDrawings(_positional, annulus, movingTarget, new TargetDrawing(), new TargetText());
_painter.AddDrawings(_positional, _highLight, annulus, movingTarget, new TargetDrawing(), new TargetText());

#if DEBUG

try
{
var deadTime = DateTime.Now.AddSeconds(10);
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/UI/RotationConfigWindow_Control.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ private static void DrawControlTab()
ImGui.PopStyleVar();
}

private static void DrawColor4(string name, ref Vector4 value, Vector4 @default, string description = "")
private static void DrawColor4(string name, ref Vector4 value, Vector4 @default, Action otherthing = null, string description = "")
{
ImGui.SetNextItemWidth(210);
if (ImGui.ColorEdit4(name, ref value))
{
otherthing?.Invoke();
Service.Config.Save();
}
if (ImGuiHelper.HoveredStringReset(description) && value != @default)
Expand Down
7 changes: 5 additions & 2 deletions RotationSolver/UI/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,11 @@ private void DrawParamDisplay()
{
ImGuiHelper.Spacing();

DrawColor3(LocalizationManager.RightLang.ConfigWindow_Param_TeachingModeColor,
ref Service.Config.TeachingModeColor, Service.Default.TeachingModeColor);
DrawColor4(LocalizationManager.RightLang.ConfigWindow_Param_TeachingModeColor,
ref Service.Config.TeachingModeColor, Service.Default.TeachingModeColor, otherthing: () =>
{
PainterManager.HighlightColor = Service.Config.TeachingModeColor;
});
}

ImGui.Separator();
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/Updaters/MajorUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using ECommons.DalamudServices;
using ECommons.GameHelpers;
using RotationSolver.Commands;
using RotationSolver.UI;

namespace RotationSolver.Updaters;

Expand Down Expand Up @@ -67,6 +68,7 @@ private static void FrameworkUpdate(Framework framework)
{
SocialUpdater.UpdateSocial();
PreviewUpdater.UpdatePreview();
PainterManager.ActionId = Service.Config.TeachingMode ? ActionUpdater.NextAction?.AdjustedID ?? 0 : 0;
ActionUpdater.UpdateActionInfo();

if (!ShouldPreventActions)
Expand Down
2 changes: 1 addition & 1 deletion XIVPainter

0 comments on commit 0571ae9

Please sign in to comment.