Пример #1
0
    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);
    }
Пример #2
0
 public void Execute(MenuCommand command)
 {
     MenuState = command.Execute();
     if (!command.isLeaf)
     {
         commandsHistory.Push(command); // добавляем выполненную команду в историю команд (если не листовая)
     }
 }
Пример #3
0
    //================================================================================

    public void SwitchState(IMenuState newState)
    {
        if (_currentState != null)
        {
            _currentState.OnExit();
        }

        _currentState = newState;
        _currentState.OnEnter();
    }
Пример #4
0
    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);
    }
Пример #5
0
    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"];
    }
Пример #6
0
 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;
 }
Пример #7
0
        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);
        }
Пример #8
0
        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();
        }
Пример #9
0
 public void SetState(IMenuState state, int sid)
 {
     this.State   = state;
     this.stateId = sid;
 }
Пример #10
0
 public Menu(IMenuState state, int sid)
 {
     this.State   = state;
     this.stateId = sid;
 }
Пример #11
0
 public void Config(IMenuState state)
 {
     this.state = state;
     state.AddButtons(this);
 }
Пример #12
0
 /// <summary>
 /// Het huidige menu veranderen met de meegegeven
 /// </summary>
 /// <param name="tempState"></param>
 public void SetState(IMenuState tempState)
 {
     currentMenuState = tempState;
 }
Пример #13
0
 public void GoToEditingState()
 {
     currentState = editingState;
 }
Пример #14
0
 public void GoToInMenuState()
 {
     currentState = inMenuState;
 }
Пример #15
0
 public void GoToHoveringState()
 {
     currentState = hoverState;
     UIManager.Instance.lineDrawer.ClearLine();
 }
Пример #16
0
 public static void SetMenuState(string NextState)
 {
     MenuState.End();
     MenuState = MenuStateList[NextState];
     MenuState.Start();
 }