Пример #1
0
    public virtual void Reinitialize(Toolset _toolSet, List <bool> activityFlags, bool focus, bool activate)
    {
        if (activityFlags.Count != toolItems.Count)
        {
            Debug.Log("Wrong number of activity flags for " + toolName + ". Will not reinitialize");
            return;
        }

        List <ToolItem> allItems = new List <ToolItem>();

        foreach (ToolItem item in toolItems)
        {
            allItems.Add(item);
        }

        toolItems.Clear();

        for (int i = 0; i < allItems.Count; ++i)
        {
            if (activityFlags[i])
            {
                toolItems.Add(allItems[i]);
            }
            else
            {
                allItems[i].DeactivateItem();
                allItems[i].Disable();
                allItems[i].gameObject.SetActive(false);
            }
        }

        if (toolItems.Count > 0)
        {
            activeItem = toolItems[0];
        }
        else
        {
            activeItem = null;
        }

        focusItem = activeItem;

        RearrangeToolItems();

        if (activate && activeItem != null)
        {
            activeItem.ActivateItem();

            if (highlightActiveItem)
            {
                activeItem.Highlight();
            }
        }
        if (focus && activeItem != null && toolSet.Tools[0] == this)
        {
            FocusTool();
        }
    }
Пример #2
0
    void PrevItem()
    {
        --focusIndex;
        if (focusIndex < 0)
        {
            focusIndex = toolItems.Count - 1;
        }

        focusItem.UnfocusItem();
        focusItem = toolItems[focusIndex];

        ShiftItems();

        focusItem.FocusItem();

        if (activeHighlight)
        {
            LowlightAll();
            focusItem.Highlight();
        }
    }
Пример #3
0
    void NextItem()
    {
        ++focusIndex;
        if (focusIndex >= toolItems.Count)
        {
            focusIndex = 0;
        }

        focusItem.UnfocusItem();
        focusItem = toolItems[focusIndex];

        ShiftItems();

        focusItem.FocusItem();

        if (activeHighlight)
        {
            LowlightAll();
            focusItem.Highlight();
        }
    }