private void UpdateContainerBarsSizeDynamically() { UserSettings.Config.Monsterscomponent config = UserSettings.PlayerConfig.Overlay.MonstersComponent; NumberOfPartsDisplayed = MonsterPartsContainer.Children.Cast <Monster_Widget.Parts.MonsterPart>() .Where(p => p.IsVisible) .Count(); NumberOfAilmentsDisplayed = MonsterAilmentsContainer.Children.Cast <Monster_Widget.Parts.MonsterAilment>() .Where(a => a.IsVisible) .Count(); double partsContainerWidth = MonsterPartsContainer.MaxWidth / Math.Max(1, Math.Min(config.MaxPartColumns, Math.Max(1, Math.Ceiling(NumberOfPartsDisplayed / (double)config.MaxNumberOfPartsAtOnce)))); double ailmentsContainerWidth = MonsterAilmentsContainer.MaxWidth / Math.Max(1, Math.Min(config.MaxPartColumns, Math.Max(1, Math.Ceiling(NumberOfAilmentsDisplayed / (double)config.MaxNumberOfPartsAtOnce)))); MonsterPartsContainer.ItemWidth = double.IsInfinity(partsContainerWidth) ? (MonsterPartsContainer.Width - 2) / 2 : partsContainerWidth; MonsterAilmentsContainer.ItemWidth = double.IsInfinity(ailmentsContainerWidth) ? (MonsterPartsContainer.Width - 2) / 2 : ailmentsContainerWidth; foreach (Monster_Widget.Parts.MonsterPart part in MonsterPartsContainer.Children) { part.UpdateHealthSize(MonsterPartsContainer.ItemWidth); } foreach (Monster_Widget.Parts.MonsterAilment ailment in MonsterAilmentsContainer.Children) { ailment.UpdateSize(MonsterAilmentsContainer.ItemWidth); } }
public 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(); MonsterHealthBar.MaxSize = NewSize - 69; MonsterStaminaBar.MaxSize = NewSize - 72; UpdateHealthBar(MonsterHealthBar, Context.Health, Context.MaxHealth); UpdateHealthBar(MonsterStaminaBar, Context.Stamina, Context.MaxStamina); }
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); }
public void ApplySettings() { UserSettings.Config.Monsterscomponent config = UserSettings.PlayerConfig.Overlay.MonstersComponent; MonsterPartsContainer.Visibility = !config.EnableMonsterParts && !config.EnableRemovableParts ? Visibility.Collapsed : Visibility.Visible; MonsterAilmentsContainer.Visibility = !config.EnableMonsterAilments ? Visibility.Collapsed : Visibility.Visible; foreach (Monster_Widget.Parts.MonsterPart part in MonsterPartsContainer.Children) { part.ApplySettings(); } foreach (Monster_Widget.Parts.MonsterAilment ailment in MonsterAilmentsContainer.Children) { ailment.ApplySettings(); } if (Context != null) { SetMonsterHealthBarText(Context.Health, Context.MaxHealth); } }