diff --git a/YJMPD-UWP/MainPage.xaml b/YJMPD-UWP/MainPage.xaml
index 14a3048..c318e39 100644
--- a/YJMPD-UWP/MainPage.xaml
+++ b/YJMPD-UWP/MainPage.xaml
@@ -74,7 +74,7 @@
-
+
@@ -116,7 +116,7 @@
-
+
diff --git a/YJMPD-UWP/MainPage.xaml.cs b/YJMPD-UWP/MainPage.xaml.cs
index 8d6c535..04d98a0 100644
--- a/YJMPD-UWP/MainPage.xaml.cs
+++ b/YJMPD-UWP/MainPage.xaml.cs
@@ -43,13 +43,19 @@ namespace YJMPD_UWP
this.InitializeComponent();
Frame.Navigated += Frame_Navigated;
- Frame.Navigate(typeof(MatchView));
+ Frame.Navigate(typeof(GameView));
}
private void OnBackRequested(object sender, BackRequestedEventArgs e)
{
if (e.Handled) return;
+ if (App.Game.Status == Model.GameHandler.GameStatus.STARTED)
+ {
+ e.Handled = true;
+ return;
+ }
+
if (Frame.CanGoBack)
{
e.Handled = true;
@@ -92,7 +98,7 @@ namespace YJMPD_UWP
switch (pagename.ToLower())
{
- case "matchview":
+ case "gameview":
NavList.SelectedIndex = 0;
break;
case "statisticsview":
@@ -122,7 +128,7 @@ namespace YJMPD_UWP
{
if (Frame.BackStack.Count >= 1)
Frame.BackStack.Clear();
- Frame.Navigate(typeof(MatchView));
+ Frame.Navigate(typeof(GameView));
}
else
if (NavListStatistics.IsSelected)
diff --git a/YJMPD-UWP/Model/ApiHandler.cs b/YJMPD-UWP/Model/ApiHandler.cs
index bb596ec..f47e3e2 100644
--- a/YJMPD-UWP/Model/ApiHandler.cs
+++ b/YJMPD-UWP/Model/ApiHandler.cs
@@ -6,6 +6,7 @@ using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Windows.Devices.Geolocation;
using YJMPD_UWP.Helpers;
using YJMPD_UWP.Views;
@@ -22,7 +23,10 @@ namespace YJMPD_UWP.Model
Msg,
PlayerJoined,
PlayerRemoved,
- PictureUrl
+ PictureUrl,
+ DestinationReached,
+ GameEnded,
+ PlayerReady
}
public ApiHandler()
@@ -60,7 +64,33 @@ namespace YJMPD_UWP.Model
if (!App.Game.Selected)
App.Photo.SetPhoto(o[Command.PictureUrl.ToString()].ToString());
- App.Game.MoveToStarted();
+ double lat = (double)o["lat"];
+ double lon = (double)o["lon"];
+
+ BasicGeoposition bgps = new BasicGeoposition() { Latitude = lat, Longitude = lon };
+
+ App.Game.MoveToStarted(bgps);
+ break;
+ case Command.GameEnded:
+ string winner = o["winner"].ToString();
+
+ if (winner == Settings.Username)
+ winner = "You";
+
+ Util.ShowToastNotification(winner + " won!", "Press Ready or Leave");
+
+ JArray players = (JArray)o["players"];
+
+ foreach(JToken pl in players)
+ {
+ string username = o["username"].ToString();
+ double points = (double)o["points"];
+ double pointstotal = (double)o["pointstotal"];
+
+ App.Game.UpdatePlayer(username, pointstotal, points);
+ }
+
+ App.Game.StopMatch();
break;
default:
//Do nothing
@@ -130,5 +160,29 @@ namespace YJMPD_UWP.Model
return true;
}
+
+ public async Task DestinationReached()
+ {
+ JObject obj = JObject.FromObject(new
+ {
+ command = Command.DestinationReached.ToString(),
+ username = Settings.Username
+ });
+ await App.Network.Write(obj.ToString(Formatting.None));
+
+ return true;
+ }
+
+ public async Task Ready()
+ {
+ JObject obj = JObject.FromObject(new
+ {
+ command = Command.PlayerReady.ToString(),
+ ready = true
+ });
+ await App.Network.Write(obj.ToString(Formatting.None));
+
+ return true;
+ }
}
}
diff --git a/YJMPD-UWP/Model/GameHandler.cs b/YJMPD-UWP/Model/GameHandler.cs
index e5e0dbc..18c3638 100644
--- a/YJMPD-UWP/Model/GameHandler.cs
+++ b/YJMPD-UWP/Model/GameHandler.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
+using Windows.Devices.Geolocation;
using Windows.Devices.Geolocation.Geofencing;
using Windows.Foundation;
using Windows.Services.Maps;
@@ -22,6 +23,12 @@ namespace YJMPD_UWP.Model
public delegate void OnPlayersUpdateHandler(object sender, GamePlayersUpdatedEventArgs e);
public event OnPlayersUpdateHandler OnPlayersUpdate;
+ public delegate void OnDestinationEnteredHandler(object sender, EventArgs e);
+ public event OnDestinationEnteredHandler OnDestinationEnter;
+
+ public delegate void OnDestinationLeftHandler(object sender, EventArgs e);
+ public event OnDestinationLeftHandler OnDestinationLeave;
+
public enum GameStatus { STARTED, SEARCHING, WAITING, ENDED, STOPPED }
public GameStatus Status { get; private set; }
@@ -48,12 +55,56 @@ namespace YJMPD_UWP.Model
OnPlayersUpdate(this, new GamePlayersUpdatedEventArgs(player));
}
+ private void UpdateDestinationEnter()
+ {
+ if (OnDestinationEnter == null) return;
+
+ OnDestinationEnter(this, new EventArgs());
+ }
+ private void UpdateDestinationLeave()
+ {
+ if (OnDestinationLeave == null) return;
+
+ OnDestinationLeave(this, new EventArgs());
+ }
public GameHandler()
{
Players = new List();
Status = GameStatus.STOPPED;
App.Photo.OnStatusUpdate += Photo_OnStatusUpdate;
+ GeofenceMonitor.Current.GeofenceStateChanged += Current_GeofenceStateChanged;
+ }
+
+ private void Current_GeofenceStateChanged(GeofenceMonitor sender, object args)
+ {
+ if (Status != GameStatus.STARTED) return;
+
+ var reports = sender.ReadReports();
+
+ foreach (GeofenceStateChangeReport report in reports)
+ {
+ GeofenceState state = report.NewState;
+ Geofence geofence = report.Geofence;
+
+ if (geofence.Id != "destination") continue;
+
+ else if (state == GeofenceState.Entered)
+ {
+ UpdateDestinationEnter();
+
+ if (!Selected)
+ App.Api.DestinationReached();
+ }
+
+ else if (state == GeofenceState.Exited)
+ {
+ UpdateDestinationLeave();
+
+ if (Selected)
+ Util.ShowToastNotification("Left Area", "Please return to your location!");
+ }
+ }
}
private void Photo_OnStatusUpdate(object sender, PhotoStatusUpdatedEventArgs e)
@@ -93,9 +144,12 @@ namespace YJMPD_UWP.Model
UpdateGameStatus(GameStatus.WAITING);
}
- public void MoveToStarted()
+ public void MoveToStarted(BasicGeoposition bgps)
{
App.Navigate(typeof(GameView));
+
+ GeofenceMonitor.Current.Geofences.Add(new Geofence("destination", new Geocircle(bgps, 50), MonitoredGeofenceStates.Entered | MonitoredGeofenceStates.Exited, false, TimeSpan.FromSeconds(1)));
+
UpdateGameStatus(GameStatus.STARTED);
}
@@ -120,7 +174,7 @@ namespace YJMPD_UWP.Model
GeofenceMonitor.Current.Geofences.Clear();
UpdateGamePlayers(null);
- App.Navigate(typeof(MatchView));
+ App.Navigate(typeof(GameView));
}
public void UpdatePlayer(string username, double pointstotal, double points)
@@ -136,13 +190,30 @@ namespace YJMPD_UWP.Model
}
}
+ public Player GetPlayer(string username)
+ {
+ foreach(Player p in Players)
+ {
+ if(p.Username == username)
+ return p;
+ }
+
+ return null;
+ }
+
//Ending
- public async Task End()
+ public async Task StopMatch()
{
CalculateDistanceWalked();
Settings.Statistics.Matches += 1;
+ Settings.Statistics.AddPoints(GetPlayer(Settings.Username).Points);
+
+ GeofenceMonitor.Current.Geofences.Clear();
+ Selected = false;
+
+ App.Navigate(typeof(ScoreView));
UpdateGameStatus(GameStatus.ENDED);
return true;
@@ -156,23 +227,13 @@ namespace YJMPD_UWP.Model
//Starting and Stopping
- public async Task Start()
- {
- return await StartGame();
- }
-
- public async Task Stop()
- {
- return await StopGame();
- }
-
- private async Task StartGame()
+ public async Task StartGame()
{
UpdateGameStatus(GameStatus.SEARCHING);
return await App.Api.JoinGame();
}
- private async Task StopGame()
+ public async Task StopGame()
{
App.Api.LeaveGame();
@@ -191,7 +252,7 @@ namespace YJMPD_UWP.Model
case GameStatus.STOPPED:
break;
case GameStatus.SEARCHING:
- App.Navigate(typeof(MatchView));
+ App.Navigate(typeof(GameView));
break;
case GameStatus.WAITING:
if (Selected)
diff --git a/YJMPD-UWP/Model/NetworkHandler.cs b/YJMPD-UWP/Model/NetworkHandler.cs
index b4fba04..a72c447 100644
--- a/YJMPD-UWP/Model/NetworkHandler.cs
+++ b/YJMPD-UWP/Model/NetworkHandler.cs
@@ -130,7 +130,7 @@ namespace YJMPD_UWP.Model
Debug.WriteLine("Disconnecting...");
if (App.Game.Status != GameHandler.GameStatus.STOPPED)
- await App.Game.Stop();
+ await App.Game.StopGame();
UpdateNetworkStatus(NetworkStatus.DISCONNECTED);
diff --git a/YJMPD-UWP/ViewModels/GameVM.cs b/YJMPD-UWP/ViewModels/GameVM.cs
index 73064a7..4e66c0d 100644
--- a/YJMPD-UWP/ViewModels/GameVM.cs
+++ b/YJMPD-UWP/ViewModels/GameVM.cs
@@ -1,5 +1,6 @@
-using Windows.UI.Xaml.Media;
-using Windows.UI.Xaml.Media.Imaging;
+using System.Collections.Generic;
+using System.Diagnostics;
+using YJMPD_UWP.Model.Object;
namespace YJMPD_UWP.ViewModels
{
@@ -7,14 +8,135 @@ namespace YJMPD_UWP.ViewModels
{
public GameVM() : base("Game")
{
-
+ App.Geo.OnStatusUpdate += Geo_OnStatusUpdate;
+ App.Network.OnStatusUpdate += Network_OnStatusUpdate;
+ App.Game.OnStatusUpdate += Game_OnStatusUpdate;
+ App.Game.OnPlayersUpdate += Game_OnPlayersUpdate;
}
- public ImageSource Photo
+ private void Game_OnPlayersUpdate(object sender, Helpers.EventArgs.GamePlayersUpdatedEventArgs e)
+ {
+ dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
+ {
+ NotifyPropertyChanged(nameof(Players));
+ NotifyPropertyChanged(nameof(PlayersCount));
+ });
+ }
+
+ private void Game_OnStatusUpdate(object sender, Helpers.EventArgs.GameStatusUpdatedEventArgs e)
+ {
+ dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
+ {
+ NotifyPropertyChanged(nameof(StartGame));
+ NotifyPropertyChanged(nameof(StopGame));
+ });
+ }
+
+ private void Network_OnStatusUpdate(object sender, Helpers.EventArgs.NetworkStatusUpdatedEventArgs e)
+ {
+ dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
+ {
+ NotifyPropertyChanged(nameof(GameAvailable));
+ NotifyPropertyChanged(nameof(ServerAvailable));
+ NotifyPropertyChanged(nameof(ServerMessage));
+ });
+ }
+
+ private void Geo_OnStatusUpdate(object sender, Helpers.EventArgs.PositionStatusUpdatedEventArgs e)
+ {
+ dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
+ {
+ NotifyPropertyChanged(nameof(GameAvailable));
+ NotifyPropertyChanged(nameof(ServerAvailable));
+ NotifyPropertyChanged(nameof(ServerMessage));
+ });
+ }
+
+
+ public List Players
{
get
{
- return new BitmapImage(new System.Uri(App.Photo.Photo));
+ return new List(App.Game.Players);
+ }
+ }
+
+ public string PlayersCount
+ {
+ get
+ {
+ if (App.Game.Players.Count == 1)
+ return "There is currently " + App.Game.Players.Count + " player in the game.";
+ else
+ return "There are currently " + App.Game.Players.Count + " players in the game.";
+ }
+ }
+
+ public bool GameAvailable
+ {
+ get
+ {
+ return App.Geo.Status == Windows.Devices.Geolocation.PositionStatus.Ready && App.Network.Status == Model.NetworkHandler.NetworkStatus.CONNECTED;
+ }
+ }
+
+ public bool ServerAvailable
+ {
+ get
+ {
+ return !GameAvailable;
+ }
+ }
+
+ public string ServerMessage
+ {
+ get
+ {
+ string str = "";
+
+ switch (App.Network.Status)
+ {
+ case Model.NetworkHandler.NetworkStatus.DISCONNECTED:
+ str = "Disconnected";
+ break;
+ case Model.NetworkHandler.NetworkStatus.CONNECTING:
+ str = "Connecting to server...";
+ break;
+ }
+
+ switch(App.Geo.Status)
+ {
+ case Windows.Devices.Geolocation.PositionStatus.Disabled:
+ case Windows.Devices.Geolocation.PositionStatus.NotAvailable:
+ case Windows.Devices.Geolocation.PositionStatus.NoData:
+ str = "GPS not available";
+ break;
+ case Windows.Devices.Geolocation.PositionStatus.NotInitialized:
+ case Windows.Devices.Geolocation.PositionStatus.Initializing:
+ str = "Waiting on GPS...";
+ break;
+ }
+
+ if (str == "")
+ str = "Connected";
+
+ return str;
+ }
+ }
+
+ public bool StartGame
+ {
+ get
+ {
+ return App.Game.Status == Model.GameHandler.GameStatus.STOPPED;
+ }
+ }
+
+ public bool StopGame
+ {
+ get
+ {
+ return !StartGame;
}
}
}
diff --git a/YJMPD-UWP/ViewModels/MatchVM.cs b/YJMPD-UWP/ViewModels/MatchVM.cs
index fd6e3cb..71a02de 100644
--- a/YJMPD-UWP/ViewModels/MatchVM.cs
+++ b/YJMPD-UWP/ViewModels/MatchVM.cs
@@ -1,6 +1,5 @@
-using System.Collections.Generic;
-using System.Diagnostics;
-using YJMPD_UWP.Model.Object;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Media.Imaging;
namespace YJMPD_UWP.ViewModels
{
@@ -8,135 +7,71 @@ namespace YJMPD_UWP.ViewModels
{
public MatchVM() : base("Match")
{
- App.Geo.OnStatusUpdate += Geo_OnStatusUpdate;
- App.Network.OnStatusUpdate += Network_OnStatusUpdate;
- App.Game.OnStatusUpdate += Game_OnStatusUpdate;
- App.Game.OnPlayersUpdate += Game_OnPlayersUpdate;
+
+ App.Game.OnDestinationEnter += Game_OnDestinationEnter;
+ App.Game.OnDestinationLeave += Game_OnDestinationLeave;
}
- private void Game_OnPlayersUpdate(object sender, Helpers.EventArgs.GamePlayersUpdatedEventArgs e)
+ private void Game_OnDestinationLeave(object sender, System.EventArgs e)
{
dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
- NotifyPropertyChanged(nameof(Players));
- NotifyPropertyChanged(nameof(PlayersCount));
+ if (App.Game.Selected)
+ Error = "Return to location!";
+
+ NotifyPropertyChanged(nameof(ErrorVisible));
+ NotifyPropertyChanged(nameof(Error));
});
}
- private void Game_OnStatusUpdate(object sender, Helpers.EventArgs.GameStatusUpdatedEventArgs e)
+ private void Game_OnDestinationEnter(object sender, System.EventArgs e)
{
dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
- NotifyPropertyChanged(nameof(StartMatch));
- NotifyPropertyChanged(nameof(StopMatch));
- });
+ if (App.Game.Selected)
+ Error = "";
+
+ if (!App.Game.Selected)
+ Message = "You reached the destination!";
+
+ NotifyPropertyChanged(nameof(ErrorVisible));
+ NotifyPropertyChanged(nameof(Error));
+ NotifyPropertyChanged(nameof(MessageVisible));
+ NotifyPropertyChanged(nameof(Message));
+ });
}
- private void Network_OnStatusUpdate(object sender, Helpers.EventArgs.NetworkStatusUpdatedEventArgs e)
- {
- dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
- {
- NotifyPropertyChanged(nameof(MatchAvailable));
- NotifyPropertyChanged(nameof(ServerAvailable));
- NotifyPropertyChanged(nameof(ServerMessage));
- });
- }
-
- private void Geo_OnStatusUpdate(object sender, Helpers.EventArgs.PositionStatusUpdatedEventArgs e)
- {
- dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
- {
- NotifyPropertyChanged(nameof(MatchAvailable));
- NotifyPropertyChanged(nameof(ServerAvailable));
- NotifyPropertyChanged(nameof(ServerMessage));
- });
- }
-
-
- public List Players
+ public bool MessageVisible
{
get
{
- return new List(App.Game.Players);
+ return Message != "";
}
}
- public string PlayersCount
+ public bool ErrorVisible
{
get
{
- if (App.Game.Players.Count == 1)
- return "There is currently " + App.Game.Players.Count + " player in the match.";
- else
- return "There are currently " + App.Game.Players.Count + " players in the match.";
+ return Error != "";
}
}
- public bool MatchAvailable
+ public string Message
{
- get
- {
- return App.Geo.Status == Windows.Devices.Geolocation.PositionStatus.Ready && App.Network.Status == Model.NetworkHandler.NetworkStatus.CONNECTED;
- }
+ get; private set;
}
- public bool ServerAvailable
+ public string Error
{
- get
- {
- return !MatchAvailable;
- }
+ get; private set;
}
- public string ServerMessage
+ public ImageSource Photo
{
get
{
- string str = "";
-
- switch (App.Network.Status)
- {
- case Model.NetworkHandler.NetworkStatus.DISCONNECTED:
- str = "Disconnected";
- break;
- case Model.NetworkHandler.NetworkStatus.CONNECTING:
- str = "Connecting to server...";
- break;
- }
-
- switch(App.Geo.Status)
- {
- case Windows.Devices.Geolocation.PositionStatus.Disabled:
- case Windows.Devices.Geolocation.PositionStatus.NotAvailable:
- case Windows.Devices.Geolocation.PositionStatus.NoData:
- str = "GPS not available";
- break;
- case Windows.Devices.Geolocation.PositionStatus.NotInitialized:
- case Windows.Devices.Geolocation.PositionStatus.Initializing:
- str = "Waiting on GPS...";
- break;
- }
-
- if (str == "")
- str = "Connected";
-
- return str;
- }
- }
-
- public bool StartMatch
- {
- get
- {
- return App.Game.Status == Model.GameHandler.GameStatus.STOPPED;
- }
- }
-
- public bool StopMatch
- {
- get
- {
- return !StartMatch;
+ return new BitmapImage(new System.Uri(App.Photo.Photo));
}
}
}
diff --git a/YJMPD-UWP/ViewModels/PhotoVM.cs b/YJMPD-UWP/ViewModels/PhotoVM.cs
index be8816b..c7d7903 100644
--- a/YJMPD-UWP/ViewModels/PhotoVM.cs
+++ b/YJMPD-UWP/ViewModels/PhotoVM.cs
@@ -28,7 +28,7 @@ namespace YJMPD_UWP.ViewModels
secondsleft--;
if(secondsleft <= 0)
{
- App.Game.Stop();
+ App.Game.StopGame();
}
}
diff --git a/YJMPD-UWP/ViewModels/ScoreVM.cs b/YJMPD-UWP/ViewModels/ScoreVM.cs
index 57add71..f33d05a 100644
--- a/YJMPD-UWP/ViewModels/ScoreVM.cs
+++ b/YJMPD-UWP/ViewModels/ScoreVM.cs
@@ -37,9 +37,9 @@ namespace YJMPD_UWP.ViewModels
get
{
if (App.Game.Players.Count == 1)
- return "There is currently " + App.Game.Players.Count + " player in the match.";
+ return "There is currently " + App.Game.Players.Count + " player in the game.";
else
- return "There are currently " + App.Game.Players.Count + " players in the match.";
+ return "There are currently " + App.Game.Players.Count + " players in the game.";
}
}
}
diff --git a/YJMPD-UWP/Views/GameView.xaml b/YJMPD-UWP/Views/GameView.xaml
index fe66f90..2efc678 100644
--- a/YJMPD-UWP/Views/GameView.xaml
+++ b/YJMPD-UWP/Views/GameView.xaml
@@ -3,13 +3,51 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:YJMPD_UWP.Views"
+ xmlns:convert="using:YJMPD_UWP.Helpers.Converter"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/YJMPD-UWP/Views/GameView.xaml.cs b/YJMPD-UWP/Views/GameView.xaml.cs
index 0101d7c..67afe3c 100644
--- a/YJMPD-UWP/Views/GameView.xaml.cs
+++ b/YJMPD-UWP/Views/GameView.xaml.cs
@@ -1,4 +1,5 @@
-using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
using YJMPD_UWP.ViewModels;
namespace YJMPD_UWP.Views
@@ -13,5 +14,15 @@ namespace YJMPD_UWP.Views
this.DataContext = gamevm;
this.InitializeComponent();
}
+
+ private void StartGameButton_Click(object sender, RoutedEventArgs e)
+ {
+ App.Game.StartGame();
+ }
+
+ private void StopGameButton_Click(object sender, RoutedEventArgs e)
+ {
+ App.Game.StopGame();
+ }
}
}
diff --git a/YJMPD-UWP/Views/MatchView.xaml b/YJMPD-UWP/Views/MatchView.xaml
index 3993876..d9d53c6 100644
--- a/YJMPD-UWP/Views/MatchView.xaml
+++ b/YJMPD-UWP/Views/MatchView.xaml
@@ -12,42 +12,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
diff --git a/YJMPD-UWP/Views/MatchView.xaml.cs b/YJMPD-UWP/Views/MatchView.xaml.cs
index 3d5055b..acc8f50 100644
--- a/YJMPD-UWP/Views/MatchView.xaml.cs
+++ b/YJMPD-UWP/Views/MatchView.xaml.cs
@@ -1,5 +1,4 @@
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls;
using YJMPD_UWP.ViewModels;
namespace YJMPD_UWP.Views
@@ -14,15 +13,5 @@ namespace YJMPD_UWP.Views
this.DataContext = matchvm;
this.InitializeComponent();
}
-
- private void StartMatchButton_Click(object sender, RoutedEventArgs e)
- {
- App.Game.Start();
- }
-
- private void StopMatchButton_Click(object sender, RoutedEventArgs e)
- {
- App.Game.Stop();
- }
}
}
diff --git a/YJMPD-UWP/Views/ScoreView.xaml.cs b/YJMPD-UWP/Views/ScoreView.xaml.cs
index e46883f..03da032 100644
--- a/YJMPD-UWP/Views/ScoreView.xaml.cs
+++ b/YJMPD-UWP/Views/ScoreView.xaml.cs
@@ -27,9 +27,12 @@ namespace YJMPD_UWP.Views
ReadyCheck.Visibility = Visibility.Visible;
ReadyButton.IsEnabled = false;
- Task.Delay(TimeSpan.FromMilliseconds(1500));
+ App.Api.Ready();
- App.Navigate(typeof(WaitingView));
+ await Task.Delay(TimeSpan.FromMilliseconds(500));
+
+ App.Game.MoveToWaiting();
+ App.Navigate(typeof(WaitingView), "Waiting on other players...");
}
}
}
diff --git a/YJMPD-UWP/YJMPD-UWP.csproj b/YJMPD-UWP/YJMPD-UWP.csproj
index 22e7b20..a4f11f5 100644
--- a/YJMPD-UWP/YJMPD-UWP.csproj
+++ b/YJMPD-UWP/YJMPD-UWP.csproj
@@ -119,9 +119,9 @@
-
-
+
+
@@ -130,12 +130,12 @@
AboutView.xaml
-
- GameView.xaml
-
MatchView.xaml
+
+ GameView.xaml
+
PhotoView.xaml
@@ -196,11 +196,11 @@
MSBuild:Compile
Designer
-
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile