void RunSession(bool write_state) { BingoGameState s; playing_session.BeginPlay(); // can't check valid, games with no balls are also not valid, but shouldn't end the list. while ((s = playing_session.StepReplay(false)).game != null) { // this begins a thread that plays once. // playing_session.Up if (s.valid) { playing_session.LoadPlayerCards(s); string[] columns = s.game.Name.Split('\t'); UpdateStatus("Session: " + this.playing_session.session.session_name + ", Game: " + columns[1].ToString() + " Started"); playing_session.Play(s); while (playing_session.Active) { Thread.SpinWait(1); } if (BingoGameCore4.RateRank.Calculate(s)) { if (write_state) { StateWriter.DumpState(s, false, true); } } UpdateStatus("Session: " + this.playing_session.session.session_name + ", Game: " + columns[1].ToString() + " Ended"); } } UpdateStatus("Updating Session Rate & Rank Data Tables..."); BingoGameCore4.RateRank.UpdateRanks(playing_session.bingoday, playing_session.session_number); UpdateLastStatusLine("Updating Session Rate & Rank Data Tables... Done"); }
void check_winner_Tick(object sender, EventArgs e) { Log.log("Tick."); check_winner.Stop(); timer_gameEventDataSet.FillUnprocessed(10); { if (timer_gameEventDataSet.GamesProcessed.Rows.Count > 0) { complete = false; // if playing session is not initialized, a warning is thrown for this loop. foreach (DataRow row in timer_gameEventDataSet.GamesProcessed.Rows) { DataRow GameEventRow = row.GetParentRow("game_is_processed"); int row_session = Convert.ToInt32(GameEventRow["session"]); //if( this_session == null || playing_session.session_number != row_session ) { SetupNewSession(Convert.ToDateTime(GameEventRow["bingoday"]), Convert.ToInt32(GameEventRow["session"])); this_session.StatusUpdate += UpdateStatus; UpdateStatus("Reloading players in session " + playing_session.session_number); // each session has one set of players... // playing_session.ReloadPlayers(); } // this has game number in it... BingoGameState[] states = playing_session.StepToReplay(GameEventRow); if (states != null) { UpdateStatus("Playing session " + playing_session.session_number ); foreach (BingoGameState game_state in states) { // bingo game state contains the BingoGameEvent // so part of initializiation is the Bingogaemevent from the row ... already exists... playing_session.DoPlayState(game_state); //playing_session.Play( game_state ); if (BingoGameCore4.RateRank.Calculate(game_state)) { //StateWriter.WritePerCardStatistics = true; //StateWriter.WritePlayerPackBreakdown = true; // StateWriter. StateWriter.DumpState(game_state, false, false); } } UpdateStatus("Played session (wrote results)" + playing_session.session_number ); } row["processed"] = true; timer_gameEventDataSet.GamesProcessed.CommitChanges(); } } else { if (!complete) { UpdateStatus("Everything Complete."); complete = true; } } } check_winner.Start(); // select from prize_validations, see if anything is new. // step to game, and play. }
void EltaninReceiver_GameChanged(int new_Game) { //this needs to have an option. if (true) { return; } //---------------------------------------------- // FIX //---------------------------------------------- if (playing_session == null) { return; } Log.log("New game " + new_Game); if (new_Game != old_game) { if (old_game > 0) { UpdateStatus("Reloading players in session " + playing_session.session_number + " and game " + old_game); try { //playing_session.PlayerList //playing_session.ReloadPlayers(/* pack_sequence */); // make sure the players are up to date... /* * for( int p = 0; p < 60; p++ ) * playing_session.PlayerList.Add( new BingoPlayer() ); */ BingoGameState s = playing_session.StepToReplay(old_game); if (s.valid) { UpdateStatus("Playing session " + playing_session.session_number + " and game " + old_game); playing_session.Play(s); while (playing_session.Active) { Thread.SpinWait(1); } UpdateStatus("Calculating session " + playing_session.session_number + " and game " + old_game); if (BingoGameCore4.RateRank.Calculate(s)) { UpdateStatus("Writing session " + playing_session.session_number + " and game " + old_game); StateWriter.DumpState(s, false, false); } else { UpdateStatus("Game did not get ranked, not writing."); } } else { UpdateStatus("Skiping game... not playing it."); } } catch (Exception e) { Log.log("Outermost catcher caught exception - " + e.StackTrace); Log.log("Timer will resume at least..."); Log.log(e.Message); } } old_game = new_Game; } // Scan prior game... //throw new Exception( "The method or operation is not implemented." ); }