public void End() { AppShell.RemoveAllFlyoutItems(); LengthOfThisGame = StartingTime - DateTime.UtcNow; var EndInfo = new IntroductionViewModel(AppShell, "Konec"); if (LengthOfThisGame.Minutes <= Model.Limit.Minutes) { var EndText = new Text() { Title = "Úspěšně jsi dokončil hru", OwnText = "Hra ti trvala " + LengthOfThisGame.Minutes + " minut. " + "Limit byl " + Model.Limit.Minutes + " minut.", PositionInIntroduction = 0 }; EndInfo.AddText(EndText); } else { var EndText = new Text() { Title = "Hru jsi nestihnul v limitu", OwnText = "Hra ti trvala " + LengthOfThisGame.Minutes + " minut. " + "Limit byl " + Model.Limit.Minutes + " minut.", PositionInIntroduction = 0 }; EndInfo.AddText(EndText); } }
public async void LoadAndPlayGame(int id, AppShell appShell) { var restClient = new RestClient.RestClient(); var gameResource = await restClient.GetFullGameByIdAsync(id); var converter = new FullGameConverter(); var game = converter.Convert(gameResource); LocationChecker = new LocationChecker(); AppShell = appShell; Model = game; MapService = new MapService(AppShell); Introduction = new IntroductionViewModel(AppShell, Model.Introduction.Title); if (Model.Introduction.DisplayObjects != null) { foreach (DisplayObject obj in Model.Introduction.DisplayObjects) { Introduction.AddDisplayObject(obj); } } Text InfoAboutGame = new Text() { Title = "Hráči, kteří se podíleli na této hře", PositionInIntroduction = 0, OwnText = "" }; foreach (User user in Model.Owners) { InfoAboutGame.OwnText = InfoAboutGame.OwnText + user.UserName + " "; } Introduction.AddText(InfoAboutGame); if (Model.Introduction.MapPositions != null) { MapService.AddNotStops(Model.Introduction.MapPositions as List <MapPosition>); } StartingTime = DateTime.UtcNow; foreach (Stop stop in Model.Stops) { SetUpStopModel(stop); } }