示例#1
0
 private void ChangeBarsSizes(double NewSize)
 {
     // Parts
     MonsterPartsContainer.MaxWidth  = MonsterAilmentsContainer.MaxWidth = (NewSize - 2) / 2;
     MonsterPartsContainer.ItemWidth = MonsterAilmentsContainer.ItemWidth = MonsterPartsContainer.MaxWidth / Math.Max(1, UserSettings.PlayerConfig.Overlay.MonstersComponent.MaxPartColumns);
     UpdatePartHealthBarSizes(MonsterPartsContainer.ItemWidth);
     // Monster Bar
     MonsterHealthBar.MaxSize  = NewSize - 69;
     MonsterStaminaBar.MaxSize = NewSize - 72;
     MonsterHealthBar.UpdateBar(Context.CurrentHP, Context.TotalHP);
     MonsterStaminaBar.UpdateBar(Context.Stamina, Context.MaxStamina);
 }
示例#2
0
 private void ChangeBarsSizes(double NewSize)
 {
     UserSettings.Config.Monsterscomponent config = UserSettings.PlayerConfig.Overlay.MonstersComponent;
     // Parts
     MonsterPartsContainer.MaxWidth    = config.EnableMonsterAilments ? (NewSize - 2) / 2 : (NewSize - 1);
     MonsterAilmentsContainer.MaxWidth = config.EnableMonsterParts || config.EnableRemovableParts ? (NewSize - 2) / 2 : (NewSize - 1);
     UpdateContainerBarsSizeDynamically();
     // Monster Bar
     MonsterHealthBar.MaxSize  = NewSize - 69;
     MonsterStaminaBar.MaxSize = NewSize - 72;
     MonsterHealthBar.UpdateBar(Context.Health, Context.MaxHealth);
     MonsterStaminaBar.UpdateBar(Context.Stamina, Context.MaxStamina);
 }
示例#3
0
 private void ChangeBarsSizes(double NewSize)
 {
     UserSettings.Config.Monsterscomponent config = UserSettings.PlayerConfig.Overlay.MonstersComponent;
     // Parts
     MonsterPartsContainer.MaxWidth    = config.EnableMonsterAilments ? (NewSize - 2) / 2 : (NewSize - 1);
     MonsterAilmentsContainer.MaxWidth = config.EnableMonsterParts ? (NewSize - 2) / 2 : (NewSize - 1);
     MonsterPartsContainer.ItemWidth   = MonsterAilmentsContainer.ItemWidth = MonsterPartsContainer.MaxWidth / Math.Max(1, UserSettings.PlayerConfig.Overlay.MonstersComponent.MaxPartColumns);
     UpdateContainerBarsSizeDynamically();
     // Monster Bar
     MonsterHealthBar.MaxSize  = NewSize - 69;
     MonsterStaminaBar.MaxSize = NewSize - 72;
     MonsterHealthBar.UpdateBar(Context.CurrentHP, Context.TotalHP);
     MonsterStaminaBar.UpdateBar(Context.Stamina, Context.MaxStamina);
 }
示例#4
0
        private void UpdateMonsterInfo(Monster Monster)
        {
            // Used when starting HunterPie for the first time, since the events won't be triggered
            this.Visibility       = Visibility.Visible;
            this.MonsterName.Text = Monster.Name;
            // Update monster health
            MonsterHealthBar.MaxSize = this.Width * 0.7833333333333333;
            MonsterHealthBar.UpdateBar(Monster.CurrentHP, Monster.TotalHP);
            SetMonsterHealthBarText(Monster.CurrentHP, Monster.TotalHP);

            if ((Monster.CurrentHP / Monster.TotalHP * 100) < Monster.CaptureThreshold)
            {
                this.CapturableIcon.Visibility = Visibility.Visible;
            }

            // Monster stamina
            MonsterStaminaBar.MaxSize = this.Width - 72;
            MonsterStaminaBar.UpdateBar(Monster.Stamina, Monster.MaxStamina);
            SetMonsterStaminaText(Monster.Stamina, Monster.MaxStamina);

            // Gets monster icon
            MonsterIcon.Source = GetMonsterIcon(Monster.ID);

            SwitchSizeBasedOnTarget();

            // Parts
            this.MonsterPartsContainer.Children.Clear();
            foreach (Part mPart in Monster.Parts)
            {
                Monster_Widget.Parts.MonsterPart PartDisplay = new Monster_Widget.Parts.MonsterPart()
                {
                    Style = FindResource("OVERLAY_MONSTER_PART_BAR_STYLE") as Style
                };
                PartDisplay.SetContext(mPart, this.MonsterPartsContainer.ItemWidth);
                this.MonsterPartsContainer.Children.Add(PartDisplay);
            }

            // Ailments
            this.MonsterAilmentsContainer.Children.Clear();
            foreach (Ailment ailment in Monster.Ailments)
            {
                Monster_Widget.Parts.MonsterAilment AilmentDisplay = new Monster_Widget.Parts.MonsterAilment()
                {
                    Style = FindResource("OVERLAY_MONSTER_AILMENT_BAR_STYLE") as Style
                };
                AilmentDisplay.SetContext(ailment, this.MonsterAilmentsContainer.ItemWidth);
                MonsterAilmentsContainer.Children.Add(AilmentDisplay);
            }

            // Enrage
            if (Monster.IsEnraged)
            {
                ANIM_ENRAGEDICON.Begin(this.MonsterHealthBar, true);
                ANIM_ENRAGEDICON.Begin(this.HealthBossIcon, true);
                EnrageTimerText.Visibility = Visibility.Visible;
                EnrageTimerText.Text       = $"{Monster.EnrageTimerStatic - Monster.EnrageTimer:0}s";
            }

            // Set monster crown
            this.MonsterCrown.Source     = Monster.Crown == null ? null : (ImageSource)FindResource(Monster.Crown);
            this.MonsterCrown.Visibility = Monster.Crown == null ? Visibility.Collapsed : Visibility.Visible;
            Weaknesses.Children.Clear(); // Removes every weakness icon
            if (Monster.Weaknesses == null)
            {
                return;
            }
            foreach (string Weakness in Monster.Weaknesses.Keys)
            {
                ImageSource img = this.Resources[Weakness] as ImageSource;
                img.Freeze();
                WeaknessDisplay MonsterWeaknessDisplay = new WeaknessDisplay {
                    Icon   = img,
                    Width  = 20,
                    Height = 20
                };
                Weaknesses.Children.Add(MonsterWeaknessDisplay);
            }
        }
示例#5
0
        private void UpdateMonsterInfo(Monster Monster)
        {
            Visibility       = Visibility.Visible;
            MonsterName.Text = Monster.Name;
            // Update monster health
            MonsterHealthBar.MaxSize = Width * 0.7833333333333333;
            MonsterHealthBar.UpdateBar(Monster.Health, Monster.MaxHealth);
            SetMonsterHealthBarText(Monster.Health, Monster.MaxHealth);

            if ((Monster.Health / Monster.MaxHealth * 100) < Monster.CaptureThreshold)
            {
                CapturableIcon.Visibility = Visibility.Visible;
            }

            // Monster stamina
            MonsterStaminaBar.MaxSize = Width - 72;
            MonsterStaminaBar.UpdateBar(Monster.Stamina, Monster.MaxStamina);
            SetMonsterStaminaText(Monster.Stamina, Monster.MaxStamina);

            // Gets monster icon
            MonsterIcon.Source = GetMonsterIcon(Monster.Id);

            SwitchSizeBasedOnTarget();

            // Parts
            int index = 0;

            MonsterPartsContainer.Children.Clear();
            while (index < Monster.Parts.Count)
            {
                Part mPart = Monster.Parts[index];
                Monster_Widget.Parts.MonsterPart PartDisplay = new Monster_Widget.Parts.MonsterPart()
                {
                    Style = FindResource("OVERLAY_MONSTER_PART_BAR_STYLE") as Style
                };
                PartDisplay.SetContext(mPart, MonsterPartsContainer.ItemWidth);
                MonsterPartsContainer.Children.Add(PartDisplay);
                index++;
            }

            // Ailments
            index = 0;
            MonsterAilmentsContainer.Children.Clear();
            while (index < Monster.Ailments.Count)
            {
                Ailment ailment = Monster.Ailments[index];
                Monster_Widget.Parts.MonsterAilment AilmentDisplay = new Monster_Widget.Parts.MonsterAilment()
                {
                    Style = FindResource("OVERLAY_MONSTER_AILMENT_BAR_STYLE") as Style
                };
                AilmentDisplay.SetContext(ailment, MonsterAilmentsContainer.ItemWidth);
                MonsterAilmentsContainer.Children.Add(AilmentDisplay);
                index++;
            }

            // Enrage
            if (Monster.IsEnraged)
            {
                ANIM_ENRAGEDICON.Begin(MonsterHealthBar, true);
                ANIM_ENRAGEDICON.Begin(HealthBossIcon, true);
                EnrageTimerText.Visibility = Visibility.Visible;
                EnrageTimerText.Text       = $"{Monster.EnrageTimerStatic - Monster.EnrageTimer:0}s";
            }

            // Set monster crown
            MonsterCrown.Source     = Monster.Crown == null ? null : (ImageSource)FindResource(Monster.Crown);
            MonsterCrown.Visibility = Monster.Crown == null ? Visibility.Collapsed : Visibility.Visible;
            Weaknesses.Children.Clear(); // Removes every weakness icon
            if (Monster.Weaknesses == null)
            {
                return;
            }
            index = 0;
            while (index < Monster.Weaknesses.Keys.Count)
            {
                string      Weakness = Monster.Weaknesses.Keys.ElementAt(index);
                ImageSource img      = FindResource(Weakness) as ImageSource;
                img?.Freeze();
                WeaknessDisplay MonsterWeaknessDisplay = new WeaknessDisplay
                {
                    Icon   = img,
                    Width  = 20,
                    Height = 20
                };
                Weaknesses.Children.Add(MonsterWeaknessDisplay);
                index++;
            }
        }
示例#6
0
 private void OnStaminaUpdate(object source, MonsterUpdateEventArgs args) => Dispatch(() =>
 {
     MonsterStaminaBar.UpdateBar(args.Stamina, args.MaxStamina);
     SetMonsterStaminaText(args.Stamina, args.MaxStamina);
 });