void Start() { if (terrainEditor == null) { terrainEditor = gameObject.AddComponent <TerrainEditor>(); } if (editorMenu != null) { editorMenu.menuToggled.AddListener(ShutEditor); } terrainEditor.SetSettings(gameSettings); editorMenu.loadSaveEvent.AddListener(LoadMap); editorMenu.makeSaveEvent.AddListener(SaveMap); editingState = new EditingState(); hoverState = new HoverState(); inMenuState = new InMenuState(); currentState = editingState; FillTileChooser(); cameraControls.SetSize(gameSettings); }
public void Execute(MenuCommand command) { MenuState = command.Execute(); if (!command.isLeaf) { commandsHistory.Push(command); // добавляем выполненную команду в историю команд (если не листовая) } }
//================================================================================ public void SwitchState(IMenuState newState) { if (_currentState != null) { _currentState.OnExit(); } _currentState = newState; _currentState.OnEnter(); }
public static void MenuOff() { MenuState = MenuStateList["Null"]; MenuStateList["Main"].End(); MenuStateList["Status"].End(); InventoryEndfrag = true; MenuStateList["InventorySelect"].End(); MenuStateList["UseItem"].End(); MenuStateList["UseComand"].End(); MenuStateList["SelectShortCut"].End(); MenuStateList["Equip"].End(); MenuStateList["EquipComand"].End(); // GameManager.SetState(GameManager.LastState); }
public void SetUp() { MenuStateList.Clear(); EquipTextList.Clear(); InventoryEndfrag = true; GameObject EquipWindow = GameObject.Find("MenuCanvas").transform.Find("InventoryPanel").transform.Find("EquipWindow").transform.Find("EquipItemPanel").gameObject; EquipTextList.Add(ItemType.Weapon, EquipWindow.transform.Find("WeaponText").GetComponent <Text>()); EquipTextList.Add(ItemType.Head, EquipWindow.transform.Find("HeadText").GetComponent <Text>()); EquipTextList.Add(ItemType.Body, EquipWindow.transform.Find("BodyText").GetComponent <Text>()); EquipTextList.Add(ItemType.Hand, EquipWindow.transform.Find("HandText").GetComponent <Text>()); EquipTextList.Add(ItemType.Foot, EquipWindow.transform.Find("FootText").GetComponent <Text>()); EquipTextList.Add(ItemType.Accessory, EquipWindow.transform.Find("AccessoryText").GetComponent <Text>()); MenuStateList.Add("Null", new NullState()); MenuStateList.Add("Main", new MainMenuState()); MenuStateList["Main"].SetUp(); MenuStateList.Add("Status", new StatusState()); MenuStateList["Status"].SetUp(); MenuStateList.Add("InventorySelect", new InventorySelectState()); MenuStateList["InventorySelect"].SetUp(); MenuStateList.Add("UseItem", new ItemUseState()); MenuStateList["UseItem"].SetUp(); MenuStateList.Add("UseComand", new UseComandState()); MenuStateList["UseComand"].SetUp(); MenuStateList.Add("SelectShortCut", new SelectShortCutState()); MenuStateList["SelectShortCut"].SetUp(); MenuStateList.Add("Equip", new EquipState()); MenuStateList["Equip"].SetUp(); MenuStateList.Add("EquipComand", new EquipComandState()); MenuStateList["EquipComand"].SetUp(); Playerp = GameObject.FindGameObjectWithTag("Playerp").GetComponent <Playerp>(); MenuState = MenuStateList["Null"]; }
public MenuManager(ContentManager content, Game1 game) { runningGame = game; MiddleScreenWidth = runningGame.MiddleScreenWidth; MiddleScreenHeight = runningGame.MiddleScreenHeight; controlsMenuState = new ControlsMenuState(content, this); creditsMenuState = new CreditsMenuState(content, this); infoMenuState = new InfoMenuState(content, this); mainMenuState = new MainMenuState(content, this); playMenuState = new PlayMenuState(content, this); pauseMenuState = new PauseMenuState(content, this); inbetweenLevelMenuState = new InbetweenLevelMenuState(content, this); menuBackground = new MenuBackground(content); titelTexture = content.Load <Texture2D>("2DGameName"); currentMenuState = mainMenuState; }
public ASummonersTaleGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; #region Set up settings Settings = new Settings(); if (!(Task.Run(async() => await Settings.ReadSettings()).Result)) { Exit(); return; } if (Settings.AntiAliasingOn) { EnableAntiAliasing(); } #endregion screenRectangle = new Rectangle(0, 0, 1280, 720); graphics.PreferredBackBufferHeight = screenRectangle.Height; graphics.PreferredBackBufferWidth = screenRectangle.Width; stateManager = new GameStateManager(this); Components.Add(stateManager); this.IsMouseVisible = true; #region Create game states splashScreenState = new SplashScreenState(this); startMenuState = new MenuState(this); playState = new PlayState(this); worldMapState = new WorldMapState(this); #endregion stateManager.ChangeState((SplashScreenState)splashScreenState, PlayerIndex.One); }
static void Main(string[] args) { const int MenuIndexOffset = 1; // Start menu off at 1 rather than 0 const string GameOutputPath = "../../../GbaGameEngine/src/game/data/"; if (System.IO.Directory.Exists(GameOutputPath)) { FileManager.Instance = new FileManager(GameOutputPath); } else { const string DefaultOutputPath = "data/"; if (!System.IO.Directory.Exists(DefaultOutputPath)) { System.IO.Directory.CreateDirectory(DefaultOutputPath); } FileManager.Instance = new FileManager(DefaultOutputPath); } ConverterOption[] menuOptions = new ConverterOption[] { new ConverterOption { menuLabel = "Sprite", createMenuStateFn = () => { return(new MenuSpriteConverter()); } }, new ConverterOption { menuLabel = "Tilemap", createMenuStateFn = () => { return(new MenuTilemapConverter()); } }, new ConverterOption { menuLabel = "Audio", createMenuStateFn = () => { return(new MenuAudioConverter()); } }, new ConverterOption { menuLabel = "Ui Atlus", createMenuStateFn = () => { return(new MenuUiAtlusConverter()); } }, new ConverterOption { menuLabel = "Build Midis", createMenuStateFn = () => { return(new MenuMidiBuilder()); } }, }; Console.WriteLine("Select converter:"); for (int i = 0; i < menuOptions.Length; ++i) { Console.WriteLine(string.Format("{0}. {1}", i + MenuIndexOffset, menuOptions[i].menuLabel)); } int menuOption; while (!Int32.TryParse(Console.ReadLine(), out menuOption)) { Console.WriteLine(intParseErrorMsg); continue; } while (true) { if (menuOption >= 0 + MenuIndexOffset && menuOption < menuOptions.Length + MenuIndexOffset) { IMenuState menu = menuOptions[menuOption - MenuIndexOffset].createMenuStateFn(); menu.Enter(); break; } else { Console.WriteLine("Invalid menu option"); continue; } } AnyKeyToContinue(); }
public void SetState(IMenuState state, int sid) { this.State = state; this.stateId = sid; }
public Menu(IMenuState state, int sid) { this.State = state; this.stateId = sid; }
public void Config(IMenuState state) { this.state = state; state.AddButtons(this); }
/// <summary> /// Het huidige menu veranderen met de meegegeven /// </summary> /// <param name="tempState"></param> public void SetState(IMenuState tempState) { currentMenuState = tempState; }
public void GoToEditingState() { currentState = editingState; }
public void GoToInMenuState() { currentState = inMenuState; }
public void GoToHoveringState() { currentState = hoverState; UIManager.Instance.lineDrawer.ClearLine(); }
public static void SetMenuState(string NextState) { MenuState.End(); MenuState = MenuStateList[NextState]; MenuState.Start(); }