public override void OnNavigatedTo(INavigationParameters parameters) { if (parameters.TryGetValue("Board", out List <string> ReturnedList)) { UnpackColectionToTiles(ReturnedList); Score = parameters.GetValue <string>("Score"); BestScore = parameters.GetValue <string>("BestScore"); UpdateTilesBackgroundColors(); TriggerFontSizeChange(); int ScoreAfterMove = CalculateScoreBoard.CalculateScoreBoardMethod(PackTilesToColection()); if (ScoreAfterMove > int.Parse(Score)) { Score = ScoreAfterMove.ToString(); } if (ScoreAfterMove > int.Parse(BestScore)) { BestScore = ScoreAfterMove.ToString(); } PlayingOver2048 = true; } }
public void MoveTriggerImpl(Direction direction) { DirectionName = direction; List <string> PackedList = PackTilesToColection(); MoveEngine moveEngine = new MoveEngine(PackedList, direction); UnpackColectionToTiles(moveEngine.MovedList); UpdateTilesBackgroundColors(); TriggerFontSizeChange(); int ScoreAfterMove = CalculateScoreBoard.CalculateScoreBoardMethod(PackTilesToColection()); if (ScoreAfterMove > int.Parse(Score)) { Score = ScoreAfterMove.ToString(); } if (ScoreAfterMove > int.Parse(BestScore)) { BestScore = ScoreAfterMove.ToString(); } PackedList = PackTilesToColection(); if (!PlayingOver2048) { if (CheckIfExist2048Tile(PackedList)) { var navigationParams = new NavigationParameters(); navigationParams.Add("ViewModel", this); _navigationService.NavigateAsync("NavigationPage/WinningPopup", navigationParams); } } }