public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("config"); application.ContentSearchPaths.Add("resources"); application.ContentSearchPaths.Add("buildings"); // This will set the world bounds to be (0,0, w, h) // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved var width = application.MainWindow.WindowSizeInPixels.Width; var height = application.MainWindow.WindowSizeInPixels.Height; var defaultWidth = 1080; var defaultHeight = 1920; var scaleFactor = width * height / (defaultWidth * defaultHeight); Font.FontScaleFactor = scaleFactor; CCScene.SetDefaultDesignResolution(width, height, CCSceneResolutionPolicy.ShowAll); // Determine whether to use the high or low def versions of our images // Make sure the default texel to content size ratio is set correctly // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd) var scene = new MainMenuScene(mainWindow, BuildingDescriptionDatabase, ColorCollectionFile, LanguageSettings); mainWindow.RunWithScene(scene); #if DEBUG mainWindow.DisplayStats = true; mainWindow.StatsScale = 5; #endif }
// Use this for initialization void Start() { anim = GetComponent <Animation>(); sprite = GetComponent <SpriteRenderer>(); startPos = transform.position; startScale = transform.localScale; beatSFX = GetComponent <AudioSource>(); menu = GameObject.Find("_MainMenuScene").GetComponent <MainMenuScene>(); }
public override void OnEnter(ProcedureOwner procedureOwner) { var mainMenu = UIManagerComponent.Instance.OpenUIWindow <MainMenu_Window>(); GameObjectUtility.CreateGameObject(3000); m_mainmenuscene = SceneManagerComponent.Instance.GetScene <MainMenuScene>(); m_mainmenuscene.OnEnter(); }
static void Main() { using (var game = new SceneManager()) { Scene scene = new MainMenuScene(game); game.SetScene(scene); game.Run(); } }
public void CommandFired(Command command) { switch (command) { case InternalSceneChangeCommand changeScene: { Scene oldScene = ActiveScene; ActiveScene = changeScene.NewScene; oldScene.Dispose(); LevelRenderingLayer.LevelScreenSize = LevelRenderingLayer.DefaultLevelScreenSize; ResolutionChanged = true; break; } case SavedSceneChangeCommand changeScene: { Scene oldScene = ActiveScene; Woofer.Controller.CommandFired(new InternalSceneChangeCommand(new LoadingScreen())); oldScene.Dispose(); LevelRenderingLayer.LevelScreenSize = LevelRenderingLayer.DefaultLevelScreenSize; ResolutionChanged = true; new Thread(() => { ActiveScene = CurrentSave.GetScene(changeScene.SceneName); if (ActiveScene == null) { ActiveScene = new MainMenuScene(); Console.WriteLine("An error occurred"); } else { Woofer.Controller.CurrentSave.Data.ActiveSceneName = changeScene.SceneName; CommandFired(new SaveCommand()); } }).Start(); break; } case ResolutionChangeCommand changeResolution: { LevelRenderingLayer.LevelScreenSize = changeResolution.NewResolution; ResolutionChanged = true; break; } case SaveCommand save: { Woofer.Controller.CurrentSave.Save(); break; } } }
public static void LoadAll() { gameScene = new GameScene(); mainMenuScene = new MainMenuScene(); aboutScene = new AboutScene(); pauseScene = new PauseScene(); gameOverScene = new GameOverScene(); winScene = new WinScene(); Map.Initialize(); //should be in gameScene but that f***s thigns up CurrentScene = mainMenuScene; }
void Start() { DontDestroyOnLoad(this.gameObject); if (singleton == null) { playFromBeginning = true; singleton = this; } else { Destroy(this.gameObject); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create sprite batch and add to game services spriteBatch = new SpriteBatch(GraphicsDevice); Services.AddService(spriteBatch); //Initial values _sceneManager = new SceneManager(this); var menuScene = new MainMenuScene(this); //Add and start game main menu scene _sceneManager.AddScene("MainMenu", menuScene); _sceneManager.StartScene("MainMenu"); }
private void HandleResizeEvent(object sender, SizeEventArgs e) { Application.Game.Window.SetView(new View(new FloatRect(0, 0, e.Width, e.Height))); var t = SceneManager.CurrentScene.GetType(); Scene s = null; if (t == typeof(MainMenuScene)) { s = new MainMenuScene(); } else if (t == typeof(GameScene)) { s = new GameScene(); } SceneManager.Load(s); }
public void Init() { if (!Directory.Exists("Levels")) Directory.CreateDirectory("Levels"); if (!Directory.Exists("Saves")) Directory.CreateDirectory("Saves"); if (!File.Exists("Saves\\Highscores_MP.xml")) { var scores = new Highscores(); FileController.Save(scores, "Saves\\Highscores_MP.xml"); } if (!File.Exists("Saves\\Highscores_SP.xml")) { var scores = new Highscores(); FileController.Save(scores, "Saves\\Highscores_SP.xml"); } Pause = new PauseScene(this); MainMenu = new MainMenuScene(this); InGame = new GameScene(this); Question = new ExitQuestion(this); SaveQuestion = new SaveSelectScene(this); LoadQuestion = new LoadSelectScene(this); HighscoreScn = new HighscoresScene(this); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { Store.Instance.LoadFromJson("Content\\Base.json"); this.Scenes.GetOrAdd("MainMenu", (key) => { var scene = new MainMenuScene(key, this.GraphicsDevice); scene.SceneEnd += this.OnSceneEnd; return(scene); }); this.Scenes.GetOrAdd("StopTheBoats", (key) => { var scene = new StopTheBoatsScene(key, this.GraphicsDevice); scene.SceneEnd += this.OnSceneEnd; return(scene); }); this.Scenes.GetOrAdd("BoundsEditor", (key) => { var scene = new PolygonBoundsEditor(key, this.GraphicsDevice); scene.SceneEnd += this.OnSceneEnd; return(scene); }); this.SetCurrentScene("MainMenu"); }
private GameContextController() { if (instance != null & instance != this) { instance = this; } mainMenuScene = new MainMenuScene(this); mainScene = new MainScene(this); sceneDictionary = new Dictionary <string, IScene <GameContextController> >(); sceneDictionary.Add(mainMenuScene.name, mainMenuScene); sceneDictionary.Add(mainScene.name, mainScene); sceneDictionary.Add("Start", null); log("Create GameContextController"); model = new GameContextModel(); view = new GameContextView(this); log("Successfully Created GameContextController"); log("Loading Main Menu"); log("Main Menu Loaded"); SceneManager.sceneLoaded += ((Scene scene, LoadSceneMode mode) => { if (scene.name != "Start") { SetScene(sceneDictionary[scene.name]); } }); }
public void StartNewScene(string sceneName) { GameScene newScene = null; switch (sceneName) { case "MainMenu": newScene = new MainMenuScene(world); break; case "InnerGame": newScene = new InnerGameScene(world); break; } if (scenes.Count > 0) { scenes.Peek().Exit(); } scenes.Push(newScene); newScene.Start(); }
// Use this for initialization void Awake () { REF = this; PersistentDataManager.Reset(); if(UM_InAppPurchaseManager.instance.IsProductPurchased("full_game")) { if(SaveGameUtils.fullGameOwned==0) { SaveGameUtils.fullGameOwned = 1; SaveGameUtils.saveSettings(); } } if(UM_InAppPurchaseManager.instance.IsProductPurchased("full_gameplus")) { if(SaveGameUtils.fullGameOwned<2) { SaveGameUtils.fullGameOwned = 2; SaveGameUtils.saveSettings(); } } StartCoroutine(doLoadJSON()); GameObject g = GameObject.Find("GameLoadObj"); if(g!=null) { Destroy(g); } SaveGameUtils.loadSettings(); }
/// <summary> /// Create and load some scenes /// </summary> public static void Load(ContentManager content) { SoundManager.Load(content); // load a test scene testScene = new TestScene("test"); testScene.Load(); scenes.Add(testScene); // done with test scene // transition transitionScene = new TransitionScene("transition"); transitionScene.Load(); scenes.Add(transitionScene); // main menu mainMenuScene = new MainMenuScene("mainmenu"); mainMenuScene.Load(); scenes.Add(mainMenuScene); SetScene("mainmenu"); }
protected override IEnumerator UnloadScene(MainMenuScene scene, Action <float, string> progressDelegate) { yield break; }
protected override IEnumerator UnloadScene(MainMenuScene scene, Action<float, string> progressDelegate) { yield break; }
protected override UIElement InitializeUI(Loader loader, DrawingContext context, int screenWidth, int screenHeight) { string textFormat = "testSceneTextFormat"; string whiteBrush = "testSceneWhiteBrush"; string text1background = "testSceneText1background"; string text2background = "testSceneText2background"; string text3background = "testSceneText3background"; string panelBitmap = "testScenePanelBitmap"; //string buttonlBitmap = "panelBitmap"; //context.NewBitmap(buttonlBitmap, loader.LoadBitmapFromFile(@"Textures\button.png")); context.NewNinePartsBitmap(panelBitmap, loader.LoadBitmapFromFile(@"Textures\button.png"), 15, 121, 15, 46); context.NewSolidBrush(whiteBrush, new RawColor4(1f, 1f, 1f, 1f)); context.NewSolidBrush(text1background, new RawColor4(0.6f, 0.1f, 0.2f, 1f)); context.NewSolidBrush(text2background, new RawColor4(0.2f, 0.4f, 0.8f, 1f)); context.NewSolidBrush(text3background, new RawColor4(0.5f, 0.4f, 0.3f, 1f)); context.NewTextFormat(textFormat); _ui = new UIMultiElementsContainer(Vector2.Zero, new Vector2(screenWidth, screenHeight)); _panel = new UISequentialContainer(Vector2.Zero, new Vector2(200, 200)) { MainAxis = UISequentialContainer.Alignment.Center, CrossAxis = UISequentialContainer.Alignment.Center, //Background = new TextureBackground(panelBitmap) Background = new NinePartsTextureBackground(panelBitmap) }; _ui.Add(_panel); _text1 = new UIText("X", new Vector2(120, 16), textFormat, whiteBrush) { Background = new ColorBackground(text1background) }; _text2 = new UIText("Y", new Vector2(120, 16), textFormat, whiteBrush) { Background = new ColorBackground(text2background) }; _text3 = new UIText("Z", new Vector2(120, 16), textFormat, whiteBrush) { Background = new ColorBackground(text3background) }; UIElement text4 = new UIText("Click Me!", new Vector2(120, 16), textFormat, whiteBrush); UIElement m = new UIMarginContainer(_text1, 2f); UIButton button = new UIButton(text4) { ReleasedBackground = new ColorBackground(text1background), PressedBackground = new ColorBackground(text2background) }; button.OnClicked += () => { MainMenuScene menu = new MainMenuScene(); Game.ChangeScene(menu); }; _panel.Add(m); _panel.Add(_text2); _panel.Add(_text3); _panel.Add(button); _text1.OnClicked += () => { Transition transition = new SmoothTransition(_go.Rotation.X, _go.Rotation.X + MathUtil.TwoPi, 2); transition.Process += value => _go.SetRotationX(value); transition.Process += value => _go.SetRotationY(value); transition.Process += value => _go.SetRotationZ(value); }; _text2.OnClicked += () => { Transition transition = new SmoothTransition(_go.Rotation.Y, _go.Rotation.Y + MathUtil.TwoPi, 2); transition.Process += value => _go.SetRotationY(value); //_voice.Stop(); //_voice.Play(); _voice2.Stop(); _voice2.Play(); }; _text3.OnClicked += () => { Transition transition = new SmoothTransition(_go.Rotation.Z, _go.Rotation.Z + MathUtil.TwoPi, 2); transition.Process += value => _go.SetRotationZ(value); _voice.Play(); //_voice2.Play(); }; _text1.IsClickable = true; _text2.IsClickable = true; _text3.IsClickable = true; return(_ui); }
protected override void LoadGameContent() { // UI text generated with: https://fontmeme.com/pixel-fonts/ // font: KA1 // base color: 2A2A57 // selected color: FF0000 Assets.LoadTexture("HUDNewGameBase", "UI/new_game_base"); Assets.LoadTexture("HUDNewGameSelected", "UI/new_game_selected"); Assets.LoadTexture("HUDSettingsBase", "UI/settings_base"); Assets.LoadTexture("HUDSettingsSelected", "UI/settings_selected"); Assets.LoadTexture("HUDQuitBase", "UI/quit_base"); Assets.LoadTexture("HUDQuitSelected", "UI/quit_selected"); Assets.LoadTexture("HUDContinueBase", "UI/continue_base"); Assets.LoadTexture("HUDContinueSelected", "UI/continue_selected"); Assets.LoadTexture("HUDVideoSettingsBase", "UI/video_base"); Assets.LoadTexture("HUDVideoSettingsSelected", "UI/video_selected"); Assets.LoadTexture("HUDAudioSettingsBase", "UI/audio_base"); Assets.LoadTexture("HUDAudioSettingsSelected", "UI/audio_selected"); Assets.LoadTexture("HUDBackBase", "UI/back_base"); Assets.LoadTexture("HUDBackSelected", "UI/back_selected"); Assets.LoadTexture("HUDResolutionLabel", "UI/resolution"); Assets.LoadTexture("HUDFPSLimitLabel", "UI/fps_limit"); Assets.LoadTexture("HUDVsyncLabel", "UI/vsync"); Assets.LoadTexture("HUDWindowModeLabel", "UI/window_mode"); Assets.LoadTexture("HUD30", "UI/30"); Assets.LoadTexture("HUD60", "UI/60"); Assets.LoadTexture("HUD120", "UI/120"); Assets.LoadTexture("HUDUnlimited", "UI/unlimited"); Assets.LoadTexture("HUD720p", "UI/720p"); Assets.LoadTexture("HUD1080p", "UI/1080p"); Assets.LoadTexture("HUD1440p", "UI/1440p"); Assets.LoadTexture("HUD4K", "UI/4k"); Assets.LoadTexture("HUDOn", "UI/on"); Assets.LoadTexture("HUDOff", "UI/off"); Assets.LoadTexture("HUDApplyBase", "UI/apply_base"); Assets.LoadTexture("HUDApplySelected", "UI/apply_selected"); Assets.LoadTexture("HUDCancelBase", "UI/cancel_base"); Assets.LoadTexture("HUDCancelSelected", "UI/cancel_selected"); Assets.LoadTexture("HUDWindowed", "UI/windowed"); Assets.LoadTexture("HUDFullscreen", "UI/fullscreen"); Assets.LoadTexture("HUDArrowRightBase", "UI/arrow_right_base"); Assets.LoadTexture("HUDArrowRightSelected", "UI/arrow_right_selected"); Assets.LoadTexture("HUDArrowLeftBase", "UI/arrow_right_base", flipHorizontal: true); Assets.LoadTexture("HUDArrowLeftSelected", "UI/arrow_right_selected", flipHorizontal: true); Assets.LoadTexture("HUDLoading", "UI/loading"); Assets.LoadTexture("HUDWinningBase", "UI/winning"); Assets.LoadTexture("HUDWinningSelected", "UI/winning_selected"); Assets.LoadTexture("HUDRestartBase", "UI/restart"); Assets.LoadTexture("HUDWRestartSelected", "UI/restart_selected"); Assets.LoadTexture("HUDLost", "UI/wasted"); Assets.LoadTexture("HeroIdle", "Hero/Sprites/left_idle"); Assets.LoadTexture("HeroRun", "Hero/Sprites/run_left"); Assets.LoadTexture("HeroRunBackwards", "Hero/Sprites/run_backwards_left"); Assets.LoadTexture("Jetpacking", "Hero/Sprites/jatpack_on"); Assets.LoadTexture("Kick", "Hero/Sprites/kick_jetpack_off"); Assets.LoadTexture("KickJetpacking", "Hero/Sprites/kick_jetpack_on"); Assets.LoadTexture("HandgunBulletPoint", "Hero/Sprites/handgun_bullet_point"); Assets.LoadTexture("HandgunBulletShell", "Hero/Sprites/handgun_bullet_shell"); Assets.LoadTexture("ShotgunShell", "Hero/Sprites/shotgun_shelll"); Assets.LoadTexture("Gun", "Hero/Sprites/handgun_left"); Assets.LoadTexture("Machinegun", "Hero/Sprites/machine_gun_left"); Assets.LoadTexture("Shotgun", "Hero/Sprites/shotgun"); Assets.LoadTexture("Spikes", "Enivornment/Traps/spikes"); Assets.LoadTexture("Saw", "Enivornment/Traps/saw"); Assets.LoadTexture("Keycard", "Enivornment/Items/key"); Assets.LoadTexture("Door", "Enivornment/Items/door"); Assets.LoadTexture("HandgunAmmo", "Enivornment/Items/pistol_ammo"); Assets.LoadTexture("MachineGunAmmo", "Enivornment/Items/machine_gun_ammo"); Assets.LoadTexture("ShotgunAmmo", "Enivornment/Items/shotgun_ammo"); Assets.LoadTexture("FuelCan", "Enivornment/Items/fuel_can"); Assets.LoadTexture("Lava", "Enivornment/Tilesheets/lava"); Assets.LoadTexture("MountedGun", "Enivornment/Traps/mounted_gun"); Assets.LoadTexture("IntroText", "Text/intro"); Assets.LoadTexture("KickText", "Text/kick_tutorial"); Assets.LoadTexture("ControlsText", "Text/controls_tutorial"); Assets.LoadTexture("SpartaText", "Text/sparta"); Assets.LoadTexture("FuelAmmoText", "Text/fuel_ammo_pickup"); Assets.LoadTexture("EnemyRun", "Enemies/enemy_run_left"); Assets.LoadTexture("EnemyIdle", "Enemies/left_idle"); Assets.LoadTexture("UIHealth", "Hero/Sprites/UI_health"); AudioEngine.AddSound("AmmoPickup", "Audio/ammo_pickup"); AudioEngine.AddSound("FuelPickup", "Audio/fuel_pickup"); AudioEngine.AddSound("HandgunShot", "Audio/handgun_shot"); AudioEngine.AddSound("HealthPickup", "Audio/health_pickup"); AudioEngine.AddSound("HeroJump", "Audio/hero_jump"); AudioEngine.AddSound("KeyPickup", "Audio/key_pickup"); AudioEngine.AddSound("MachineGunShot", "Audio/machine_gun_shot"); AudioEngine.AddSound("MountedGunExplode", "Audio/mounted_gun_explode"); AudioEngine.AddSound("MountedGunShoot", "Audio/mounted_gun_shoot"); AudioEngine.AddSound("ShotgunShot", "Audio/shotgun_shot"); AudioEngine.AddSound("Kick", "Audio/kick"); AudioEngine.AddSound("HeroHurt", "Audio/hurt"); AudioEngine.AddSound("EnemyDie", "Audio/enemy_die"); AudioEngine.AddSound("DoorOpen", "Audio/door_open"); AudioEngine.AddSound("Jetpack", "Audio/jetpack", true); AudioEngine.AddSound("Music", "Audio/8-bit (1)", true); MapSerializer mapSerializer = new LDTKJsonMapParser(); world = mapSerializer.Load("D:/GameDev/MonoGame/lurum_dare_48/lurum_dare_48/lurum_dare_48/Maps/ld_48_world.json"); MainMenuScene mainMenuScene = new MainMenuScene(); PauseMenuScene pauseMenuScene = new PauseMenuScene(); Level1Scene level1 = new Level1Scene(world, font); SettingsScene settings = new SettingsScene(); VideoSettingsScene videoSettings = new VideoSettingsScene(); LoadingScreenScene loadingScreen = new LoadingScreenScene(); EndGameScene endGameScene = new EndGameScene(); LoseGameScreen loseGameScreen = new LoseGameScreen(); SceneManager.AddScene(mainMenuScene); SceneManager.AddScene(settings); SceneManager.AddScene(pauseMenuScene); SceneManager.AddScene(level1); SceneManager.AddScene(videoSettings); SceneManager.AddScene(loadingScreen); SceneManager.AddScene(endGameScene); SceneManager.AddScene(loseGameScreen); SceneManager.LoadScene(mainMenuScene); SceneManager.SetLoadingScene(loadingScreen); }
/// <summary> /// スタートボタンを押したときの処理 /// </summary> public void OnStartButton() { MainMenuScene.ChangeScene(); }