Skip to content

Commit

Permalink
add selectors to choose which game mode to convert
Browse files Browse the repository at this point in the history
  • Loading branch information
tmokmss committed Oct 19, 2018
1 parent 1a6c870 commit ad1682b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
13 changes: 9 additions & 4 deletions Osu2Saber/Model/BatchProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ namespace Osu2Saber.Model
{
class BatchProcessor : BindableBase
{
public static bool IncludeTaiko { set; get; } = false;
public static bool IncludeCtB { set; get; } = true;
public static bool IncludeMania { set; get; } = true;

object progressLock = new object();
double progress;
Logger logger;
Expand Down Expand Up @@ -75,10 +79,11 @@ Osu2BsConverter ConvertBeatmap(OszProcessor oszp)
OutputDir = Osu2BsConverter.WorkDir;
var o2b = new Osu2BsConverter(oszp.OutDir, oszp.OszName);

foreach (var osufile in oszp.LoadOsuFiles())
{
o2b.AddBeatmap(osufile);
}
oszp.LoadOsuFiles()
.Where(osuFile => IncludeTaiko || osuFile.Mode != 1)
.Where(osuFile => IncludeCtB || osuFile.Mode != 2)
.Where(osuFile => IncludeMania || osuFile.Mode != 3)
.ToList().ForEach(osufile => o2b.AddBeatmap(osufile));

o2b.ProcessAll();

Expand Down
3 changes: 1 addition & 2 deletions Osu2Saber/Model/OszProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ public IEnumerable<Beatmap> LoadOsuFiles()
{
var beatmaps = OsuFiles
.Select(file => LoadOsuFile(file))
.Where(map => map != null)
.Where(map => map.Mode != 1); // exclude taiko map
.Where(map => map != null);
return beatmaps;
}
}
Expand Down
4 changes: 4 additions & 0 deletions Osu2Saber/View/ConfigPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
<CheckBox IsChecked="{Binding PreferHarder}" Content="Prefer harder maps" HorizontalAlignment="Left" Margin="10,103,0,0" VerticalAlignment="Top" ToolTip="Prioritize harder beatmaps when there're more than 5 beatmaps"/>
<CheckBox IsChecked="{Binding HandleHitSlider}" Content="Don't ignore Hit Slider" HorizontalAlignment="Left" Margin="10,134,0,0" VerticalAlignment="Top" ToolTip="By default, hit sliders are ignored because they make a map too difficult. However, some maps get better with them. Just try it!"/>
<CheckBox IsChecked="{Binding NoDirectionAndPlacement}" Content="No cut-direction &amp; scattared-placement" HorizontalAlignment="Left" Margin="10,164,0,0" VerticalAlignment="Top" ToolTip="For mappers, this option generates only notes without setting any cut direction or scattared placement"/>
<Label Content="Includes:" HorizontalAlignment="Left" Margin="10,184,0,0" VerticalAlignment="Top" Width="102" Height="27"/>
<CheckBox IsChecked="{Binding IncludeTaiko}" Content="Taiko" HorizontalAlignment="Left" Margin="70,190,0,0" VerticalAlignment="Top"/>
<CheckBox IsChecked="{Binding IncludeCtB}" Content="CtB" HorizontalAlignment="Left" Margin="128,190,0,0" VerticalAlignment="Top"/>
<CheckBox IsChecked="{Binding IncludeMania}" Content="mania" HorizontalAlignment="Left" Margin="178,190,0,0" VerticalAlignment="Top"/>

</Grid>
</UserControl>
20 changes: 19 additions & 1 deletion Osu2Saber/ViewModel/ConfigPanelViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public double MinimumDifficulty
}
get => Osu2BsConverter.MinimumDifficulty;
}

public bool PreferHarder
{
set { Osu2BsConverter.PreferHarder = value; }
Expand All @@ -48,5 +48,23 @@ public bool NoDirectionAndPlacement
set { ConvertAlgorithm.NoDirectionAndPlacement = value; }
get => ConvertAlgorithm.NoDirectionAndPlacement;
}

public bool IncludeTaiko
{
set { BatchProcessor.IncludeTaiko = value; }
get => BatchProcessor.IncludeTaiko;
}

public bool IncludeCtB
{
set { BatchProcessor.IncludeCtB = value; }
get => BatchProcessor.IncludeCtB;
}

public bool IncludeMania
{
set { BatchProcessor.IncludeMania = value; }
get => BatchProcessor.IncludeMania;
}
}
}

0 comments on commit ad1682b

Please sign in to comment.