Revert "Remove some BUI boilerplate" (#30214)
Revert "Remove some BUI boilerplate (#28399)"
This reverts commit cbf329a82d.
This commit is contained in:
@@ -41,7 +41,7 @@ namespace Content.Client.Inventory
|
||||
public const string HiddenPocketEntityId = "StrippingHiddenEntity";
|
||||
|
||||
[ViewVariables]
|
||||
private StrippingMenu? _strippingMenu;
|
||||
private readonly StrippingMenu? _strippingMenu;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly EntityUid _virtualHiddenEntity;
|
||||
@@ -51,30 +51,33 @@ namespace Content.Client.Inventory
|
||||
_examine = EntMan.System<ExamineSystem>();
|
||||
_inv = EntMan.System<InventorySystem>();
|
||||
_cuffable = EntMan.System<SharedCuffableSystem>();
|
||||
|
||||
// TODO update name when identity changes
|
||||
var title = Loc.GetString("strippable-bound-user-interface-stripping-menu-title", ("ownerName", Identity.Name(Owner, EntMan)));
|
||||
_strippingMenu = new StrippingMenu(title, this);
|
||||
_strippingMenu.OnClose += Close;
|
||||
|
||||
// TODO use global entity
|
||||
// BUIs are opened and closed while applying comp sates, so spawning entities here is probably not the best idea.
|
||||
_virtualHiddenEntity = EntMan.SpawnEntity(HiddenPocketEntityId, MapCoordinates.Nullspace);
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_strippingMenu = this.CreateWindow<StrippingMenu>();
|
||||
_strippingMenu.OnDirty += UpdateMenu;
|
||||
_strippingMenu.Title = Loc.GetString("strippable-bound-user-interface-stripping-menu-title", ("ownerName", Identity.Name(Owner, EntMan)));
|
||||
|
||||
_strippingMenu?.OpenCenteredLeft();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
EntMan.DeleteEntity(_virtualHiddenEntity);
|
||||
|
||||
if (!disposing)
|
||||
return;
|
||||
|
||||
if (_strippingMenu != null)
|
||||
_strippingMenu.OnDirty -= UpdateMenu;
|
||||
|
||||
EntMan.DeleteEntity(_virtualHiddenEntity);
|
||||
base.Dispose(disposing);
|
||||
_strippingMenu?.Dispose();
|
||||
}
|
||||
|
||||
public void DirtyMenu()
|
||||
|
||||
Reference in New Issue
Block a user