private void applyAspectRatio(BindableNumber <float> sizeChanged) { try { if (!aspectLock.Value) { float proposedAspectRatio = currentAspectRatio; if (proposedAspectRatio >= aspectRatio.MinValue && proposedAspectRatio <= aspectRatio.MaxValue) { // aspect ratio was in a valid range. updateAspectRatio(); return; } } // if lock is applied (or the specified values were out of range) aim to adjust the axis the user was not adjusting to conform. if (sizeChanged == sizeX) { sizeY.Value = (int)(areaSize.Value.X / aspectRatio.Value); } else { sizeX.Value = (int)(areaSize.Value.Y * aspectRatio.Value); } } finally { // cancel any event which may have fired while updating variables as a result of aspect ratio limitations. // this avoids a potential feedback loop. aspectRatioApplication?.Cancel(); } }
public DifficultyPointPiece(HitObject hitObject) : base(hitObject.DifficultyControlPoint) { HitObject = hitObject; speedMultiplier = hitObject.DifficultyControlPoint.SliderVelocityBindable.GetBoundCopy(); }
public SamplePointPiece(HitObject hitObject) : base(hitObject.SampleControlPoint) { HitObject = hitObject; volume = hitObject.SampleControlPoint.SampleVolumeBindable.GetBoundCopy(); bank = hitObject.SampleControlPoint.SampleBankBindable.GetBoundCopy(); }
public EffectRowAttribute(EffectControlPoint effect) : base(effect, "effect") { kiaiMode = effect.KiaiModeBindable.GetBoundCopy(); omitBarLine = effect.OmitFirstBarLineBindable.GetBoundCopy(); scrollSpeed = effect.ScrollSpeedBindable.GetBoundCopy(); }
public DifficultyPointPiece(DifficultyControlPoint point) : base(point) { speedMultiplier = point.SpeedMultiplierBindable.GetBoundCopy(); Y = Height; }
protected SliderBar() { if (typeof(T) == typeof(int)) { CurrentNumber = new BindableInt() as BindableNumber <T>; } else if (typeof(T) == typeof(long)) { CurrentNumber = new BindableLong() as BindableNumber <T>; } else if (typeof(T) == typeof(double)) { CurrentNumber = new BindableDouble() as BindableNumber <T>; } else if (typeof(T) == typeof(float)) { CurrentNumber = new BindableFloat() as BindableNumber <T>; } if (CurrentNumber == null) { throw new NotSupportedException($"We don't support the generic type of {nameof(BindableNumber<T>)}."); } CurrentNumber.ValueChanged += v => UpdateValue(NormalizedValue); }
/// <summary> /// Applies a setting from a configuration bindable using <paramref name="applyFunc"/>, if it has been changed by the user. /// </summary> protected void ApplySetting <T>(BindableNumber <T> setting, Action <T> applyFunc) where T : struct, IComparable <T>, IConvertible, IEquatable <T> { if (userChangedSettings.TryGetValue(setting, out bool userChangedSetting) && userChangedSetting) { applyFunc.Invoke(setting.Value); } }
private void load(PippidonPlayfield playfield, TextureStore textures) { AddInternal(new Sprite { RelativeSizeAxes = Axes.Both, Texture = textures.Get("coin"), }); currentLane = playfield.CurrentLane.GetBoundCopy(); }
private void load() { sampleBank = samplePoint.SampleBankBindable.GetBoundCopy(); sampleBank.BindValueChanged(_ => recreate()); sampleVolume = samplePoint.SampleVolumeBindable.GetBoundCopy(); sampleVolume.BindValueChanged(_ => recreate()); recreate(); }
public RomajiTagSelectionBlueprint(ITextTag item) : base(item) { if (!(item is RomajiTag romajiTag)) { throw new InvalidCastException(nameof(item)); } text = romajiTag.TextBindable.GetBoundCopy(); startIndex = romajiTag.StartIndexBindable.GetBoundCopy(); endIndex = romajiTag.EndIndexBindable.GetBoundCopy(); }
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) { if (HiddenComboCount.Value == 0) { return; } currentCombo = scoreProcessor.Combo.GetBoundCopy(); currentCombo.BindValueChanged(combo => { targetAlpha = Math.Max(min_alpha, 1 - (float)combo.NewValue / HiddenComboCount.Value); }, true); }
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) { if (HiddenComboCount.Value == 0) { return; } CurrentCombo = scoreProcessor.Combo.GetBoundCopy(); CurrentCombo.BindValueChanged(combo => { ComboBasedAlpha = Math.Max(MIN_ALPHA, 1 - (float)combo.NewValue / HiddenComboCount.Value); }, true); }
/// <summary> /// Transfer a setting from <see cref="BeatmapDifficulty"/> to a configuration bindable. /// Only performs the transfer if the user is not currently overriding. /// </summary> protected void TransferSetting <T>(BindableNumber <T> bindable, T beatmapDefault) where T : struct, IComparable <T>, IConvertible, IEquatable <T> { bindable.UnbindEvents(); userChangedSettings.TryAdd(bindable, false); bindable.Default = beatmapDefault; // users generally choose a difficulty setting and want it to stick across multiple beatmap changes. // we only want to value transfer if the user hasn't changed the value previously. if (!userChangedSettings[bindable]) { bindable.Value = beatmapDefault; } bindable.ValueChanged += _ => userChangedSettings[bindable] = !bindable.IsDefault; }
public ColourPropertyDisplay(string name, Func <int, Color4> resultColour) { resultFunction = resultColour; RelativeSizeAxes = Axes.X; Height = height; Children = new Drawable[] { new SpriteText { Text = name, Font = new FontUsage(null, font_size) }, new FillFlowContainer <GridItem> { RelativeSizeAxes = Axes.X, Height = slider_height, Direction = FillDirection.Horizontal, Spacing = new osuTK.Vector2(spacing), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Children = new GridItem[] { new GridItem(new HBSliderBar <int> { RelativeSizeAxes = Axes.Both, Current = Bindable = new BindableNumber <int> { MinValue = 0, MaxValue = 255, Value = 127, Precision = 1 } }), new GridItem(0.2f, resultBox = new Box { RelativeSizeAxes = Axes.Both }) } } }; Bindable.BindValueChanged(OnValueChanged, true); }
public BindableDisplayContainer(BindableNumber <T> bindable) { Anchor = Anchor.Centre; Origin = Anchor.Centre; SpriteText valueText; InternalChild = new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { new SpriteText { Text = $"{typeof(T).Name} value:" }, valueText = new SpriteText { Text = bindable.Value.ToString(CultureInfo.InvariantCulture) } } }; bindable.ValueChanged += v => valueText.Text = v.ToString(CultureInfo.InvariantCulture); }
public DifficultyPointPiece(DifficultyControlPoint difficultyPoint) { this.difficultyPoint = difficultyPoint; speedMultiplier = difficultyPoint.SpeedMultiplierBindable.GetBoundCopy(); }
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) { health = scoreProcessor.Health.GetBoundCopy(); }
public void RemoveAdjustment(AdjustableProperty type, BindableNumber <double> adjustBindable) => getAggregate(type).RemoveSource(adjustBindable);
public void AddAdjustment(AdjustableProperty type, BindableNumber <double> adjustBindable) => throw new NotImplementedException();
public void RemoveAdjustment(AdjustableProperty type, BindableNumber <double> adjustBindable) => adjustments.RemoveAdjustment(type, adjustBindable);
public SamplePointPiece(SampleControlPoint samplePoint) { this.samplePoint = samplePoint; volume = samplePoint.SampleVolumeBindable.GetBoundCopy(); bank = samplePoint.SampleBankBindable.GetBoundCopy(); }
public DifficultyRowAttribute(DifficultyControlPoint difficulty) : base(difficulty, "difficulty") { speedMultiplier = difficulty.SpeedMultiplierBindable.GetBoundCopy(); }
public TimingPointPiece(TimingControlPoint point) { this.point = point; beatLength = point.BeatLengthBindable.GetBoundCopy(); }
public TimingRowAttribute(TimingControlPoint timing) : base(timing, "timing") { timeSignature = timing.TimeSignatureBindable.GetBoundCopy(); beatLength = timing.BeatLengthBindable.GetBoundCopy(); }
public void RemoveAdjustment(AdjustableProperty type, BindableNumber <double> adjustBindable) => throw new NotSupportedException();
public TimingPointPiece(TimingControlPoint point) : base(point) { beatLength = point.BeatLengthBindable.GetBoundCopy(); }
private void load(SolosuPlayfield playfield) { currentLane = playfield.CurrentLane.GetBoundCopy(); }
public void ApplyToHealthProcessor(HealthProcessor healthProcessor) { health = healthProcessor.Health.GetBoundCopy(); }
public SampleRowAttribute(SampleControlPoint sample) : base(sample, "sample") { sampleBank = sample.SampleBankBindable.GetBoundCopy(); volume = sample.SampleVolumeBindable.GetBoundCopy(); }