This is the main type for your game
상속: Microsoft.Xna.Framework.Game
예제 #1
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     var info = e.Parameter as GameDetected;
     Info = info;
     _game = XamlGame<ScummGame>.Create("", Window.Current.CoreWindow, GamePanel);
     _menuService.Game = _game;
     _game.Services.AddService<IMenuService>(_menuService);
 }
예제 #2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var info = e.Parameter as GameDetected;

            Info  = info;
            _game = XamlGame <ScummGame> .Create("", Window.Current.CoreWindow, GamePanel);

            _menuService.Game = _game;
            _game.Services.AddService <IMenuService>(_menuService);
        }
예제 #3
0
        static int Main(string[] args)
        {
            var    musicDriver      = "adlib";
            var    showVersion      = false;
            var    showHelp         = false;
            var    listAudioDevices = false;
            var    bootParam        = 0;
            var    copyProtection   = false;
            string switches         = null;
            var    options          = new OptionSet
            {
                { "v|version", "Display NScumm version information and exit", v => showVersion = v != null },
                { "h|help", "Display a brief help text and exit", h => showHelp = h != null },
                { "e|music-driver=", "Select music driver", d => musicDriver = d },
                { "list-audio-devices", "List all available audio devices", b => listAudioDevices = b != null },
                { "b|boot-param=", "Pass number to the boot script (boot param)", (int b) => bootParam = b },
                { "debugflags=", "Enable engine specific debug flags (separated by commas)", d => switches = d },
                { "copy_protection", "Enable copy protection in SCUMM games, when NScumm disables it by default.", b => copyProtection = b != null }
            };

            try
            {
                var extras = options.Parse(args);
                Initialize(switches);
                if (showVersion)
                {
                    ShowVersion();
                }
                else if (showHelp)
                {
                    Usage(options);
                }
                else if (listAudioDevices)
                {
                    ListAudioDevices();
                }
                else if (extras.Count == 1)
                {
                    var path = ScummHelper.NormalizePath(extras[0]);
                    if (File.Exists(path))
                    {
                        var pluginsdDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins");
                        var gd = new GameDetector();
                        gd.AddPluginsFromDirectory(pluginsdDirectory);
                        var info = gd.DetectGame(path);
                        if (info == null)
                        {
                            Console.Error.WriteLine("This game is not supported, sorry please contact me if you want to support this game.");
                        }
                        else
                        {
                            ((AudioManager)ServiceLocator.AudioManager).Directory = Path.GetDirectoryName(info.Game.Path);
                            var settings = new GameSettings(info.Game, info.Engine)
                            {
                                AudioDevice = musicDriver, CopyProtection = copyProtection, BootParam = bootParam
                            };
                            var game = new ScummGame(settings);
                            game.Services.AddService <IMenuService>(new MenuService(game));
                            game.Run();
                        }
                    }
                    else
                    {
                        Console.Error.WriteLine("The file {0} does not exist.", path);
                    }
                }
                else
                {
                    Usage(options);
                    return(1);
                }
            }
            catch (ArgumentException)
            {
                Usage(options);
                return(1);
            }
            catch (OptionException)
            {
                Usage(options);
                return(1);
            }
            return(0);
        }
예제 #4
0
파일: Program.cs 프로젝트: scemino/nscumm
        static int Main(string[] args)
        {
            var musicDriver = "adlib";
            var showVersion = false;
            var showHelp = false;
            var listAudioDevices = false;
            var bootParam = 0;
            var copyProtection = false;
            string switches = null;
            var options = new OptionSet
            {
                { "v|version", "Display NScumm version information and exit", v => showVersion = v != null },
                { "h|help", "Display a brief help text and exit", h => showHelp = h != null },
                { "e|music-driver=", "Select music driver", d => musicDriver = d },
                { "list-audio-devices", "List all available audio devices", b => listAudioDevices = b != null },
                { "b|boot-param=", "Pass number to the boot script (boot param)", (int b) => bootParam = b },
                { "debugflags=", "Enable engine specific debug flags (separated by commas)", d => switches = d },
                { "copy_protection", "Enable copy protection in SCUMM games, when NScumm disables it by default.", b => copyProtection = b != null }
            };

            try
            {
                var extras = options.Parse(args);
                Initialize(switches);
                if (showVersion)
                {
                    ShowVersion();
                }
                else if (showHelp)
                {
                    Usage(options);
                }
                else if (listAudioDevices)
                {
                    ListAudioDevices();
                }
                else if (extras.Count == 1)
                {
                    var path = ScummHelper.NormalizePath(extras[0]);
                    if (File.Exists(path))
                    {
                        var pluginsdDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins");
                        var gd = new GameDetector();
                        gd.AddPluginsFromDirectory(pluginsdDirectory);
                        var info = gd.DetectGame(path);
                        if (info == null)
                        {
                            Console.Error.WriteLine("This game is not supported, sorry please contact me if you want to support this game.");
                        }
                        else
                        {
                            ((AudioManager)ServiceLocator.AudioManager).Directory = Path.GetDirectoryName(info.Game.Path);
                            var settings = new GameSettings(info.Game, info.Engine) { AudioDevice = musicDriver, CopyProtection = copyProtection, BootParam = bootParam };
                            var game = new ScummGame(settings);
                            game.Services.AddService<IMenuService>(new MenuService(game));
                            game.Run();
                        }
                    }
                    else
                    {
                        Console.Error.WriteLine("The file {0} does not exist.", path);
                    }
                }
                else
                {
                    Usage(options);
                    return 1;
                }
            }
            catch (ArgumentException)
            {
                Usage(options);
                return 1;
            }
            catch (OptionException)
            {
                Usage(options);
                return 1;
            }
            return 0;
        }