private void Setup(IItemsContainer container, SoundUI soundOpen, SoundUI soundClose) { this.itemsContainer = container; if (!ReferenceEquals(soundOpen, null) || !ReferenceEquals(soundClose, null)) { var window = this.GetByName <WindowMenuWithInventory>("WindowMenuWithInventory"); if (!ReferenceEquals(soundOpen, null)) { window.SoundOpening = soundOpen; } if (!ReferenceEquals(soundClose, null)) { window.SoundClosing = soundClose; } } this.RefreshViewModel(); }
public static WindowContainerExchange Show( IItemsContainer itemsContainer, SoundUI soundOpen = null, SoundUI soundClose = null, bool isAutoClose = false) { var instance = new WindowContainerExchange(); instance.Setup(itemsContainer, soundOpen, soundClose); Api.Client.UI.LayoutRootChildren.Add(instance); if (isAutoClose) { ((IWorldObject)itemsContainer.Owner) .ClientSceneObject .AddComponent <ClientComponentAutoCloseWindow>() .Setup(instance, closeCheckFunc: () => itemsContainer.OccupiedSlotsCount == 0); } return(instance); }