private void cbAffix_SelectionChanged(object sender, SelectionChangedEventArgs e) { _changingaffix = true; var aff = cbAffix.SelectedItem as Affix; spSLiders.Children.Clear(); sliders.Clear(); if (aff != null) { var tiers = aff.GetTiers(); tbtlabel.Text = ""; if (aff != EmptySelection) { for (int i = 0; i < aff.Mod.Count; i++) { OverlayedSlider os = new OverlayedSlider(); os.OverlayText = aff.AliasStrings[i]; sliders.Add(os); os.ValueChanged += slValue_ValueChanged; os.Tag = i; var tics = tiers.SelectMany(im => Enumerable.Range((int)Math.Round(im.Stats[i].Range.From), (int)Math.Round(im.Stats[i].Range.To - im.Stats[i].Range.From + 1))).Select(f => (double)f).ToList(); if (aff.AliasStrings[i].Contains(" per second")) { tics = tics.Select(t => t / 60.0).ToList(); } os.Minimum = tics.First(); os.Maximum = tics.Last(); os.Ticks = new DoubleCollection(tics); spSLiders.Children.Add(os); } } } OnpropertyChanged("SelectedAffix"); if (SelectedAffixChanged != null) { SelectedAffixChanged(this, aff); } _changingaffix = false; if (sliders.Count > 0) { slValue_ValueChanged(sliders[0], new RoutedPropertyChangedEventArgs <double>(sliders[0].Value, sliders[0].Value)); } }
private void cbAffix_SelectionChanged(object sender, SelectionChangedEventArgs e) { _changingaffix = true; var aff = cbAffix.SelectedItem as Affix; spSLiders.Children.Clear(); _sliders.Clear(); tbtlabel.Text = ""; if (aff != null) { var tiers = aff.GetTiers(); if (aff != EmptySelection) { for (var i = 0; i < aff.Mods.Count; i++) { var ranges = tiers.Select(t => t.Stats[i].Range).ToList(); var isFloatMod = ranges.Any(r => Math.Abs((int)r.From - r.From) > 1e-5 || Math.Abs((int)r.To - r.To) > 1e-5); var tics = ranges.SelectMany( r => Enumerable.Range((int)Math.Round(isFloatMod ? r.From * 100 : r.From), (int)Math.Round((r.To - r.From) * (isFloatMod ? 100 : 1) + 1))) .Select(f => isFloatMod ? (double)f / 100 : f); var os = new OverlayedSlider(aff.Mods[i], new DoubleCollection(tics)); os.ValueChanged += slValue_ValueChanged; os.Tag = i; _sliders.Add(os); spSLiders.Children.Add(os); } } } OnPropertyChanged("SelectedAffix"); if (SelectedAffixChanged != null) { SelectedAffixChanged(this, aff); } _changingaffix = false; if (_sliders.Count > 0) { slValue_ValueChanged(_sliders[0], new RoutedPropertyChangedEventArgs <double>(_sliders[0].Value, _sliders[0].Value)); } }
private void cbAffix_SelectionChanged(object sender, SelectionChangedEventArgs e) { _changingaffix = true; var aff = cbAffix.SelectedItem as Affix; spSLiders.Children.Clear(); _sliders.Clear(); tbtlabel.Text = ""; if (aff != null) { var tiers = aff.GetTiers(); if (aff != EmptySelection) { for (var i = 0; i < aff.Mods.Count; i++) { var ranges = tiers.Select(t => t.Stats[i].Range).ToList(); var isFloatMod = ranges.Any(r => Math.Abs((int) r.From - r.From) > 1e-5 || Math.Abs((int) r.To - r.To) > 1e-5); var tics = ranges.SelectMany( r => Enumerable.Range((int) Math.Round(isFloatMod ? r.From * 100 : r.From), (int) Math.Round((r.To - r.From) * (isFloatMod ? 100 : 1) + 1))) .Select(f => isFloatMod ? (double) f / 100 : f); var os = new OverlayedSlider(aff.Mods[i], new DoubleCollection(tics)); os.ValueChanged += slValue_ValueChanged; os.Tag = i; _sliders.Add(os); spSLiders.Children.Add(os); } } } OnPropertyChanged("SelectedAffix"); if (SelectedAffixChanged != null) SelectedAffixChanged(this, aff); _changingaffix = false; if (_sliders.Count > 0) slValue_ValueChanged(_sliders[0], new RoutedPropertyChangedEventArgs<double>(_sliders[0].Value, _sliders[0].Value)); }
private void cbAffix_SelectionChanged(object sender, SelectionChangedEventArgs e) { _changingaffix = true; var aff = cbAffix.SelectedItem as Affix; spSLiders.Children.Clear(); sliders.Clear(); if (aff != null) { var tiers = aff.GetTiers(); tbtlabel.Text = ""; if (aff != EmptySelection) { for (int i = 0; i < aff.Mod.Count; i++) { OverlayedSlider os = new OverlayedSlider(); os.OverlayText = aff.AliasStrings[i]; sliders.Add(os); os.ValueChanged += slValue_ValueChanged; os.Tag = i; var tics = tiers.SelectMany(im => Enumerable.Range((int)Math.Round(im.Stats[i].Range.From), (int)Math.Round(im.Stats[i].Range.To - im.Stats[i].Range.From + 1))).Select(f => (double)f).ToList(); if (aff.AliasStrings[i].Contains(" per second")) { tics = tics.Select(t => t / 60.0).ToList(); } os.Minimum = tics.First(); os.Maximum = tics.Last(); os.Ticks = new DoubleCollection(tics); spSLiders.Children.Add(os); } } } OnpropertyChanged("SelectedAffix"); if (SelectedAffixChanged != null) SelectedAffixChanged(this, aff); _changingaffix = false; if (sliders.Count > 0) slValue_ValueChanged(sliders[0], new RoutedPropertyChangedEventArgs<double>(sliders[0].Value, sliders[0].Value)); }