コード例 #1
0
        public void ChangeItem(RightClickMenuItem itemInfo)
        {
            Mask.raycastTarget = true;
            Mask.color         = itemInfo.BackgroundColor;
            // Due to the way Unity handles selectables and transitions, we will handle the transitions ourselves instead.
            var colorBlock = colors;

            colorBlock.highlightedColor = CalculateHighlight(itemInfo.BackgroundColor);
            colorBlock.selectedColor    = colorBlock.highlightedColor;
            colorBlock.disabledColor    = Color.clear;
            colors = colorBlock;
            // Temporary solution for items/actions that currently do not have an icon set up or have the default question mark icon.
            if (itemInfo.IconSprite == null || itemInfo.IconSprite.name == "question_mark")
            {
                icon.SetActive(false);
                altLabel.SetActive(true);
                altLabel.SetText(itemInfo.Label);
            }
            else
            {
                SetupIcon(itemInfo);
            }
        }