private void ClientRemote_OnContainerOpened(IStaticWorldObject worldObject) { var privateState = GetPrivateState(worldObject); var itemsContainer = privateState.ItemsContainer; var soundClose = Client.UI.GetApplicationResource<SoundUI>("SoundWindowContainerClose"); var menuWindow = WindowContainerExchange.Show( itemsContainer, soundClose: soundClose, isAutoClose: true); var character = Client.Characters.CurrentPlayerCharacter; InteractionCheckerSystem.SharedRegister( character, worldObject, finishAction: _ => menuWindow.CloseWindow()); ClientInteractionUISystem.Register( worldObject, menuWindow, onMenuClosedByClient: () => { InteractionCheckerSystem.SharedUnregister(character, worldObject, isAbort: false); if (!worldObject.IsDestroyed) { this.CallServer(_ => _.ServerRemote_OnClientInteractFinish(worldObject)); } }); Logger.Important("Started object interaction with " + worldObject); ClientCurrentInteractionMenu.RegisterMenuWindow(menuWindow); ClientCurrentInteractionMenu.Open(); }
public BaseUserControlWithWindow ClientOpenUI(IWorldObject worldObject) { var itemsContainer = GetPublicState((IStaticWorldObject)worldObject).ItemsContainer; var soundOpen = Client.UI.GetApplicationResource <SoundUI>("SoundWindowContainerBagOpen"); var soundClose = Client.UI.GetApplicationResource <SoundUI>("SoundWindowContainerBagClose"); return(WindowContainerExchange.Show(itemsContainer, soundOpen, soundClose, isAutoClose: true)); }
public void Setup(WindowContainerExchange setWindow, Func <bool> closeCheckFunc) { this.window = setWindow; this.closeCheckFunc = closeCheckFunc; }