Esempio n. 1
0
 public override void SetItem(OverlayItemBase item)
 {
     this.item = (OverlayImageItem)item;
     this.ImageFilePathTextBox.Text = this.item.FilePath;
     this.ImageWidthTextBox.Text    = this.item.Width.ToString();
     this.ImageHeightTextBox.Text   = this.item.Height.ToString();
 }
        public override void SetItem(OverlayItemBase item)
        {
            this.item = (OverlayGameStats)item;

            this.GameComboBox.SelectedItem     = this.item.Setup.Name;
            this.CategoryComboBox.SelectedItem = this.item.Setup.Category;

            this.UsernameTextBox.Text          = this.item.Setup.Username;
            this.PlatformComboBox.SelectedItem = EnumHelper.GetEnumName(this.item.Setup.Platform);

            this.BorderColorComboBox.Text = this.item.BorderColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.BorderColor))
            {
                this.BorderColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.BorderColor)).Key;
            }

            this.BackgroundColorComboBox.Text = this.item.BackgroundColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.BackgroundColor))
            {
                this.BackgroundColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.BackgroundColor)).Key;
            }

            this.TextColorComboBox.Text = this.item.TextColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.TextColor))
            {
                this.TextColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.TextColor)).Key;
            }

            this.TextFontComboBox.Text = this.item.TextFont;
            this.TextSizeComboBox.Text = this.item.TextSize.ToString();

            this.HTMLText.Text = this.item.HTMLText;
        }
        public override void SetItem(OverlayItemBase item)
        {
            this.item = (OverlayProgressBar)item;

            this.GoalTypeComboBox.SelectedItem = EnumHelper.GetEnumName(this.item.ProgressBarType);

            if (!string.IsNullOrEmpty(this.item.CurrentAmountCustom))
            {
                this.StartingAmountTextBox.Text = this.item.CurrentAmountCustom.ToString();
            }
            else
            {
                this.StartingAmountTextBox.Text = this.item.CurrentAmountNumber.ToString();
            }

            if (this.item.ProgressBarType == ProgressBarTypeEnum.Followers && this.item.CurrentAmountNumber < 0)
            {
                this.TotalFollowsCheckBox.IsChecked = true;
                this.StartingAmountTextBox.Text     = "0";
            }

            if (!string.IsNullOrEmpty(this.item.GoalAmountCustom))
            {
                this.GoalAmountTextBox.Text = this.item.GoalAmountCustom.ToString();
            }
            else
            {
                this.GoalAmountTextBox.Text = this.item.GoalAmountNumber.ToString();
            }

            this.ResetAfterDaysTextBox.Text = this.item.ResetAfterDays.ToString();

            this.ProgressColorComboBox.Text = this.item.ProgressColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.ProgressColor))
            {
                this.ProgressColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.ProgressColor)).Key;
            }

            this.BackgroundColorComboBox.Text = this.item.BackgroundColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.BackgroundColor))
            {
                this.BackgroundColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.BackgroundColor)).Key;
            }

            this.TextColorComboBox.Text = this.item.TextColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.TextColor))
            {
                this.TextColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.TextColor)).Key;
            }

            this.TextFontComboBox.Text = this.item.TextFont;

            this.WidthTextBox.Text  = this.item.Width.ToString();
            this.HeightTextBox.Text = this.item.Height.ToString();

            this.HTMLText.Text = this.item.HTMLText;

            this.command = this.item.GoalReachedCommand;
            this.UpdateChangedCommand();
        }
Esempio n. 4
0
        public override void SetItem(OverlayItemBase item)
        {
            this.item = (OverlayGameQueue)item;

            this.TotalToShowTextBox.Text = this.item.TotalToShow.ToString();

            this.WidthTextBox.Text  = this.item.Width.ToString();
            this.HeightTextBox.Text = this.item.Height.ToString();

            this.TextFontComboBox.Text = this.item.TextFont;

            this.BorderColorComboBox.Text = this.item.BorderColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.BorderColor))
            {
                this.BorderColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.BorderColor)).Key;
            }

            this.BackgroundColorComboBox.Text = this.item.BackgroundColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.BackgroundColor))
            {
                this.BackgroundColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.BackgroundColor)).Key;
            }

            this.TextColorComboBox.Text = this.item.TextColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.TextColor))
            {
                this.TextColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.TextColor)).Key;
            }

            this.AddEventAnimationComboBox.SelectedItem    = EnumHelper.GetEnumName(this.item.AddEventAnimation);
            this.RemoveEventAnimationComboBox.SelectedItem = EnumHelper.GetEnumName(this.item.RemoveEventAnimation);

            this.HTMLText.Text = this.item.HTMLText;
        }
 public override void SetItem(OverlayItemBase item)
 {
     this.item = (OverlayVideoItem)item;
     this.VideoFilePathTextBox.Text = this.item.FilePath;
     this.VideoWidthTextBox.Text    = this.item.Width.ToString();
     this.VideoHeightTextBox.Text   = this.item.Height.ToString();
     this.VideoVolumeSlider.Value   = this.item.Volume;
 }
Esempio n. 6
0
 public OverlayAction(string overlayName, OverlayItemBase item, OverlayItemPosition position, OverlayItemEffects effects)
     : this()
 {
     this.OverlayName = overlayName;
     this.Item        = item;
     this.Position    = position;
     this.Effects     = effects;
 }
 public override void SetItem(OverlayItemBase item)
 {
     this.item = (OverlayYouTubeItem)item;
     this.YoutubeVideoIDTextBox.Text   = this.item.VideoID;
     this.YoutubeStartTimeTextBox.Text = this.item.StartTime.ToString();
     this.YouTubeWidthTextBox.Text     = this.item.Width.ToString();
     this.YouTubeHeightTextBox.Text    = this.item.Height.ToString();
     this.YouTubeVolumeSlider.Value    = this.item.Volume;
 }
        public override void SetItem(OverlayItemBase item)
        {
            this.item = (OverlayMixerClip)item;

            this.VideoWidthTextBox.Text  = this.item.Width.ToString();
            this.VideoHeightTextBox.Text = this.item.Height.ToString();
            this.VideoVolumeSlider.Value = this.item.Volume;

            this.EntranceAnimationComboBox.SelectedItem = EnumHelper.GetEnumName(this.item.EntranceAnimation);
            this.ExitAnimationComboBox.SelectedItem     = EnumHelper.GetEnumName(this.item.ExitAnimation);
        }
        private async Task WidgetsBackgroundUpdate()
        {
            await BackgroundTaskWrapper.RunBackgroundTask(this.backgroundThreadCancellationTokenSource, async (tokenSource) =>
            {
                tokenSource.Token.ThrowIfCancellationRequested();

                UserViewModel user = await ChannelSession.GetCurrentUser();

                foreach (var widgetGroup in ChannelSession.Settings.OverlayWidgets.GroupBy(ow => ow.OverlayName))
                {
                    IOverlayService overlay = this.GetOverlay(widgetGroup.Key);
                    if (overlay != null)
                    {
                        overlay.StartBatching();
                        foreach (OverlayWidget widget in widgetGroup)
                        {
                            try
                            {
                                if (widget.IsEnabled)
                                {
                                    bool isInitialized = widget.Item.IsInitialized;

                                    if (!isInitialized)
                                    {
                                        await widget.Item.Initialize();
                                    }

                                    if (!isInitialized || !widget.DontRefresh)
                                    {
                                        OverlayItemBase item = await widget.Item.GetProcessedItem(user, new List <string>(), new Dictionary <string, string>());
                                        if (item != null)
                                        {
                                            await overlay.SendItem(item, widget.Position, new OverlayItemEffects());
                                        }
                                    }
                                }
                                else
                                {
                                    await widget.Item.Disable();
                                }
                            }
                            catch (Exception ex) { Logger.Log(ex); }
                        }
                        await overlay.EndBatching();
                    }
                }

                await Task.Delay(ChannelSession.Settings.OverlayWidgetRefreshTime * 1000);
            });
        }
        public override void SetItem(OverlayItemBase item)
        {
            this.item = (OverlayStreamBoss)item;

            this.StartingHealthTextBox.Text = this.item.StartingHealth.ToString();

            this.WidthTextBox.Text  = this.item.Width.ToString();
            this.HeightTextBox.Text = this.item.Height.ToString();

            this.TextFontComboBox.Text  = this.item.TextFont;
            this.TextColorComboBox.Text = this.item.TextColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.TextColor))
            {
                this.TextColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.TextColor)).Key;
            }

            this.BorderColorComboBox.Text = this.item.BorderColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.BorderColor))
            {
                this.BorderColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.BorderColor)).Key;
            }

            this.BackgroundColorComboBox.Text = this.item.BackgroundColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.BackgroundColor))
            {
                this.BackgroundColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.BackgroundColor)).Key;
            }

            this.ProgressColorComboBox.Text = this.item.ProgressColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.ProgressColor))
            {
                this.ProgressColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.ProgressColor)).Key;
            }

            this.DamageAnimationComboBox.SelectedItem  = EnumHelper.GetEnumName(this.item.DamageAnimation);
            this.NewBossAnimationComboBox.SelectedItem = EnumHelper.GetEnumName(this.item.NewBossAnimation);

            this.FollowBonusTextBox.Text   = this.item.FollowBonus.ToString();
            this.HostBonusTextBox.Text     = this.item.HostBonus.ToString();
            this.SubBonusTextBox.Text      = this.item.SubscriberBonus.ToString();
            this.DonationBonusTextBox.Text = this.item.DonationBonus.ToString();
            this.SparkBonusTextBox.Text    = this.item.SparkBonus.ToString();
            this.EmberBonusTextBox.Text    = this.item.EmberBonus.ToString();

            this.HTMLText.Text = this.item.HTMLText;

            this.command = this.item.NewStreamBossCommand;
            this.UpdateChangedCommand();
        }
Esempio n. 11
0
        private async Task SendEffectPacket(string type, OverlayItemBase item, OverlayItemPosition position, OverlayItemEffects effects)
        {
            JObject jobj = new JObject();

            if (effects != null)
            {
                jobj.Merge(JObject.FromObject(effects));
            }
            if (position != null)
            {
                jobj.Merge(JObject.FromObject(position));
            }
            jobj.Merge(JObject.FromObject(item));
            await this.SendPacket(type, jobj);
        }
Esempio n. 12
0
        public async Task SendItem(OverlayItemBase item, OverlayItemPosition position, OverlayItemEffects effects)
        {
            if (item is OverlayImageItem)
            {
                OverlayImageItem imageItem = (OverlayImageItem)item;
                this.httpListenerServer.SetLocalFile(imageItem.FileID, imageItem.FilePath);
            }
            else if (item is OverlayVideoItem)
            {
                OverlayVideoItem videoItem = (OverlayVideoItem)item;
                this.httpListenerServer.SetLocalFile(videoItem.FileID, videoItem.FilePath);
            }

            await this.SendEffectPacket(item.ItemType, item, position, effects);
        }
Esempio n. 13
0
        public override void SetItem(OverlayItemBase item)
        {
            this.item = (OverlayLeaderboard)item;

            this.LeaderboardTypeComboBox.SelectedItem = EnumHelper.GetEnumName(this.item.LeaderboardType);
            if (this.item.LeaderboardType == LeaderboardTypeEnum.CurrencyRank && ChannelSession.Settings.Currencies.ContainsKey(this.item.CurrencyID))
            {
                this.CurrencyRankComboBox.SelectedItem = ChannelSession.Settings.Currencies[this.item.CurrencyID];
            }

            if (this.item.LeaderboardType == LeaderboardTypeEnum.Sparks || this.item.LeaderboardType == LeaderboardTypeEnum.Embers)
            {
                this.SparkEmberDateComboBox.SelectedItem = EnumHelper.GetEnumName(this.item.DateRange);
            }

            this.TotalToShowTextBox.Text = this.item.TotalToShow.ToString();

            this.WidthTextBox.Text  = this.item.Width.ToString();
            this.HeightTextBox.Text = this.item.Height.ToString();

            this.TextFontComboBox.Text = this.item.TextFont;

            this.BorderColorComboBox.Text = this.item.BorderColor;
            if (ColorSchemes.HTMLColorSchemeDictionary.ContainsValue(this.item.BorderColor))
            {
                this.BorderColorComboBox.Text = ColorSchemes.HTMLColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.BorderColor)).Key;
            }

            this.BackgroundColorComboBox.Text = this.item.BackgroundColor;
            if (ColorSchemes.HTMLColorSchemeDictionary.ContainsValue(this.item.BackgroundColor))
            {
                this.BackgroundColorComboBox.Text = ColorSchemes.HTMLColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.BackgroundColor)).Key;
            }

            this.TextColorComboBox.Text = this.item.TextColor;
            if (ColorSchemes.HTMLColorSchemeDictionary.ContainsValue(this.item.TextColor))
            {
                this.TextColorComboBox.Text = ColorSchemes.HTMLColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.TextColor)).Key;
            }

            this.AddEventAnimationComboBox.SelectedItem    = EnumHelper.GetEnumName(this.item.AddEventAnimation);
            this.RemoveEventAnimationComboBox.SelectedItem = EnumHelper.GetEnumName(this.item.RemoveEventAnimation);

            this.HTMLText.Text = this.item.HTMLText;
        }
Esempio n. 14
0
        protected override async Task PerformInternal(UserViewModel user, IEnumerable <string> arguments)
        {
            if (this.WidgetID != Guid.Empty)
            {
                OverlayWidget widget = ChannelSession.Settings.OverlayWidgets.FirstOrDefault(w => w.Item.ID.Equals(this.WidgetID));
                if (widget != null)
                {
                    widget.IsEnabled = this.ShowWidget;
                    if (!widget.IsEnabled)
                    {
                        IOverlayService overlay = ChannelSession.Services.OverlayServers.GetOverlay(widget.OverlayName);
                        if (overlay != null)
                        {
                            await overlay.RemoveItem(widget.Item);
                        }
                    }
                }
            }
            else
            {
#pragma warning disable CS0612 // Type or member is obsolete
                if (this.Position == null && this.Effect != null)
                {
                    this.Position = new OverlayItemPosition(OverlayEffectPositionType.Percentage, this.Effect.Horizontal, this.Effect.Vertical);
                }
                if (this.Effects == null && this.Effect != null)
                {
                    this.Effects = new OverlayItemEffects((OverlayEffectEntranceAnimationTypeEnum)this.Effect.EntranceAnimation,
                                                          (OverlayEffectVisibleAnimationTypeEnum)this.Effect.VisibleAnimation, (OverlayEffectExitAnimationTypeEnum)this.Effect.ExitAnimation, this.Effect.Duration);
                }
                this.Effect = null;
#pragma warning restore CS0612 // Type or member is obsolete

                string          overlayName = (string.IsNullOrEmpty(this.OverlayName)) ? ChannelSession.Services.OverlayServers.DefaultOverlayName : this.OverlayName;
                IOverlayService overlay     = ChannelSession.Services.OverlayServers.GetOverlay(overlayName);
                if (overlay != null)
                {
                    OverlayItemBase processedItem = await this.Item.GetProcessedItem(user, arguments, this.extraSpecialIdentifiers);

                    await overlay.SendItem(processedItem, this.Position, this.Effects);
                }
            }
        }
Esempio n. 15
0
        public override void SetItem(OverlayItemBase item)
        {
            this.item = (OverlayEventList)item;

            this.ShowFollowsCheckBox.IsChecked    = this.item.ItemTypes.Contains(EventListItemTypeEnum.Followers);
            this.ShowHostsCheckBox.IsChecked      = this.item.ItemTypes.Contains(EventListItemTypeEnum.Hosts);
            this.ShowSubsResubsCheckBox.IsChecked = this.item.ItemTypes.Contains(EventListItemTypeEnum.Subscribers);
            this.ShowDonationsCheckBox.IsChecked  = this.item.ItemTypes.Contains(EventListItemTypeEnum.Donations);
            this.ShowSparksCheckBox.IsChecked     = this.item.ItemTypes.Contains(EventListItemTypeEnum.Sparks);
            this.ShowEmbersCheckBox.IsChecked     = this.item.ItemTypes.Contains(EventListItemTypeEnum.Embers);
            this.ShowMilestonesCheckBox.IsChecked = this.item.ItemTypes.Contains(EventListItemTypeEnum.Milestones);

            this.TotalToShowTextBox.Text       = this.item.TotalToShow.ToString();
            this.ResetOnLoadCheckBox.IsChecked = this.item.ResetOnLoad;

            this.WidthTextBox.Text  = this.item.Width.ToString();
            this.HeightTextBox.Text = this.item.Height.ToString();

            this.TextFontComboBox.Text = this.item.TextFont;

            this.BorderColorComboBox.Text = this.item.BorderColor;
            if (ColorSchemes.HTMLColorSchemeDictionary.ContainsValue(this.item.BorderColor))
            {
                this.BorderColorComboBox.Text = ColorSchemes.HTMLColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.BorderColor)).Key;
            }

            this.BackgroundColorComboBox.Text = this.item.BackgroundColor;
            if (ColorSchemes.HTMLColorSchemeDictionary.ContainsValue(this.item.BackgroundColor))
            {
                this.BackgroundColorComboBox.Text = ColorSchemes.HTMLColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.BackgroundColor)).Key;
            }

            this.TextColorComboBox.Text = this.item.TextColor;
            if (ColorSchemes.HTMLColorSchemeDictionary.ContainsValue(this.item.TextColor))
            {
                this.TextColorComboBox.Text = ColorSchemes.HTMLColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.TextColor)).Key;
            }

            this.AddEventAnimationComboBox.SelectedItem    = EnumHelper.GetEnumName(this.item.AddEventAnimation);
            this.RemoveEventAnimationComboBox.SelectedItem = EnumHelper.GetEnumName(this.item.RemoveEventAnimation);

            this.HTMLText.Text = this.item.HTMLText;
        }
        public override void SetItem(OverlayItemBase item)
        {
            this.item = (OverlayTimer)item;

            this.TotalLengthTextBox.Text = this.item.TotalLength.ToString();

            this.TextColorComboBox.Text = this.item.TextColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.TextColor))
            {
                this.TextColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.TextColor)).Key;
            }

            this.TextFontComboBox.Text = this.item.TextFont;

            this.TextSizeComboBox.Text = this.item.TextSize.ToString();

            this.HTMLText.Text = this.item.HTMLText;

            this.command = this.item.TimerCompleteCommand;
            this.UpdateChangedCommand();
        }
        public override void SetItem(OverlayItemBase item)
        {
            this.item = (OverlayTimerTrain)item;

            this.MinimumSecondsTextBox.Text = this.item.MinimumSecondsToShow.ToString();
            this.TextColorComboBox.Text     = this.item.TextColor;
            if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.TextColor))
            {
                this.TextColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.TextColor)).Key;
            }
            this.TextFontComboBox.Text = this.item.TextFont;
            this.TextSizeComboBox.Text = this.item.TextSize.ToString();

            this.FollowBonusTextBox.Text   = this.item.FollowBonus.ToString();
            this.HostBonusTextBox.Text     = this.item.HostBonus.ToString();
            this.SubBonusTextBox.Text      = this.item.SubscriberBonus.ToString();
            this.DonationBonusTextBox.Text = this.item.DonationBonus.ToString();
            this.SparkBonusTextBox.Text    = this.item.SparkBonus.ToString();

            this.HTMLText.Text = this.item.HTMLText;
        }
        public override void SetItem(OverlayItemBase item)
        {
            this.item                  = (OverlayTextItem)item;
            this.TextTextBox.Text      = this.item.Text;
            this.TextSizeComboBox.Text = this.item.Size.ToString();
            string color = this.item.Color;

            if (ColorSchemes.HTMLColorSchemeDictionary.ContainsValue(color))
            {
                color = ColorSchemes.HTMLColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(color)).Key;
            }
            this.TextFontComboBox.Text            = this.item.Font;
            this.TextBoldCheckBox.IsSelected      = this.item.Bold;
            this.TextItalicCheckBox.IsSelected    = this.item.Italic;
            this.TextUnderlineCheckBox.IsSelected = this.item.Underline;
            this.TextColorComboBox.Text           = color;
            string shadowColor = this.item.ShadowColor;

            if (ColorSchemes.HTMLColorSchemeDictionary.ContainsValue(shadowColor))
            {
                shadowColor = ColorSchemes.HTMLColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(shadowColor)).Key;
            }
            this.TextShadowColorComboBox.Text = shadowColor;
        }
Esempio n. 19
0
 public abstract void SetItem(OverlayItemBase item);
        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. 21
0
#pragma warning disable CS0612 // Type or member is obsolete
        public static OverlayItemModelBase ConvertOverlayItem(OverlayItemBase item)
        {
            if (item is OverlayTextItem)
            {
                OverlayTextItem oItem = (OverlayTextItem)item;
                return(new OverlayTextItemModel(oItem.Text, oItem.Color, oItem.Size, oItem.Font, oItem.Bold, oItem.Italic, oItem.Underline, oItem.ShadowColor));
            }
            else if (item is OverlayImageItem)
            {
                OverlayImageItem oItem = (OverlayImageItem)item;
                return(new OverlayImageItemModel(oItem.FilePath, oItem.Width, oItem.Height));
            }
            else if (item is OverlayVideoItem)
            {
                OverlayVideoItem oItem = (OverlayVideoItem)item;
                return(new OverlayVideoItemModel(oItem.FilePath, oItem.Width, oItem.Height, oItem.Volume));
            }
            else if (item is OverlayYouTubeItem)
            {
                OverlayYouTubeItem oItem = (OverlayYouTubeItem)item;
                return(new OverlayYouTubeItemModel(oItem.VideoID, oItem.Width, oItem.Height, oItem.StartTime, oItem.Volume));
            }
            else if (item is OverlayWebPageItem)
            {
                OverlayWebPageItem oItem = (OverlayWebPageItem)item;
                return(new OverlayWebPageItemModel(oItem.URL, oItem.Width, oItem.Height));
            }
            else if (item is OverlayHTMLItem)
            {
                OverlayHTMLItem oItem = (OverlayHTMLItem)item;
                return(new OverlayHTMLItemModel(oItem.HTMLText));
            }
            else if (item is OverlayChatMessages)
            {
                OverlayChatMessages oItem = (OverlayChatMessages)item;
                return(new OverlayChatMessagesListItemModel(oItem.HTMLText, oItem.TotalToShow, 0, oItem.TextFont, oItem.Width, oItem.TextSize, oItem.BorderColor, oItem.BackgroundColor,
                                                            oItem.TextColor, OverlayListItemAlignmentTypeEnum.Top, (OverlayItemEffectEntranceAnimationTypeEnum)oItem.AddEventAnimation, OverlayItemEffectExitAnimationTypeEnum.None));
            }
            else if (item is OverlayEventList)
            {
                OverlayEventList oItem = (OverlayEventList)item;
                List <OverlayEventListItemTypeEnum> types = new List <OverlayEventListItemTypeEnum>();
                foreach (EventListItemTypeEnum type in oItem.ItemTypes)
                {
                    types.Add((OverlayEventListItemTypeEnum)type);
                }
                return(new OverlayEventListItemModel(oItem.HTMLText, types, oItem.TotalToShow, 0, oItem.TextFont, oItem.Width, oItem.Height, oItem.BorderColor, oItem.BackgroundColor,
                                                     oItem.TextColor, OverlayListItemAlignmentTypeEnum.Top, (OverlayItemEffectEntranceAnimationTypeEnum)oItem.AddEventAnimation, (OverlayItemEffectExitAnimationTypeEnum)oItem.RemoveEventAnimation));
            }
            else if (item is OverlayGameQueue)
            {
                OverlayGameQueue oItem = (OverlayGameQueue)item;
                return(new OverlayGameQueueListItemModel(oItem.HTMLText, oItem.TotalToShow, oItem.TextFont, oItem.Width, oItem.Height, oItem.BorderColor, oItem.BackgroundColor,
                                                         oItem.TextColor, OverlayListItemAlignmentTypeEnum.Top, (OverlayItemEffectEntranceAnimationTypeEnum)oItem.AddEventAnimation, (OverlayItemEffectExitAnimationTypeEnum)oItem.RemoveEventAnimation));
            }
            else if (item is OverlayLeaderboard)
            {
                OverlayLeaderboard oItem = (OverlayLeaderboard)item;
                OverlayLeaderboardListItemModel result = new OverlayLeaderboardListItemModel(oItem.HTMLText, (OverlayLeaderboardListItemTypeEnum)oItem.LeaderboardType, oItem.TotalToShow,
                                                                                             oItem.TextFont, oItem.Width, oItem.Height, oItem.BorderColor, oItem.BackgroundColor, oItem.TextColor, OverlayListItemAlignmentTypeEnum.Top,
                                                                                             (OverlayItemEffectEntranceAnimationTypeEnum)oItem.AddEventAnimation, (OverlayItemEffectExitAnimationTypeEnum)oItem.RemoveEventAnimation, null);
                result.CurrencyID           = oItem.CurrencyID;
                result.LeaderboardDateRange = (OverlayLeaderboardListItemDateRangeEnum)oItem.DateRange;
                return(result);
            }
            else if (item is OverlayProgressBar)
            {
                OverlayProgressBar          oItem  = (OverlayProgressBar)item;
                OverlayProgressBarItemModel result = new OverlayProgressBarItemModel(oItem.HTMLText, (OverlayProgressBarItemTypeEnum)oItem.ProgressBarType, oItem.ResetAfterDays,
                                                                                     oItem.ProgressColor, oItem.BackgroundColor, oItem.TextColor, oItem.TextFont, oItem.Width, oItem.Height, oItem.GoalReachedCommand);
                result.StartAmount         = result.CurrentAmount = oItem.CurrentAmountNumber;
                result.GoalAmount          = oItem.GoalAmountNumber;
                result.CurrentAmountCustom = oItem.CurrentAmountCustom;
                result.GoalAmountCustom    = oItem.GoalAmountCustom;
                return(result);
            }
            else if (item is OverlaySongRequests)
            {
                OverlaySongRequests oItem = (OverlaySongRequests)item;
                return(new OverlaySongRequestsListItemModel(oItem.HTMLText, oItem.TotalToShow, oItem.TextFont, oItem.Width, oItem.Height, oItem.BorderColor, oItem.BackgroundColor,
                                                            oItem.TextColor, true, OverlayListItemAlignmentTypeEnum.Top, (OverlayItemEffectEntranceAnimationTypeEnum)oItem.AddEventAnimation, (OverlayItemEffectExitAnimationTypeEnum)oItem.RemoveEventAnimation));
            }
            else if (item is OverlayStreamBoss)
            {
                OverlayStreamBoss oItem = (OverlayStreamBoss)item;
                return(new OverlayStreamBossItemModel(oItem.HTMLText, oItem.StartingHealth, oItem.Width, oItem.Height, oItem.TextColor, oItem.TextFont, oItem.BorderColor, oItem.BackgroundColor,
                                                      oItem.ProgressColor, oItem.FollowBonus, oItem.HostBonus, oItem.SubscriberBonus, oItem.DonationBonus, oItem.SparkBonus, oItem.EmberBonus, 1.0, 1.0,
                                                      (OverlayItemEffectVisibleAnimationTypeEnum)oItem.DamageAnimation, (OverlayItemEffectVisibleAnimationTypeEnum)oItem.NewBossAnimation, oItem.NewStreamBossCommand));
            }
            else if (item is OverlayMixerClip)
            {
                OverlayMixerClip oItem = (OverlayMixerClip)item;
                return(new OverlayStreamClipItemModel(oItem.Width, oItem.Height, oItem.Volume, (OverlayItemEffectEntranceAnimationTypeEnum)oItem.EntranceAnimation, (OverlayItemEffectExitAnimationTypeEnum)oItem.ExitAnimation));
            }
            else if (item is OverlayTimer)
            {
                OverlayTimer oItem = (OverlayTimer)item;
                return(new OverlayTimerItemModel(oItem.HTMLText, oItem.TotalLength, oItem.TextColor, oItem.TextFont, oItem.TextSize, oItem.TimerCompleteCommand));
            }
            else if (item is OverlayTimerTrain)
            {
                OverlayTimerTrain oItem = (OverlayTimerTrain)item;
                return(new OverlayTimerTrainItemModel(oItem.HTMLText, oItem.MinimumSecondsToShow, oItem.TextColor, oItem.TextFont, oItem.TextSize, oItem.FollowBonus, oItem.HostBonus, oItem.SubscriberBonus, oItem.DonationBonus, oItem.SparkBonus, oItem.EmberBonus));
            }
            return(null);
        }
Esempio n. 22
0
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            await this.RunAsyncOperation(async() =>
            {
                if (string.IsNullOrEmpty(this.NameTextBox.Text))
                {
                    await MessageBoxHelper.ShowMessageDialog("A name must be specified");
                    return;
                }

                if (this.TypeComboBox.SelectedIndex < 0)
                {
                    await MessageBoxHelper.ShowMessageDialog("A widget type must be selected");
                    return;
                }

                if (this.OverlayNameComboBox.SelectedIndex < 0)
                {
                    await MessageBoxHelper.ShowMessageDialog("An overlay to use must be selected");
                    return;
                }
                string overlayName = (string)this.OverlayNameComboBox.SelectedItem;

                OverlayItemPosition position = this.ItemPosition.GetPosition();
                if (position == null)
                {
                    return;
                }

                OverlayItemBase item = null;
                OverlayWidgetTypeEnum overlayType = EnumHelper.GetEnumValueFromString <OverlayWidgetTypeEnum>((string)this.TypeComboBox.SelectedItem);
                if (overlayType == OverlayWidgetTypeEnum.Image)
                {
                    item = this.ImageItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.Text)
                {
                    item = this.TextItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.YouTube)
                {
                    item = this.YouTubeItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.Video)
                {
                    item = this.VideoItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.WebPage)
                {
                    item = this.WebPageItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.HTML)
                {
                    item = this.HTMLItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.ProgressBar)
                {
                    item = this.ProgressBarItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.EventList)
                {
                    item = this.EventListItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.GameQueue)
                {
                    item = this.GameQueueItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.ChatMessages)
                {
                    item = this.ChatMessagesItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.MixerClip)
                {
                    item = this.MixerClipItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.Leaderboard)
                {
                    item = this.LeaderboardItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.Timer)
                {
                    item = this.TimerItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.TimerTrain)
                {
                    item = this.TimerTrainItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.StreamBoss)
                {
                    item = this.StreamBossItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.GameStats)
                {
                    item = this.GameStatsItem.GetItem();
                }
                else if (overlayType == OverlayWidgetTypeEnum.SongRequests)
                {
                    item = this.SongRequestsItem.GetItem();
                }

                if (item == null)
                {
                    await MessageBoxHelper.ShowMessageDialog("There are missing Widget details");
                    return;
                }

                if (this.Widget == null)
                {
                    this.Widget = new OverlayWidget(this.NameTextBox.Text, overlayName, item, position, this.DontRefreshToggleButton.IsChecked.GetValueOrDefault());
                    ChannelSession.Settings.OverlayWidgets.Add(this.Widget);
                }
                else
                {
                    item.ID = this.Widget.Item.ID;

                    this.Widget.Name        = this.NameTextBox.Text;
                    this.Widget.OverlayName = overlayName;
                    this.Widget.Item        = item;
                    this.Widget.Position    = position;
                    this.Widget.DontRefresh = this.DontRefreshToggleButton.IsChecked.GetValueOrDefault();
                }

                this.Close();
            });
        }
Esempio n. 23
0
 public async Task RemoveItem(OverlayItemBase item)
 {
     await this.SendPacket("remove", JObject.FromObject(item));
 }
 public override void SetItem(OverlayItemBase item)
 {
     this.item             = (OverlayHTMLItem)item;
     this.HTMLTextBox.Text = this.item.HTMLText;
 }