예제 #1
0
        public override void AddSpDescription()
        {
            if (PART_SpDescription != null)
            {
#if DEBUG
                logger.Debug($"HowLongToBeat [Ignored] - PART_SpDescription allready insert");
#endif
                return;
            }

            try
            {
                HltbDescriptionIntegration SpDescription = new HltbDescriptionIntegration();
                SpDescription.Name = SpDescriptionName;

                ui.AddElementInGameSelectedDescription(SpDescription, PluginDatabase.PluginSettings.IntegrationTopGameDetails, PluginDatabase.PluginSettings.IntegrationShowTitle);
                PART_SpDescription = IntegrationUI.SearchElementByName(SpDescriptionName);
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "HowLongToBeat");
            }
        }
        public override void AddCustomElements()
        {
            if (ListCustomElements.Count > 0)
            {
#if DEBUG
                logger.Debug($"HowLongToBeat - CustomElements allready insert - {ListCustomElements.Count}");
#endif
                return;
            }

            FrameworkElement PART_HltbButtonWithJustIcon   = null;
            FrameworkElement PART_hltbProgressBarWithTitle = null;
            FrameworkElement PART_hltbProgressBar          = null;
            try
            {
                PART_HltbButtonWithJustIcon   = IntegrationUI.SearchElementByName("PART_HltbButtonWithJustIcon", false, true);
                PART_hltbProgressBarWithTitle = IntegrationUI.SearchElementByName("PART_hltbProgressBarWithTitle", false, true);
                PART_hltbProgressBar          = IntegrationUI.SearchElementByName("PART_hltbProgressBar", false, true);
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "HowLongToBeat", $"Error on find custom element");
            }

            if (PART_HltbButtonWithJustIcon != null)
            {
                PART_HltbButtonWithJustIcon                  = new HltbButton();
                PART_HltbButtonWithJustIcon.Name             = "HltbButtonWithJustIcon";
                ((Button)PART_HltbButtonWithJustIcon).Click += OnBtActionBarClick;
                try
                {
                    ui.AddElementInCustomTheme(PART_HltbButtonWithJustIcon, "PART_HltbButtonWithJustIcon");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_HltbButtonWithJustIcon", Element = PART_HltbButtonWithJustIcon
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "HowLongToBeat", "Error on AddCustomElements()");
                }
            }
            else
            {
#if DEBUG
                logger.Debug($"HowLongToBeat - PART_HltbButtonWithJustIcon not find");
#endif
            }

            if (PART_hltbProgressBarWithTitle != null)
            {
                PART_hltbProgressBarWithTitle      = new HltbDescriptionIntegration(true);
                PART_hltbProgressBarWithTitle.Name = "hltbProgressBarWithTitle";
                try
                {
                    ui.AddElementInCustomTheme(PART_hltbProgressBarWithTitle, "PART_hltbProgressBarWithTitle");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_hltbProgressBarWithTitle", Element = PART_hltbProgressBarWithTitle
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "HowLongToBeat", "Error on AddCustomElements()");
                }
            }
            else
            {
#if DEBUG
                logger.Debug($"HowLongToBeat - PART_HltbButtonWithJustIcon not find");
#endif
            }

            if (PART_hltbProgressBar != null)
            {
                PART_hltbProgressBar      = PART_hltbProgressBarWithTitle = new HltbDescriptionIntegration(false);
                PART_hltbProgressBar.Name = "hltbProgressBar";
                try
                {
                    ui.AddElementInCustomTheme(PART_hltbProgressBar, "PART_hltbProgressBar");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_hltbProgressBar", Element = PART_hltbProgressBar
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "HowLongToBeat", "Error on AddCustomElements()");
                }
            }
            else
            {
#if DEBUG
                logger.Debug($"HowLongToBeat - PART_HltbButtonWithJustIcon not find");
#endif
            }
        }