Пример #1
0
            public void Draw()
            {
                if (!ImGui.BeginTabItem(LabelTab))
                {
                    return;
                }
                var items  = _modManager.Collections.ActiveCollection.Cache?.ChangedItems ?? new Dictionary <string, object?>();
                var forced = _modManager.Collections.ForcedCollection.Cache?.ChangedItems ?? new Dictionary <string, object?>();

                using var raii = ImGuiRaii.DeferredEnd(ImGui.EndTabItem);

                ImGui.SetNextItemWidth(-1);
                if (ImGui.InputTextWithHint("##ChangedItemsFilter", "Filter...", ref _filter, 64))
                {
                    _filterLower = _filter.ToLowerInvariant();
                }

                if (!ImGui.BeginTable("##ChangedItemsTable", 1, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY, AutoFillSize))
                {
                    return;
                }

                raii.Push(ImGui.EndTable);

                var list = items.AsEnumerable();

                if (forced.Count > 0)
                {
                    list = list.Concat(forced).OrderBy(kvp => kvp.Key);
                }

                if (_filter.Any())
                {
                    list = list.Where(kvp => kvp.Key.ToLowerInvariant().Contains(_filterLower));
                }

                foreach (var(name, data) in list)
                {
                    ImGui.TableNextRow();
                    ImGui.TableNextColumn();
                    _base.DrawChangedItem(name, data, ImGui.GetStyle().ScrollbarSize);
                }
            }
Пример #2
0
            private void DrawChangedItemsTab()
            {
                if (Mod.Data.ChangedItems.Count == 0 || !ImGui.BeginTabItem(LabelChangedItemsTab))
                {
                    return;
                }

                using var raii = ImGuiRaii.DeferredEnd(ImGui.EndTabItem);

                if (!ImGui.BeginListBox(LabelChangedItemsHeader, AutoFillSize))
                {
                    return;
                }

                raii.Push(ImGui.EndListBox);
                foreach (var(name, data) in Mod.Data.ChangedItems)
                {
                    _base.DrawChangedItem(name, data);
                }
            }