コード例 #1
0
        private static int Main(string[] args)
        {
            ParserResult <CommandLineOptions> commandLineOptions = Parser.Default.ParseArguments <CommandLineOptions>(args);

            return(commandLineOptions.MapResult(
                       options =>
            {
                var worldDirectory = new WorldDirectory(options.WorldDirectory);

                using (var game = new TextAdventureGame(worldDirectory))
                {
                    game.Run();
                }

                return 0;
            },
                       errors => 1));
        }
コード例 #2
0
        public TextAdventureGame(WorldDirectory worldDirectory)
        {
            _worldDirectory = worldDirectory.EnsureNotNull(nameof(worldDirectory));

            _graphics     = new GraphicsDeviceManager(this);
            _world        = worldDirectory.CreateWorld();
            _form         = (Form)Control.FromHandle(Window.Handle);
            _form.Opacity = 0;

            Stream iconStream = worldDirectory.OpenIconStream();

            if (iconStream != null)
            {
                _form.Icon = new Icon(iconStream);
            }

            Content.RootDirectory = "Content";
            Window.Title          = $"{_world.Name} - Text Adventure";
        }