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

Commit

Permalink
fix: fixed some ui bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Mar 20, 2023
1 parent d538539 commit aa8883a
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 38 deletions.
14 changes: 12 additions & 2 deletions RotationSolver.Basic/Actions/BaseAction/BaseAction_ActionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,17 @@ public unsafe bool Use()
{
var loc = new FFXIVClientStructs.FFXIV.Common.Math.Vector3() { X = _position.X, Y = _position.Y, Z = _position.Z };

return _action.TargetArea ? ActionManager.Instance()->UseActionLocation(ActionType.Spell, ID, Service.Player.ObjectId, &loc) :
ActionManager.Instance()->UseAction(ActionType.Spell, AdjustedID, _targetId);
if (_action.TargetArea)
{
return ActionManager.Instance()->UseActionLocation(ActionType.Spell, ID, Service.Player.ObjectId, &loc);
}
else if(Service.ObjectTable.SearchById(_targetId) == null)
{
return false;
}
else
{
return ActionManager.Instance()->UseAction(ActionType.Spell, AdjustedID, _targetId);
}
}
}
9 changes: 2 additions & 7 deletions RotationSolver/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal static class RotationHelper
};

public static bool IsDefault(this ICustomRotation rotation)
=> DefaultAssembly == GetId(rotation);
=> DefaultAssembly == rotation.GetType().Assembly.GetName().Name;

public static bool IsAllowed(this ICustomRotation rotation, out string name)
{
Expand All @@ -26,12 +26,7 @@ public static bool IsAllowed(this ICustomRotation rotation, out string name)
return false;
}
name = rotation.GetType().Assembly.GetName().Name;
return _allowedAssembly.Contains(GetId(rotation));
}

internal static string GetId(this ICustomRotation rotation)
{
return Convert.ToBase64String(rotation.GetType().Assembly.GetName().GetPublicKeyToken());
return _allowedAssembly.Contains(name);
}

public static Vector4 GetColor(this ICustomRotation rotation)
Expand Down
6 changes: 3 additions & 3 deletions RotationSolver/UI/ControlWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ public override void Draw()

ImGui.Text(pair.Key);

bool started = false;
uint started = 0;
foreach(var item in showItems)
{
if (started)
if (started % 14 != 0)
{
ImGui.SameLine();
}
DrawActionCooldown(item);
started = true;
started ++;
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,7 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
ImGui.SameLine();
Spacing();

var display = ImGui.GetIO().DisplaySize;
var displayS = Math.Min(display.X, display.Y) * 0.8f;
var display = ImGui.GetIO().DisplaySize * 0.7f;

foreach (var texture in attrs)
{
Expand All @@ -491,7 +490,7 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
{
DrawTooltip(() =>
{
var ratio = Math.Min(1, displayS / Math.Max(texture.Texture.Width, texture.Texture.Height));
var ratio = Math.Min(1, Math.Min(display.X / texture.Texture.Width, display.Y / texture.Texture.Height));
var size = new Vector2(texture.Texture.Width * ratio,
texture.Texture.Height * ratio);
ImGui.Image(texture.Texture.ImGuiHandle, size);
Expand Down
20 changes: 9 additions & 11 deletions RotationSolver/UI/RotationConfigWindow_Control.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
using ImGuiNET;
using RotationSolver.Basic;
using RotationSolver.Localization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace RotationSolver.UI;

internal partial class RotationConfigWindow
{
private void DrawControlTab()
{
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_UseGamepadCommand,
ref Service.Config.UseGamepadCommand);


DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_UseKeyboardCommand,
ref Service.Config.UseKeyboardCommand);

ImGui.Separator();

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_ShowControlWindow,
ref Service.Config.ShowControlWindow);

Expand All @@ -22,12 +26,6 @@ private void DrawControlTab()
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_IsControlWindowLock,
ref Service.Config.IsControlWindowLock);

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_UseKeyboardCommand,
ref Service.Config.UseKeyboardCommand);

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_UseGamepadCommand,
ref Service.Config.UseGamepadCommand);

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_ControlShowCooldown,
ref Service.Config.ControlShowCooldown);

Expand Down
13 changes: 1 addition & 12 deletions RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@ private void DrawDebugTab()

if (ImGui.BeginTabBar("Debug Items"))
{

#if DEBUG
if(RotationUpdater.Plugins != null)
{
foreach (var p in RotationUpdater.Plugins)
{
var s = p;
ImGui.InputText($"##{p}", ref s, 512);
}
}
#endif
DrawParamTabItem("Status", DrawStatus);
DrawParamTabItem("Party", DrawParty);
DrawParamTabItem("Target Data", DrawTargetData);
Expand Down Expand Up @@ -106,7 +95,7 @@ private unsafe void DrawTargetData()

foreach (var status in b.StatusList)
{
var source = Service.ObjectTable.SearchById(status.SourceId)?.Name ?? "None";
var source = status.SourceId == Service.Player.ObjectId ? "You" : Service.ObjectTable.SearchById(status.SourceId) == null ? "None" : "Others";
ImGui.Text($"{status.GameData.Name}: {status.StatusId} From: {source}");
}
}
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/UI/RotationConfigWindow_RotationDev.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ private void DrawRotationDevTab()
var list = Service.Config.OtherLibs.ToList();
list.RemoveAt(removeIndex);
Service.Config.OtherLibs = list.ToArray();
Service.Config.Save();
}

ImGui.EndChild();
Expand Down

0 comments on commit aa8883a

Please sign in to comment.