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

Commit

Permalink
fix: state icon.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 23, 2023
1 parent 7ef8cc1 commit 1a921a2
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 45 deletions.
1 change: 1 addition & 0 deletions Resources/downloadList.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
"ArchiDog1998|FFXIVRotations|DefaultRotations",
"ArchiDog1998|FFXIVRotations|SupportersRotations",
"IncognitoWater|IncognitoWaterRotations|IcWaRotations",
"thunderebolt|BoltsRotations|BoltsRotations",
"BrakusTapus|KirboRotations|KirboRotations"
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public enum PluginConfigBool : byte
[Default(true)] ChooseAttackMark,
[Default(false)] CanAttackMarkAOE,
[Default(true)] FilterStopMark,
[Default(true)] ShowHostiles,
[Default(true)] ShowHostilesIcons,

[Default(true)] TeachingMode,
[Default(true)] UseOverlayWindow,
Expand Down Expand Up @@ -321,6 +321,7 @@ public enum PluginConfigBool : byte
[Default(false)] AutoOpenChest,
[Default(true)] AutoCloseChestWindow,

[Default(true)] ShowStateIcon,
[Default(true)] ShowBeneficialPositions,
[Default(false)] HideWarning,
}
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/Localization/ConfigTranslation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ internal static class ConfigTranslation
PluginConfigBool.ShowControlWindow => LocalizationManager.RightLang.ConfigWindow_Control_ShowControlWindow,
PluginConfigBool.IsControlWindowLock => LocalizationManager.RightLang.ConfigWindow_Control_IsInfoWindowNoMove,
PluginConfigBool.ShowBeneficialPositions => LocalizationManager.RightLang.ConfigWindow_UI_ShowBeneficialPosition,
PluginConfigBool.ShowHostiles => LocalizationManager.RightLang.ConfigWindow_UI_ShowHostiles,
PluginConfigBool.ShowHostilesIcons => LocalizationManager.RightLang.ConfigWindow_UI_ShowHostiles,

// auto
PluginConfigBool.UseAOEAction => LocalizationManager.RightLang.ConfigWindow_Param_UseAOEAction,
Expand Down Expand Up @@ -121,6 +121,7 @@ internal static class ConfigTranslation
PluginConfigBool.TargetHuntingRelicLevePriority => LocalizationManager.RightLang.ConfigWindow_Param_TargetHuntingRelicLevePriority,
PluginConfigBool.TargetQuestPriority => LocalizationManager.RightLang.ConfigWindow_Param_TargetQuestPriority,
PluginConfigBool.ShowTargetDeadTime => LocalizationManager.RightLang.ConfigWindow_Param_ShowTargetDeadTime,
PluginConfigBool.ShowStateIcon => LocalizationManager.RightLang.ConfigWindow_UI_ShowStateIcon,


// extra
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -710,4 +710,5 @@ internal partial class Strings

public string ConfigWindow_UI_StateIconHeight { get; set; } = "State Icon height from position";
public string ConfigWindow_UI_StateIconSize { get; set; } = "State Icon size";
public string ConfigWindow_UI_ShowStateIcon { get; set; } = "Show State Icon";
}
65 changes: 25 additions & 40 deletions RotationSolver/UI/PainterManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public override void UpdateOnFrame(XIVPainter.XIVPainter painter)
{
SubItems = Array.Empty<IDrawing3D>();

if (!Service.Config.GetValue(PluginConfigBool.ShowHostiles)) return;
if (!Service.Config.GetValue(PluginConfigBool.ShowHostilesIcons)) return;

List<IDrawing3D> subItems = new List<IDrawing3D>();

Expand Down Expand Up @@ -200,7 +200,6 @@ public override void UpdateOnFrame(XIVPainter.XIVPainter painter)
}

static XIVPainter.XIVPainter _painter;
static XIVPainter.XIVPainter _forcePainter;
static DrawingHighlightHotbar _highLight = new();
static Drawing3DImage _stateImage;
public static HashSet<uint> ActionIds => _highLight.ActionIds;
Expand All @@ -212,43 +211,6 @@ public static Vector4 HighlightColor
}

public static void Init()
{
InitPainter();
InitForcePainter();
}

private static void InitForcePainter()
{
_forcePainter = XIVPainter.XIVPainter.Create(Svc.PluginInterface, "RotationSolverForceOverlay");
_forcePainter.DrawingHeight = 0;

_stateImage = new Drawing3DImage(null, default, 0)
{
MustInViewRange = true,
UpdateEveryFrame = () =>
{
if (!Player.Available) return;
_stateImage.Position = Player.Object.Position + new Vector3(0,
Service.Config.GetValue(PluginConfigFloat.StateIconHeight), 0);
if (DataCenter.State)
{
if(IconSet.GetTexture(61516, out var texture))
{
_stateImage.SetTexture(texture, Service.Config.GetValue(PluginConfigFloat.StateIconSize));
}
}
else
{
_stateImage.SetTexture(null, 0);
}
},
};

_forcePainter.AddDrawings(_stateImage);
}

private static void InitPainter()
{
_painter = XIVPainter.XIVPainter.Create(Svc.PluginInterface, "RotationSolverOverlay");

Expand Down Expand Up @@ -293,7 +255,30 @@ private static void InitPainter()
movingTarget.To = tar.Value;
};

_painter.AddDrawings(_highLight, annulus, movingTarget, new TargetDrawing(), new TargetsDrawing(), new TargetText(), new BeneficialPositionDrawing());
_stateImage = new Drawing3DImage(null, default, 0)
{
MustInViewRange = true,
UpdateEveryFrame = () =>
{
if (!Player.Available) return;
_stateImage.Position = Player.Object.Position + new Vector3(0,
Service.Config.GetValue(PluginConfigFloat.StateIconHeight), 0);
if (DataCenter.State && Service.Config.GetValue(PluginConfigBool.ShowStateIcon))
{
if (IconSet.GetTexture(61516, out var texture))
{
_stateImage.SetTexture(texture, Service.Config.GetValue(PluginConfigFloat.StateIconSize));
}
}
else
{
_stateImage.SetTexture(null, 0);
}
},
};

_painter.AddDrawings(_highLight, _stateImage, annulus, movingTarget, new TargetDrawing(), new TargetsDrawing(), new TargetText(), new BeneficialPositionDrawing());
}

public static void UpdateSettings()
Expand Down
9 changes: 6 additions & 3 deletions RotationSolver/UI/RotationConfigWindow_Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,20 +384,23 @@ private static void DrawUI()
new ColorEditSearchPlugin(PluginConfigVector4.MovingTargetColor)
),

new CheckBoxSearchPlugin(PluginConfigBool.ShowHostiles,
new CheckBoxSearchPlugin(PluginConfigBool.ShowHostilesIcons,
new DragFloatSearchPlugin(PluginConfigFloat.HostileIconHeight, 0.002f),
new DragFloatSearchPlugin(PluginConfigFloat.HostileIconSize, 0.002f)
),

new CheckBoxSearchPlugin(PluginConfigBool.ShowStateIcon,
new DragFloatSearchPlugin(PluginConfigFloat.StateIconHeight, 0.002f),
new DragFloatSearchPlugin(PluginConfigFloat.StateIconSize, 0.002f)),

new CheckBoxSearchPlugin(PluginConfigBool.ShowBeneficialPositions,
new ColorEditSearchPlugin(PluginConfigVector4.BeneficialPositionColor),
new ColorEditSearchPlugin(PluginConfigVector4.HoveredBeneficialPositionColor)
),

new CheckBoxSearchPlugin(PluginConfigBool.DrawMeleeOffset)),

new DragFloatSearchPlugin(PluginConfigFloat.StateIconHeight, 0.002f),
new DragFloatSearchPlugin(PluginConfigFloat.StateIconSize, 0.002f),

};

// Windows
Expand Down

0 comments on commit 1a921a2

Please sign in to comment.