示例#1
0
 public OverlayItemEffects(OverlayEffectEntranceAnimationTypeEnum entrance, OverlayEffectVisibleAnimationTypeEnum visible, OverlayEffectExitAnimationTypeEnum exit, double duration)
 {
     this.EntranceAnimation = entrance;
     this.VisibleAnimation  = visible;
     this.ExitAnimation     = exit;
     this.Duration          = duration;
 }
 public OverlayStreamBoss(string htmlText, int startingHealth, int width, int height, string textColor, string textFont, string borderColor, string backgroundColor,
                          string progressColor, double followBonus, double hostBonus, double subscriberBonus, double donationBonus, double sparkBonus,
                          OverlayEffectVisibleAnimationTypeEnum damageAnimation, OverlayEffectVisibleAnimationTypeEnum newBossAnimation, CustomCommand newStreamBossCommand)
     : base(StreamBossItemType, htmlText)
 {
     this.StartingHealth       = startingHealth;
     this.Width                = width;
     this.Height               = height;
     this.TextColor            = textColor;
     this.TextFont             = textFont;
     this.BorderColor          = borderColor;
     this.BackgroundColor      = backgroundColor;
     this.ProgressColor        = progressColor;
     this.FollowBonus          = followBonus;
     this.HostBonus            = hostBonus;
     this.SubscriberBonus      = subscriberBonus;
     this.DonationBonus        = donationBonus;
     this.SparkBonus           = sparkBonus;
     this.DamageAnimation      = damageAnimation;
     this.NewBossAnimation     = newBossAnimation;
     this.NewStreamBossCommand = newStreamBossCommand;
 }
示例#3
0
        public override OverlayItemBase GetItem()
        {
            if (!int.TryParse(this.StartingHealthTextBox.Text, out int startingHealth) || startingHealth <= 0)
            {
                return(null);
            }

            if (string.IsNullOrEmpty(this.WidthTextBox.Text) || !int.TryParse(this.WidthTextBox.Text, out int width) ||
                string.IsNullOrEmpty(this.HeightTextBox.Text) || !int.TryParse(this.HeightTextBox.Text, out int height))
            {
                return(null);
            }

            string textColor = this.TextColorComboBox.Text;

            if (ColorSchemes.ColorSchemeDictionary.ContainsKey(textColor))
            {
                textColor = ColorSchemes.ColorSchemeDictionary[textColor];
            }

            if (string.IsNullOrEmpty(this.TextFontComboBox.Text))
            {
                return(null);
            }

            string borderColor = this.BorderColorComboBox.Text;

            if (ColorSchemes.ColorSchemeDictionary.ContainsKey(borderColor))
            {
                borderColor = ColorSchemes.ColorSchemeDictionary[borderColor];
            }

            string backgroundColor = this.BackgroundColorComboBox.Text;

            if (ColorSchemes.ColorSchemeDictionary.ContainsKey(backgroundColor))
            {
                backgroundColor = ColorSchemes.ColorSchemeDictionary[backgroundColor];
            }

            string progressColor = this.ProgressColorComboBox.Text;

            if (ColorSchemes.ColorSchemeDictionary.ContainsKey(progressColor))
            {
                progressColor = ColorSchemes.ColorSchemeDictionary[progressColor];
            }

            if (!double.TryParse(this.FollowBonusTextBox.Text, out double followBonus) || followBonus < 0.0)
            {
                return(null);
            }

            if (!double.TryParse(this.HostBonusTextBox.Text, out double hostBonus) || hostBonus < 0.0)
            {
                return(null);
            }

            if (!double.TryParse(this.SubBonusTextBox.Text, out double subBonus) || subBonus < 0.0)
            {
                return(null);
            }

            if (!double.TryParse(this.DonationBonusTextBox.Text, out double donationBonus) || donationBonus < 0.0)
            {
                return(null);
            }

            if (!double.TryParse(this.SparkBonusTextBox.Text, out double sparkBonus) || sparkBonus < 0.0)
            {
                return(null);
            }

            if (string.IsNullOrEmpty(this.HTMLText.Text))
            {
                return(null);
            }

            OverlayEffectVisibleAnimationTypeEnum damageAnimation  = EnumHelper.GetEnumValueFromString <OverlayEffectVisibleAnimationTypeEnum>((string)this.DamageAnimationComboBox.SelectedItem);
            OverlayEffectVisibleAnimationTypeEnum newBossAnimation = EnumHelper.GetEnumValueFromString <OverlayEffectVisibleAnimationTypeEnum>((string)this.NewBossAnimationComboBox.SelectedItem);

            return(new OverlayStreamBoss(this.HTMLText.Text, startingHealth, width, height, textColor, this.TextFontComboBox.Text, borderColor, backgroundColor,
                                         progressColor, followBonus, hostBonus, subBonus, donationBonus, sparkBonus, damageAnimation, newBossAnimation, this.command));
        }
        public override ActionBase GetAction()
        {
            double duration;

            if (double.TryParse(this.DurationTextBox.Text, out duration) && duration > 0 && this.EntranceAnimationComboBox.SelectedIndex >= 0 &&
                this.VisibleAnimationComboBox.SelectedIndex >= 0 && this.ExitAnimationComboBox.SelectedIndex >= 0)
            {
                OverlayEffectEntranceAnimationTypeEnum entrance  = EnumHelper.GetEnumValueFromString <OverlayEffectEntranceAnimationTypeEnum>((string)this.EntranceAnimationComboBox.SelectedItem);
                OverlayEffectVisibleAnimationTypeEnum  animation = EnumHelper.GetEnumValueFromString <OverlayEffectVisibleAnimationTypeEnum>((string)this.VisibleAnimationComboBox.SelectedItem);
                OverlayEffectExitAnimationTypeEnum     exit      = EnumHelper.GetEnumValueFromString <OverlayEffectExitAnimationTypeEnum>((string)this.ExitAnimationComboBox.SelectedItem);

                int horizontal = 0;
                int vertical   = 0;
                if (this.PositionSimpleAdvancedToggleButton.IsChecked.GetValueOrDefault())
                {
                    horizontal = (int)this.HorizontalSlider.Value;
                    vertical   = (int)this.VerticalSlider.Value;
                }
                else
                {
                    if (this.IsSimplePositionButtonSelected(this.TopLeftPositionButton))
                    {
                        horizontal = 25;
                        vertical   = 25;
                    }
                    else if (this.IsSimplePositionButtonSelected(this.TopPositionButton))
                    {
                        horizontal = 50;
                        vertical   = 25;
                    }
                    else if (this.IsSimplePositionButtonSelected(this.TopRightPositionButton))
                    {
                        horizontal = 75;
                        vertical   = 25;
                    }
                    else if (this.IsSimplePositionButtonSelected(this.LeftPositionButton))
                    {
                        horizontal = 25;
                        vertical   = 50;
                    }
                    else if (this.IsSimplePositionButtonSelected(this.CenterPositionButton))
                    {
                        horizontal = 50;
                        vertical   = 50;
                    }
                    else if (this.IsSimplePositionButtonSelected(this.RightPositionButton))
                    {
                        horizontal = 75;
                        vertical   = 50;
                    }
                    else if (this.IsSimplePositionButtonSelected(this.BottomLeftPositionButton))
                    {
                        horizontal = 25;
                        vertical   = 75;
                    }
                    else if (this.IsSimplePositionButtonSelected(this.BottomPositionButton))
                    {
                        horizontal = 50;
                        vertical   = 75;
                    }
                    else if (this.IsSimplePositionButtonSelected(this.BottomRightPositionButton))
                    {
                        horizontal = 75;
                        vertical   = 75;
                    }
                }

                OverlayEffectTypeEnum type = EnumHelper.GetEnumValueFromString <OverlayEffectTypeEnum>((string)this.TypeComboBox.SelectedItem);
                if (type == OverlayEffectTypeEnum.Image)
                {
                    if (!string.IsNullOrEmpty(this.ImageFilePathTextBox.Text))
                    {
                        int width;
                        int height;
                        if (int.TryParse(this.ImageWidthTextBox.Text, out width) && width > 0 &&
                            int.TryParse(this.ImageHeightTextBox.Text, out height) && height > 0)
                        {
                            return(new OverlayAction(new OverlayImageEffect(this.ImageFilePathTextBox.Text, width, height, entrance, animation, exit, duration, horizontal, vertical)));
                        }
                    }
                }
                else if (type == OverlayEffectTypeEnum.Text)
                {
                    if (!string.IsNullOrEmpty(this.TextTextBox.Text) && !string.IsNullOrEmpty(this.FontColorComboBox.Text))
                    {
                        string color = this.FontColorComboBox.Text;
                        if (ColorSchemes.ColorSchemeDictionary.ContainsKey(color))
                        {
                            color = ColorSchemes.ColorSchemeDictionary[color];
                        }

                        if (int.TryParse(this.FontSizeComboBox.Text, out int size) && size > 0)
                        {
                            return(new OverlayAction(new OverlayTextEffect(this.TextTextBox.Text, color, size, entrance, animation, exit, duration, horizontal, vertical)));
                        }
                    }
                }
                else if (type == OverlayEffectTypeEnum.YouTube)
                {
                    if (!string.IsNullOrEmpty(this.YoutubeVideoIDTextBox.Text))
                    {
                        string videoID = this.YoutubeVideoIDTextBox.Text;
                        videoID = videoID.Replace("https://www.youtube.com/watch?v=", "");
                        videoID = videoID.Replace("https://youtu.be/", "");
                        if (videoID.Contains("&"))
                        {
                            videoID = videoID.Substring(0, videoID.IndexOf("&"));
                        }

                        if (int.TryParse(this.YoutubeStartTimeTextBox.Text, out int startTime))
                        {
                            int width;
                            int height;
                            if (int.TryParse(this.YoutubeWidthTextBox.Text, out width) && width > 0 &&
                                int.TryParse(this.YoutubeHeightTextBox.Text, out height) && height > 0)
                            {
                                return(new OverlayAction(new OverlayYoutubeEffect(videoID, startTime, width, height, entrance, animation, exit, duration, horizontal, vertical)));
                            }
                        }
                    }
                }
                else if (type == OverlayEffectTypeEnum.Video)
                {
                    if (!string.IsNullOrEmpty(this.VideoFilePathTextBox.Text))
                    {
                        int width;
                        int height;
                        if (int.TryParse(this.VideoWidthTextBox.Text, out width) && width > 0 &&
                            int.TryParse(this.VideoHeightTextBox.Text, out height) && height > 0)
                        {
                            return(new OverlayAction(new OverlayVideoEffect(this.VideoFilePathTextBox.Text, width, height, entrance, animation, exit, duration, horizontal, vertical)));
                        }
                    }
                }
                else if (type == OverlayEffectTypeEnum.WebPage)
                {
                    if (!string.IsNullOrEmpty(this.WebPageFilePathTextBox.Text))
                    {
                        int width;
                        int height;
                        if (int.TryParse(this.WebPageWidthTextBox.Text, out width) && width > 0 &&
                            int.TryParse(this.WebPageHeightTextBox.Text, out height) && height > 0)
                        {
                            return(new OverlayAction(new OverlayWebPageEffect(this.WebPageFilePathTextBox.Text, width, height, entrance, animation, exit, duration, horizontal, vertical)));
                        }
                    }
                }
                else if (type == OverlayEffectTypeEnum.HTML)
                {
                    if (!string.IsNullOrEmpty(this.HTMLTextBox.Text))
                    {
                        return(new OverlayAction(new OverlayHTMLEffect(this.HTMLTextBox.Text, entrance, animation, exit, duration, horizontal, vertical)));
                    }
                }
            }
            return(null);
        }
        public override ActionBase GetAction()
        {
            string type = (string)this.TypeComboBox.SelectedItem;

            if (!string.IsNullOrEmpty(type))
            {
                if (type.Equals(ShowHideWidgetOption))
                {
                    if (this.WidgetNameComboBox.SelectedIndex >= 0)
                    {
                        OverlayWidget widget = (OverlayWidget)this.WidgetNameComboBox.SelectedItem;
                        return(new OverlayAction(widget.Item.ID, this.ShowHideWidgetCheckBox.IsChecked.GetValueOrDefault()));
                    }
                }
                else
                {
                    OverlayActionTypeEnum overlayType = EnumHelper.GetEnumValueFromString <OverlayActionTypeEnum>(type);

                    if (this.OverlayNameComboBox.SelectedIndex < 0)
                    {
                        return(null);
                    }
                    string overlayName = (string)this.OverlayNameComboBox.SelectedItem;

                    double duration;
                    if (double.TryParse(this.DurationTextBox.Text, out duration) && duration > 0 && this.EntranceAnimationComboBox.SelectedIndex >= 0 &&
                        this.VisibleAnimationComboBox.SelectedIndex >= 0 && this.ExitAnimationComboBox.SelectedIndex >= 0)
                    {
                        OverlayEffectEntranceAnimationTypeEnum entrance = EnumHelper.GetEnumValueFromString <OverlayEffectEntranceAnimationTypeEnum>((string)this.EntranceAnimationComboBox.SelectedItem);
                        OverlayEffectVisibleAnimationTypeEnum  visible  = EnumHelper.GetEnumValueFromString <OverlayEffectVisibleAnimationTypeEnum>((string)this.VisibleAnimationComboBox.SelectedItem);
                        OverlayEffectExitAnimationTypeEnum     exit     = EnumHelper.GetEnumValueFromString <OverlayEffectExitAnimationTypeEnum>((string)this.ExitAnimationComboBox.SelectedItem);

                        OverlayItemEffects effect = new OverlayItemEffects(entrance, visible, exit, duration);

                        OverlayItemPosition position = this.ItemPosition.GetPosition();

                        OverlayItemBase item = null;

                        if (overlayType == OverlayActionTypeEnum.Image)
                        {
                            item = this.ImageItem.GetItem();
                        }
                        else if (overlayType == OverlayActionTypeEnum.Text)
                        {
                            item = this.TextItem.GetItem();
                        }
                        else if (overlayType == OverlayActionTypeEnum.YouTube)
                        {
                            item = this.YouTubeItem.GetItem();
                        }
                        else if (overlayType == OverlayActionTypeEnum.Video)
                        {
                            item = this.VideoItem.GetItem();
                        }
                        else if (overlayType == OverlayActionTypeEnum.WebPage)
                        {
                            item = this.WebPageItem.GetItem();
                        }
                        else if (overlayType == OverlayActionTypeEnum.HTML)
                        {
                            item = this.HTMLItem.GetItem();
                        }

                        if (item != null)
                        {
                            return(new OverlayAction(overlayName, item, position, effect));
                        }
                    }
                }
            }
            return(null);
        }
 public OverlayEffectBase(OverlayEffectTypeEnum effectType, OverlayEffectEntranceAnimationTypeEnum entrance, OverlayEffectVisibleAnimationTypeEnum visible,
                          OverlayEffectExitAnimationTypeEnum exit, double duration, int horizontal, int vertical)
 {
     this.EffectType        = effectType;
     this.EntranceAnimation = entrance;
     this.VisibleAnimation  = visible;
     this.ExitAnimation     = exit;
     this.Duration          = duration;
     this.Horizontal        = horizontal;
     this.Vertical          = vertical;
 }
 public OverlayWebPageEffect(string url, int width, int height, OverlayEffectEntranceAnimationTypeEnum entrance, OverlayEffectVisibleAnimationTypeEnum visible,
                             OverlayEffectExitAnimationTypeEnum exit, double duration, int horizontal, int vertical)
     : base(OverlayEffectTypeEnum.WebPage, entrance, visible, exit, duration, horizontal, vertical)
 {
     this.URL    = url;
     this.Width  = width;
     this.Height = height;
 }
 public OverlayHTMLEffect(string htmlText, OverlayEffectEntranceAnimationTypeEnum entrance, OverlayEffectVisibleAnimationTypeEnum visible, OverlayEffectExitAnimationTypeEnum exit,
                          double duration, int horizontal, int vertical)
     : base(OverlayEffectTypeEnum.HTML, entrance, visible, exit, duration, horizontal, vertical)
 {
     this.HTMLText = htmlText;
 }
 public OverlayYoutubeEffect(string id, int startTime, int width, int height, OverlayEffectEntranceAnimationTypeEnum entrance, OverlayEffectVisibleAnimationTypeEnum visible,
                             OverlayEffectExitAnimationTypeEnum exit, double duration, int horizontal, int vertical)
     : base(OverlayEffectTypeEnum.YouTube, entrance, visible, exit, duration, horizontal, vertical)
 {
     this.ID        = id;
     this.StartTime = startTime;
     this.Width     = width;
     this.Height    = height;
 }
 public OverlayVideoEffect(string filepath, int width, int height, OverlayEffectEntranceAnimationTypeEnum entrance, OverlayEffectVisibleAnimationTypeEnum visible,
                           OverlayEffectExitAnimationTypeEnum exit, double duration, int horizontal, int vertical)
     : base(OverlayEffectTypeEnum.Video, entrance, visible, exit, duration, horizontal, vertical)
 {
     this.FilePath = filepath;
     this.Width    = width;
     this.Height   = height;
     this.ID       = Guid.NewGuid().ToString().Replace("-", string.Empty);
 }
 public OverlayTextEffect(string text, string color, int size, OverlayEffectEntranceAnimationTypeEnum entrance, OverlayEffectVisibleAnimationTypeEnum visible,
                          OverlayEffectExitAnimationTypeEnum exit, double duration, int horizontal, int vertical)
     : base(OverlayEffectTypeEnum.Text, entrance, visible, exit, duration, horizontal, vertical)
 {
     this.Text  = text;
     this.Color = color;
     this.Size  = size;
 }