예제 #1
0
 public Config(GraphicText gfx)
     : base(gfx)
 {
     gfx_ = gfx;
     add("font", configFont);
     add("text", configText);
     add("alignment", configAlignment);
 }
예제 #2
0
                bool configGraphic(string key, string value, Configuration.Options options)
                {
                    Graphic graphic = null;

                    switch (value.ToLower())
                    {
                    case "text":
                        graphic = new GraphicText(container_, options);
                        break;

                    case "battery":
                        graphic = new GraphicBattery(container_, options);
                        break;

                    case "list":
                        graphic = new GraphicList(container_, options);
                        break;

                    case "bar":
                        graphic = new GraphicBar(container_, options);
                        break;

                    case "icon":
                        graphic = new GraphicIcon(container_, options);
                        break;

                    case "slider":
                        graphic = new GraphicSlider(container_, options);
                        break;

                    case "test":
                        graphic = new GraphicTest(container_, options);
                        break;

                    case "curvedbar":
                        graphic = new GraphicCurvedBar(container_, options);
                        break;
                    }

                    if (graphic != null)
                    {
                        if (graphic.construct())
                        {
                            setSubHandler(graphic.getConfigHandler());
                            container_.graphics_.Add(graphic);
                            return(true);
                        }
                        else
                        {
                            container_.log(Console.LogType.Error, $"Failed to construct graphic:{value}");
                        }
                    }
                    else
                    {
                        container_.log(Console.LogType.Error, $"Invalid graphic type:{value}");
                    }
                    return(false);
                }
예제 #3
0
        private void Text_Changed(object sender, SelectionChangedEventArgs e)
        {
            if (!controlchanged)
            {
                labelIndex = textlist.IndexOf(textlist.Find(x => x.Name == textselect.SelectedItem.ToString()));
                GraphicText text = textlist[labelIndex];
                textX.Text     = text.X.ToString();
                textY.Text     = text.Y.ToString();
                textwidth.Text = text.Width.ToString();
                if (text.Rich)
                {
                    lineHeightLabel.Visibility = Visibility.Visible;
                    lineHeight.Visibility      = Visibility.Visible;
                    lineHeight.Text            = text.LineHeight.ToString();
                }
                else
                {
                    lineHeightLabel.Visibility = Visibility.Collapsed;
                    lineHeight.Visibility      = Visibility.Collapsed;
                }
                glowEnable.IsChecked = textlist[labelIndex].HasGlow;
                glowColor.Text       = text.GlowColor;
                switch (textlist[labelIndex].ContentAlign)
                {
                case HorizontalAlignment.Right:
                {
                    alignRight.RaiseEvent(new RoutedEventArgs(System.Windows.Controls.Primitives.ButtonBase.ClickEvent));
                    break;
                }

                case HorizontalAlignment.Center:
                {
                    alignCenter.RaiseEvent(new RoutedEventArgs(System.Windows.Controls.Primitives.ButtonBase.ClickEvent));
                    break;
                }

                case HorizontalAlignment.Left:
                {
                    alignLeft.RaiseEvent(new RoutedEventArgs(System.Windows.Controls.Primitives.ButtonBase.ClickEvent));
                    break;
                }
                }
            }
        }
예제 #4
0
 void Awake()
 {
     text = transform.parent.GetComponent <GraphicText>();
 }