This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
49a5938
commit 2ef07a3
Showing
8 changed files
with
165 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
using ImGuiNET; | ||
using RotationSolver.Basic.Actions; | ||
using RotationSolver.Basic; | ||
using RotationSolver.Updaters; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Collections; | ||
using System.Numerics; | ||
|
||
namespace RotationSolver.UI; | ||
|
||
internal class CooldownWindow : InfoWindow | ||
{ | ||
public CooldownWindow() | ||
:base(nameof(CooldownWindow)) | ||
{ | ||
|
||
} | ||
|
||
public override void Draw() | ||
{ | ||
if (RotationUpdater.RightNowRotation != null) | ||
{ | ||
ImGui.Separator(); | ||
foreach (var pair in RotationUpdater.AllGroupedActions) | ||
{ | ||
var showItems = pair.Where(i => !(i is IBaseAction a && a.IsGeneralGCD)).OrderBy(a => a.ID); | ||
|
||
if (!showItems.Any()) continue; | ||
|
||
ImGui.Text(pair.Key); | ||
|
||
uint started = 0; | ||
foreach (var item in showItems) | ||
{ | ||
if (started % 14 != 0) | ||
{ | ||
ImGui.SameLine(); | ||
} | ||
DrawActionCooldown(item); | ||
started++; | ||
} | ||
} | ||
} | ||
} | ||
|
||
static readonly uint black = ImGui.ColorConvertFloat4ToU32(new Vector4(0, 0, 0, 1)); | ||
static readonly uint white = ImGui.ColorConvertFloat4ToU32(new Vector4(1, 1, 1, 1)); | ||
static readonly uint progressCol = ImGui.ColorConvertFloat4ToU32(new Vector4(0.6f, 0.6f, 0.6f, 0.6f)); | ||
private static void DrawActionCooldown(IAction act) | ||
{ | ||
var width = Service.Config.ControlWindow0GCDSize; | ||
var recast = act.RecastTimeOneCharge; | ||
var elapsed = act.RecastTimeElapsed; | ||
|
||
ImGui.BeginGroup(); | ||
var pos = ImGui.GetCursorPos(); | ||
var winPos = ImGui.GetWindowPos(); | ||
|
||
ControlWindow.DrawIAction(act, width); | ||
ImGuiHelper.HoveredString(act.Name); | ||
|
||
if (!act.EnoughLevel) | ||
{ | ||
ImGui.GetWindowDrawList().AddRectFilled(new Vector2(pos.X, pos.Y) + winPos, | ||
new Vector2(pos.X + width, pos.Y + width) + winPos, progressCol); | ||
} | ||
else if (act.IsCoolingDown) | ||
{ | ||
var ratio = recast == 0 ? 0 : elapsed % recast / recast; | ||
ImGui.GetWindowDrawList().AddRectFilled(new Vector2(pos.X + width * ratio, pos.Y) + winPos, | ||
new Vector2(pos.X + width, pos.Y + width) + winPos, progressCol); | ||
|
||
string time = recast == 0 || !act.EnoughLevel ? "0" : ((int)(recast - elapsed % recast) + 1).ToString(); | ||
var strSize = ImGui.CalcTextSize(time); | ||
var fontPos = new Vector2(pos.X + width / 2 - strSize.X / 2, pos.Y + width / 2 - strSize.Y / 2) + winPos; | ||
|
||
TextShade(fontPos, time, 1.5f, white, black); | ||
} | ||
|
||
if (act.EnoughLevel && act is IBaseAction bAct && bAct.MaxCharges > 1) | ||
{ | ||
for (int i = 0; i < bAct.CurrentCharges; i++) | ||
{ | ||
ImGui.GetWindowDrawList().AddCircleFilled(winPos + pos + (i + 0.5f) * new Vector2(6, 0), 2.5f, white); | ||
} | ||
} | ||
|
||
ImGui.EndGroup(); | ||
} | ||
|
||
static void TextShade(Vector2 pos, string text, float width, uint fore, uint background) | ||
{ | ||
ImGui.GetWindowDrawList().AddText(pos - new Vector2(0, width), background, text); | ||
ImGui.GetWindowDrawList().AddText(pos - new Vector2(0, -width), background, text); | ||
ImGui.GetWindowDrawList().AddText(pos - new Vector2(width, 0), background, text); | ||
ImGui.GetWindowDrawList().AddText(pos - new Vector2(-width, 0), background, text); | ||
ImGui.GetWindowDrawList().AddText(pos, fore, text); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Dalamud.Interface.Windowing; | ||
using ImGuiNET; | ||
using RotationSolver.Basic; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace RotationSolver.UI; | ||
|
||
internal abstract class InfoWindow : Window | ||
{ | ||
const ImGuiWindowFlags BaseFlags = ControlWindow.BaseFlags | ||
| ImGuiWindowFlags.AlwaysAutoResize | ||
| ImGuiWindowFlags.NoResize; | ||
|
||
public InfoWindow(string name) | ||
: base(name, BaseFlags) | ||
{ | ||
|
||
} | ||
|
||
public override void PreDraw() | ||
{ | ||
ImGui.PushStyleColor(ImGuiCol.WindowBg, Service.Config.InfoWindowBg); | ||
|
||
Flags = BaseFlags; | ||
if (Service.Config.IsInfoWindowLock) | ||
{ | ||
Flags |= ImGuiWindowFlags.NoInputs; | ||
} | ||
|
||
//ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(0, 0)); | ||
ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0); | ||
} | ||
|
||
public override void PostDraw() | ||
{ | ||
ImGui.PopStyleColor(); | ||
ImGui.PopStyleVar(); | ||
base.PostDraw(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters