Example #1
0
        private async Task loadSplashScreen(IGame game)
        {
            AGSSplashScreen splashScreen = new AGSSplashScreen();

            Rooms.SplashScreen = splashScreen.Load(game);

            var splashBackground = game.Factory.Object.GetObject("Splash Background");

            splashBackground.Image = await game.Factory.Graphics.LoadImageAsync("Rooms/Splash/bg.png");

            Rooms.SplashScreen.Background = splashBackground;

            game.State.Rooms.Add(Rooms.SplashScreen);
            Rooms.SplashScreen.Events.OnAfterFadeIn.SubscribeToAsync(async() =>
            {
                await loadRooms(game);
                Debug.WriteLine("Startup: Loaded Rooms");
                Task charactersLoaded = loadCharacters(game);
                await loadUi(game);
                Debug.WriteLine("Startup: Loaded UI");
                DefaultInteractions defaults = new DefaultInteractions(game, game.Events);
                defaults.Load();
                await charactersLoaded;
                Debug.WriteLine("Startup: Loaded Characters");
                await game.State.Player.ChangeRoomAsync(Rooms.EmptyStreet.Result, 50, 30);
            });
            await game.State.ChangeRoomAsync(Rooms.SplashScreen);

            Debug.WriteLine("Startup: Loaded splash screen");
        }
Example #2
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 (sender, e) =>
            {
                Hooks.FontLoader.InstallFonts("../../Assets/Fonts/pf_ronda_seven.ttf", "../../Assets/Fonts/Pixel_Berry_08_84_Ltd.Edition.TTF");
                AGSGameSettings.DefaultSpeechFont = Hooks.FontLoader.LoadFontFromPath("../../Assets/Fonts/pf_ronda_seven.ttf", 14f, FontStyle.Regular);
                AGSGameSettings.DefaultTextFont = Hooks.FontLoader.LoadFontFromPath("../../Assets/Fonts/Pixel_Berry_08_84_Ltd.Edition.TTF", 14f, FontStyle.Regular);
                AGSGameSettings.CurrentSkin = null;
                game.State.RoomTransitions.Transition = AGSRoomTransitions.Fade();
                setKeyboardEvents(game);
                Shaders.SetStandardShader();

                /*IObject bg = game.Factory.Object.GetObject("Empty Street BG");
                bg.Image = await game.Factory.Graphics.LoadImageAsync("../../Assets/Rooms/EmptyStreet/bg.png");
                game.State.UI.Add(bg);
                var room = game.Factory.Room.GetRoom("x");
                game.State.ChangeRoom(room);

                await Task.Delay(1);*/

                addDebugLabels(game);
                Debug.WriteLine("Startup: Loading Assets");
                await loadPlayerCharacter(game);
                Debug.WriteLine("Startup: Loaded Player Character");
                await loadRooms(game);
                Debug.WriteLine("Startup: Loaded Rooms");
                Task charactersLoaded = loadCharacters(game);
                var topPanel = await loadUi(game);
                Debug.WriteLine("Startup: Loaded UI");
                DefaultInteractions defaults = new DefaultInteractions(game, game.Events);
                defaults.Load();
                await charactersLoaded.ContinueWith(c =>
                {
                    Debug.WriteLine("Startup: Loaded Characters");
                    game.State.Player.ChangeRoom(Rooms.EmptyStreet.Result, 50, 30);
                    topPanel.Visible = true;
                });
            });

            game.Start(new AGSGameSettings("Demo Game", new AGS.API.Size(320, 200), 
				windowSize: new AGS.API.Size(640, 400), windowState: WindowState.Normal));
		}
Example #3
0
        private async Task loadSplashScreen(IGame game)
        {
            AGSSplashScreen splashScreen = new AGSSplashScreen();

            Rooms.SplashScreen = splashScreen.Load(game);
            game.State.Rooms.Add(Rooms.SplashScreen);
            Rooms.SplashScreen.Events.OnAfterFadeIn.SubscribeToAsync(async() =>
            {
                await loadRooms(game);
                Debug.WriteLine("Startup: Loaded Rooms");
                Task charactersLoaded = loadCharacters(game);
                var topPanel          = await loadUi(game);
                Debug.WriteLine("Startup: Loaded UI");
                DefaultInteractions defaults = new DefaultInteractions(game, game.Events);
                defaults.Load();
                await charactersLoaded;
                Debug.WriteLine("Startup: Loaded Characters");
                await game.State.Player.ChangeRoomAsync(Rooms.EmptyStreet.Result, 50, 30);
                topPanel.Visible = true;
            });
            await game.State.ChangeRoomAsync(Rooms.SplashScreen);

            Debug.WriteLine("Startup: Loaded splash screen");
        }