Esempio n. 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 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 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;
 }
 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 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;
 }
Esempio n. 6
0
 public OverlayMixerClip(int width, int height, int volume, OverlayEffectEntranceAnimationTypeEnum entrance, OverlayEffectExitAnimationTypeEnum exit)
     : base(OverlayMixerClip.MixerClipItemType)
 {
     this.Width             = width;
     this.Height            = height;
     this.Volume            = volume;
     this.EntranceAnimation = entrance;
     this.ExitAnimation     = exit;
 }
 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;
 }
Esempio n. 8
0
        public override OverlayItemBase GetItem()
        {
            if (string.IsNullOrEmpty(this.TotalToShowTextBox.Text) || !int.TryParse(this.TotalToShowTextBox.Text, out int totalToShow) || totalToShow <= 0)
            {
                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 textColor = this.TextColorComboBox.Text;

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

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

            if (string.IsNullOrEmpty(this.TextSizeTextBox.Text) || !int.TryParse(this.TextSizeTextBox.Text, out int textSize))
            {
                return(null);
            }

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

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

            OverlayEffectEntranceAnimationTypeEnum addEventAnimation = EnumHelper.GetEnumValueFromString <OverlayEffectEntranceAnimationTypeEnum>((string)this.AddEventAnimationComboBox.SelectedItem);

            return(new OverlayChatMessages(this.HTMLText.Text, totalToShow, width, borderColor, backgroundColor, textColor, this.TextFontComboBox.Text,
                                           textSize, addEventAnimation));
        }
Esempio n. 9
0
 public OverlayChatMessages(string htmlText, int totalToShow, int width, string borderColor, string backgroundColor, string textColor,
                            string textFont, int textSize, OverlayEffectEntranceAnimationTypeEnum addEventAnimation)
     : base(ChatMessagesItemType, htmlText)
 {
     this.TotalToShow       = totalToShow;
     this.Width             = width;
     this.BorderColor       = borderColor;
     this.BackgroundColor   = backgroundColor;
     this.TextColor         = textColor;
     this.TextFont          = textFont;
     this.TextSize          = textSize;
     this.AddEventAnimation = addEventAnimation;
 }
Esempio n. 10
0
 public OverlayGameQueue(string htmlText, int totalToShow, string textFont, int width, int height, string borderColor, string backgroundColor, string textColor,
                         OverlayEffectEntranceAnimationTypeEnum addEventAnimation, OverlayEffectExitAnimationTypeEnum removeEventAnimation)
     : base(GameQueueItemType, htmlText)
 {
     this.TotalToShow          = totalToShow;
     this.TextFont             = textFont;
     this.Width                = width;
     this.Height               = height;
     this.BorderColor          = borderColor;
     this.BackgroundColor      = backgroundColor;
     this.TextColor            = textColor;
     this.AddEventAnimation    = addEventAnimation;
     this.RemoveEventAnimation = removeEventAnimation;
 }
 public OverlayLeaderboard(string htmlText, LeaderboardTypeEnum leaderboardType, int totalToShow, string borderColor, string backgroundColor, string textColor,
                           string textFont, int width, int height, OverlayEffectEntranceAnimationTypeEnum addEvent, OverlayEffectExitAnimationTypeEnum removeEvent)
     : base(LeaderboardItemType, htmlText)
 {
     this.LeaderboardType      = leaderboardType;
     this.TotalToShow          = totalToShow;
     this.BorderColor          = borderColor;
     this.BackgroundColor      = backgroundColor;
     this.TextColor            = textColor;
     this.TextFont             = textFont;
     this.Width                = width;
     this.Height               = height;
     this.AddEventAnimation    = addEvent;
     this.RemoveEventAnimation = removeEvent;
 }
        public override OverlayItemBase GetItem()
        {
            int width;
            int height;

            if (int.TryParse(this.VideoWidthTextBox.Text, out width) && width > 0 &&
                int.TryParse(this.VideoHeightTextBox.Text, out height) && height > 0)
            {
                OverlayEffectEntranceAnimationTypeEnum entranceEventAnimation = EnumHelper.GetEnumValueFromString <OverlayEffectEntranceAnimationTypeEnum>((string)this.EntranceAnimationComboBox.SelectedItem);
                OverlayEffectExitAnimationTypeEnum     exitEventAnimation     = EnumHelper.GetEnumValueFromString <OverlayEffectExitAnimationTypeEnum>((string)this.ExitAnimationComboBox.SelectedItem);

                return(new OverlayMixerClip(width, height, (int)this.VideoVolumeSlider.Value, entranceEventAnimation, exitEventAnimation));
            }
            return(null);
        }
        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);
        }
        private static async Task Version11Upgrade(int version, string filePath)
        {
            if (version < 11)
            {
                string data = File.ReadAllText(filePath);
                data = data.Replace("MixItUp.Base.Actions.OverlayAction, MixItUp.Base", "MixItUp.Desktop.Services.LegacyOverlayAction, MixItUp.Desktop");
                DesktopChannelSettings legacySettings = SerializerHelper.DeserializeFromString <DesktopChannelSettings>(data);
                await ChannelSession.Services.Settings.Initialize(legacySettings);

                Dictionary <Guid, LegacyOverlayAction> legacyOverlayActions = new Dictionary <Guid, LegacyOverlayAction>();

                List <CommandBase> commands = new List <CommandBase>();
                commands.AddRange(legacySettings.ChatCommands);
                commands.AddRange(legacySettings.EventCommands);
                commands.AddRange(legacySettings.InteractiveCommands);
                commands.AddRange(legacySettings.TimerCommands);
                commands.AddRange(legacySettings.ActionGroupCommands);
                commands.AddRange(legacySettings.GameCommands);
                commands.AddRange(legacySettings.RemoteCommands);
                foreach (CommandBase command in commands)
                {
                    foreach (ActionBase action in command.Actions)
                    {
                        if (action is LegacyOverlayAction)
                        {
                            legacyOverlayActions[action.ID] = (LegacyOverlayAction)action;
                        }
                    }
                }

                DesktopChannelSettings settings = await SerializerHelper.DeserializeFromFile <LegacyDesktopChannelSettings>(filePath);

                await ChannelSession.Services.Settings.Initialize(settings);

                commands.Clear();
                commands.AddRange(settings.ChatCommands);
                commands.AddRange(settings.EventCommands);
                commands.AddRange(settings.InteractiveCommands);
                commands.AddRange(settings.TimerCommands);
                commands.AddRange(settings.ActionGroupCommands);
                commands.AddRange(settings.GameCommands);
                commands.AddRange(settings.RemoteCommands);
                foreach (CommandBase command in commands)
                {
                    foreach (ActionBase action in command.Actions)
                    {
                        if (action is OverlayAction && legacyOverlayActions.ContainsKey(action.ID))
                        {
                            OverlayAction       overlayAction       = (OverlayAction)action;
                            LegacyOverlayAction legacyOverlayAction = legacyOverlayActions[action.ID];

                            OverlayEffectEntranceAnimationTypeEnum entrance = OverlayEffectEntranceAnimationTypeEnum.None;
                            OverlayEffectExitAnimationTypeEnum     exit     = OverlayEffectExitAnimationTypeEnum.None;
                            if (legacyOverlayAction.FadeDuration > 0)
                            {
                                entrance = OverlayEffectEntranceAnimationTypeEnum.FadeIn;
                                exit     = OverlayEffectExitAnimationTypeEnum.FadeOut;
                            }

                            if (!string.IsNullOrEmpty(legacyOverlayAction.ImagePath))
                            {
                                overlayAction.Effect = new OverlayImageEffect(legacyOverlayAction.ImagePath, legacyOverlayAction.ImageWidth, legacyOverlayAction.ImageHeight,
                                                                              entrance, OverlayEffectVisibleAnimationTypeEnum.None, exit, legacyOverlayAction.Duration, legacyOverlayAction.Horizontal, legacyOverlayAction.Vertical);
                            }
                            else if (!string.IsNullOrEmpty(legacyOverlayAction.Text))
                            {
                                overlayAction.Effect = new OverlayTextEffect(legacyOverlayAction.Text, legacyOverlayAction.Color, legacyOverlayAction.FontSize,
                                                                             entrance, OverlayEffectVisibleAnimationTypeEnum.None, exit, legacyOverlayAction.Duration, legacyOverlayAction.Horizontal, legacyOverlayAction.Vertical);
                            }
                            else if (!string.IsNullOrEmpty(legacyOverlayAction.youtubeVideoID))
                            {
                                overlayAction.Effect = new OverlayYoutubeEffect(legacyOverlayAction.youtubeVideoID, legacyOverlayAction.youtubeStartTime, legacyOverlayAction.VideoWidth,
                                                                                legacyOverlayAction.VideoHeight, entrance, OverlayEffectVisibleAnimationTypeEnum.None, exit, legacyOverlayAction.Duration, legacyOverlayAction.Horizontal,
                                                                                legacyOverlayAction.Vertical);
                            }
                            else if (!string.IsNullOrEmpty(legacyOverlayAction.localVideoFilePath))
                            {
                                overlayAction.Effect = new OverlayVideoEffect(legacyOverlayAction.localVideoFilePath, legacyOverlayAction.VideoWidth, legacyOverlayAction.VideoHeight,
                                                                              entrance, OverlayEffectVisibleAnimationTypeEnum.None, exit, legacyOverlayAction.Duration, legacyOverlayAction.Horizontal, legacyOverlayAction.Vertical);
                            }
                            else if (!string.IsNullOrEmpty(legacyOverlayAction.HTMLText))
                            {
                                overlayAction.Effect = new OverlayHTMLEffect(legacyOverlayAction.HTMLText, entrance, OverlayEffectVisibleAnimationTypeEnum.None, exit, legacyOverlayAction.Duration,
                                                                             legacyOverlayAction.Horizontal, legacyOverlayAction.Vertical);
                            }
                        }
                        else if (action is CounterAction)
                        {
                            CounterAction counterAction = (CounterAction)action;
                            if (counterAction.SaveToFile)
                            {
                                counterAction.ResetOnLoad = !counterAction.ResetOnLoad;
                            }
                        }
                    }
                }

                await ChannelSession.Services.Settings.Save(settings);
            }
        }
Esempio n. 15
0
        public override OverlayItemBase GetItem()
        {
            if (this.LeaderboardTypeComboBox.SelectedIndex < 0)
            {
                return(null);
            }
            LeaderboardTypeEnum leaderboardType = EnumHelper.GetEnumValueFromString <LeaderboardTypeEnum>((string)this.LeaderboardTypeComboBox.SelectedItem);

            if (string.IsNullOrEmpty(this.TotalToShowTextBox.Text) || !int.TryParse(this.TotalToShowTextBox.Text, out int totalToShow) || totalToShow <= 0)
            {
                return(null);
            }

            string borderColor = this.BorderColorComboBox.Text;

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

            string backgroundColor = this.BackgroundColorComboBox.Text;

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

            string textColor = this.TextColorComboBox.Text;

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

            if (string.IsNullOrEmpty(this.TextFontComboBox.Text))
            {
                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);
            }

            OverlayEffectEntranceAnimationTypeEnum addEventAnimation    = EnumHelper.GetEnumValueFromString <OverlayEffectEntranceAnimationTypeEnum>((string)this.AddEventAnimationComboBox.SelectedItem);
            OverlayEffectExitAnimationTypeEnum     removeEventAnimation = EnumHelper.GetEnumValueFromString <OverlayEffectExitAnimationTypeEnum>((string)this.RemoveEventAnimationComboBox.SelectedItem);

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

            if (leaderboardType == LeaderboardTypeEnum.CurrencyRank)
            {
                if (this.CurrencyRankComboBox.SelectedIndex < 0)
                {
                    return(null);
                }
                return(new OverlayLeaderboard(this.HTMLText.Text, leaderboardType, totalToShow, borderColor, backgroundColor, textColor, this.TextFontComboBox.Text, width, height,
                                              addEventAnimation, removeEventAnimation, (UserCurrencyViewModel)this.CurrencyRankComboBox.SelectedItem));
            }
            else if (leaderboardType == LeaderboardTypeEnum.Sparks || leaderboardType == LeaderboardTypeEnum.Embers)
            {
                if (this.SparkEmberDateComboBox.SelectedIndex < 0)
                {
                    return(null);
                }
                return(new OverlayLeaderboard(this.HTMLText.Text, leaderboardType, totalToShow, borderColor, backgroundColor, textColor, this.TextFontComboBox.Text, width, height,
                                              addEventAnimation, removeEventAnimation, EnumHelper.GetEnumValueFromString <LeaderboardSparksEmbersDateEnum>(this.SparkEmberDateComboBox.SelectedItem as string)));
            }
            else
            {
                return(new OverlayLeaderboard(this.HTMLText.Text, leaderboardType, totalToShow, borderColor, backgroundColor, textColor, this.TextFontComboBox.Text, width, height,
                                              addEventAnimation, removeEventAnimation));
            }
        }
        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);
        }
Esempio n. 17
0
 public OverlayLeaderboard(string htmlText, LeaderboardTypeEnum leaderboardType, int totalToShow, string borderColor, string backgroundColor, string textColor,
                           string textFont, int width, int height, OverlayEffectEntranceAnimationTypeEnum addEvent, OverlayEffectExitAnimationTypeEnum removeEvent, LeaderboardSparksEmbersDateEnum date)
     : this(htmlText, leaderboardType, totalToShow, borderColor, backgroundColor, textColor, textFont, width, height, addEvent, removeEvent)
 {
     this.DateRange = date;
 }
 public OverlayLeaderboard(string htmlText, LeaderboardTypeEnum leaderboardType, int totalToShow, string borderColor, string backgroundColor, string textColor,
                           string textFont, int width, int height, OverlayEffectEntranceAnimationTypeEnum addEvent, OverlayEffectExitAnimationTypeEnum removeEvent, UserCurrencyViewModel currency)
     : this(htmlText, leaderboardType, totalToShow, borderColor, backgroundColor, textColor, textFont, width, height, addEvent, removeEvent)
 {
     this.CurrencyID = currency.ID;
 }
 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 override OverlayItemBase GetItem()
        {
            List <EventListItemTypeEnum> eventTypes = new List <EventListItemTypeEnum>();

            if (this.ShowFollowsCheckBox.IsChecked.GetValueOrDefault())
            {
                eventTypes.Add(EventListItemTypeEnum.Followers);
            }
            if (this.ShowHostsCheckBox.IsChecked.GetValueOrDefault())
            {
                eventTypes.Add(EventListItemTypeEnum.Hosts);
            }
            if (this.ShowSubsResubsCheckBox.IsChecked.GetValueOrDefault())
            {
                eventTypes.Add(EventListItemTypeEnum.Subscribers);
            }
            if (this.ShowDonationsCheckBox.IsChecked.GetValueOrDefault())
            {
                eventTypes.Add(EventListItemTypeEnum.Donations);
            }
            if (this.ShowMilestonesCheckBox.IsChecked.GetValueOrDefault())
            {
                eventTypes.Add(EventListItemTypeEnum.Milestones);
            }

            if (eventTypes.Count == 0)
            {
                return(null);
            }

            if (string.IsNullOrEmpty(this.TotalToShowTextBox.Text) || !int.TryParse(this.TotalToShowTextBox.Text, out int totalToShow) || totalToShow <= 0)
            {
                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 textColor = this.TextColorComboBox.Text;

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

            if (string.IsNullOrEmpty(this.TextFontComboBox.Text))
            {
                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);
            }

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

            OverlayEffectEntranceAnimationTypeEnum addEventAnimation    = EnumHelper.GetEnumValueFromString <OverlayEffectEntranceAnimationTypeEnum>((string)this.AddEventAnimationComboBox.SelectedItem);
            OverlayEffectExitAnimationTypeEnum     removeEventAnimation = EnumHelper.GetEnumValueFromString <OverlayEffectExitAnimationTypeEnum>((string)this.RemoveEventAnimationComboBox.SelectedItem);

            return(new OverlayEventList(this.HTMLText.Text, eventTypes, totalToShow, this.ResetOnLoadCheckBox.IsChecked.GetValueOrDefault(), this.TextFontComboBox.Text, width, height,
                                        borderColor, backgroundColor, textColor, addEventAnimation, removeEventAnimation));
        }
 public OverlayEventList(string htmlText, IEnumerable <EventListItemTypeEnum> itemTypes, int totalToShow, bool resetOnLoad, string textFont, int width, int height,
                         string borderColor, string backgroundColor, string textColor, OverlayEffectEntranceAnimationTypeEnum addEventAnimation, OverlayEffectExitAnimationTypeEnum removeEventAnimation)
     : base(EventListItemType, htmlText)
 {
     this.ItemTypes            = new List <EventListItemTypeEnum>(itemTypes);
     this.TotalToShow          = totalToShow;
     this.ResetOnLoad          = resetOnLoad;
     this.TextFont             = textFont;
     this.Width                = width;
     this.Height               = height;
     this.BorderColor          = borderColor;
     this.BackgroundColor      = backgroundColor;
     this.TextColor            = textColor;
     this.AddEventAnimation    = addEventAnimation;
     this.RemoveEventAnimation = removeEventAnimation;
 }