RynthSuite as of 2026-12-02 (internal 152e13d): release 2026.12.1.1

This commit is contained in:
Tom Bohar 2026-12-02 06:45:07 -05:00
commit 6b5a9c7e99
65 changed files with 3920 additions and 237 deletions

View file

@ -7,6 +7,10 @@
// Plugins/Shared/DerethClock.cs has the math; RynthCore hosts the frameless
// window (plugin API v90) and remembers where it is.
//
// A clear background by default (2026-12-01: no box, the sun or moon and the text shadowed, so it
// can sit on the radar or under the arrow without taking room); /rdef daynight box brings the
// dark box back (DefSettings.DayNightBox). While hovered a faint box shows where to grab it.
//
// anywhere drag to move; Ctrl+wheel: bigger or smaller (30-250%);
// right-click: hide it (/rdef daynight, the bar button, or
// Settings > Interface > In The Retail Toolbar's Place show it again).
@ -64,10 +68,12 @@ internal sealed class DayNightWindow
private const float Pad = 5, RowH = 16, Mark = 14, Gap = 4, Radius = 4;
private static readonly uint SunColor = Argb(0xFFF2C14E), MoonColor = Argb(0xFFB8C7F0);
private static readonly uint ShadowColor = Argb(0xD8000000); // under the text and icon on a clear background
private static uint A(uint c, float alpha) => WithAlpha(c, (uint)Math.Clamp(MathF.Round(alpha * 255f), 0f, 255f));
/// <summary>Draws the timer into the host's window; returns the height it needs (pixels). Render thread.</summary>
public float Draw(DayNightView v)
/// <summary>Draws the timer into the host's window; returns the height it needs (pixels).
/// <paramref name="box"/>: the dark box; false = a clear background, the text shadowed. Render thread.</summary>
public float Draw(DayNightView v, bool box = false)
{
Scale();
uint bg = Color(RynthUiColor.Background), line = Color(RynthUiColor.Hairline);
@ -81,8 +87,11 @@ internal sealed class DayNightWindow
if (width < 30) return height;
ImDrawListPtr dl = ImGui.GetWindowDrawList();
Vector2 max = origin + new Vector2(width, height);
dl.AddRectFilled(origin, max, A(bg, 0.94f), Px(Radius));
dl.AddRect(origin, max, line, Px(Radius));
if (box)
{
dl.AddRectFilled(origin, max, A(bg, 0.94f), Px(Radius));
dl.AddRect(origin, max, line, Px(Radius));
}
// The whole window is the drag surface.
ImGui.SetCursorScreenPos(origin);
@ -90,6 +99,8 @@ internal sealed class DayNightWindow
_host.PanelDragWithLastItem();
if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) _host.SetPanelOpen(Title, RynthPanelOpen.Close);
bool hot = ImGui.IsItemHovered();
if (!box && hot) dl.AddRectFilled(origin, max, A(bg, 0.45f), Px(Radius)); // where to grab it
Vector2 sh = new(MathF.Max(1f, MathF.Round(Px(1))), MathF.Max(1f, MathF.Round(Px(1)))); // the shadow's offset
long nowMs = Environment.TickCount64;
double left = v.Ready ? v.SecondsLeft(nowMs) : 0;
@ -99,12 +110,15 @@ internal sealed class DayNightWindow
Vector2 at = origin + new Vector2(pad, pad);
string icon = !v.Ready || v.Now.IsDay ? RynthIcons.Sun : HasGlyph(RynthIcons.Moon) ? RynthIcons.Moon : RynthIcons.Star;
uint iconColor = !v.Ready ? faint : v.Now.IsDay ? SunColor : MoonColor;
if (!box) PanelButtonsWindow.DrawIcon(dl, icon, at + sh, new Vector2(Px(Mark), rowH), Px(13), ShadowColor);
PanelButtonsWindow.DrawIcon(dl, icon, at, new Vector2(Px(Mark), rowH), Px(13), iconColor);
ImFontPtr nf = Font(RynthUiFont.NarrowBold11), sf = Font(RynthUiFont.Narrow9);
float tx = at.X + Px(Mark) + Px(Gap), right = origin.X + width - pad;
float lw = nf.CalcTextSizeA(Fs(nf), float.MaxValue, 0f, label).X;
dl.AddText(nf, Fs(nf), new Vector2(MathF.Round(tx), MathF.Round(at.Y + (rowH - Fs(nf)) * 0.5f)), v.Ready ? text : faint, label);
Vector2 labelAt = new(MathF.Round(tx), MathF.Round(at.Y + (rowH - Fs(nf)) * 0.5f));
if (!box) dl.AddText(nf, Fs(nf), labelAt + sh, ShadowColor, label);
dl.AddText(nf, Fs(nf), labelAt, v.Ready ? text : faint, label);
// The hour's name, right-aligned, only when it fits whole.
if (v.Ready)
@ -112,7 +126,11 @@ internal sealed class DayNightWindow
string hour = v.Now.HourName;
float hw = sf.CalcTextSizeA(Fs(sf), float.MaxValue, 0f, hour).X;
if (tx + lw + Px(8) + hw <= right)
dl.AddText(sf, Fs(sf), new Vector2(MathF.Round(right - hw), MathF.Round(at.Y + (rowH - Fs(sf)) * 0.5f)), faint, hour);
{
Vector2 hourAt = new(MathF.Round(right - hw), MathF.Round(at.Y + (rowH - Fs(sf)) * 0.5f));
if (!box) dl.AddText(sf, Fs(sf), hourAt + sh, ShadowColor, hour);
dl.AddText(sf, Fs(sf), hourAt, box ? faint : A(text, 0.8f), hour);
}
}
if (hot) SafeImGui.SetItemTooltip(Tip(v, left));
@ -139,7 +157,8 @@ internal sealed class DayNightWindow
internal static string Tip(DayNightView v, double left)
{
const string help = "A Dereth day is 2 h 7 min of real time: 63.5 minutes of day, then 63.5 of night.\n"
+ "Drag to move; Ctrl+wheel: bigger or smaller; right-click: hide (/rdef daynight).";
+ "Drag to move; Ctrl+wheel: bigger or smaller; right-click: hide (/rdef daynight).\n"
+ "/rdef daynight box: the dark box; /rdef daynight clear: no background.";
if (!v.Ready) return "Day or night in Dereth, and the real minutes until it changes. Shown once you're in the world.\n" + help;
TimeSpan t = TimeSpan.FromSeconds(Math.Ceiling(left));
string until = t.TotalMinutes >= 1 ? $"{(int)t.TotalMinutes} min {t.Seconds} s" : $"{t.Seconds} s";