コード例 #1
0
        protected override void ClientInteractStart(ClientObjectData data)
        {
            var worldObject = data.GameObject;
            var character   = Client.Characters.CurrentPlayerCharacter;

            var menuWindow = WindowCraftingStation.Open(this);

            ClientCurrentInteractionMenu.RegisterMenuWindow(menuWindow);

            InteractionCheckerSystem.SharedRegister(
                character,
                worldObject,
                finishAction: _ => menuWindow.CloseWindow());

            ClientInteractionUISystem.Register(
                worldObject,
                menuWindow,
                onMenuClosedByClient:
                () => InteractionCheckerSystem.SharedUnregister(
                    character,
                    worldObject,
                    isAbort: false));

            ClientCurrentInteractionMenu.Open();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        public static void Open(IItem itemStorage)
        {
            if (instance?.IsOpened == true && instance.itemStorage == itemStorage)
            {
                instance.CloseWindow();
            }
            else
            {
                if (instance == null)
                {
                    instance             = new WindowStorageFridgeContainer();
                    instance.itemStorage = itemStorage;
                    Api.Client.UI.LayoutRootChildren.Add(instance);
                }
                else
                {
                    instance.itemStorage = itemStorage;
                    instance.RefreshViewModel();
                }

                if (CloseCurrentWindow(itemStorage))
                {
                    ClientCurrentInteractionMenu.RegisterMenuWindow(instance);
                    ClientCurrentInteractionMenu.Open();
                }
            }
        }
コード例 #4
0
        public static void Open(IItem remote)
        {
            if (instance?.IsOpened == true)
            {
                instance.CloseWindow();
            }
            else
            {
                if (instance == null)
                {
                    instance        = new WindowVehicleRemoteControl();
                    instance.remote = remote;
                    Api.Client.UI.LayoutRootChildren.Add(instance);
                }

                ClientCurrentInteractionMenu.RegisterMenuWindow(instance);
                ClientCurrentInteractionMenu.Open();
            }
        }