示例#1
0
文件: Runner.cs 项目: JatinR/quest
        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.InfoFormat("{0} Initialising {1}", GameId, m_filename);

            IASL 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.InfoFormat("{0} Initialised successfully", GameId);
            }
            else
            {
                Logging.Log.InfoFormat("{0} Failed to initialise game - errors found in file", GameId);
            }

            return success;
        }
示例#3
0
文件: GameQuery.cs 项目: JatinR/quest
        public bool Initialise()
        {
            m_game = GameLauncher.GetGame(m_filename, null);
            m_v4Game = m_game as LegacyASL.LegacyGame;
            m_v5Game = m_game as WorldModel;
            m_helper = new PlayerHelper(m_game, m_dummyUI);

            try
            {
                if (!m_helper.Initialise(m_dummyUI, out m_errors))
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
                m_errors.Add(ex.Message);
                return false;
            }

            return true;
        }
示例#4
0
        public bool Initialise()
        {
            m_game   = GameLauncher.GetGame(m_filename, null);
            m_v4Game = m_game as LegacyASL.LegacyGame;
            m_v5Game = m_game as WorldModel;
            m_helper = new PlayerHelper(m_game, m_dummyUI);

            try
            {
                if (!m_helper.Initialise(m_dummyUI, out m_errors))
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                m_errors.Add(ex.Message);
                return(false);
            }

            return(true);
        }
示例#5
0
        public bool Initialise(out List<string> errors, bool? isCompiled)
        {
            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, isCompiled);
            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;
        }