protected override void OnSelectionChanged() { base.OnSelectionChanged(); bool canOperate = SelectedHitObjects.Count() > 1 || SelectedHitObjects.Any(s => s is Slider); SelectionBox.CanRotate = canOperate; SelectionBox.CanScaleX = canOperate; SelectionBox.CanScaleY = canOperate; }
private MenuItem createHitSampleMenuItem(string name, string sampleName) { return(new TernaryStateMenuItem(name, MenuItemType.Standard, setHitSampleState) { State = { Value = getHitSampleState() } }); void setHitSampleState(TernaryState state) { switch (state) { case TernaryState.False: RemoveHitSample(sampleName); break; case TernaryState.True: AddHitSample(sampleName); break; } } TernaryState getHitSampleState() { int countExisting = SelectedHitObjects.Count(h => h.Samples.Any(s => s.Name == sampleName)); if (countExisting == 0) { return(TernaryState.False); } if (countExisting < SelectedHitObjects.Count()) { return(TernaryState.Indeterminate); } return(TernaryState.True); } }
private MenuItem createNewComboMenuItem() { return(new TernaryStateMenuItem("New combo", MenuItemType.Standard, setNewComboState) { State = { Value = getHitSampleState() } }); void setNewComboState(TernaryState state) { switch (state) { case TernaryState.False: SetNewCombo(false); break; case TernaryState.True: SetNewCombo(true); break; } } TernaryState getHitSampleState() { int countExisting = selectedBlueprints.Select(b => (IHasComboInformation)b.HitObject).Count(h => h.NewCombo); if (countExisting == 0) { return(TernaryState.False); } if (countExisting < SelectedHitObjects.Count()) { return(TernaryState.Indeterminate); } return(TernaryState.True); } }