Ejemplo n.º 1
0
                bool configBorder(string key, string value, Configuration.Options options)
                {
                    // border:style:size:spacing:type:color

                    //string prefix = "VIS_Icon_Border";
                    graphic_.RenderData.BorderIcon = Icon.getIcon($"VIS_Icon_Border{value}");
                    if (graphic_.RenderData.BorderIcon == null)
                    {
                        graphic_.log(Console.LogType.Error, $"Invalid border icon '{value}'");
                        return(false);
                    }
                    graphic_.RenderData.BorderName = value;

                    graphic_.BorderSize    = options.asFloat(0, Default.BorderSize);
                    graphic_.BorderSpacing = options.asFloat(1, Default.BorderSpacing);

                    ValueType vt;

                    if (!toValueType(options[2], out vt, Default.ValueType))
                    {
                        return(false);
                    }
                    graphic_.BorderSizeType = vt;

                    graphic_.RenderData.BorderColor = options.asColor(3, Default.BorderColor);
                    return(true);
                }
Ejemplo n.º 2
0
                bool configBackground(string key, string value, Configuration.Options options)
                {
                    // background:color:icon:rotation:thickness:type

                    graphic_.RenderData.BackgroundColor = Configuration.asColor(value, Default.GfxBackgroundColor);

                    if (options.Count > 0)
                    {
                        graphic_.RenderData.BackgroundIconName = options[0] == "" ? IconNameSquareSimple : options[0];
                        graphic_.RenderData.BackgroundIcon     = Icon.getIcon(options[0]);
                        if (graphic_.RenderData.BackgroundIcon == null)
                        {
                            graphic_.log(Console.LogType.Error, $"Invalid background icon '{options[0]}'");
                            return(false);
                        }

                        graphic_.BackgroundRotation = (options.asFloat(1, 0f) / 180f) * (float)Math.PI;

                        graphic_.BackgroundThickness = options.asFloat(2, 0f);
                        ValueType vt;
                        if (!toValueType(options[3], out vt, Default.ValueType))
                        {
                            return(false);
                        }

                        graphic_.BackgroundThicknessType = vt;
                    }

                    return(true);
                }
Ejemplo n.º 3
0
            bool configStyle(string key, string value, Configuration.Options options)
            {
                minDegree_ = Configuration.asFloat(value, minDegree_);
                maxDegree_ = options.asFloat(0, maxDegree_);
                colorLerp_ = options.asBoolean(1, colorLerp_);

                if (minDegree_ > maxDegree_)
                {
                    minDegree_ -= 360f;
                }

                thickness_ = options.asFloat(2, thickness_);

                return(true);
            }
Ejemplo n.º 4
0
            bool configSetSlider(string key, string value, Configuration.Options options)
            {
                switch (value.ToLower())
                {
                case "top":
                case "t":
                    sliderOrientation_ = SliderOrientation.Top;
                    break;

                case "left":
                case "l":
                    sliderOrientation_ = SliderOrientation.Left;
                    break;

                case "bottom":
                case "b":
                    sliderOrientation_ = SliderOrientation.Bottom;
                    break;

                case "right":
                case "r":
                    sliderOrientation_ = SliderOrientation.Right;
                    break;

                default:
                    log(Console.LogType.Error, $"Invalid slider orientation '{value}'");
                    return(false);
                }

                sliderWidth_ = options.asFloat(0, 0.03f);
                sliderColor_ = options.asColor(1, Color.WhiteSmoke);
                return(true);
            }
Ejemplo n.º 5
0
 bool configFont(string key, string value, Configuration.Options options)
 {
     container_.Font      = value != string.Empty ? value : Default.Font;
     container_.FontSize  = options.asFloat(0, Default.FontSize);
     container_.FontColor = options.asColor(1, Default.FontColor);
     return(true);
 }
Ejemplo n.º 6
0
 bool configFont(string key, string value, Configuration.Options options)
 {
     gfx_.font_           = value != string.Empty ? value : Default.Font;
     gfx_.fontSize_       = options.asFloat(0, 0f);
     gfx_.Color           = options.asColor(1, Default.FontColor);
     gfx_.useDefaultFont_ = false;
     return(true);
 }
Ejemplo n.º 7
0
            bool configBarStyle(string key, string value, Configuration.Options options)
            {
                rotation_ = (options.asFloat(0, Default.BarRotation) / 180f) * (float)Math.PI;

                switch (value.ToLower())
                {
                case "simple":
                    renderStyledBar_ = Graphic.renderSimpleBar;
                    break;

                case "segments":
                    renderStyledBar_ = Graphic.renderSegmentedBar;
                    break;

                case "tiles":
                    renderStyledBar_ = Graphic.renderTiledBar;
                    tiles_           = options.asInteger(1, Default.BarTileCount);
                    tileSpace_       = options.asFloat(2, Default.BarTileSpace);
                    if (options.Count >= 4)
                    {
                        if (!toValueType(options[3], out tileSpaceType_, Default.BarTileSpaceType))
                        {
                            return(false);
                        }
                    }

                    if (options.Count >= 5)
                    {
                        if (RenderTarget.spriteExist(options[4]))
                        {
                            tileName_ = options[4];
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    break;

                default:
                    log(Console.LogType.Error, $"Invalid bar style '{value}'");
                    return(false);
                }

                return(true);
            }
Ejemplo n.º 8
0
                bool configVisibility(string key, string value, Configuration.Options options)
                {
                    Func <string, OperatorDelegate> func = (op) =>
                    {
                        switch (op)
                        {
                        case "equal":
                        case "==":
                            return(equal);

                        case "unequal":
                        case "!=":
                            return(unequal);

                        case "less":
                        case "<":
                            return(less);

                        case "greater":
                        case ">":
                            return(greater);

                        case "lessequal":
                        case "<=":
                            return(lessequal);

                        case "greaterequal":
                        case ">=":
                            return(greaterequal);

                        default:
                            return(val_false);
                        }
                    };

                    graphic_.VisibleOperatorA  = func(value.ToLower());
                    graphic_.VisibleThresholdA = options.asFloat(0, 0f);

                    if (options.Count >= 4)
                    {
                        switch (options[1].ToLower())
                        {
                        case "||":
                        case "or":
                            graphic_.VisibleCondition = cond_or;
                            break;

                        case "&&":
                        case "and":
                            graphic_.VisibleCondition = cond_and;
                            break;

                        default:
                            return(false);
                        }
                        graphic_.VisibleOperatorB  = func(options[2].ToLower());
                        graphic_.VisibleThresholdB = options.asFloat(3, 0f);
                    }

                    return(true);
                }