Exemple #1
0
        protected void ViewColorList()
        {
            IEnumerable <PropertyInfo> properties = typeof(Colors).GetTypeInfo().DeclaredProperties;

            foreach (PropertyInfo property in properties)
            {
                Color clr = (Color)property.GetValue(null);

                /*
                 * TextBlock tbBlk = new TextBlock();
                 * tbBlk.Text = String.Format("{0} \x2014 {1:X2}-{2:X2}-{3:X2}-{4:X2}",
                 *                          property.Name, clr.A, clr.R, clr.G, clr.B);
                 * tbBlk.Foreground = new SolidColorBrush(clr);
                 * stackPanel.Children.Add(tbBlk);
                 */
                OutlinedTextBlock outlinedTextBlock = new OutlinedTextBlock();
                outlinedTextBlock.Text = String.Format("{0} \x2014 {1:X2}-{2:X2}-{3:X2}-{4:X2}",
                                                       property.Name, clr.A, clr.R, clr.G, clr.B);



                outlinedTextBlock.Fill            = new SolidColorBrush(clr);
                outlinedTextBlock.FontSize        = 30;
                outlinedTextBlock.StrokeThickness = 0.3;
                outlinedTextBlock.Stroke          = new SolidColorBrush(Colors.White - clr);
                stackPanel.Children.Add(outlinedTextBlock);
            }
        }
Exemple #2
0
        public static void Add(int Key, double Timeleft)
        {
            Extensions.Execute.UIThread(() =>
            {
                Border Border = new Border {
                    Width = 55, Height = 54, Margin = new System.Windows.Thickness(0, 0, 3, 0)
                };
                OutlinedTextBlock Text = new OutlinedTextBlock
                {
                    Text                = Skills.Format(Timeleft),
                    FontSize            = 20,
                    HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
                    VerticalAlignment   = System.Windows.VerticalAlignment.Center,
                    TextWrapping        = System.Windows.TextWrapping.Wrap,
                    FontWeight          = System.Windows.FontWeights.Bold,
                    TextAlignment       = System.Windows.TextAlignment.Center,
                    Margin              = new System.Windows.Thickness(2, 0, 0, 3),
                    StrokeThickness     = 1,
                    Fill                = Extensions.HexToBrush("#ffffff"),
                    Stroke              = Extensions.HexToBrush("#000000"),
                };

                Border.Child = Text;
                Items.Add(Key, new Helpers {
                    Border = Border, Text = Text
                });

                if (Area != null)
                {
                    Area.Children.Add(Border);
                }
            });
            // Hydra 15 Sec
        }
Exemple #3
0
        private void removeOutdateDanmaku(string _UniqueName)
        {
            OutlinedTextBlock _targetDanmaku = BindingCanvas.FindName(_UniqueName) as OutlinedTextBlock;

            if (_targetDanmaku != null)
            {
                BindingCanvas.Children.Remove(_targetDanmaku);
                BindingCanvas.UnregisterName(_UniqueName);
                _targetDanmaku = null;
            }
        }
Exemple #4
0
        public object CreateControl()
        {
            if (NoCooldown)
            {
                return(null);
            }

            Text = new OutlinedTextBlock
            {
                Text          = "0.0",
                FontFamily    = FKMethods.HelveticaFont,
                FontSize      = 20,
                Fill          = Extensions.HexToBrush("#fff"),
                TextAlignment = System.Windows.TextAlignment.Center,
                Margin        = new System.Windows.Thickness(0, -2, 0, 0)
            };

            return(Text);
        }
Exemple #5
0
        private void AddR2LAnimation(string _UniqueName, Duration AppearDuration)
        {
            OutlinedTextBlock _targetDanmaku = BindingCanvas.FindName(_UniqueName) as OutlinedTextBlock;

            double          _danmakuWidth    = _targetDanmaku.ActualWidth;
            DoubleAnimation _doubleAnimation = new DoubleAnimation(BindingCanvas.ActualWidth, -_danmakuWidth, AppearDuration, FillBehavior.Stop);

            //Storyboard _sb = new Storyboard();
            //Storyboard.SetTarget(_doubleAnimation, _targetDanmaku);
            //Storyboard.SetTargetProperty(_doubleAnimation, mCache_R2LPropertyPath);
            _doubleAnimation.Completed += delegate(object o, EventArgs e) { removeOutdateDanmaku(_targetDanmaku.Name); };
            _targetDanmaku.BeginAnimation(Canvas.LeftProperty, _doubleAnimation);


            //_sb.Completed += delegate (object o, EventArgs e) { removeOutdateDanmaku(_targetDanmaku.Name); };

            //_sb.Children.Add(_doubleAnimation);
            //_sb.Begin();
        }
Exemple #6
0
        protected override void DisplayContent()
        {
            contentWrapPanel.Children.Clear();
            foreach (Upgrade upgrade in Upgrades.upgrades.Values)
            {
                upgrade.cardCanvasList.Clear();
            }
            foreach (Pilot pilot in Pilots.pilots.Values)
            {
                pilot.cardCanvasList.Clear();
            }

            foreach (Build build in Builds.builds.OrderByDescending(build => build.displayOrder).ToList())
            {
                AlignableWrapPanel buildWrapPanel = new AlignableWrapPanel();
                buildWrapPanel.HorizontalContentAlignment = HorizontalAlignment.Center;

                AlignableWrapPanel spacerWrapPanel = new AlignableWrapPanel();
                spacerWrapPanel.HorizontalContentAlignment = HorizontalAlignment.Center;

                Canvas topSpacer = new Canvas();
                topSpacer.Width  = 99999;
                topSpacer.Height = Opt.ApResMod(50);
                spacerWrapPanel.Children.Add(topSpacer);

                ImageButton addPilotButton = new ImageButton("add_pilot", 0.5);
                addPilotButton.uniqueBuildId = build.uniqueBuildId;
                addPilotButton.MouseDown    += new MouseButtonEventHandler(AddPilotClicked);
                addPilotButton.Margin        = ScaledThicknessFactory.GetThickness(2, 0, 2, 0);
                spacerWrapPanel.Children.Add(addPilotButton);

                ImageButton upButton = new ImageButton("up", 0.5);
                upButton.uniqueBuildId = build.uniqueBuildId;
                upButton.MouseDown    += new MouseButtonEventHandler(UpClicked);
                upButton.Margin        = ScaledThicknessFactory.GetThickness(2, 0, 2, 0);
                spacerWrapPanel.Children.Add(upButton);

                ImageButton downButton = new ImageButton("down", 0.5);
                downButton.uniqueBuildId = build.uniqueBuildId;
                downButton.MouseDown    += new MouseButtonEventHandler(DownClicked);
                downButton.Margin        = ScaledThicknessFactory.GetThickness(2, 0, 2, 0);
                spacerWrapPanel.Children.Add(downButton);

                OutlinedTextBlock copyFor = new OutlinedTextBlock();
                copyFor.Text            = "COPY FOR";
                copyFor.StrokeThickness = Opt.ApResMod(0.5);
                copyFor.Stroke          = new SolidColorBrush(Color.FromRgb(40, 40, 40));
                copyFor.FontWeight      = FontWeights.Bold;
                copyFor.Fill            = new SolidColorBrush(Color.FromRgb(80, 80, 80));
                copyFor.FontSize        = Opt.ApResMod(15);
                copyFor.FontFamily      = new FontFamily("Segoe UI");
                copyFor.Margin          = ScaledThicknessFactory.GetThickness(2, 3, 2, 0);
                spacerWrapPanel.Children.Add(copyFor);

                ComboBox copyForOption = new ComboBox();
                copyForOption.Items.Add("Vassal 7.0.3+");
                copyForOption.Items.Add("Facebook");
                copyForOption.Items.Add("BBCode");
                copyForOption.Items.Add("Reddit");
                copyForOption.Items.Add("Text");
                copyForOption.HorizontalContentAlignment = HorizontalAlignment.Left;
                copyForOption.VerticalContentAlignment   = VerticalAlignment.Center;
                copyForOption.SelectedIndex = 0;
                copyForOption.FontSize      = Opt.ApResMod(13);
                copyForOption.FontFamily    = new FontFamily("Segoe UI");
                copyForOption.Margin        = ScaledThicknessFactory.GetThickness(2, 3, 2, 3);
                copyForOption.Padding       = ScaledThicknessFactory.GetThickness(3, 0, 3, 0);
                spacerWrapPanel.Children.Add(copyForOption);
                comboBoxes[build.uniqueBuildId] = copyForOption;

                ImageButton copy = new ImageButton("copy", 0.5);
                copy.uniqueBuildId = build.uniqueBuildId;
                copy.MouseDown    += new MouseButtonEventHandler(CopyClicked);
                copy.Margin        = ScaledThicknessFactory.GetThickness(2, 0, 2, 0);
                spacerWrapPanel.Children.Add(copy);

                ImageButton deleteBuildButton = new ImageButton("delete_squad", 0.5);
                deleteBuildButton.uniqueBuildId = build.uniqueBuildId;
                deleteBuildButton.MouseDown    += new MouseButtonEventHandler(DeleteBuildClicked);
                deleteBuildButton.Margin        = ScaledThicknessFactory.GetThickness(2, 0, 2, 0);
                spacerWrapPanel.Children.Add(deleteBuildButton);

                Canvas bottomSpacer = new Canvas();
                bottomSpacer.Width  = 99999;
                bottomSpacer.Height = 1;
                spacerWrapPanel.Children.Add(bottomSpacer);

                OutlinedTextBlock totalCost = new OutlinedTextBlock();
                totalCost.Text            = "TOTAL COST";
                totalCost.StrokeThickness = Opt.ApResMod(0.5);
                totalCost.Stroke          = new SolidColorBrush(Color.FromRgb(40, 40, 40));
                totalCost.FontWeight      = FontWeights.Bold;
                totalCost.Fill            = new SolidColorBrush(Color.FromRgb(80, 80, 80));
                totalCost.FontSize        = Opt.ApResMod(15);
                totalCost.FontFamily      = new FontFamily("Segoe UI");
                totalCost.Margin          = ScaledThicknessFactory.GetThickness(2, 3, 0, 0);
                spacerWrapPanel.Children.Add(totalCost);

                OutlinedTextBlock totalCost2 = new OutlinedTextBlock();
                totalCost2.Text            = ": " + build.totalCost.ToString();
                totalCost2.StrokeThickness = Opt.ApResMod(0.5);
                totalCost2.Stroke          = new SolidColorBrush(Color.FromRgb(40, 40, 40));
                totalCost2.FontWeight      = FontWeights.Bold;
                totalCost2.Fill            = new SolidColorBrush(Color.FromRgb(80, 80, 80));
                totalCost2.FontSize        = Opt.ApResMod(18);
                totalCost2.FontFamily      = new FontFamily("Segoe UI");
                totalCost2.Margin          = ScaledThicknessFactory.GetThickness(2, 0, 0, 0);
                spacerWrapPanel.Children.Add(totalCost2);

                buildWrapPanel.Children.Add(spacerWrapPanel);


                foreach (UniquePilot uniquePilot in build.pilots.Values.OrderByDescending(uniquePilot => uniquePilot.pilot.pilotSkill).ThenByDescending(uniquePilot => uniquePilot.pilot.cost).ToList())
                {
                    StackPanel pilotAndUpgradeInfoStackPanel = new StackPanel();
                    pilotAndUpgradeInfoStackPanel.Orientation = Orientation.Horizontal;


                    StackPanel pilotAndControlls = new StackPanel();
                    pilotAndControlls.Orientation       = Orientation.Vertical;
                    pilotAndControlls.VerticalAlignment = VerticalAlignment.Top;

                    CardCanvas pilotCanvas = uniquePilot.pilot.GetCanvas(pilotCardWidth, pilotCardHeight, new Thickness(2, 2, 2, 2), this);
                    pilotCanvas.AddDeleteButtonEvent(this, build.uniqueBuildId, uniquePilot.id);
                    pilotAndControlls.Children.Add(pilotCanvas);

                    StackPanel controls = new StackPanel();
                    controls.Orientation = Orientation.Horizontal;

                    ImageButton addUpgradeButton = new ImageButton("add_upgrade", 0.5);
                    addUpgradeButton.uniquePilotId = uniquePilot.id;
                    addUpgradeButton.uniqueBuildId = build.uniqueBuildId;
                    addUpgradeButton.MouseDown    += new MouseButtonEventHandler(AddUpgradeClicked);
                    addUpgradeButton.Margin        = ScaledThicknessFactory.GetThickness(2, 10, 2, 0);
                    controls.Children.Add(addUpgradeButton);

                    ImageButton swapPilotButton = new ImageButton("swap_pilot", 0.5);
                    swapPilotButton.uniquePilotId = uniquePilot.id;
                    swapPilotButton.uniqueBuildId = build.uniqueBuildId;
                    swapPilotButton.MouseDown    += new MouseButtonEventHandler(SwapPilotClicked);
                    swapPilotButton.Margin        = ScaledThicknessFactory.GetThickness(2, 10, 2, 0);
                    controls.Children.Add(swapPilotButton);

                    OutlinedTextBlock pilotAndUpgradesCost = new OutlinedTextBlock();
                    pilotAndUpgradesCost.Text            = "COST";
                    pilotAndUpgradesCost.StrokeThickness = Opt.ApResMod(0.5);
                    pilotAndUpgradesCost.Stroke          = new SolidColorBrush(Color.FromRgb(40, 40, 40));
                    pilotAndUpgradesCost.FontWeight      = FontWeights.Bold;
                    pilotAndUpgradesCost.Fill            = new SolidColorBrush(Color.FromRgb(80, 80, 80));
                    pilotAndUpgradesCost.FontSize        = Opt.ApResMod(15);
                    pilotAndUpgradesCost.FontFamily      = new FontFamily("Segoe UI");
                    pilotAndUpgradesCost.Margin          = ScaledThicknessFactory.GetThickness(2, 13, 0, 0);
                    controls.Children.Add(pilotAndUpgradesCost);

                    OutlinedTextBlock pilotAndUpgradesCost2 = new OutlinedTextBlock();
                    pilotAndUpgradesCost2.Text            = ": " + uniquePilot.totalCost.ToString();
                    pilotAndUpgradesCost2.StrokeThickness = Opt.ApResMod(0.5);
                    pilotAndUpgradesCost2.Stroke          = new SolidColorBrush(Color.FromRgb(40, 40, 40));
                    pilotAndUpgradesCost2.FontWeight      = FontWeights.Bold;
                    pilotAndUpgradesCost2.Fill            = new SolidColorBrush(Color.FromRgb(80, 80, 80));
                    pilotAndUpgradesCost2.FontSize        = Opt.ApResMod(18);
                    pilotAndUpgradesCost2.FontFamily      = new FontFamily("Segoe UI");
                    pilotAndUpgradesCost2.Margin          = ScaledThicknessFactory.GetThickness(2, 10, 0, 0);
                    controls.Children.Add(pilotAndUpgradesCost2);

                    pilotAndControlls.Children.Add(controls);
                    pilotAndUpgradeInfoStackPanel.Children.Add(pilotAndControlls);

                    int        currentUpgradeNumber = 0;
                    StackPanel upgradesStackPanel   = new StackPanel();
                    upgradesStackPanel.Orientation       = Orientation.Vertical;
                    upgradesStackPanel.VerticalAlignment = VerticalAlignment.Top;
                    foreach (KeyValuePair <int, Upgrade> upgrade in uniquePilot.upgrades.OrderBy(upgrade => upgrade.Value.upgradeType.ToString()).ThenByDescending(upgrade => upgrade.Value.cost).ThenByDescending(upgrade => upgrade.Value.name))
                    {
                        CardCanvas upgradeCanvas = upgrade.Value.GetCanvas(upgradeCardWidth, upgradeCardHeight, new Thickness(2, 2, 2, 2), this);
                        upgradeCanvas.AddDeleteButtonEvent(this, build.uniqueBuildId, uniquePilot.id);
                        upgradesStackPanel.Children.Add(upgradeCanvas);

                        if (currentUpgradeNumber % 2 == 1)
                        {
                            pilotAndUpgradeInfoStackPanel.Children.Add(upgradesStackPanel);
                            upgradesStackPanel = new StackPanel();
                        }

                        currentUpgradeNumber++;
                    }
                    if (currentUpgradeNumber % 2 == 1)
                    {
                        pilotAndUpgradeInfoStackPanel.Children.Add(upgradesStackPanel);
                    }
                    pilotAndUpgradeInfoStackPanel.Margin = ScaledThicknessFactory.GetThickness(10, 20, 10, 0);
                    buildWrapPanel.Children.Add(pilotAndUpgradeInfoStackPanel);
                }
                contentWrapPanel.Children.Add(buildWrapPanel);
            }
        }
Exemple #7
0
        public void Draw(Canvas canvas, IWidget widget)
        {
            var scaleBar = (ScaleBarWidget)widget;

            if (!scaleBar.CanTransform())
            {
                return;
            }

            _brushScaleBar        = new SolidColorBrush(scaleBar.TextColor.ToXaml());
            _brushScaleBarStroke  = new SolidColorBrush(scaleBar.Halo.ToXaml());
            _brushScaleText       = new SolidColorBrush(scaleBar.TextColor.ToXaml());
            _brushScaleTextStroke = new SolidColorBrush(scaleBar.Halo.ToXaml());

            var textBlock = new OutlinedTextBlock();

            textBlock.Text            = "9999 m";
            textBlock.Fill            = _brushScaleText;
            textBlock.Stroke          = _brushScaleTextStroke;
            textBlock.StrokeThickness = StrokeExternal - StrokeInternal + 1;
            textBlock.FontFamily      = new FontFamily(scaleBar.Font.FontFamily);
            textBlock.FontSize        = scaleBar.Font.Size;
            textBlock.FontWeight      = FontWeights.Bold;

            float  scaleBarLength1;
            string scaleBarText1;
            float  scaleBarLength2;
            string scaleBarText2;

            (scaleBarLength1, scaleBarText1, scaleBarLength2, scaleBarText2) = scaleBar.GetScaleBarLengthAndText();

            // Calc height of scale bar
            Size textSize;

            // Do this, because height of text changes sometimes (e.g. from 2 m to 1 m)
            textSize = textBlock.MeasureText();

            var scaleBarHeight = textSize.Height + (scaleBar.TickLength + StrokeExternal * 0.5f + scaleBar.TextMargin) * scaleBar.Scale;

            if (scaleBar.ScaleBarMode == ScaleBarMode.Both && scaleBar.SecondaryUnitConverter != null)
            {
                scaleBarHeight *= 2;
            }
            else
            {
                scaleBarHeight += StrokeExternal * 0.5f * scaleBar.Scale;
            }

            scaleBar.Height = (float)scaleBarHeight;

            // Draw lines

            // Get lines for scale bar
            var points = scaleBar.GetScaleBarLinePositions(scaleBarLength1, scaleBarLength2, StrokeExternal);

            // BoundingBox for scale bar
            BoundingBox envelop = new BoundingBox();

            if (points != null)
            {
                // Draw outline of lines
                for (int i = 0; i < points.Length; i += 2)
                {
                    var line = new Line();
                    line.X1                 = points[i].X;
                    line.Y1                 = points[i].Y;
                    line.X2                 = points[i + 1].X;
                    line.Y2                 = points[i + 1].Y;
                    line.Stroke             = _brushScaleBarStroke;
                    line.StrokeThickness    = StrokeExternal;
                    line.StrokeStartLineCap = PenLineCap.Square;
                    line.StrokeEndLineCap   = PenLineCap.Square;
                    canvas.Children.Add(line);
                }

                // Draw lines
                for (int i = 0; i < points.Length; i += 2)
                {
                    var line = new Line();
                    line.X1                 = points[i].X;
                    line.Y1                 = points[i].Y;
                    line.X2                 = points[i + 1].X;
                    line.Y2                 = points[i + 1].Y;
                    line.Stroke             = _brushScaleBar;
                    line.StrokeThickness    = StrokeInternal;
                    line.StrokeStartLineCap = PenLineCap.Square;
                    line.StrokeEndLineCap   = PenLineCap.Square;
                    canvas.Children.Add(line);
                }

                envelop = points[0].BoundingBox;

                for (int i = 1; i < points.Length; i++)
                {
                    envelop = envelop.Join(points[i].BoundingBox);
                }

                envelop = envelop.Grow(StrokeExternal * 0.5f * scaleBar.Scale);
            }

            // Draw text

            // Calc text height
            Size textSize1;
            Size textSize2;

            scaleBarText1 = scaleBarText1 ?? string.Empty;
            scaleBarText2 = scaleBarText2 ?? string.Empty;

            textBlock.Text = scaleBarText1;
            textSize1      = textBlock.MeasureText();

            textBlock.Text = scaleBarText2;
            textSize2      = textBlock.MeasureText();

            var boundingBoxText  = new BoundingBox(0, 0, textSize.Width, textSize.Height);
            var boundingBoxText1 = new BoundingBox(0, 0, textSize1.Width, textSize1.Height);
            var boundingBoxText2 = new BoundingBox(0, 0, textSize2.Width, textSize2.Height);

            var(posX1, posY1, posX2, posY2) = scaleBar.GetScaleBarTextPositions(boundingBoxText, boundingBoxText1, boundingBoxText2, StrokeExternal);

            // Now draw text
            textBlock.Text   = scaleBarText1;
            textBlock.Width  = textSize1.Width;
            textBlock.Height = textSize1.Height;

            Canvas.SetLeft(textBlock, posX1);
            Canvas.SetTop(textBlock, posY1);

            canvas.Children.Add(textBlock);

            envelop = envelop.Join(new BoundingBox(posX1, posY1, posX1 + textSize1.Width, posY1 + textSize1.Height));

            if (scaleBar.ScaleBarMode == ScaleBarMode.Both && scaleBar.SecondaryUnitConverter != null)
            {
                textBlock = new OutlinedTextBlock();

                textBlock.Fill            = _brushScaleText;
                textBlock.Stroke          = _brushScaleTextStroke;
                textBlock.StrokeThickness = StrokeExternal - StrokeInternal + 1;
                textBlock.FontFamily      = new FontFamily(scaleBar.Font.FontFamily);
                textBlock.FontSize        = scaleBar.Font.Size;
                textBlock.FontWeight      = FontWeights.Bold;

                textBlock.Text   = scaleBarText2;
                textBlock.Width  = textSize2.Width;
                textBlock.Height = textSize2.Height;

                Canvas.SetLeft(textBlock, posX2);
                Canvas.SetTop(textBlock, posY2);

                canvas.Children.Add(textBlock);

                envelop = envelop.Join(new BoundingBox(posX2, posY2, posX2 + textSize2.Width, posY2 + textSize2.Height));
            }

            scaleBar.Envelope = envelop;

            if (scaleBar.ShowEnvelop)
            {
                // Draw a rect around the scale bar for testing
                var rect = new Rectangle();
                rect.Width           = envelop.MaxX - envelop.MinX;
                rect.Height          = envelop.MaxY - envelop.MinY;
                rect.Stroke          = _brushScaleTextStroke;
                rect.StrokeThickness = 1;
                Canvas.SetLeft(rect, envelop.MinX);
                Canvas.SetTop(rect, envelop.MinY);
                canvas.Children.Add(rect);
            }
        }
Exemple #8
0
        /// <summary>
        /// Draw a right to left danmaku on binding canvas
        /// </summary>
        /// <param name="Content">Danmaku content</param>
        /// <param name="Style">Override default danmaku style if needed</param>
        /// <returns></returns>
        public string DrawDanmaku_R2L(string Content, BaseDanmaku Style = null)
        {
            SolidColorBrush  _FillBrush;
            Duration         _duration;
            DropShadowEffect _ShadowEffect;

            if (Style == null || Style == mDefaultStyle)
            {
                Style         = mDefaultStyle;
                _FillBrush    = mCache_SolidColorBrush;
                _ShadowEffect = mCache_ShadowEffect;
                _duration     = mCache_Duration;
            }
            else
            {
                if (Style.Duration != mDefaultStyle.Duration)
                {
                    _duration = new Duration(TimeSpan.FromMilliseconds(Style.Duration));
                }
                else
                {
                    _duration = mCache_Duration;
                }

                if (Style.ColorR != mDefaultStyle.ColorR || Style.ColorG != mDefaultStyle.ColorG || Style.ColorB != mDefaultStyle.ColorB)
                {
                    _FillBrush    = new SolidColorBrush(Color.FromRgb(Style.ColorR, Style.ColorG, Style.ColorB));
                    _ShadowEffect = mCache_ShadowEffect;
                    if ((Style.ColorR + Style.ColorG + Style.ColorB + 1) / 3 >= 255 / 2)
                    {
                        _ShadowEffect.Color = Color.FromRgb(0, 0, 0);
                    }
                    else
                    {
                        _ShadowEffect.Color = Color.FromRgb(255, 255, 255);
                    }
                }
                else
                {
                    _ShadowEffect = mCache_ShadowEffect;
                    _FillBrush    = mCache_SolidColorBrush;
                }
            }

            OutlinedTextBlock _thisDanmaku = new OutlinedTextBlock();

            _thisDanmaku.Name = "uni_" + Utils.GetRandomString(5);

            // Style
            _thisDanmaku.Text       = Content;
            _thisDanmaku.FontFamily = Style.FontFamily;
            _thisDanmaku.FontSize   = Style.FontSize;
            _thisDanmaku.Fill       = _FillBrush;
            _thisDanmaku.SetValue(Canvas.TopProperty, Style.PositionX);
            _thisDanmaku.SetValue(Canvas.LeftProperty, Style.PositionY);
            _thisDanmaku.FontWeight = FontWeights.Bold;

            if (Style.Shadow)
            {
                _thisDanmaku.Effect = _ShadowEffect;
            }

            // Animation
            _thisDanmaku.Loaded += delegate(object o, RoutedEventArgs e) { AddR2LAnimation(_thisDanmaku.Name, _duration); };

            // Add to canvas
            BindingCanvas.Children.Add(_thisDanmaku);
            BindingCanvas.RegisterName(_thisDanmaku.Name, _thisDanmaku);

            return(_thisDanmaku.Name);
        }
        /// <summary>
        /// Draw a right to left danmaku on binding canvas
        /// </summary>
        /// <param name="Content">Danmaku content</param>
        /// <param name="Style">Override default danmaku style if needed</param>
        /// <returns></returns>
        public string DrawDanmaku_R2L(string Content, BaseDanmaku Style = null)
        {
            SolidColorBrush _FillBrush;
            Duration _duration;
            DropShadowEffect _ShadowEffect;
            if (Style == null || Style == mDefaultStyle) {
                Style = mDefaultStyle;
                _FillBrush = mCache_SolidColorBrush;
                _ShadowEffect = mCache_ShadowEffect;
                _duration = mCache_Duration;
            } else {
                if (Style.Duration != mDefaultStyle.Duration) {
                    _duration = new Duration(TimeSpan.FromMilliseconds(Style.Duration));
                } else {
                    _duration = mCache_Duration;
                }

                if (Style.ColorR != mDefaultStyle.ColorR || Style.ColorG != mDefaultStyle.ColorG || Style.ColorB != mDefaultStyle.ColorB) {
                    _FillBrush = new SolidColorBrush(Color.FromRgb(Style.ColorR, Style.ColorG, Style.ColorB));
                    _ShadowEffect = mCache_ShadowEffect;
                    if ((Style.ColorR + Style.ColorG + Style.ColorB + 1) / 3 >= 255 / 2) {
                        _ShadowEffect.Color = Color.FromRgb(0, 0, 0);
                    } else {
                        _ShadowEffect.Color = Color.FromRgb(255, 255, 255);
                    }
                } else {
                    _ShadowEffect = mCache_ShadowEffect;
                    _FillBrush = mCache_SolidColorBrush;
                }
            }

            OutlinedTextBlock _thisDanmaku = new OutlinedTextBlock();
            _thisDanmaku.Name = "uni_" + Utils.GetRandomString(5);

            // Style
            _thisDanmaku.Text = Content;
            _thisDanmaku.FontFamily = Style.FontFamily;
            _thisDanmaku.FontSize = Style.FontSize;
            _thisDanmaku.Fill = _FillBrush;
            _thisDanmaku.SetValue(Canvas.TopProperty, Style.PositionX);
            _thisDanmaku.SetValue(Canvas.LeftProperty, Style.PositionY);
            _thisDanmaku.FontWeight = FontWeights.Bold;

            if (Style.Shadow) {
                _thisDanmaku.Effect = _ShadowEffect;
            }

            // Animation
            _thisDanmaku.Loaded += delegate (object o, RoutedEventArgs e) { AddR2LAnimation(_thisDanmaku.Name, _duration); };

            // Add to canvas
            BindingCanvas.Children.Add(_thisDanmaku);
            BindingCanvas.RegisterName(_thisDanmaku.Name, _thisDanmaku);

            return _thisDanmaku.Name;
        }