public void SetHostGame(MenuState menuState) { this.menuState = menuState; this.dummyButton.SetActive(false); this.gameObject.SetActive(true); this.StartUDPBroadcasting(); }
float timeHolder; // Waiting time #endregion Fields #region Methods // Back button public void Back() { if(menuState == MenuState.Credits) { DisableCredits(); menuState = MenuState.Home; } // end if else if(menuState == MenuState.Help) { DisableInstructions(); menuState = MenuState.Home; } // end else if else if(menuState == MenuState.Solo || menuState == MenuState.Multi) { DisableMapSelection(); mapSelection = "nothing"; guideText.text = "Please select a map"; menuState = MenuState.Home; } // end else if else if (menuState == MenuState.Colors) { DisableColors(); mapSelection = "nothing"; guideText.text = "Please select a map"; GameMaster.Instance.NumPlayers = 0; menuState = MenuState.Home; } // end else if else { menuState = MenuState.Home; } // end else }
private void GUIMainMenu() { Rect buttonRect = new Rect(Screen.width / 2 - (buttonWidth / 2), Screen.height * buttonsStart, buttonWidth, buttonHeight); playButton = GUI.Button(buttonRect, "Play"); buttonRect.y += buttonsOffset; settingsButton = GUI.Button(buttonRect, "Settings"); buttonRect.y += buttonsOffset; exitButton = GUI.Button(buttonRect, "Exit"); // Draw a button to start the game if (playButton) { // On Click, load the first level. // "Stage1" is the name of the first scene we created. Application.LoadLevel("Level1"); } if (settingsButton) { menuState = MenuState.settings; } if (exitButton) { Application.Quit(); } }
void Start () { selected = Buttons.newGame; oldVal = selected; highlightSelected (selected); mousedOver = false; ms = GameObject.Find ("Game Controller").GetComponent<MenuState>(); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(new Color(10, 10, 10)); spriteBatch.Begin(SpriteSortMode.FrontToBack, null); if (menuState == MenuState.start) { spriteBatch.DrawString(AssetManager.spriteFont, "Press start or hold both sholder buttons to quit", new Vector2(100, 200), Color.White); } if (menuState == MenuState.game) { if (keyboard.IsKeyDown(Keys.P)) { menuState = MenuState.start; } foreach (GameObject g in GameObjectManager.gameObjects) { g.Draw(spriteBatch); } } spriteBatch.End(); spriteBatch.Begin(); userInterface.Draw(spriteBatch); spriteBatch.End(); base.Draw(gameTime); }
public Menu(Screen screen, Mouse mouse) { _screen = screen; _mouse = mouse; _subjectBarStatus = MenuState.MENU_CLOSED; _objectBarStatus = MenuState.MENU_CLOSED; }
private void onKeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.T) { if (this.menuState == MenuState.CLOSED) { List<GTA.MenuItem> menuItems = new List<GTA.MenuItem>(); List<string> tnames = Team.getTeamNames(); tnames.ForEach((string name) => { menuItems.Add( new TeamSpawnerButton(name, Messages.get("app-button-spawn-label", new string[] {name}), this.onTeamSelected ) ); }); GTA.Menu menu = new GTA.Menu(Messages.get("app-menu-title"), menuItems.ToArray()); menu.HeaderColor = Color.DarkBlue; menu.SelectedItemColor = Color.Aqua; menu.FooterColor = Color.White; menu.FooterHeight = 5; View.AddMenu(menu); this.menuState = MenuState.OPEN; } else { View.CloseAllMenus(); this.menuState = MenuState.CLOSED; } } else if (e.KeyCode == Keys.L) { UI.Notify(Messages.get("app-notify-config-reload")); this.loadConfig(); } }
void MenuTransitionLeft() { newMenuPos = new Vector2(Screen.width * 1.5f, Screen.height / 2f); switch (curMenu) { case MenuState.MAIN: //Credits creditsMenu.SetActive(true); creditsMenu.transform.position = newMenuPos; curMenu = MenuState.TRANSITIONING; lastMenu = MenuState.MAIN; nextMenu = MenuState.CREDITS; StartCoroutine(ShiftMenu()); break; case MenuState.SETTINGS: //Main mainMenu.SetActive(true); mainMenu.transform.position = newMenuPos; curMenu = MenuState.TRANSITIONING; lastMenu = MenuState.SETTINGS; nextMenu = MenuState.MAIN; StartCoroutine(ShiftMenu()); break; case MenuState.CREDITS: //Directions directionsMenu.SetActive(true); directionsMenu.transform.position = newMenuPos; curMenu = MenuState.TRANSITIONING; lastMenu = MenuState.CREDITS; nextMenu = MenuState.DIRECTIONS; StartCoroutine(ShiftMenu()); break; } }
public MenuScreen() { isActive = false; isHidden = true; canLauchChallenge = false; menuSound = SoundEffectLibrary.Get("cursor").CreateInstance(); m_sprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("menu_start_bg"), m_transform); m_sprite.Transform.Position = outPos; arrow = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("arrow"), new Transform(m_transform, true)); moveTo = new MoveToStaticAction(Program.TheGame, m_transform, inPos, 1); moveTo.StartPosition = new Vector2(80, 200); moveTo.Interpolator = new PSmoothstepInterpolation(); moveTo.Timer.Interval = 0.5f; moveOut = new MoveToStaticAction(Program.TheGame, m_transform, outPos, 1); moveOut.StartPosition = inPos; moveOut.Interpolator = new PSmoothstepInterpolation(); moveOut.Timer.Interval = 0.5f; choice = MenuState.START; challengeChoice = ChallengeState.CHALL_1; }
private void DrawDefaultMenu() { GUILayout.BeginArea(defaultAreaRect, mainMenuStyle); GUILayout.BeginArea(defaultContentRect); GUILayout.FlexibleSpace(); if (GUILayout.Button("继 续", Data.GUI.Button.Medium)) SwitchGameState(); GUILayout.FlexibleSpace(); if (GUILayout.Button("选 项", Data.GUI.Button.Medium)) { stagedState = MenuState.Options; Methods.GUI.StageCurrentOptions(); } GUILayout.FlexibleSpace(); if (GUILayout.Button("关 于", Data.GUI.Button.Medium)) stagedState = MenuState.About; GUILayout.FlexibleSpace(); if (GUILayout.Button("回到主界面", Data.GUI.Button.Medium)) stagedState = MenuState.Back; GUILayout.FlexibleSpace(); if (GUILayout.Button("退 出", Data.GUI.Button.Medium)) stagedState = MenuState.Quit; GUILayout.FlexibleSpace(); GUILayout.EndArea(); GUILayout.EndArea(); }
private void DoContinueMenu() { m_scrollPosition = GUI.BeginScrollView ( new Rect(m_itemCenter.x - 10.0f, m_itemCenter.y + 260.0f, Title.width + 20.0f, 320.0f), m_scrollPosition, new Rect(0, 0, Title.width, m_levels.Count * 60.0f), false, true ); Rect buttonPosition = new Rect(0, 0, Title.width, 48.0f); foreach (FlickerLevel level in m_levels) { GUI.SetNextControlName (level.internalName); if (GUI.Button(buttonPosition, level.name) || (m_pressedOK && m_highlighted == level.internalName)) { Application.LoadLevel(level.internalName); } buttonPosition.y += 60; } GUI.EndScrollView(); buttonPosition = new Rect(m_itemCenter.x, m_itemCenter.y + 260.0f + 320.0f + 92.0f, Title.width, 48.0f); GUI.SetNextControlName ("back"); if (GUI.Button(buttonPosition, "Back") || (m_pressedOK && m_highlighted == "back")) { m_menuState = MenuState.Main; m_highlighted = "levelselect"; m_pressedOK = false; } }
bool createProfile(int aIndex) { const int CONTROL_COUNT = 3; bool success = false; float startX = Screen.width * 0.5f - m_ButtonSize.x * 0.5f; float startY = Screen.height * 0.5f - (m_ButtonSize.y * 0.5f * CONTROL_COUNT - m_Offset); Rect buttonRect = new Rect(startX, startY, m_ButtonSize.x, m_ButtonSize.y * 5); GUI.color = Color.black; GUILayout.BeginArea(buttonRect); GUILayout.BeginVertical(); GUILayout.Label("Name"); m_ProfileName = GUILayout.TextField(m_ProfileName); if (GUILayout.Button("Create") && m_ProfileName.Length != 0) { ProfileManager.instance.setProfle(aIndex, new Profile(m_ProfileName)); m_State = MenuState.PROFILE_SELECTION; success = true; } GUILayout.EndVertical(); GUILayout.EndArea(); return success; }
public Menu(params MenuItem[] items) { IsTouchEnabled = true; SizeF s = Director.Instance.WinSize; IsRelativeAnchorPoint = false; AnchorPoint = new PointF(0.5f, 0.5f); ContentSize = s; RectangleF r = UIApplication.SharedApplication.StatusBarFrame; DeviceOrientation orientation = Director.Instance.DeviceOrientation; if (orientation == DeviceOrientation.LandscapeLeft || orientation == DeviceOrientation.LandscapeRight) { s.Height -= r.Width; } else { s.Height -= r.Height; } SetPosition(s.Width / 2f, s.Height / 2f); int z = 0; IsRunning = true; foreach (MenuItem item in items) { AddChild(item, z); ++z; } _state = MenuState.Waiting; _selectedItem = null; }
public static void Draw(GameTime gameTime) { if (menuStateStack.Count != 0) { menuStateStack.Peek().Draw(gameTime); } if (pop1by1) { while (menuStateStack.Count != 0) { menuStateStack.Pop().Exit(); } pop1by1 = false; } else if (popped) { menuStateStack.Pop().Exit(); popped = false; if (menuStateStack.Count != 0) menuStateStack.Peek().Start(); } if (pushed != null) { if (menuStateStack.Count != 0) menuStateStack.Peek().Exit(); menuStateStack.Push(pushed); pushed.Start(); pushed = null; } }
void DisplayModeMenu() { GUI.BeginGroup(new Rect(Screen.width / 2 - 150, 50, 300, Screen.height)); if (GUI.Button(new Rect(55, 50, 180, 40), "Survival")) { (gameControler.GetComponent("GameControler") as GameControler).gameMode = GameMode.Survival; Application.LoadLevel(1); } if (GUI.Button(new Rect(55, 100, 180, 40), "King of the Hill")) { (gameControler.GetComponent("GameControler") as GameControler).gameMode = GameMode.KingOfTheHill; Application.LoadLevel(1); } if (GUI.Button(new Rect(55, 150, 180, 40), "Time limit")) { (gameControler.GetComponent("GameControler") as GameControler).gameMode = GameMode.TimeLimit; Application.LoadLevel(1); } if (GUI.Button(new Rect(55, 200, 180, 40), "Pacifist")) { (gameControler.GetComponent("GameControler") as GameControler).gameMode = GameMode.Pacifist; Application.LoadLevel(1); } if (GUI.Button(new Rect(55, 250, 180, 40), "Previous")) { if (state == MenuState.SingleplayerMode) state = MenuState.MainMenu; else state = MenuState.Multiplayer; } //layout end GUI.EndGroup(); }
public void triggerState(MenuState menuState) { if (GetComponent<UserEntry>() != null) { if (GetComponent<UserEntry>().getUser() != null) { if ((menuState == MenuState.create_message)) { ParseUser user = GetComponent<UserEntry>().getUser(); //GetComponent<UserEntry>().setUser(null); EventManager.enterConversation(user); } } } if (menuState == MenuState.messages) { if (!appManager.GetComponent<Messaging>().hasPartners()) { appManager.GetComponent<Messaging>().startFetchPartners(); appManager.GetComponent<Messaging>().showNoPartnersNotification(); return; } } if(menuState == MenuState.search) { if (!appManager.GetComponent<UserManagement>().userHasSufficientProfileInformation()) { appManager.GetComponent<UserManagement>().showProfileInformationNotification(); menuState = MenuState.profile; } } EventManager.changeMenuState(menuState); }
public static void Handle(MenuState menuState, Action navigationAction, Action itemsActionAction, Action itemsShowingDetailsAction, Action itemsSelectingPartyMemberAction, Action giftsSelectingPartyMemberAction, Action useGiftSelectingPartyMemberAction, Action equipmentSelectingPartyMemberAction, Action equipmentActionAction, Action equipmentSelectingEquipmentSlotAction, Action formationAction, Action statusSelectingPartyMemberAction, Action statusAction, Action questAction, Action saveFileOverrideAction, Action settingsAction, Action itemsAction, Action giftsAction, Action equipmentAction, Action saveAction) { switch (menuState) { case MenuState.Empty: /* Do nothing */ break; case MenuState.Navigation: navigationAction(); break; case MenuState.ItemsAction: itemsActionAction(); break; case MenuState.ItemsShowingDetails: itemsShowingDetailsAction(); break; case MenuState.ItemsSelectingPartyMember: itemsSelectingPartyMemberAction(); break; case MenuState.GiftsSelectingPartyMember: giftsSelectingPartyMemberAction(); break; case MenuState.UseGiftSelectingPartyMember: useGiftSelectingPartyMemberAction(); break; case MenuState.EquipmentSelectingPartyMember: equipmentSelectingPartyMemberAction(); break; case MenuState.EquipmentAction: equipmentActionAction(); break; case MenuState.EquipmentSelectingEquipmentSlot: equipmentSelectingEquipmentSlotAction(); break; case MenuState.Formation: formationAction(); break; case MenuState.StatusSelectingPartyMember: statusSelectingPartyMemberAction(); break; case MenuState.Status: statusAction(); break; case MenuState.Quest: questAction(); break; case MenuState.SaveFileOverride: saveFileOverrideAction(); break; case MenuState.Settings: settingsAction(); break; case MenuState.Items: itemsAction(); break; case MenuState.Gifts: giftsAction(); break; case MenuState.Equipment: equipmentAction(); break; case MenuState.Save: saveAction(); break; } }
static void Main(string[] args) { Console.Title = "800Craft Configuration (" + Updater.CurrentRelease.VersionString + ")"; try { Logger.Logged += OnLogged; Console.WriteLine("Initializing 800Craft..."); Server.InitLibrary(args); if (!File.Exists(Paths.ConfigFileName)) { Console.WriteLine("Configuration ({0}) was not found. Using defaults.", Paths.ConfigFileName); } Config.Load(false, false); sections = (ConfigSection[])Enum.GetValues(typeof(ConfigSection)); menuState = MenuState.SectionList; StateLoop(); } catch (Exception ex) { Logger.LogAndReportCrash("Unhandled exception in ConfigCLI", "ConfigCLI", ex, true); ReportFailure(ShutdownReason.Crashed); } }
// Update is called once per frame void Update () { titleSprite.enabled = false; gameOverSprite.enabled = false; switch(menuState) { case MenuState.Starting: titleSprite.enabled = true; if (Input.GetButton("Confirm")) { gameLoopManager.StartGame(); menuState = MenuState.Playing; } else { if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Input.GetKeyDown(KeyCode.Alpha1)) gameLoopManager.InitializeGame(1); if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Input.GetKeyDown(KeyCode.Alpha2)) gameLoopManager.InitializeGame(2); if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Input.GetKeyDown(KeyCode.Alpha3)) gameLoopManager.InitializeGame(3); if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Input.GetKeyDown(KeyCode.Alpha4)) gameLoopManager.InitializeGame(4); } break; case MenuState.GameOver: gameOverSprite.enabled = true; break; } }
private void menuStateChanged(MenuState menuState) { if (menuState == MenuState.news) { StartCoroutine(updateNews()); } }
public void ChangeScreen( MenuState newState ) { if ( currentScreen == MenuState.NONE || newState == MenuState.NONE ) throw new System.NotSupportedException( "The state of the pause menu cannot be NONE" ); currentScreen = newState; BackgroundRenderer.sprite = screenMap[currentScreen].Background; }
void Awake() { screenMap = new Dictionary<MenuState, ScreenState>(); currentScreen = MenuState.Pause; BackgroundRenderer = gameObject.GetComponent<SpriteRenderer>(); screenMap.Add( MenuState.Pause, new PauseScreen( Skin, BackgroundRenderer, this ) ); screenMap.Add( MenuState.Instructions, new InstructionScreen( Skin, BackgroundRenderer, this ) ); }
//protected: protected void Start() { m_diffLevel = Difficulty.easy; m_randomizer = (GameObject.Find ("GameManager")).GetComponent<Randomizer>(); m_MenuState = (GameObject.Find ("GameManager")).GetComponent<MenuState>(); m_EventManager = EventManager.Instance; m_myCam = (GameObject.Find ("GameManager")).camera; }
/// <summary> Change screen. </summary> /// <remarks> James, 2014-05-02. </remarks> /// <exception cref="NotSupportedException"> Thrown when the state of the menu is set to NONE. </exception> /// <param name="state"> The state of the menu to be changed to. </param> public void ChangeScreen( MenuState state ) { if ( state == MenuState.NONE ) throw new System.NotSupportedException( "The state of the menu cannot be NONE" ); currentScreen = screenMap[ state ]; spRender.sprite = currentScreen.Background; }
public void GameOver(Allegiance winner) { mState = GameState.GameOver; // zu faul neue variablen einzuführen... // OptionsMenu = gewonnen // MainMenu = verloren mMenuState = winner == Allegiance.Player ? MenuState.OptionsMenu : MenuState.MainMenu; }
public void SetState (int state) { _menuState = (MenuState)state; Load (); // TODO: Play a sound }
public MenuPage AddBtn(Button btn, MenuState newState) { if (_pageButtonActions.Contains(btn)) _pageButtonActions.Remove(btn); _pageButtonActions.Add(btn, newState); return this; }
public void StartGame() { if (gameInProgress) return; gameInProgress = true; menuState = MenuState.IN_GAME; menu.DeactivateHighScore (); }
public void CraftingRecipesStart(List<CraftingRecipe> recipes, List<int> blocks, Action<int?> craftingRecipeSelected) { this.craftingrecipes2 = recipes; this.craftingblocks = blocks; this.craftingrecipeselected = craftingRecipeSelected; guistate = GuiState.CraftingRecipes; menustate = new MenuState(); FreeMouse = true; }
public void SetState(string input) { if(input == "Credits") state = MenuState.Credits; else if(input == "Controls") state = MenuState.Controls; else state = MenuState.Empty; }
private MenuFlowTransition(MenuState currentState) { this.currentState = currentState; }
public static MenuFlowTransition From(MenuState currentState) { return(new MenuFlowTransition(currentState)); }
public void ShowPickerMenu() { _state = MenuState.Picker; }
public void ShowMainMenu() { _state = MenuState.MainMenu; }
public void OnHelpButtonPressed() { state = MenuState.HELP; helpScreen.SetActive(true); }
public void Update(GameMenu menu) { //TODO: Esc bug меню if (menu.IsShown) { return; } if (IsLoginState) { if (LogIn.Update(MasterNI) == 1) { IsLoginState = false; PlayerName.Text = LogIn.PlayerName; PlayerMoney.Text = LogIn.PlayerMoney.ToString(); } } else { if (Home.Update() == ButtonStates.CLICKED) { if (State != MenuState.HOME) { if (RollingBack.Position != RollingBack.DownPosition) { RollingBack.SetDown(); } if (State == MenuState.COLLECTION) { collection.Hide(); } else if (State == MenuState.PLAY) { play.Hide(); } State = MenuState.HOME; } } if (Play.Update() == ButtonStates.CLICKED) { if (State != MenuState.PLAY) { RollingBack.SetUp(); if (State == MenuState.COLLECTION) { collection.Hide(); } State = MenuState.PLAY; } } if (Collection.Update() == ButtonStates.CLICKED) { if (State != MenuState.COLLECTION) { if (State == MenuState.PLAY) { play.Hide(); } RollingBack.SetUp(); State = MenuState.COLLECTION; } } if (OpenCardPack.Update() == ButtonStates.CLICKED) { // RollingBack.SetUp(); // if (State == MenuState.COLLECTION) // collection.Hide(); } if (Options.Update() == ButtonStates.CLICKED) { menu.Show(null, null, this); if (State == MenuState.COLLECTION) { collection.Hide(); } else if (State == MenuState.PLAY) { play.Hide(); } } if (State == MenuState.COLLECTION) { if (!RollingBack.IsMoving && !collection.IsShown) { collection.Show(1, true); } } if (State == MenuState.PLAY) { if (!RollingBack.IsMoving && !play.IsShown) { play.Show(); } } } RollingBack.Update(); collection.Update(); play.Update(); if (State == MenuState.CONNECTING) { play.Update(); if (!GameNI.IsConnected) { GameNI.ConnectTo(GameIP); } if (GameNI.IsConnected) { Log.SendMessage("Подключено"); CommandParser.InitGameServer(GameNI); State = MenuState.HOME; play.IsSearchState = false; play.ShowCancelButton(); Parent.CreateGame(GameNI); } } string[] CN; CommandParser.UpdateMasterServer(out CN); if (CN != null) { if (CN[0] == "CONNECT") { GameNI = new NetworkInterface(); State = MenuState.CONNECTING; GameIP = CN[1]; play.HideCancelButton(); } } }
private bool RedirectToMenu(MenuState newState) { throw new NotImplementedException(); }
protected void DrawGamemodeSetup(float guiScale) { const int width = 400; int height = Screen.height; // Draw settings title Rect settingsTitleRect = new Rect((0.5f * Screen.width - 0.5f * (settingsTitleTexture.width * 0.5f)), (0.25f * Screen.height - 0.5f * (settingsTitleTexture.height * 0.5f)), settingsTitleTexture.width * 0.5f, settingsTitleTexture.height * 0.5f); GUI.DrawTexture(settingsTitleRect, settingsTitleTexture); GUILayout.BeginArea(new Rect(0.5f * (Screen.width - width), 0.5f * (Screen.height), width, height)); GUILayout.BeginHorizontal(); GUILayout.Label("Map size:", new GUILayoutOption[] { GUILayout.Width(100) }); // Show value GUILayout.Label(maze.width + "x" + maze.height, new GUILayoutOption[] { GUILayout.Width(50) }); // Maze dimensions slider { mazeDimensions = GUILayout.HorizontalSlider(mazeDimensions, MIN_MAZE_SIZE, MAX_MAZE_SIZE); // Update values maze.width = (int)mazeDimensions; maze.height = (int)mazeDimensions; levelGen.lightCount = (int)(LIGHT_CHANCE * (maze.width * maze.height)); // Round up to odd number if (maze.width % 2 == 0) { maze.width += 1; } if (maze.height % 2 == 0) { maze.height += 1; } } GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label("Enemy count: ", new GUILayoutOption[] { GUILayout.Width(100) }); // Show value GUILayout.Label(levelGen.enemyCount.ToString(), new GUILayoutOption[] { GUILayout.Width(50) }); // Enemy count slider { enemyCount = GUILayout.HorizontalSlider(enemyCount, MIN_ENEMY_COUNT, MAX_ENEMY_COUNT); // Update values levelGen.enemyCount = (int)enemyCount; } GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label("Generate loops: ", new GUILayoutOption[] { GUILayout.Width(100) }); generateLoops = GUILayout.Toggle(generateLoops, ""); // Update value if (generateLoops) { maze.generationMode = Maze.Mode.CREATELOOPS; } else { maze.generationMode = Maze.Mode.PERFECT; } GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label("Damage on: ", new GUILayoutOption[] { GUILayout.Width(100) }); damageOn = GUILayout.Toggle(damageOn, ""); // Update value if (damageOn) { Projectile.DamageMultiplier = 1.0f; } else { Projectile.DamageMultiplier = 0.0f; } GUILayout.EndHorizontal(); GUILayout.Space(25); if (GUILayout.Button("Play!")) { StartGame(); menuState = MenuState.GAME; } GUILayout.EndArea(); }
protected void Update() { bool justClicked = false; bool escJustPressed = false; if (Input.GetMouseButton(0) && !clicked) { justClicked = true; clicked = true; } if (Input.GetKey(KeyCode.Escape) && !escPressed) { escJustPressed = true; escPressed = true; } switch (menuState) { case MenuState.TITLE: if (justClicked) { menuState = MenuState.GAMEMODESETUP; } else if (escJustPressed) { Application.Quit(); } break; case MenuState.GAMEMODESETUP: if (escJustPressed) { menuState = MenuState.TITLE; } break; case MenuState.GAME: if (Time.realtimeSinceStartup - roundStartTime < ROUND_START_DELAY) { Time.timeScale = 0.0f; } else { Time.timeScale = 1.0f; if (escJustPressed) { fadeStartTime = Time.realtimeSinceStartup; menuState = MenuState.FADETOPAUSE; } if (playerCharacter.Health <= 0.0f || GameObject.FindObjectsOfType(typeof(NonplayerCharacter)).Length == 0) { fadeStartTime = Time.realtimeSinceStartup; menuState = MenuState.FADETOPAUSE; } } break; case MenuState.PAUSE: Time.timeScale = 0.0f; if (escJustPressed && !playerCharacter.Dead && GameObject.FindObjectsOfType(typeof(NonplayerCharacter)).Length > 0) { fadeStartTime = Time.realtimeSinceStartup; menuState = MenuState.FADETOGAME; } break; case MenuState.FADETOPAUSE: Time.timeScale = 0.0f; fadeVal = Mathf.Lerp(0.0f, FADE_MAX, (Time.realtimeSinceStartup - fadeStartTime) * FADE_SPEED); if (fadeVal == FADE_MAX) { menuState = MenuState.PAUSE; } break; case MenuState.FADETOGAME: Time.timeScale = 0.0f; fadeVal = Mathf.Lerp(FADE_MAX, 0.0f, (Time.realtimeSinceStartup - fadeStartTime) * FADE_SPEED); if (fadeVal == 0.0f) { menuState = MenuState.GAME; } break; } if (clicked && !Input.GetMouseButton(0)) { clicked = false; } if (escPressed && !Input.GetKey(KeyCode.Escape)) { escPressed = false; } #if NPC_DEBUG if (tex != null) { int width = NonplayerCharacter.CellStates.GetLength(0); int height = NonplayerCharacter.CellStates.GetLength(1); // Update grid texture for (int x = 0; x < width; ++x) { for (int y = 0; y < height; ++y) { Color colour = Color.black; switch (NonplayerCharacter.CellStates[x, y]) { case CellState.BLOCKED: colour = Color.red; break; case CellState.CLEAR: colour = Color.green; break; case CellState.UNKNOWN: colour = Color.blue; break; } tex.SetPixel(x, y, colour); } } tex.Apply(); } if (tex2 != null) { int width = NonplayerCharacter.PathFindingGrid.GetLength(0); int height = NonplayerCharacter.PathFindingGrid.GetLength(1); // Update pathfinding texture for (int x = 0; x < width; ++x) { for (int y = 0; y < height; ++y) { Color colour = Color.black; if (NonplayerCharacter.PathFindingGrid[x, y].Accessible) { colour = Color.white; } tex2.SetPixel(x, y, colour); } } // Update texture tex2.Apply(); } #endif }
public void ChangeMenuState(MenuState newMenuState) { SetPanelActive(_currentMenuState, false); SetPanelActive(newMenuState, true); _currentMenuState = newMenuState; }
public void SetState(MenuState s) { state = s; }
void Update() { #region Controle de Animacao if (!menuAnimation.IsPlaying("Menu_Exit_2") && menuState == MenuState.CREDITOS) { creditosAnimation.CrossFade("Creditos_Enter_2"); menuPanel.SetActive(false); creditosPanel.SetActive(true); menuState = MenuState.DEFAULT; } if (!menuAnimation.IsPlaying("Menu_Exit_2") && menuState == MenuState.JOGAR) { selecaoAnimation.CrossFade("Selecao_Enter"); // Debug.Log("Selecao_Enter"); menuPanel.SetActive(false); selecaoPanel.SetActive(true); menuState = MenuState.DEFAULT; airplaneList[indexAirplane].transform.position = startPosition; moveAirplane = MoveAirplane.LEFTRIGHT; } if (!menuAnimation.IsPlaying("Menu_Exit_2") && menuState == MenuState.SAIR) { sairAnimation.CrossFade("Sair_Enter"); menuPanel.SetActive(false); sairPanel.SetActive(true); menuState = MenuState.DEFAULT; } if (creditosPanel.activeSelf) { if (!creditosAnimation.IsPlaying("Creditos_Exit_2") && menuState == MenuState.MENU) { menuAnimation.CrossFade("Menu_Enter_2"); menuPanel.SetActive(true); creditosPanel.SetActive(false); menuState = MenuState.DEFAULT; } } if (sairPanel.activeSelf) { if (!sairAnimation.IsPlaying("Sair_Exit") && menuState == MenuState.MENU) { menuAnimation.CrossFade("Menu_Enter_2"); menuPanel.SetActive(true); sairPanel.SetActive(false); menuState = MenuState.DEFAULT; } } if (selecaoPanel.activeSelf) { if (!selecaoAnimation.IsPlaying("Selecao_Exit_2") && menuState == MenuState.MENU) { menuAnimation.CrossFade("Menu_Enter_2"); menuPanel.SetActive(true); selecaoPanel.SetActive(false); menuState = MenuState.DEFAULT; moveAirplane = MoveAirplane.DEFAULT; } else if (selecaoAnimation.IsPlaying("Selecao_Exit_2") && menuState == MenuState.MENU) { if (moveAirplane == MoveAirplane.LEFT) { airplaneList[indexAirplane].transform.position = Vector3.MoveTowards(airplaneList[indexAirplane].transform.position, startPosition, speed * Time.deltaTime); } } } #endregion #region Controle de Escolha_de_Avioes if (moveAirplane == MoveAirplane.RIGHT && menuState != MenuState.MENU) { airplaneList[indexAirplane].transform.position = Vector3.MoveTowards(airplaneList[indexAirplane].transform.position, finalPosition, speed * Time.deltaTime); if (airplaneList[indexAirplane].transform.position == finalPosition) { moveAirplane = MoveAirplane.RIGHTLEFT; indexAirplane++; if (indexAirplane >= airplaneList.Count) { indexAirplane = 0; } airplaneList[indexAirplane].transform.position = startPosition; } } if (moveAirplane == MoveAirplane.RIGHTLEFT && menuState != MenuState.MENU) { airplaneList[indexAirplane].transform.position = Vector3.MoveTowards(airplaneList[indexAirplane].transform.position, middlePosition, speed * Time.deltaTime); if (airplaneList[indexAirplane].transform.position == middlePosition) { moveAirplane = MoveAirplane.DEFAULT; } } if (moveAirplane == MoveAirplane.LEFT && menuState != MenuState.MENU) { airplaneList[indexAirplane].transform.position = Vector3.MoveTowards(airplaneList[indexAirplane].transform.position, startPosition, speed * Time.deltaTime); if (airplaneList[indexAirplane].transform.position == startPosition) { moveAirplane = MoveAirplane.LEFTRIGHT; indexAirplane--; if (indexAirplane < 0) { indexAirplane = airplaneList.Count - 1; } airplaneList[indexAirplane].transform.position = finalPosition; } } if (moveAirplane == MoveAirplane.LEFTRIGHT && menuState != MenuState.MENU) { airplaneList[indexAirplane].transform.position = Vector3.MoveTowards(airplaneList[indexAirplane].transform.position, middlePosition, speed * Time.deltaTime); if (airplaneList[indexAirplane].transform.position == middlePosition) { moveAirplane = MoveAirplane.DEFAULT; } } #endregion }
public void CloseMenu() { currentMenuState = null; }
public static void Update() { switch (MenuState) { case MenuState.TitleScreen: if (InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.A) || InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.Start) || InputHelper.WasKeyPressed(Keys.Space) || InputHelper.WasKeyPressed(Keys.Enter)) { MenuState = MenuState.MainMenu; } break; case MenuState.MainMenu: // Menu Navigation if (InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.DPadUp) || (InputHelper.NGS[(int)PlayerIndex.One].ThumbSticks.Left.Y <0.3 && InputHelper.NGS[(int)PlayerIndex.One].ThumbSticks.Left.Y> 0.3) || InputHelper.WasKeyPressed(Keys.Up)) { currentMenuItem--; if (currentMenuItem < 0) { currentMenuItem = menuItems.Count - 1; } SoundManager.PlaySound("PickUpItem"); } if (InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.DPadDown) || (InputHelper.NGS[(int)PlayerIndex.One].ThumbSticks.Left.Y <-0.3 && InputHelper.NGS[(int)PlayerIndex.One].ThumbSticks.Left.Y> -0.3) || InputHelper.WasKeyPressed(Keys.Down)) { currentMenuItem++; if (currentMenuItem >= menuItems.Count) { currentMenuItem = 0; } SoundManager.PlaySound("PickUpItem"); } //Menu Item Actions if (InputHelper.WasButtonPressed(PlayerIndex.One, Buttons.A) || (InputHelper.WasKeyPressed(Keys.Space)) || (InputHelper.WasKeyPressed(Keys.Enter))) { switch (currentMenuItem) { case 0: // Begin Game GameManager.GameState = GameState.Playing; GameManager.CreateLevels(); MusicManager.StopSong(); MusicManager.PlaySong(Game1.MusicGame01); MusicManager.SetRepeating(true); break; case 1: // How To Play GameManager.GameState = GameState.HowToPlay; break; case 2: // Exit Game Game1.ExitGame(); break; } } break; } }
public void PlayHasStarted() { state = MenuState.PLAYING; hud.SetActive(true); }
public override float DrawHeader(IStateOwner pOwner, MenuState Source, Graphics Target, RectangleF Bounds) { //for the pause screen, we don't draw the header. We return half the size of the screen though. //return base.DrawHeader(Target, Bounds); return((float)Bounds.Height * 0.6f); }
public void ShowSettingsMenu() { _state = MenuState.Settings; }
private void Handle(IAcSession acSession, IMenuCreateIo input, bool isCommand) { var acDomain = _set._acDomain; var menuById = _set._menuById; var menuRepository = acDomain.RetrieveRequiredService <IRepository <Menu, Guid> >(); if (!input.Id.HasValue) { throw new ValidationException("标识是必须的"); } MenuState menu; if (acDomain.MenuSet.TryGetMenu(input.Id.Value, out menu)) { throw new ValidationException("给定标识的实体已经存在" + input.Id); } if (input.ParentId.HasValue) { MenuState parentMenu; if (!acDomain.MenuSet.TryGetMenu(input.ParentId.Value, out parentMenu)) { throw new NotExistException("标识为" + input.ParentId.Value + "的父菜单不存在"); } if (input.AppSystemId != parentMenu.AppSystemId) { throw new ValidationException("非法的数据,子菜单的应用系统必须和父菜单一致"); } } var entity = Menu.Create(input); lock (Locker) { if (acDomain.MenuSet.TryGetMenu(input.Id.Value, out menu)) { throw new ValidationException("给定标识的实体已经存在" + input.Id); } if (input.ParentId.HasValue) { MenuState parentMenu; if (!acDomain.MenuSet.TryGetMenu(input.ParentId.Value, out parentMenu)) { throw new NotExistException("标识为" + input.ParentId.Value + "的父菜单不存在"); } } var menuState = MenuState.Create(acDomain, entity); if (!menuById.ContainsKey(entity.Id)) { menuById.Add(entity.Id, menuState); } if (isCommand) { try { menuRepository.Add(entity); menuRepository.Context.Commit(); } catch { if (menuById.ContainsKey(entity.Id)) { menuById.Remove(entity.Id); } menuRepository.Context.Rollback(); throw; } } } if (isCommand) { acDomain.MessageDispatcher.DispatchMessage(new MenuAddedEvent(acSession, entity, input, isPrivate: true)); } }
protected void EnterState(MenuState newState) { State = newState; TimeEnteredState = SMH.Now; }
private void Update(MenuState state) { var menuById = _set._menuById; menuById[state.Id] = state; }
//选择状态 private void btnState_Click(object sender, EventArgs e) { MenuState.Show(btnState, new Point(0, btnState.Height), ToolStripDropDownDirection.Right); }
public void SetMenuState(MenuState menuState) { this.menuState = menuState; }
private MenuFlowTransitionAction getTransitionAction(MenuState newState) { MenuFlowTransitionStates transitionStates = MenuFlowTransitionStatesBuilder.From(currentState).To(newState); return(MenuFlowTransitions.GetAction(transitionStates)); }
public override void Update() { if (isActive) { // Positionning arrow // if (choice == MenuState.START) { arrow.Transform.Position = new Vector2(-25, -7); } if (choice == MenuState.CHALLENGES) { arrow.Transform.Position = new Vector2(-45, 7); } // Actions with enter or space // if ((Game1.kbs.IsKeyDown(Keys.Enter) && Game1.old_kbs.IsKeyUp(Keys.Enter)) || (Game1.kbs.IsKeyDown(Keys.Space) && Game1.old_kbs.IsKeyUp(Keys.Space))) { ExecuteStartAction(); menuSound.Play(); } // Up and down input between start & challenges // if (choice != MenuState.CHALLENGE_CHOICE) { if (Game1.kbs.IsKeyDown(Keys.Up) && Game1.old_kbs.IsKeyUp(Keys.Up)) { choice = MenuState.START; menuSound.Play(); } if (Game1.kbs.IsKeyDown(Keys.Down) && Game1.old_kbs.IsKeyUp(Keys.Down)) { choice = MenuState.CHALLENGES; menuSound.Play(); } } // Left and right input between challenges // if (choice == MenuState.CHALLENGE_CHOICE) { if (Game1.kbs.IsKeyDown(Keys.LeftAlt) && Game1.old_kbs.IsKeyUp(Keys.LeftAlt)) { choice = MenuState.START; challengeChoice = ChallengeState.CHALL_1; m_sprite.SpriteSheet = TextureLibrary.GetSpriteSheet("menu_start_bg"); canLauchChallenge = false; menuSound.Play(); } if (Game1.kbs.IsKeyDown(Keys.Right) && Game1.old_kbs.IsKeyUp(Keys.Right)) { if (challengeChoice < ChallengeState.CHALL_5) { challengeChoice++; arrow.Transform.PosX += deltaArrowBetweenChallenges; menuSound.Play(); } } if (Game1.kbs.IsKeyDown(Keys.Left) && Game1.old_kbs.IsKeyUp(Keys.Left)) { if (challengeChoice > ChallengeState.CHALL_1) { challengeChoice--; arrow.Transform.PosX -= deltaArrowBetweenChallenges; menuSound.Play(); } } } } actionManager.Update(); }
public void To(MenuState newState) { MenuFlowTransitionAction action = getTransitionAction(newState); action.Perform(); }
public void QuitClicked() { quitAudio.Play(); menuState = MenuState.Quit; }
public override void HandleInput(GameTime gameTime) { foreach (Button button in mainButtonList) { button.HandleInput(); } foreach (Button button in sessionButtonList) { button.HandleInput(); } fileToStart.HandleInput(); nextFilePage.HandleInput(); prevFilePage.HandleInput(); guideToStart.HandleInput(); nextGuidePage.HandleInput(); prevGuidePage.HandleInput(); //if (currentState == MenuState.FileMenu) //{ // for (int i = 0; i < sessionButtonList.Count; i++) // { // if (sessionButtonList[i].IsHeld) // { // screenManager.AddScreen(new LoadScreen(sessionPathList[i], screenManager)); // currentState = MenuState.StartMenu; // sessionPathList = new List<string>(); // sessionButtonList = new List<Button>(); // for (int h = 0; h < mainButtonList.Count; h++) // mainButtonList[h].WorldPosition = new Vector2(mainButtonList[h].WorldPosition.X, 299 + h * 66); // fileToStart.WorldPosition = new Vector2(fileToStart.WorldPosition.X, 1160); // prevFilePage.WorldPosition = new Vector2(prevFilePage.WorldPosition.X, 1160); // nextFilePage.WorldPosition = new Vector2(nextFilePage.WorldPosition.X, 1160); // } // else if (sessionButtonList[i].IsSelected) // { // errorMessage = sessionPathList[i].Replace(Content.BaseDirectory, ""); // errorTimer = 30; // } // } //} if (currentState == MenuState.MovingToFile) { if (!sessionButtonList[0].Modifiers[0].Active) { currentState = MenuState.FileMenu; foreach (Button button in sessionButtonList) { button.ClearModifiers(); } foreach (Button button in mainButtonList) { button.ClearModifiers(); } nextFilePage.ClearModifiers(); prevFilePage.ClearModifiers(); fileToStart.ClearModifiers(); } } else if (currentState == MenuState.MovingFromFile) { if (!sessionButtonList[0].Modifiers[0].Active) { fileMenuPageNumber = 0; currentState = MenuState.StartMenu; foreach (Button button in sessionButtonList) { button.ClearModifiers(); } foreach (Button button in mainButtonList) { button.ClearModifiers(); } nextFilePage.ClearModifiers(); prevFilePage.ClearModifiers(); fileToStart.ClearModifiers(); } } else if (currentState == MenuState.FileMovingBack || currentState == MenuState.FileMovingForth) { if (!sessionButtonList[0].Modifiers[0].Active) { currentState = MenuState.FileMenu; foreach (Button button in sessionButtonList) { button.ClearModifiers(); } } } else if (currentState == MenuState.MovingToGuide) { if (!guideScreen[0].Modifiers[0].Active) { currentState = MenuState.GuideMenu; foreach (Button button in mainButtonList) { button.ClearModifiers(); } foreach (Page page in guideScreen) { page.ClearModifiers(); } backgroundSession.ClearModifiers(); backgroundSession.AddModifier(new RotateModifier2D(0.006f, false, -1)); titleText.ClearModifiers(); nextGuidePage.ClearModifiers(); prevGuidePage.ClearModifiers(); guideToStart.ClearModifiers(); } } else if (currentState == MenuState.MovingFromGuide) { if (!guideScreen[0].Modifiers[0].Active) { currentState = MenuState.StartMenu; foreach (Button button in mainButtonList) { button.ClearModifiers(); } foreach (Page page in guideScreen) { page.ClearModifiers(); } backgroundSession.ClearModifiers(); backgroundSession.AddModifier(new RotateModifier2D(0.006f, false, -1)); titleText.ClearModifiers(); nextGuidePage.ClearModifiers(); prevGuidePage.ClearModifiers(); guideToStart.ClearModifiers(); } } else if (currentState == MenuState.GuideMovingBack || currentState == MenuState.GuideMovingForth) { if (!guideToStart.Modifiers[0].Active) { currentState = MenuState.GuideMenu; } } }
public void NewGameClicked() { newgameAudio.Play(); menuState = MenuState.Newgame; }
public override void OnStateEnter(Animator animator, AnimatorStateInfo animatorStateInfo, int layerIndex) { _MenuState = FindObjectOfType <MenuState>(); _MenuState.OnStateEnter(animator, animatorStateInfo, layerIndex); }
private void InitializeMenuLord() { MenuLord._instance = this; _currentMenuState = MenuState.MS_MAIN; }