Skip to content

Commit

Permalink
beta v0.0.10
Browse files Browse the repository at this point in the history
- Add hotkey Menu (M), Overlay (M, O), Reset (M, R)
  • Loading branch information
SemiR4in committed Oct 14, 2018
1 parent f1aae3d commit fc1ed36
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 31 deletions.
Binary file modified .vs/bayoen-star/v15/.suo
Binary file not shown.
Binary file modified .vs/bayoen-star/v15/Server/sqlite3/storage.ide
Binary file not shown.
Binary file modified .vs/bayoen-star/v15/Server/sqlite3/storage.ide-wal
Binary file not shown.
12 changes: 1 addition & 11 deletions bayoen-star-exe/DisplayGrid.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;

using js = Newtonsoft.Json;
using jl = Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows;
using System.Windows.Media.Imaging;

namespace bayoen
{
Expand Down
5 changes: 3 additions & 2 deletions bayoen-star-exe/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
ResizeMode="NoResize"
Height="120" Width="525"
MouseLeftButtonDown="MetroWindow_MouseLeftButtonDown"
KeyDown="MetroWindow_KeyDown"
Closing="MetroWindow_Closing">

<!--Titlebar buttons-->
Expand All @@ -35,7 +36,7 @@

<TextBlock x:Name="StatusTextBlock" Margin="8,3,8,3" Foreground="DimGray" IsEnabled="False"/>

<Button x:Name ="MenuButton" Background="Transparent" Click="MenuButton_Click">
<Button x:Name ="MenuButton" Background="Transparent" ToolTip="Hotkey 'M'" Click="MenuButton_Click">
<StackPanel Orientation="Horizontal">
<Rectangle Margin="3,6,5,3">
<Rectangle.OpacityMask>
Expand All @@ -46,7 +47,7 @@
</StackPanel>

<Button.ContextMenu>
<ContextMenu x:Name="TopContextMenu">
<ContextMenu x:Name="TopContextMenu" KeyDown="TopContextMenu_KeyDown" >
<ContextMenu.ItemsSource>
<CompositeCollection x:Name="TopCompositeCollection"/>
</ContextMenu.ItemsSource>
Expand Down
47 changes: 39 additions & 8 deletions bayoen-star-exe/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
Expand Down Expand Up @@ -42,7 +43,7 @@ public MainWindow()
public DisplayGrid OverlayDisplay;
public List<TextBox> Monitors;

public const string versionText = " - Beta v0.0.9";
public const string versionText = " - Beta v0.0.10";
public const string pptName = "puyopuyotetris";
public const string prefName = "pref.json";
public const string exportFolderName = "export";
Expand Down Expand Up @@ -1132,6 +1133,17 @@ private void FixOverlay()
this.Overlay.Top = this.pptRect.Top - this.preferences.Overlay[2];
}

private void Reset()
{
this.countingStar = new List<int>() { 0, 0 };
this.countingCrown = new List<int>() { 0, 0 };

this.CheckContainers();
this.ToMonitors();
this.Save();
System.Media.SystemSounds.Hand.Play();
}

private void MenuButton_Click(object sender, RoutedEventArgs e)
{
this.TopContextMenu.IsOpen = true;
Expand All @@ -1142,17 +1154,16 @@ private async void ResetMenuItem_ClickAsync(object sender, RoutedEventArgs e)
var result = await this.ShowMessageAsync("Do clear?", "", MessageDialogStyle.AffirmativeAndNegative);
if (result == MessageDialogResult.Affirmative)
{
this.countingStar = new List<int>() { 0, 0 };
this.countingCrown = new List<int>() { 0, 0 };

this.CheckContainers();
this.ToMonitors();
this.Save();
System.Media.SystemSounds.Hand.Play();
this.Reset();
}
}

private void OverlayMenuItem_Click(object sender, RoutedEventArgs e)
{
this.ViewOverlay();
}

private void ViewOverlay()
{
this.Overlay.Show();
if (this.Overlay.WindowState == WindowState.Minimized)
Expand All @@ -1176,6 +1187,26 @@ private void SettingMenuItem_Click(object sender, RoutedEventArgs e)
this.Setting.Activate();
}

private void TopContextMenu_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.O)
{
this.ViewOverlay();
}
else if (e.Key == Key.R)
{
this.Reset();
}
}

private void MetroWindow_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.M)
{
this.TopContextMenu.IsOpen = true;
}
}

private void MetroWindow_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
this.DragMove();
Expand Down
5 changes: 1 addition & 4 deletions bayoen-star-exe/Preferences.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Threading.Tasks;

using js = Newtonsoft.Json;
using jl = Newtonsoft.Json.Linq;
Expand Down
6 changes: 0 additions & 6 deletions bayoen-star-exe/bayoen-star.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@
<ItemGroup>
<None Include="Resources\CrownLight.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\StarBlank.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\StarPlain.png" />
</ItemGroup>
Expand All @@ -170,9 +167,6 @@
<ItemGroup>
<Resource Include="Resources\Entypo-license.txt" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\score4.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\score2_long_strong.png" />
</ItemGroup>
Expand Down

0 comments on commit fc1ed36

Please sign in to comment.