Beispiel #1
0
        public static void Run()
        {
            IGame game = AGSGame.CreateEmpty();

            //Rendering the text at a 4 time higher resolution than the actual game, so it will still look sharp when maximizing the window.
            GLText.TextResolutionFactorX = 4;
            GLText.TextResolutionFactorY = 4;

            game.Events.OnLoad.Subscribe(async() =>
            {
                AGSGameSettings.CurrentSkin = null;

                //addDebugLabels(game);
                WelcomeScreen screen = new WelcomeScreen(game);
                screen.Load();
                screen.Show();

                var room = game.Factory.Room.GetRoom("MainEditorRoom");
                await game.State.ChangeRoomAsync(room);
            });

            game.Start(new AGSGameSettings("MonoAGS Editor", new AGS.API.Size(1280, 800),
                                           windowSize: new AGS.API.Size(1280, 800), windowState: WindowState.Normal, preserveAspectRatio: false));
        }
Beispiel #2
0
        public static void Run()
        {
            Resolver resolver = new Resolver(AGSGame.Device, new AGSGameSettings("MonoAGS Editor", new Size(1280, 800),
                                                                                 windowSize: new Size(1280, 800), windowState: WindowState.Normal, preserveAspectRatio: false));
            IGame game = AGSGame.Create(resolver);

            //Rendering the text at a 4 time higher resolution than the actual game, so it will still look sharp when maximizing the window.
            GLText.TextResolutionFactorX = 4;
            GLText.TextResolutionFactorY = 4;

            game.Events.OnLoad.Subscribe(async() =>
            {
                game.Factory.Resources.ResourcePacks.Add(new ResourcePack(new FileSystemResourcePack(AGSGame.Device.FileSystem, AGSGame.Device.Assemblies.EntryAssembly), 0));
                game.Factory.Resources.ResourcePacks.Add(new ResourcePack(new EmbeddedResourcesPack(AGSGame.Device.Assemblies.EntryAssembly), 1));
                game.Factory.Fonts.InstallFonts("Fonts/Font Awesome 5 Free-Solid-900.otf", "Fonts/Fira/FiraSans-Regular.ttf");
                FontIcons.Init(game.Factory.Fonts);
                var font = game.Factory.Fonts.LoadFontFromPath("Fonts/Fira/FiraSans-Regular.ttf", 14f, FontStyle.Regular);
                game.Settings.Defaults.Fonts.Text   = font;
                game.Settings.Defaults.Fonts.Speech = font;

                AGSEditor editor = resolver.Container.Resolve <AGSEditor>();
                editor.Editor    = game;

                game.Settings.Defaults.Skin = null;

                WelcomeScreen screen = new WelcomeScreen(editor);
                screen.Load();
                screen.Show();

                var room = game.Factory.Room.GetRoom("MainEditorRoom");
                ReflectionCache.Refresh();
                await game.State.ChangeRoomAsync(room);
            });

            game.Start();
        }
Beispiel #3
0
        public bool ShowWelcomeScreen()
        {
            if (System.Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                this.ShowMessage("You are running AGS on a computer with Windows 98 or Windows ME. AGS is no longer supported on these operating systems. You are STRONGLY ADVISED to run the AGS Editor on Windows 2000, XP or Vista.", MessageBoxIcon.Warning);
            }

            if (!VerifyTemplatesDirectoryExists())
            {
                _exitFromWelcomeScreen = true;
                Application.Exit();
                return true;
            }

            bool showWelcomeScreen = ProcessCommandLineArgumentsAndReturnWhetherToShowWelcomeScreen();

            while (showWelcomeScreen)
            {
                Directory.SetCurrentDirectory(_agsEditor.EditorDirectory);
                WelcomeScreen welcomeScreen = new WelcomeScreen(_agsEditor.RecentGames);
                DialogResult result = welcomeScreen.ShowDialog();
                WelcomeScreenSelection selection = welcomeScreen.SelectedOption;
                showWelcomeScreen = false;

                if (result == DialogResult.Cancel)
                {
                    _exitFromWelcomeScreen = true;
                    Application.Exit();
                }
                else if (selection == WelcomeScreenSelection.LoadExistingGame)
                {
                    if (!_interactiveTasks.BrowseForAndLoadGame())
                    {
                        showWelcomeScreen = true;
                    }
                }
                else if (selection == WelcomeScreenSelection.ContinueRecentGame)
                {
                    string gameToLoad = Path.Combine(welcomeScreen.SelectedRecentGame.DirectoryPath, AGSEditor.GAME_FILE_NAME);
                    if (!File.Exists(gameToLoad))
                    {
                        gameToLoad = gameToLoad.Replace(AGSEditor.GAME_FILE_NAME, AGSEditor.OLD_GAME_FILE_NAME);
                        if (!File.Exists(gameToLoad))
                        {
                            Factory.GUIController.ShowMessage("Unable to find a valid game file in " + welcomeScreen.SelectedRecentGame.DirectoryPath, MessageBoxIcon.Warning);
                            showWelcomeScreen = true;
                        }
                        else if (!_interactiveTasks.LoadGameFromDisk(gameToLoad))
                        {
                            showWelcomeScreen = true;
                        }
                    }
                    else if (!_interactiveTasks.LoadGameFromDisk(gameToLoad))
                    {
                        showWelcomeScreen = true;
                    }
                }
                else
                {
                    showWelcomeScreen = !ShowNewGameWizard();
                }

                welcomeScreen.Dispose();
            }
            return _exitFromWelcomeScreen;
        }