private void OnRunButtonClicked(StoredGame storedGame) { _storedGames.Remove(storedGame); Prefs.SetStoredGames(_storedGames); SceneTransition.GameController = storedGame.ToGameController(); _animator.Play(UIAnimations.LeftClosing); _loading = SceneManager.LoadSceneAsync(Scenes.Game); _loading.allowSceneActivation = false; }
public void Init(StoredGame storedGame) { StoredGame = storedGame; _board.InitBoard(); _board.InitPieces(new Game(storedGame.Moves).Position); _title.text = storedGame.GetTitle(); _info.text = storedGame.GetInfo(); _dateTime.text = storedGame.GetDateTime(); SetRotation(storedGame.GetRotation()); }
public static async Task <int> AddNewGameToMatchAsync(int matchId) { using (ModuleContext DB = new ModuleContext()) { var match = await DB.Matches.Where(x => x.Id == matchId).SingleOrDefaultAsync(); StoredGame game = new StoredGame(); match.Games.Add(game); game.Order = match.Games.Count; await DB.SaveChangesAsync(); return(game.Id); } }
public UCTab(StoredGame storedGame) { this.storedGame = storedGame; InitializeComponent(); uCBoard = new UCBoard(); grdMain.Children.Add(uCBoard); isPause = true; isOver = false; currentMove = -1; ChangeStatusBtn(isPause); Thread thread = new Thread(new ThreadStart(PlayGame)); thread.IsBackground = true; thread.Start(); delay = 1000; }
public async Task <IActionResult> CreateGame(int?configuration) { var user = await _userManager.GetUserAsync(this.User); if (user is null) { return(BadRequest("Please join server first")); } var nGame = new StoredGame() { Completed = false, Aborted = false, CreatedBy = user, CreatedTime = DateTime.UtcNow, Name = NameGen.GetRandomName(), Players = new List <StoredGamePlayers>() }; _context.Games.Add(nGame); await _context.SaveChangesAsync(); var config = GameConfiguration.DefaultLama; if (configuration.HasValue && configuration.Value == 1) { config = GameConfiguration.NegativeLama; } var g = new Game(nGame.Id, nGame.Name, config); Games.Add(g); g.StatusChanged += GameStatusChanged; g.GameEnded += GameEnded; return(Ok(g.Id)); }