Skip to content

Commit

Permalink
[1.2.0] アニメーションとスプラッシュスクリーンに関する設定項目を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
siketyan committed Nov 25, 2016
1 parent 1a73ffc commit ab880f3
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 20 deletions.
11 changes: 9 additions & 2 deletions osu! Player/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,15 @@ private async void Init(object sender, RoutedEventArgs e)
{
var splash = new SplashWindow();
splash.Show();

await Task.Run(() => Thread.Sleep(1000));
await RefreshList();

splash.Close();
}

if (settings.UseAnimation)
{
Storyboard sb = FindResource("StartAnimation") as Storyboard;
Storyboard.SetTarget(sb, this);
sb.Completed += (s, a) =>
Expand All @@ -149,8 +154,10 @@ private async void Init(object sender, RoutedEventArgs e)
else
{
Opacity = 1f;
await RefreshList();
ShowInTaskbar = true;
}

if (!settings.UseSplashScreen) await RefreshList();
}

private void PlaySong(string tag)
Expand Down Expand Up @@ -378,7 +385,7 @@ private void OnClosing(object sender, CancelEventArgs e)
StopSong();

var isAnimationCompleted = false;
if (!isAnimationCompleted)
if (!isAnimationCompleted && settings.UseAnimation)
{
e.Cancel = true;
Storyboard sb = FindResource("CloseAnimation") as Storyboard;
Expand Down
4 changes: 2 additions & 2 deletions osu! Player/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.2.9")]
[assembly: AssemblyFileVersion("1.1.2.9")]
[assembly: AssemblyVersion("1.2.0.10")]
[assembly: AssemblyFileVersion("1.2.0.10")]
[assembly: Guid("05EA8BF5-DA65-4EF0-BE35-B5CE28169F5E")]

1 change: 1 addition & 0 deletions osu! Player/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class Settings
{
// 設定項目を追加する場合は、bool型→string型→数値型→リスト→それ以外で、配列は使用しない。
public bool UseSplashScreen { get; set; } = true;
public bool UseAnimation { get; set; } = true;
public string OsuPath { get; set; }
public int AudioDevice { get; set; } = 0;
public List<string> DisabledSongs { get; set; }
Expand Down
7 changes: 5 additions & 2 deletions osu! Player/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" Style="{StaticResource ToolWindowStyle}"
Title="Settings - osu! Player" Height="213" Width="360" WindowStartupLocation="CenterOwner"
Title="Settings - osu! Player" Height="247" Width="360" WindowStartupLocation="CenterOwner"
ResizeMode="NoResize">
<Grid>
<Grid.RowDefinitions>
Expand Down Expand Up @@ -32,7 +32,10 @@
<Label Margin="0,10,0,0">使用するオーディオデバイス</Label>
<ComboBox x:Name="AudioDevice" />

<Button Margin="0,25,0,0" Height="25" Background="Transparent"
<CheckBox x:Name="UseAnimation" Margin="0,15,0,4">ウィンドウの開閉にアニメーションを使う</CheckBox>
<CheckBox x:Name="UseSplashScreen">曲の読み込み中にスプラッシュスクリーンを表示する</CheckBox>

<Button Margin="0,15,0,0" Height="25" Background="Transparent"
BorderBrush="#CCC" Click="OpenDisabledSongs">非表示している曲の管理</Button>
</StackPanel>
</Grid>
Expand Down
4 changes: 4 additions & 0 deletions osu! Player/SettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public SettingsWindow()

OsuPath.Text = _currentOsuPath = _settings.OsuPath;
AudioDevice.SelectedIndex = _currentAudioDevice = _settings.AudioDevice;
UseAnimation.IsChecked = _settings.UseAnimation;
UseSplashScreen.IsChecked = _settings.UseSplashScreen;
}

private void OpenFolderDialog(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -59,6 +61,8 @@ private async void CloseWindow(object sender, RoutedEventArgs e)
{
_settings.OsuPath = OsuPath.Text;
_settings.AudioDevice = AudioDevice.SelectedIndex;
_settings.UseAnimation = (bool)UseAnimation.IsChecked;
_settings.UseSplashScreen = (bool)UseSplashScreen.IsChecked;
_instance.settings = _settings;

SettingsManager.WriteSettings("settings.osp", _settings);
Expand Down
16 changes: 5 additions & 11 deletions osu! Player/SplashWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@
mc:Ignorable="d" AllowsTransparency="True" Background="Transparent"
Title="Loading - osu! Player" Height="256" Width="256" WindowStyle="None"
ShowInTaskbar="False" WindowStartupLocation="CenterScreen"
Closing="OnClosing" Topmost="True" Opacity="0">
<Window.Triggers>
<EventTrigger RoutedEvent="Window.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="0:0:1" To="1"
Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Window.Triggers>
Closing="OnClosing" Topmost="True" Opacity="0" Loaded="Init">
<Window.Resources>
<Storyboard x:Key="StartAnimation">
<DoubleAnimation Duration="0:0:1" To="1"
Storyboard.TargetProperty="Opacity" />
</Storyboard>
<Storyboard x:Key="CloseAnimation" Completed="OnAnimationCompleted">
<DoubleAnimation Duration="0:0:0.5" To="0"
Storyboard.TargetProperty="Opacity" />
Expand Down
23 changes: 20 additions & 3 deletions osu! Player/SplashWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,32 @@ namespace osu_Player
public partial class SplashWindow : Window
{
private bool _isAnimationCompleted;
private MainWindow _instance;

public SplashWindow()
{
_instance = MainWindow.GetInstance();

InitializeComponent();
}

public void OnClosing(object sender, CancelEventArgs e)
private void Init(object sender, RoutedEventArgs e)
{
if (_instance.settings.UseAnimation)
{
Storyboard sb = FindResource("StartAnimation") as Storyboard;
Storyboard.SetTarget(sb, this);
sb.Begin();
}
else
{
Opacity = 1f;
}
}

private void OnClosing(object sender, CancelEventArgs e)
{
if (!_isAnimationCompleted)
if (!_isAnimationCompleted && _instance.settings.UseAnimation)
{
e.Cancel = true;
Storyboard sb = FindResource("CloseAnimation") as Storyboard;
Expand All @@ -28,7 +45,7 @@ public void OnClosing(object sender, CancelEventArgs e)
}
}

public void OnAnimationCompleted(object sender, EventArgs e)
private void OnAnimationCompleted(object sender, EventArgs e)
{
_isAnimationCompleted = true;
Close();
Expand Down

0 comments on commit ab880f3

Please sign in to comment.