using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using Dalamud.Bindings.ImGui; using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Windowing; using Dalamud.Plugin; using LLib.ImGui; using Questionable.Data; using Questionable.Model.Changelog; using Questionable.Windows.ChangelogComponents; namespace Questionable.Windows; internal sealed class ChangelogWindow : LWindow { private readonly Configuration _configuration; private readonly IDalamudPluginInterface _pluginInterface; private readonly ChangelogHeaderComponent _headerComponent; private readonly ChangelogFooterComponent _footerComponent; private int _windowOpenCount; private bool _hasSetInitialState; private float _headerAnimationTime; public ChangelogWindow(Configuration configuration, IDalamudPluginInterface pluginInterface) : base("Questionable Changelog###QuestionableChangelog", ImGuiWindowFlags.NoTitleBar) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) _configuration = configuration; _pluginInterface = pluginInterface; _headerComponent = new ChangelogHeaderComponent(); _footerComponent = new ChangelogFooterComponent(); base.Size = new Vector2(900f, 650f); base.SizeCondition = ImGuiCond.FirstUseEver; WindowSizeConstraints value = default(WindowSizeConstraints); ((WindowSizeConstraints)(ref value))._002Ector(); ((WindowSizeConstraints)(ref value)).MinimumSize = new Vector2(700f, 500f); ((WindowSizeConstraints)(ref value)).MaximumSize = new Vector2(float.MaxValue, float.MaxValue); ((Window)this).SizeConstraints = value; } public override void DrawContent() { _headerComponent.Draw(delegate(bool isOpen) { base.IsOpen = isOpen; }); DrawChangelogEntries(); ChangelogFooterComponent.Draw(delegate { base.IsOpen = false; }); ImDrawListPtr windowDrawList = ImGui.GetWindowDrawList(); Vector2 windowPos = ImGui.GetWindowPos(); Vector2 windowSize = ImGui.GetWindowSize(); windowDrawList.AddRect(windowPos, windowPos + windowSize, ImGui.ColorConvertFloat4ToU32(new Vector4(0.65f, 0.55f, 0.85f, 0.3f)), 0f, ImDrawFlags.None, 2f); } public override void OnOpen() { base.OnOpen(); _windowOpenCount++; _hasSetInitialState = false; _headerAnimationTime = 0f; _headerComponent.Reset(); } public override void OnClose() { base.OnClose(); MarkAllAsRead(); } private void DrawChangelogEntries() { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) _headerAnimationTime += ImGui.GetIO().DeltaTime; ColorDisposable val = ImRaii.PushColor(ImGuiCol.ScrollbarBg, new Vector4(0.1f, 0.08f, 0.14f, 0.6f), true); try { ColorDisposable val2 = ImRaii.PushColor(ImGuiCol.ScrollbarGrab, new Vector4(0.55f, 0.45f, 0.75f, 0.4f), true); try { ColorDisposable val3 = ImRaii.PushColor(ImGuiCol.ScrollbarGrabHovered, new Vector4(0.65f, 0.55f, 0.85f, 0.6f), true); try { ColorDisposable val4 = ImRaii.PushColor(ImGuiCol.ScrollbarGrabActive, new Vector4(0.75f, 0.55f, 0.95f, 0.8f), true); try { float num = ImGui.GetFrameHeightWithSpacing() + ImGui.GetStyle().ItemSpacing.Y * 2f; ChildDisposable val5 = ImRaii.Child((ImU8String)"ChangelogScroll", new Vector2(0f, 0f - num), false, ImGuiWindowFlags.NoScrollbar); try { if (!val5) { return; } ChildDisposable val6 = ImRaii.Child((ImU8String)"ChangelogScrollInner", Vector2.Zero, false); try { if (!val6) { return; } List changelogs = ChangelogData.Changelogs; ChangelogEntry changelogEntry = changelogs.FirstOrDefault(); if (changelogs.Count == 0) { ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 40f); Vector2 vector = ImGui.CalcTextSize("No changelog entries available."); ImGui.SetCursorPosX((ImGui.GetContentRegionAvail().X - vector.X) * 0.5f); ImGui.TextDisabled("No changelog entries available."); return; } ChangelogEntryComponent changelogEntryComponent = new ChangelogEntryComponent(_configuration, _windowOpenCount, _headerAnimationTime); foreach (ChangelogEntry item in changelogs) { changelogEntryComponent.Draw(item, item == changelogEntry, _hasSetInitialState); Vector2 cursorScreenPos = ImGui.GetCursorScreenPos(); float num2 = ImGui.GetContentRegionAvail().X * 0.5f; float num3 = (ImGui.GetContentRegionAvail().X - num2) * 0.5f; ImGui.GetWindowDrawList().AddLine(cursorScreenPos + new Vector2(num3, 0f), cursorScreenPos + new Vector2(num3 + num2, 0f), ImGui.ColorConvertFloat4ToU32(new Vector4(0.55f, 0.45f, 0.75f, 0.1f)), 1f); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 4f); } _hasSetInitialState = true; } finally { ((ChildDisposable)(ref val6)).Dispose(); } } finally { ((ChildDisposable)(ref val5)).Dispose(); } } finally { ((IDisposable)val4)?.Dispose(); } } finally { ((IDisposable)val3)?.Dispose(); } } finally { ((IDisposable)val2)?.Dispose(); } } finally { ((IDisposable)val)?.Dispose(); } } private void MarkAllAsRead() { string text = ChangelogData.Changelogs.FirstOrDefault()?.Version; if (text != null) { _configuration.LastViewedChangelogVersion = text; _pluginInterface.SavePluginConfig(_configuration); } } }