public void DoInteractiveSelection(SelectableContainer Container, bool Selection)
        {
            ApplySelect(Container, Selection);

            if (this.PreviousContainer != null && this.PreviousContainer != Container &&
                (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)))
            {
                var CurrContainerIndex = this.ExposedContainers.IndexOf(Container);
                var PrevContainerIndex = this.ExposedContainers.IndexOf(this.PreviousContainer);

                if (PrevContainerIndex > CurrContainerIndex)
                {
                    for (int Index = CurrContainerIndex + 1; Index < PrevContainerIndex; Index++)
                    {
                        ApplySelect(this.ExposedContainers[Index], Selection);
                    }
                }
                else
                {
                    for (int Index = PrevContainerIndex + 1; Index < CurrContainerIndex; Index++)
                    {
                        ApplySelect(this.ExposedContainers[Index], Selection);
                    }
                }

                this.PreviousContainer = null;
            }
            else
            {
                this.PreviousContainer = Container;
            }
        }
예제 #2
0
    // Init and spawn anything in preperation for update job state
    public override bool OnStartJob()
    {
        // Clean up old inventories if they are currently open ( This may need adjusting given multiple inventories could be accessed on the same tick )
        GameController.Instance.crewTargetDirection.ForceCleanupMenu();
        GameController.Instance.crewTargetDirection.ForceCleanUpInventories();

        if (directedToTarget & character)
        {
            character.inventory.SetOpen(true);

            // Clean up opened DIRECTED TO inventory panel ON ARRIVAL JOB
            switch (directedToTarget.TargetSelectionProfile.selectionType)
            {
            case SelectionType.Character:
                SelectableCharacter character = directedToTarget as SelectableCharacter;

                character.inventory.SetOpen(true);
                break;

            case SelectionType.Container:
                SelectableContainer container = directedToTarget as SelectableContainer;

                container.container.SetOpen(true);
                break;
            }

            return(true);
        }

        return(false);
    }
    public void SetTarget(SelectableTarget currentTarget)
    {
        // Disable character target line renderer
        if (this.currentTarget != null)
        {
            // Destroy the old selection world radial menu
            if (WorldUIRadial.Instance != null)
            {
                Destroy(WorldUIRadial.Instance.gameObject);
            }

            switch (this.currentTarget.TargetSelectionProfile.selectionType)
            {
            case SelectionType.Character:
            {
                SelectableCharacter character = (SelectableCharacter)(this.currentTarget);
                character.pathTracer.SetNavPathTrace(false);
                character.inventory.SetOpen(false);
            }
            break;

            case SelectionType.Container:
            {
                SelectableContainer container = (SelectableContainer)(this.currentTarget);
                container.container.SetOpen(false);
            }
            break;
            }

            GameController.Instance.crewTargetDirection.ForceCleanupMenu();
            GameController.Instance.crewTargetDirection.ForceCleanUpInventories();
        }

        // Set the new target
        this.currentTarget = currentTarget;

        // If character, turn on line renderer
        // Disable character target line renderer
        if (this.currentTarget != null)
        {
            WorldUIRadial radialMenu = Instantiate(worldUIMenuPrefab, GameController.Instance.selectionDisplay.transform).GetComponent <WorldUIRadial>();
            radialMenu.Init(currentTarget);

            switch (this.currentTarget.TargetSelectionProfile.selectionType)
            {
            case SelectionType.Character:
            {
                ((SelectableCharacter)(this.currentTarget)).pathTracer.SetNavPathTrace(true);
            }
            break;
            }
        }
    }
        public void ApplySelect(SelectableContainer Container, bool Select)
        {
            Container.IsSelected = Select;

            if (Container.IsSelected)
            {
                if (!this.SelectedObjects.Contains(Container.Content))
                {
                    this.SelectedObjects.Add(Container.Content);

                    var Handler = PropertyChanged;
                    if (Handler != null)
                    {
                        Handler(this, new PropertyChangedEventArgs("IsEmptySelection"));
                    }
                }
            }
            else
            if (this.SelectedObjects.Contains(Container.Content))
            {
                this.SelectedObjects.Remove(Container.Content);
            }
        }
    public void ForceCleanUpInventories()
    {
        if (directedTo.Count > 0)
        {
            foreach (SelectableTarget directables in directedTo)
            {
                // Clean up opened DIRECTED TO inventory panel
                switch (directables.TargetSelectionProfile.selectionType)
                {
                case SelectionType.Character:
                    SelectableCharacter character = directables as SelectableCharacter;

                    character.inventory.SetOpen(false);
                    break;

                case SelectionType.Container:
                    SelectableContainer container = directables as SelectableContainer;

                    container.container.SetOpen(false);
                    break;
                }
            }
        }
    }
예제 #6
0
    public void TryOpenSelection()
    {
        SelectableTarget currentTarget = GameController.Instance.targetSelection.CurrentTarget;

        if (currentTarget != null)
        {
            switch (currentTarget.TargetSelectionProfile.selectionType)
            {
            case SelectionType.Character:
            {
                SelectableCharacter character = (SelectableCharacter)currentTarget;
                character.inventory.SetOpen(true);
            }
            break;

            case SelectionType.Container:
            {
                SelectableContainer container = (SelectableContainer)currentTarget;
                container.container.SetOpen(true);
            }
            break;
            }
        }
    }
    // As the animation state exists (finishes opening the container) initialize the UI
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        SelectableContainer selectionContainer = animator.GetComponent <SelectableContainer>();

        selectionContainer.container.CreateInventoryPanel(selectionContainer.TargetSelectionProfile.selectionName);
    }
예제 #8
0
        private SelectableContainer<GraphicComponentMock> CreateContainer(GraphicComponentMock arrowMock, GraphicComponentMock contentMock)
        {
            SelectableContainer<GraphicComponentMock> container;
            if (contentMock != null)
                container = new SelectableContainer<GraphicComponentMock>(arrowMock, contentMock);
            else
                container = new SelectableContainer<GraphicComponentMock>(arrowMock);

            container.SetCoordinates(10, 10, 100, 100);
            return container;
        }