public static void LoadScenePositionSettings(MenuScene self, string sceneFolder, string regionID) { CustomWorldMod.Log($"Custom Regions: Loading settings for Illustration at [{sceneFolder}]"); string[] readingTextFile = new string[0]; if (File.Exists(sceneFolder + "positions.txt")) { CustomWorldMod.Log($"Custom Regions: Reading positions.txt for {regionID}"); readingTextFile = File.ReadAllLines(sceneFolder + "positions.txt"); int num2 = 0; while (num2 < readingTextFile.Length && num2 < self.depthIllustrations.Count) { self.depthIllustrations[num2].pos.x = float.Parse(Regex.Split(readingTextFile[num2], ", ")[0]); self.depthIllustrations[num2].pos.y = float.Parse(Regex.Split(readingTextFile[num2], ", ")[1]); self.depthIllustrations[num2].lastPos = self.depthIllustrations[num2].pos; CustomWorldMod.Log($"Custom Regions: Position file Number [{num2 + 1}] position loaded [{self.depthIllustrations[num2].pos}]"); num2++; } } if (File.Exists(sceneFolder + "depths.txt")) { CustomWorldMod.Log($"Custom Regions: Reading depths.txt for {regionID}"); readingTextFile = File.ReadAllLines(sceneFolder + "depths.txt"); int num2 = 0; while (num2 < readingTextFile.Length && num2 < self.depthIllustrations.Count) { self.depthIllustrations[num2].depth = float.Parse(readingTextFile[num2]); CustomWorldMod.Log($"Custom Regions: Depths file Number [{num2 + 1}] position loaded [{self.depthIllustrations[num2].depth}]"); num2++; } } }
/// <summary> /// onSceneUpdate this function handles the logic for the state which should be run durring the update partion of the game. /// For example this could be to check for conditions to continue to the next state of the gameplay. /// </summary> public void onSceneUpdate() { if (fc.alphaValue <= 0) { List <IComponent> complist; //This is used for changin the currentState //SetUpPlayerScene stateTwo = new SetUpPlayerScene(); //SceneSystem.Instance.setCurrentScene(stateTwo); string[] menuItems = { "Start Game", "Options", "About", "End Game" }; MenuScene menu = new MenuScene(menuItems); SceneSystem.Instance.setCurrentScene(menu); foreach (int comp in entitiesInState) { complist = ComponentManager.Instance.GetAllEntityComponents(comp); foreach (IComponent a in complist) { if (a.GetType() == typeof(DrawableComponent)) { DrawableComponent hej = (DrawableComponent)a; hej.visible = false; } if (a.GetType() == typeof(DrawableTextComponent)) { DrawableTextComponent hej = (DrawableTextComponent)a; SceneSystem.Instance.clearScene(entitiesInState); } } } } }
/// <summary> /// Call this method to init this instance. /// </summary> private void Init() { _currentMenuScene = MenuScene.MainMenu; _data = new GameData(); OnOpenGame?.Invoke(); }
protected internal override bool OnBuild(MenuScene scene) { if (!(scene.owner is SlugcatSelectMenu.SlugcatPage sp)) { return(false); } if (sp.HasMark) { sp.glowSpriteB = new FSprite("Futile_White"); sp.glowSpriteB.shader = sp.menu.manager.rainWorld.Shaders["FlatLightNoisy"]; sp.Container.AddChild(sp.glowSpriteB); sp.glowSpriteA = new FSprite("Futile_White"); sp.glowSpriteA.shader = sp.menu.manager.rainWorld.Shaders["FlatLightNoisy"]; sp.Container.AddChild(sp.glowSpriteA); } else { sp.glowSpriteA = new FSprite("pixel") { isVisible = false }; sp.glowSpriteB = new FSprite("pixel") { isVisible = false }; } return(false); }
protected internal override bool OnBuild(MenuScene scene) { if (!(scene.owner is SlugcatSelectMenu.SlugcatPage sp)) { return(false); } if (sp.HasMark) { sp.markSquare = new FSprite("pixel", true); sp.markSquare.scale = 14f; sp.markSquare.color = Color.Lerp(sp.effectColor, Color.white, 0.7f); sp.Container.AddChild(sp.markSquare); sp.markGlow = new FSprite("Futile_White", true); sp.markGlow.shader = sp.menu.manager.rainWorld.Shaders["FlatLight"]; sp.markGlow.color = sp.effectColor; sp.Container.AddChild(sp.markGlow); } else { sp.markSquare = new FSprite("pixel") { isVisible = false }; sp.markGlow = new FSprite("pixel") { isVisible = false }; } return(false); }
/// <summary> /// App window constructor /// </summary> public AppWindow() : base(new Vector2(1500, 1000), "Test App", 30.0) { // Create the menu scene MenuScene = new MenuScene(this); // Start the menu scene MenuScene.Start(); }
public static void Initialize(CCGameView gameView) { GameView = gameView; // Add content search paths var contentSearchPaths = new List <string>() { "Fonts", "Sounds", "Images" }; #if __IOS__ contentSearchPaths.Add("Sounds/iOS/"); #else // android contentSearchPaths.Add("Sounds/Android/"); #endif GameView.ContentManager.SearchPaths = contentSearchPaths; // Set display resolution to Iphone 6s/6 dims int width = GameConfig.RESOLUTION_WIDTH; int height = GameConfig.RESOLUTION_HEIGHT; GameView.DesignResolution = new CCSizeI(width, height); // Init game sounds InitializeAudio(); // Create and run menu scene var scene = new MenuScene(GameView); GameView.RunWithScene(scene); }
public void Start() { if (!Social.localUser.authenticated) { this.MenuScene = this.MainCamera.GetComponent <MenuScene>(); this.AuthenticateUser(); } }
/// <summary> Calls when the state is entered </summary> public override void OnEnter() { GameScene.Instance.Visible = false; FullscreenMessage.Instance.ForceActive("", null); _Menu = new MenuScene(); _Menu.StartFade(0f, 1f, () => { _Menu.PlayButton.TouchEnabled = true; }); _Menu.PlayButton.OnButtonRelease += OnPlay; _Menu.StoreButton.OnButtonRelease += OnStore; }
private MenuScene() { if (_instance != null) { return; } _instance = this; }
private void LoadMenu(MenuScene menu) { if (CurrentMenu != null) { CurrentMenu.Hide(); } CurrentMenu = menu; CurrentMenu.Show(); }
protected override void Initialize() { Menu = new MenuScene(this); CharacterSelect = new CharacterSelectScene(this); RegisterAccount = new RegisterAccountScene(this); CharacterCreate = new CharacterCreateScene(this); GameScence = new GameScene(this); this.Exiting += GameClient_Exiting; base.Initialize(); }
private static void MenuScene_Update(On.Menu.MenuScene.orig_Update orig, MenuScene self) { orig(self); if (Input.GetKeyDown("r")) { string regionID = self.depthIllustrations[0].fileName.Substring(0, 2); LoadScenePositionSettings(self, self.sceneFolder, regionID); } }
protected override void Initialize() { menuScene = new MenuScene(this); gameScene = new GameScene(this); Menu.IsShowMainMenuScene = true; Menu.IsShowGameScene = false; base.Initialize(); }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; IsMouseVisible = true; graphics.PreferredBackBufferWidth = Constants.VIEWPORT_WIDTH; graphics.PreferredBackBufferHeight = Constants.VIEWPORT_HEIGHT; Gate = new GateControl(Content); //demo menu = new MenuScene(Content); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); scene = Scene.createWithDefaultRenderer(); base.Update(new GameTime()); base.Draw(new GameTime()); Nez.Input.maxSupportedGamePads = 4; var s = new MenuScene();//new DebugScene(new int[2] { 0, 1 }) scene = s; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); IsMouseVisible = true; Window.AllowUserResizing = false; menuScene = new MenuScene(this); gameScene = new GameScene(this); rankingScene = new RankingScene(this); playerNameScene = new PlayerNameScene(this); }
public void Next() { if (ActiveScene.Next != null) { Disactive(); ActiveScene = ActiveScene.Next; GetCameraSettings(); _rotateType = 1; _move = true; _rotate = true; } }
public void Previos() { if (ActiveScene.Previos != null) { Disactive(); ActiveScene = ActiveScene.Previos; GetCameraSettings(); _rotateType = -1; _move = true; _rotate = true; } }
public SceneManager CreateScenes() { SceneManager sceneManager = new SceneManager(); sceneManager.AllScenes = new Stack <IScene>(); try { MenuScene menuScene = new MenuScene(); menuScene.BackgroundTextureKey = "menu"; menuScene.AllTheSpritesWithinTheScene = new List <IBaseSprite>(); MenuItemSprite menu1 = new MenuItemSprite("MI1", "Play", "rectangle", new Vector2(100, 100)); MenuItemSprite menu2 = new MenuItemSprite("MI2", "HighScores", "rectangle", new Vector2(100, 200)); MenuItemSprite menu3 = new MenuItemSprite("MI3", "Exit", "rectangle", new Vector2(100, 300)); menuScene.AllTheSpritesWithinTheScene.Add(menu1); menuScene.AllTheSpritesWithinTheScene.Add(menu2); menuScene.AllTheSpritesWithinTheScene.Add(menu3); sceneManager.ActiveScene = menuScene; PlayScene playScene = new PlayScene(); playScene.BackgroundTextureKey = "play"; playScene.AllTheSpritesWithinTheScene = new List <IBaseSprite>(); playScene.Player = new PlayerSprite(); playScene.Player = CreatePlayer(); Helper.currentPlayer = playScene.Player; playScene.AllTheSpritesWithinTheScene.Add(playScene.Player); playScene.Collectables = new List <Collectable>(); playScene.Collectables = CreateCollectables(Helper.random.Next(10, 20)); playScene.AllTheSpritesWithinTheScene.AddRange(playScene.Collectables); playScene.AllSpawnPoints = new List <SpawnPoint>(); playScene.AllSpawnPoints = CreateSpawnPoints(); playScene.AllTheSpritesWithinTheScene.AddRange(playScene.AllSpawnPoints); playScene.AllDespawnPoints = new List <DespawnPoint>(); playScene.AllDespawnPoints = CreateDespawnPoints(); playScene.AllTheSpritesWithinTheScene.AddRange(playScene.AllDespawnPoints); playScene.AllEnemies = new Queue <EnemySprite>(); playScene.AllEnemies = CreateEnemies(); playScene.AllTheSpritesWithinTheScene.AddRange(playScene.AllEnemies); sceneManager.AllScenes.Push(playScene); } catch (Exception e) { Console.WriteLine("Error while creating Scenes : {0}", e.Message); } return(sceneManager); }
private void InitalizeScenes() { var menuScene = new MenuScene(this.Content, this.Window); var gameScene = new GameScene(this.Content, this.Window, _camera); var loadingScene = new LoadingScene(this.Content, this.Window); menuScene.Initalize(); gameScene.Initalize(); loadingScene.Initalize(); Engine.Services.Get <SceneManager>().AddScene(menuScene, "menuScene"); Engine.Services.Get <SceneManager>().AddScene(gameScene, "gameScene"); Engine.Services.Get <SceneManager>().AddScene(loadingScene, "loadingScene"); Engine.Services.Get <SceneManager>().SetActiveScene("menuScene"); }
private void OnEnable() { Scene activeScene = SceneManager.GetActiveScene(); foreach (GameObject root in activeScene.GetRootGameObjects()) { menuScene = root.GetComponent <MenuScene>(); if (menuScene != null) { break; } } SwitchMenu(currentMenu); Debug.Assert(menuScene, "Testing scene object not found, info menu is not functional"); }
protected override void LoadContent() { TileFactory.ContentManager = Content; ButtonFactory.ContentManager = Content; _spriteBatch = new SpriteBatch(GraphicsDevice); _generalFont = Content.Load <SpriteFont>("GeneralFont"); _background = Content.Load <Texture2D>("Background"); _backgroundSong = Content.Load <Song>("BackgroundSong"); _menuScene = new MenuScene(_generalFont); _menuScene.PlayButton.Click += OnPlayButtonClick; _gameOverScene = new GameOverScene(_generalFont); _gameOverScene.OkButton.Click += OnOkButtonClick; _currentScene = _menuScene; MediaPlayer.Play(_backgroundSong); MediaPlayer.IsRepeating = true; }
static void Main(string[] args) { Console.WindowWidth = 74; Console.WindowHeight = 30; Console.SetBufferSize(Console.WindowWidth, Console.WindowHeight); Console.BackgroundColor = ConsoleColor.White; Console.CursorVisible = false; Console.Clear(); ConsoleGraphics graphics = new ConsoleGraphics(); GameEngine engine = new GameEngine(graphics); ResourcesManager.ImageResources.LoadImages(graphics); MenuScene scene = new MenuScene(graphics.ClientWidth, graphics.ClientHeight); scene.AddMenuItems(MenuScene.GetMainMenuItems()); engine.ChangeScene(scene); engine.Start(); }
/// <summary> /// Loads all of the content to play the game, loads all the scenes and the music for the scenes /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Adding our scenes to our components aswell as to the services // to be able to directly access the components list from other classes menuScene = new MenuScene(this, spriteBatch); this.Components.Add(menuScene); this.Services.AddService <MenuScene>(menuScene); menuScene.Show(); actionScene = new ActionScene(this, spriteBatch); this.Components.Add(actionScene); this.Services.AddService <ActionScene>(actionScene); actionScene.Hide(); helpScene = new HelpScene(this, spriteBatch); this.Components.Add(helpScene); this.Services.AddService <HelpScene>(helpScene); helpScene.Hide(); creditScene = new CreditScene(this, spriteBatch); this.Components.Add(creditScene); this.Services.AddService <CreditScene>(creditScene); creditScene.Hide(); gameOverScene = new GameOverScene(this, spriteBatch); this.Components.Add(gameOverScene); this.Services.AddService <GameOverScene>(gameOverScene); gameOverScene.Hide(); // Getting the music for the scenes menuSong = this.Content.Load <Song>("Music/Menu"); actionSong = this.Content.Load <Song>("Music/Action"); MediaPlayer.Play(menuSong); MediaPlayer.IsRepeating = true; MediaPlayer.Volume = 0.1f; }
public void Process(SocketModel model) { string message = model.message; ChatDTO data = JsonCoding<ChatDTO>.decode(message); if (Global.Instance.scene == SceneType.MenuScene) { if (sceneController == null) { sceneController = GameObject.FindGameObjectWithTag(Tags.SceneController).GetComponent<MenuScene>(); } if (data.senderName != "Server") { sceneController.AddChatList(data.senderName, data.content); } else { sceneController.AddChatList("系统公告", data.content); } } }
void Start() { Instance = this; mSlideFirstPanel = true; PlaySound("menu_transition"); }
public void LoadMainMenu() { MenuScene mainMenu = null, optionsMenu = null, creditsMenu = null, levelSelectMenu = null; mainMenu = new MenuScene( new Image( new Vector2(200, 40), Engine.Instance.GetTexture("Title-Image") ), new SimpleButton( new Vector2(280, 150), Engine.Instance.GetTexture("Play-Text"), () => { LoadMenu(levelSelectMenu); } ), new SimpleButton( new Vector2(280, 200), Engine.Instance.GetTexture("Options-Text"), () => { LoadMenu(optionsMenu); } ), new SimpleButton( new Vector2(280, 250), Engine.Instance.GetTexture("Credits-Text"), () => { LoadMenu(creditsMenu); } ), new SimpleButton( new Vector2(280, 300), Engine.Instance.GetTexture("Quit-Text"), () => { Engine.Instance.Exit(); } ) ); optionsMenu = new MenuScene( new Image(new Vector2(200, 2), Engine.Instance.GetTexture("Options-Image")), new SimpleButton( new Vector2(280, 150), Engine.Instance.GetTexture("Back-Text"), () => { LoadMenu(mainMenu); } ) ); creditsMenu = new MenuScene( new Image(new Vector2(200, 40), Engine.Instance.GetTexture("Credits-Image")), new Image(new Vector2(280, 150), Engine.Instance.GetTexture("Findlang-Twitter-Image")), new Image(new Vector2(280, 180), Engine.Instance.GetTexture("Rhys-Twitter-Image")), new SimpleButton( new Vector2(280, 210), Engine.Instance.GetTexture("Back-Text"), () => { LoadMenu(mainMenu); } ) ); levelSelectMenu = new MenuScene( new Image(new Vector2(180, 6), Engine.Instance.GetTexture("Choose-Level-Image")), new Button( new Vector2(280, 80), Engine.Instance.GetTexture("Map-1-Image"), Engine.Instance.GetTexture("Map-Button-Normal"), Engine.Instance.GetTexture("Map-Button-Highlighted"), Engine.Instance.GetTexture("Map-Button-Pressed"), () => { tempStartGame(0); HideMenu(); } ), new Button( new Vector2(280, 160), Engine.Instance.GetTexture("Map-2-Image"), Engine.Instance.GetTexture("Map-Button-Normal"), Engine.Instance.GetTexture("Map-Button-Highlighted"), Engine.Instance.GetTexture("Map-Button-Pressed"), () => { tempStartGame(1); HideMenu(); } ), new Button( new Vector2(280, 240), Engine.Instance.GetTexture("Map-3-Image"), Engine.Instance.GetTexture("Map-Button-Normal"), Engine.Instance.GetTexture("Map-Button-Highlighted"), Engine.Instance.GetTexture("Map-Button-Pressed"), () => { tempStartGame(2); HideMenu(); } ), new Button( new Vector2(280, 320), Engine.Instance.GetTexture("Map-4-Image"), Engine.Instance.GetTexture("Map-Button-Normal"), Engine.Instance.GetTexture("Map-Button-Highlighted"), Engine.Instance.GetTexture("Map-Button-Pressed"), () => { tempStartGame(3); HideMenu(); } ), new SimpleButton( new Vector2(280, 400), Engine.Instance.GetTexture("Back-Text"), () => { LoadMenu(mainMenu); } ) ); LoadMenu(mainMenu); }
public MenuItem(MenuScene menu) { this.menu = menu; texture = new Texture2D(menu.Game.GraphicsDevice, 1, 1); texture.SetData(new[] { Color.White }); font = menu.Game.Content.Load<SpriteFont>(FONT_ASSET); }
private void AutoPositionElements(MenuScene menuScene) { foreach (Element element in menuScene) { } }
public static void BuildCustomRegionScene(MenuScene self, string regionID, string sceneFolder) { if (self.flatMode) { self.AddIllustration(new MenuIllustration(self.menu, self, self.sceneFolder, $"Landscape - {regionID} - Flat", new Vector2(683f, 384f), false, true)); } else { Vector2 posVector = new Vector2(0, 0); string[] fileEntries = Directory.GetFiles(sceneFolder); Array.Sort(fileEntries); List <MenuDepthIllustration> illu = new List <MenuDepthIllustration>(); foreach (string fileName in fileEntries) { if (fileName.Contains(".png") && !fileName.ToLower().Contains("flat") && !fileName.ToLower().Contains("meta")) { string name = Path.GetFileNameWithoutExtension(fileName); //CustomWorldMod.CustomWorldLog($"Custom Regions: Loading {name}"); /* int number = name[name.Length - 1]; * if (number < positions.Length) * { * posVector.x = float.Parse(positions[number].Split(new string[] { ",", " " }, StringSplitOptions.RemoveEmptyEntries)[0]); * posVector.y = float.Parse(positions[number].Split(new string[] { ",", " " }, StringSplitOptions.RemoveEmptyEntries)[1]); * }*/ //self.AddIllustration(new MenuDepthIllustration(self.menu, self, self.sceneFolder, $"{name}", posVector, 4 + number, MenuDepthIllustration.MenuShader.Normal)); CustomWorldMod.Log($"Custom Regions: Loading MenuDepthIllustration - Name [{name}] - Position[{posVector}]"); illu.Add(new MenuDepthIllustration(self.menu, self, self.sceneFolder, name, posVector, 1f, MenuDepthIllustration.MenuShader.Normal)); } } illu.Reverse(); foreach (MenuDepthIllustration depthIllustration in illu) { CustomWorldMod.Log($"Custom Regions: Adding MenuDepthIllustration - Name [{depthIllustration.fileName}]"); self.AddIllustration(depthIllustration); } // Load positions LoadScenePositionSettings(self, sceneFolder, regionID); } string packFolder = CustomWorldMod.installedPacks.First(x => x.Value.regions.Contains(regionID)).Value.folderName; /* * string path = CustomWorldMod.resourcePath + packName + Path.DirectorySeparatorChar; * string titleFolderName = path + "Assets" + Path.DirectorySeparatorChar + "Futile" + Path.DirectorySeparatorChar + "Resources" + Path.DirectorySeparatorChar + "Illustrations"+ Path.DirectorySeparatorChar; */ string titleFolderName = CRExtras.BuildPath(packFolder, CRExtras.CustomFolder.Illustrations, includeRoot: false); if (Directory.Exists(titleFolderName)) { if (self.menu.ID == ProcessManager.ProcessID.FastTravelScreen || self.menu.ID == ProcessManager.ProcessID.RegionsOverviewScreen) { CustomWorldMod.Log($"Custom Regions: Adding Title - Name [{$"Title_{regionID}"}], path [{titleFolderName}]"); self.AddIllustration(new MenuIllustration(self.menu, self, titleFolderName, $"Title_{regionID}_Shadow", new Vector2(0.01f, 0.01f), true, false)); self.AddIllustration(new MenuIllustration(self.menu, self, titleFolderName, $"Title_{regionID}", new Vector2(0.01f, 0.01f), true, false)); self.flatIllustrations[self.flatIllustrations.Count - 1].sprite.shader = self.menu.manager.rainWorld.Shaders["MenuText"]; } } else { CustomWorldMod.Log($"Error finding Title directory for [{regionID}] - at [{titleFolderName}]", true); } }
private static void MenuScene_SaveToFile(On.Menu.MenuScene.orig_SaveToFile orig, MenuScene self) { try { orig(self); } catch (Exception e) { CustomWorldMod.Log($"(Expected behaviour) Failed to save position.txt, using custom folder [Vanilla error - {e}]"); string regionID = self.depthIllustrations[0].fileName.Substring(0, 2); Debug.Log("Saving : " + regionID); string text = string.Empty; for (int i = 0; i < self.depthIllustrations.Count; i++) { Debug.Log(self.depthIllustrations[i].fileName + " " + self.depthIllustrations[i].pos); string text2 = text; text = string.Concat(new object[] { text2, self.depthIllustrations[i].pos.x, ", ", self.depthIllustrations[i].pos.y, Environment.NewLine }); } //string regionValue; //CustomWorldMod.loadedRegions.TryGetValue(regionID, out regionValue); //string path = CustomWorldMod.resourcePath + regionValue + Path.DirectorySeparatorChar; string positionFiledPath = self.sceneFolder + Path.DirectorySeparatorChar + "positions.txt"; if (File.Exists(positionFiledPath)) { using (StreamWriter streamWriter = File.CreateText(positionFiledPath)) { streamWriter.Write(text); } } else { CustomWorldMod.Log($"ERROR! position.txt file not found! Looking at [{positionFiledPath}]"); // Create position txt file? } } }
public MenuItem(MenuScene menu, Rectangle boundaries, string text, Action<MenuScene> callback) : this(menu) { this.Text = text; this.callback = callback; textDim = font.MeasureString(this.Text); outer = boundaries; inner = new Rectangle(boundaries.Left + BORDER, boundaries.Top + BORDER, boundaries.Width - 2 * BORDER, boundaries.Height - 2 * BORDER); textNaturalPosition = new Vector2((inner.Left + inner.Right) / 2 - textDim.X / 2, (inner.Top + inner.Bottom) / 2 - textDim.Y / 2); }