コード例 #1
0
        private void CreateDiscardMenuItem(ExpressionsMenuHierarchyItem item, VRCExpressionsMenu destination, Emh.EmhDiscardType currentDiscard)
        {
            switch (currentDiscard)
            {
            case Emh.EmhDiscardType.BlankOut:
                destination.controls.Add(new VRCExpressionsMenu.Control
                {
                    type      = VRCExpressionsMenu.Control.ControlType.Button,
                    name      = "",
                    icon      = BlankIcon(),
                    value     = 1,
                    parameter = new VRCExpressionsMenu.Control.Parameter
                    {
                        name = ""
                    },
                    subMenu       = null,
                    subParameters = new VRCExpressionsMenu.Control.Parameter[0],
                    labels        = new VRCExpressionsMenu.Control.Label[0],
                });
                break;

            case Emh.EmhDiscardType.GrayOut:
                var iconNullable      = item.icon != null ? item.icon : _defaultIconOptional;
                var finalIconNullable = iconNullable != null && item.shader != null?CreateOrGetIcon(iconNullable, item.shader) : iconNullable;

                var grayedOutIcon = finalIconNullable != null?CreateOrGetIcon(finalIconNullable, _discardGrayOut) : null;

                destination.controls.Add(new VRCExpressionsMenu.Control
                {
                    type      = VRCExpressionsMenu.Control.ControlType.Button,
                    name      = item.ResolveName(),
                    icon      = grayedOutIcon,
                    value     = 1,
                    parameter = new VRCExpressionsMenu.Control.Parameter
                    {
                        name = ""
                    },
                    subMenu       = null,
                    subParameters = new VRCExpressionsMenu.Control.Parameter[0],
                    labels        = new VRCExpressionsMenu.Control.Label[0],
                });
                break;

            case Emh.EmhDiscardType.Remove:
            case Emh.EmhDiscardType.Default:
            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #2
0
        private void CreateNormalMenuItem(VRCExpressionsMenu destination, ExpressionsMenuHierarchyItem item)
        {
            var iconNullable      = item.icon != null ? item.icon : _defaultIconOptional;
            var finalIconNullable = iconNullable != null && item.shader != null?CreateOrGetIcon(iconNullable, item.shader) : iconNullable;

            destination.controls.Add(new VRCExpressionsMenu.Control
            {
                type      = TypeIn(item.type),
                name      = item.ResolveName(),
                icon      = finalIconNullable,
                value     = item.value,
                parameter = new VRCExpressionsMenu.Control.Parameter
                {
                    name = item.parameter
                },
                // style = control.style,
                subMenu       = SubMenu(item, _visited),
                subParameters = SubParams(item),
                labels        = SubLabels(item),
            });
        }