Пример #1
0
        public void Start()
        {
            IASL game = GameLauncher.GetGame(m_filename, null);

            m_player              = new ConsolePlayer(game);
            m_player.ClearBuffer += ClearBuffer;
            m_player.Finish      += Finish;
            m_helper              = new PlayerHelper(game, m_player);

            List <string> errors = new List <string>();

            if (!m_helper.Initialise(m_player, out errors))
            {
                Console.WriteLine("Failed to load game");
                foreach (string error in errors)
                {
                    Console.WriteLine(error);
                }
                Console.ReadKey();
            }
            else
            {
                game.Begin();
                PlayGame();
            }
        }
Пример #2
0
        public bool Initialise(out List <string> errors)
        {
            Logging.Log.DebugFormat("{0} Initialising {1}", GameId, m_filename);

            IASL game;

            if (LoadData != null)
            {
                game = GameLauncher.GetGame(Convert.FromBase64String(LoadData), ApiGameData.ASLVersion, ApiGameData.SourceGameUrl);
            }
            else
            {
                game = GameLauncher.GetGame(m_filename, LibraryFolder);
            }

            m_controller = new PlayerHelper(game, this);
            m_controller.UseGameColours   = true;
            m_controller.UseGameFont      = true;
            m_controller.Game.LogError   += LogError;
            m_controller.Game.UpdateList += UpdateList;
            m_controller.Game.Finished   += GameFinished;

            IASLTimer gameTimer = game as IASLTimer;

            if (gameTimer != null)
            {
                gameTimer.RequestNextTimerTick += RequestNextTimerTick;
            }

            bool success = m_controller.Initialise(this, out errors);

            if (success)
            {
                Logging.Log.DebugFormat("{0} Initialised successfully", GameId);
            }
            else
            {
                Logging.Log.WarnFormat("{0} Failed to initialise game - errors found in file", GameId);
            }

            return(success);
        }