diff --git a/Content.Client/_Cats/Event/EventItemDispenserConfigBoundUserInterface.cs b/Content.Client/_Cats/Event/EventItemDispenserConfigBoundUserInterface.cs new file mode 100644 index 00000000000..5c0c6fd93d0 --- /dev/null +++ b/Content.Client/_Cats/Event/EventItemDispenserConfigBoundUserInterface.cs @@ -0,0 +1,281 @@ +using Content.Client.UserInterface.Controls; +using Content.Shared._Cats.Event; +using Robust.Client.UserInterface; +using Robust.Client.UserInterface.Controls; +using Robust.Client.UserInterface.CustomControls; +using Robust.Shared.Prototypes; +using Robust.Shared.Utility; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Content.Client._Cats.Event; + +#pragma warning disable IDE1006 // i am going to fucking lose it + +/// +/// Hopefully i never have to touch UI ever again. +/// Even if xaml thing was working for me, this would only be marginally less of a radioactive dump. +/// +public sealed class EventItemDispenserConfigBoundUserInterface : BoundUserInterface +{ + + [Dependency] private readonly IPrototypeManager _proto = default!; + [Dependency] private readonly IEntityManager _entMan = default!; + [Dependency] private readonly ILocalizationManager _loc = default!; + + static readonly Color Green = new Color(0, 255, 0); + static readonly Color Red = new Color(255, 0, 0); + static readonly Color Transparent = new Color(255, 255, 255, 69/*haha*/); + + //EventItemDispenserConfigWindow? window; // Trying to work with robustengine's ui system makes me want to quote AM. + DefaultWindow window = default!; + EventItemDispenserComponent dispenserComp; + public EventItemDispenserConfigBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) { + IoCManager.InjectDependencies(this); + dispenserComp = _entMan.GetComponent(Owner); + } + + + + #region man-made horrors beyond your comprehension + + + + + #region all the controls + BoxContainer baseBox = default!; + BoxContainer optionBox = default!; + BoxContainer buttonBox = default!; + BoxContainer copypasteBox = default!; + + LineEdit DispensingPrototypeLineEdit = default!; + bool DispensingPrototypeValid = false; + CheckBox AutoDisposeCheckBox = default!; + Label AutoDisposeLabel = default!; + CheckBox CanManuallyDisposeCheckBox = default!; + CheckBox InfiniteCheckBox = default!; + LineEdit LimitLineEdit = default!; + + CheckBox ReplaceDisposedItemsCheckBox = default!; + LineEdit DisposedReplacementPrototypeLineEdit = default!; + bool DisposedReplacementPrototypeValid = false; + + CheckBox AutoCleanUpCheckBox = default!; + + Button copyButton = default!; + Button pasteButton = default!; + Button confirmButton = default!; + + //Button cancelButton = new(); // just hit the "x" 4head + #endregion + + #region copypasta stuff + static string SavedDispensingPrototype = default!; + static bool SavedAutoDispose = default; + static bool SavedCanManuallyDispose = default; + static bool SavedInfinite = default; + static string SavedLimit = default!; + static bool SavedReplaceDisposedItems = default; + static string SavedDisposedReplacementPrototype = default!; + static bool SavedAutoCleanUp = default; + + static bool saved = false; + + private void CopySettings(EventArgs whatever) + { + saved = true; + + SavedDispensingPrototype = DispensingPrototypeLineEdit.Text; + SavedAutoDispose = AutoDisposeCheckBox.Pressed; + SavedCanManuallyDispose = CanManuallyDisposeCheckBox.Pressed; + SavedInfinite = InfiniteCheckBox.Pressed; + SavedLimit = LimitLineEdit.Text; + SavedReplaceDisposedItems = ReplaceDisposedItemsCheckBox.Pressed; + SavedDisposedReplacementPrototype = DisposedReplacementPrototypeLineEdit.Text; + SavedAutoCleanUp = AutoCleanUpCheckBox.Pressed; + + pasteButton.Disabled = false; + } + + private void PasteSettings(EventArgs whatever) + { + DebugTools.Assert(saved); + + DispensingPrototypeLineEdit.Text = SavedDispensingPrototype; + AutoDisposeCheckBox.Pressed = SavedAutoDispose; + CanManuallyDisposeCheckBox.Pressed = SavedCanManuallyDispose; + InfiniteCheckBox.Pressed = SavedInfinite; + LimitLineEdit.Text = SavedLimit; + ReplaceDisposedItemsCheckBox.Pressed = SavedReplaceDisposedItems; + DisposedReplacementPrototypeLineEdit.Text = SavedDisposedReplacementPrototype; + AutoCleanUpCheckBox.Pressed = SavedAutoCleanUp; + + } + #endregion + + private void InitializeControls(DefaultWindow window) // windows forms ahh method + { + baseBox = this.CreateDisposableControl(); + baseBox.Orientation = BoxContainer.LayoutOrientation.Vertical; + baseBox.SeparationOverride = 4; + baseBox.Margin = new Thickness(4, 0); + baseBox.MinWidth = 450; + window.Contents.AddChild(baseBox); + + optionBox = this.CreateDisposableControl(); + optionBox.Orientation = BoxContainer.LayoutOrientation.Vertical; + baseBox.AddChild(optionBox); + + buttonBox = this.CreateDisposableControl(); + buttonBox.Orientation = BoxContainer.LayoutOrientation.Horizontal; + //buttonBox.Align = BoxContainer.AlignMode.End; + baseBox.AddChild(buttonBox); + + copypasteBox = this.CreateDisposableControl(); + //copypasteBox.HorizontalAlignment = Control.HAlignment.Left; + copypasteBox.HorizontalExpand = true; + + copyButton = this.CreateDisposableControl