protected SelectedSunnetMenu GetSelectedMenu(string module) { if (!SelectedMenu.ContainsKey(module)) { return(SelectedSunnetMenu.None); } return(SelectedMenu[module]); }
/* Custom Events to manipulate Main form from Menu buttons */ protected virtual void OnSelectedMenu(IconButton clickedBtn) { // Check for subscribers SelectedMenu?.Invoke(this, new MenuEventArgs { ClickedButtonIcon = clickedBtn, Namespace = "Club_De_Sport.UnsubscribedClientForms" }); }
void DoExit(int wid) { GUI.Label(new Rect(0, 25, 200, 50), "Are you sure?"); if (GUI.Button(new Rect(25, 75, 75, 75), "", ApplyButton)) { Application.Quit(); } if (GUI.Button(new Rect(115, 75, 75, 75), "", CancelButton)) { selMenu = SelectedMenu.MAINMENU; } }
void DoOptions(int wid) { GUIStyle optionsStyle = new GUIStyle(SmallFont); optionsStyle.normal.textColor = Color.white; // Debug.Log(OptionsWindow); GUI.Label(new Rect(OptionsWindow.width / 2 - 75, 15, 150, 40), "Options"); GUI.Label(new Rect(25, 45, 125, 30), "Screen Resolution", optionsStyle); if (GUI.Button(new Rect(175, 48, 125, 26), (string)selStrings[selGridInt])) { showDropdown = !showDropdown; lastResSelection = selGridInt; } if (showDropdown) { if (selGridInt != lastResSelection) { showDropdown = false; } GUI.Box(new Rect(335, 40, 150, 200), ""); scrollPosition = GUI.BeginScrollView(new Rect(335, 40, 150, 200), scrollPosition, new Rect(0, -5, 125, (26 * selStrings.Length) + 10), false, true); selGridInt = GUI.SelectionGrid(new Rect(0, 0, 135, 26 * selStrings.Length), selGridInt, selStrings, 1); GUI.EndScrollView(); } GUI.Label(new Rect(25, 110, 100, 30), "Quality", optionsStyle); qualSlider = (int)GUI.HorizontalSlider(new Rect(150, 119, OptionsWindow.width - 325, 12), qualSlider, 0, 6); GUI.Label(new Rect(25, 140, 100, 30), "Gamma", optionsStyle); gammaSlider = (int)GUI.HorizontalSlider(new Rect(150, 149, OptionsWindow.width - 325, 12), gammaSlider, 0.0f, 200.0f); GUI.Label(new Rect(25, 170, 100, 30), "SFX Volume", optionsStyle); SFXVolSlider = (int)GUI.HorizontalSlider(new Rect(150, 179, OptionsWindow.width - 325, 12), SFXVolSlider, 0.0f, 200.0f); GUI.Label(new Rect(25, 200, 100, 30), "Music Volume", optionsStyle); MusicVolSlider = (int)GUI.HorizontalSlider(new Rect(150, 209, OptionsWindow.width - 325, 12), MusicVolSlider, 0.0f, 200.0f); if (GUI.Button(new Rect((OptionsWindow.width / 2) - 100, OptionsWindow.height - 80, 70, 70), "", CancelButton)) { selMenu = SelectedMenu.MAINMENU; } if (GUI.Button(new Rect((OptionsWindow.width / 2) + 25, OptionsWindow.height - 80, 70, 70), "", ApplyButton)) { // Do crap selMenu = SelectedMenu.MAINMENU; UIMessage("Settings saved... NOT! :D"); } }
void Update() { if (Input.GetKeyDown(KeyCode.Escape) && Application.loadedLevel != 0) { if (showMenu) { selMenu = SelectedMenu.MAINMENU; } showMenu = !showMenu; } else if (Application.loadedLevel == 0) { showMenu = true; } }
public void ClearGame() { ListLettersGrid.Clear(); ListButtonsGame.Clear(); ListTilesTemporary.Clear(); ListTilesPermanent.Clear(); ListTileHighlight.Clear(); ListLineTilesHorizontal.Clear(); ListLineTilesVertical.Clear(); ListLineTilesDownRight.Clear(); ListLineTilesUpRight.Clear(); ListWordsToFind.Clear(); WonGame = false; HowTo = false; WordTilesTemporary = ""; SelectedMenu = SelectedMenu.start; SelectedSize = 0; ManagerSelectTile.ResetValues(); }
static void Main(string[] args) { bool play = true; Console.Title = "Tetris Michiel Van Gasse"; if (OperatingSystem.IsWindows()) // prevent warning windows only { Console.SetWindowSize(80, 35); } Console.CursorVisible = false; // disable cursor flickering around while (play) { SelectedMenu selectedMenu = MenuSelection(); switch (selectedMenu) { case SelectedMenu.StartGame: PlayTetris.PlayGame(); break; case SelectedMenu.HighScore: HighScores.ShowHighScores(); break; case SelectedMenu.Controls: Controls.ShowControls(); break; case SelectedMenu.Credits: Credits.ShowCredits(); break; case SelectedMenu.Exit: play = false; break; default: break; } } }
void DoMainMenu(int wid) { if (GameData.Instance.profileLoaded) { GUI.Label(new Rect(15, 15, MainMenuWindow.width - 30, 40), "Welcome " + GameData.Instance.CurrentProfile.ProfileName); if (GUI.Button(new Rect(70 + WindowOffset.width, 30 + WindowOffset.height, 180, 40), "", StartButton)) { if (Application.loadedLevel != GameData.Instance.CurrentProfile.CurrentLevel) { GameData.Instance.GameState = GAMESTATE.GAME; Application.LoadLevel(GameData.Instance.CurrentProfile.CurrentLevel); selMenu = SelectedMenu.MAINMENU; } else { showMenu = !showMenu; } } } else { if (GUI.Button(new Rect(70 + WindowOffset.width, 30 + WindowOffset.height, 180, 40), "", NewgameButton)) { newProfileName = "Profile Name"; selMenu = SelectedMenu.NEWGAME; } } if (GUI.Button(new Rect(70 + WindowOffset.width, 80 + WindowOffset.height, 180, 40), "", ContinueButton)) { // Count the profiles in the folder ProfileListing(); selMenu = SelectedMenu.CONTINUE; } if (GUI.Button(new Rect(70 + WindowOffset.width, 130 + WindowOffset.height, 180, 40), "", OptionsButton)) { selMenu = SelectedMenu.OPTIONS; } if (GUI.Button(new Rect(70 + WindowOffset.width, 180 + WindowOffset.height, 180, 40), "", QuitButton)) { selMenu = SelectedMenu.EXITGAME; } }
// New game window GUI method void DoNewGame(int wid) { newProfileName = GUI.TextField(new Rect(NewGameWindow.width / 2 - 128, NewGameWindow.height / 2 - 32, 256, 64), newProfileName, 12, NewGameLayout); if (GUI.Button(new Rect(NewGameWindow.width / 2 + 15, NewGameWindow.height / 2 + 64, 75, 75), "", ApplyButton)) { if (myData.ProfileExists(newProfileName)) { // It already exists. UIMessage("Profile already exists"); } else { // Create a new profile UIMessage("Profile " + newProfileName + " created."); myData.NewProfileXML(newProfileName); selMenu = SelectedMenu.MAINMENU; } } if (GUI.Button(new Rect(NewGameWindow.width / 2 - 90, NewGameWindow.height / 2 + 64, 75, 75), "", CancelButton)) { selMenu = SelectedMenu.MAINMENU; } }
void DoContinue(int wid) { loadScroll = GUI.BeginScrollView(new Rect(5, 15, ContinueWindow.width - 10, ContinueWindow.height - 120), loadScroll, new Rect(5, 15, ContinueWindow.width - 30, (profileList.Length * 120) + 5)); int i = 0; foreach (Profile p in profileList) { if (GUI.Button(new Rect(10, (120 * i) + 20, 480, 120), "", ContinueProfileButton)) { // Load the game. UIMessage("Profile " + p.ProfileName + " loaded"); GameData.Instance.SetProfile(p); if (Application.loadedLevel != 0) { GameData.Instance.GameState = GAMESTATE.STARTMENU; Application.LoadLevel(0); } selMenu = SelectedMenu.MAINMENU; } if (GUI.Button(new Rect(425, (120 * i) + 55, 50, 50), "", CancelButton)) { // Delete the profile. myData.DeleteProfile(p.ProfileSlot); UIMessage("Deleted profile " + p.ProfileName); selMenu = SelectedMenu.MAINMENU; } // The text inside the shitter profile thingy texture thing stuff GUI.Label(new Rect(40, (120 * i) + 40, 200, 40), "Profile name: " + p.ProfileName, SmallFont); i++; } GUI.EndScrollView(); if (GUI.Button(new Rect((ContinueWindow.width / 2) - 60, ContinueWindow.height - 45, 120, 30), "", BackToMainMenu)) { selMenu = SelectedMenu.MAINMENU; } }
void DoMainMenu(int wid) { if (GameData.Instance.profileLoaded) { GUI.Label(new Rect(15, 15, MainMenuWindow.width - 30, 40), "Welcome " + GameData.Instance.CurrentProfile.ProfileName); if (GUI.Button(new Rect(70 + WindowOffset.width, 30 + WindowOffset.height, 180, 40), "", StartButton)) { if (Application.loadedLevel!=GameData.Instance.CurrentProfile.CurrentLevel) { GameData.Instance.GameState = GAMESTATE.GAME; Application.LoadLevel(GameData.Instance.CurrentProfile.CurrentLevel); selMenu = SelectedMenu.MAINMENU; } else { showMenu = !showMenu; } } } else { if (GUI.Button(new Rect(70 + WindowOffset.width, 30 + WindowOffset.height, 180, 40), "", NewgameButton)) { newProfileName = "Profile Name"; selMenu = SelectedMenu.NEWGAME; } } if (GUI.Button(new Rect(70 + WindowOffset.width, 80 + WindowOffset.height, 180, 40), "", ContinueButton)) { // Count the profiles in the folder ProfileListing(); selMenu = SelectedMenu.CONTINUE; } if (GUI.Button(new Rect(70 + WindowOffset.width, 130 + WindowOffset.height, 180, 40), "", OptionsButton)) selMenu = SelectedMenu.OPTIONS; if (GUI.Button(new Rect(70 + WindowOffset.width, 180 + WindowOffset.height, 180, 40), "", QuitButton)) selMenu = SelectedMenu.EXITGAME; }
void Update() { if (Input.GetKeyDown(KeyCode.Escape) && Application.loadedLevel!=0) { if (showMenu) selMenu = SelectedMenu.MAINMENU; showMenu = !showMenu; } else if (Application.loadedLevel==0) { showMenu = true; } }
private void Menu_onMenuAdded(object sender, MenuVM menu) { SelectedMenu.Add(menu); RaisePropertyChanged(() => MenuLength); }
public static void SetSelectedMenu(this ViewDataDictionary viewData, SelectedMenu selectedMenu) { viewData[selectedMenuKey] = selectedMenu; }
void DoExit(int wid) { GUI.Label(new Rect(0, 25, 200, 50), "Are you sure?"); if(GUI.Button(new Rect(25, 75, 75, 75), "", ApplyButton)) Application.Quit(); if(GUI.Button(new Rect(115, 75, 75, 75), "", CancelButton)) selMenu=SelectedMenu.MAINMENU; }
// New game window GUI method void DoNewGame(int wid) { newProfileName = GUI.TextField(new Rect(NewGameWindow.width / 2 - 128, NewGameWindow.height / 2 - 32, 256, 64), newProfileName,12, NewGameLayout); if (GUI.Button(new Rect(NewGameWindow.width / 2 + 15, NewGameWindow.height / 2 + 64, 75, 75), "", ApplyButton)) { if (myData.ProfileExists(newProfileName)) { // It already exists. UIMessage("Profile already exists"); } else { // Create a new profile UIMessage("Profile " + newProfileName + " created."); myData.NewProfileXML(newProfileName); selMenu = SelectedMenu.MAINMENU; } } if (GUI.Button(new Rect(NewGameWindow.width / 2 - 90, NewGameWindow.height / 2 + 64, 75, 75), "", CancelButton)) { selMenu = SelectedMenu.MAINMENU; } }
void DoOptions(int wid) { GUIStyle optionsStyle = new GUIStyle(SmallFont); optionsStyle.normal.textColor = Color.white; // Debug.Log(OptionsWindow); GUI.Label(new Rect(OptionsWindow.width / 2 - 75, 15, 150, 40), "Options"); GUI.Label(new Rect(25, 45, 125, 30), "Screen Resolution", optionsStyle); if(GUI.Button(new Rect(175, 48, 125,26), (string)selStrings[selGridInt])) { showDropdown=!showDropdown; lastResSelection = selGridInt; } if(showDropdown) { if(selGridInt!=lastResSelection) showDropdown = false; GUI.Box(new Rect(335, 40, 150, 200), ""); scrollPosition = GUI.BeginScrollView(new Rect(335, 40, 150, 200), scrollPosition, new Rect(0, -5, 125, (26*selStrings.Length) + 10), false, true); selGridInt = GUI.SelectionGrid(new Rect(0, 0, 135, 26*selStrings.Length), selGridInt, selStrings, 1); GUI.EndScrollView(); } GUI.Label(new Rect(25,110,100,30), "Quality", optionsStyle); qualSlider = (int)GUI.HorizontalSlider(new Rect(150, 119, OptionsWindow.width - 325, 12),qualSlider, 0, 6); GUI.Label(new Rect(25, 140, 100, 30), "Gamma", optionsStyle); gammaSlider = (int)GUI.HorizontalSlider(new Rect(150, 149, OptionsWindow.width - 325, 12),gammaSlider, 0.0f, 200.0f); GUI.Label(new Rect(25, 170, 100, 30), "SFX Volume", optionsStyle); SFXVolSlider = (int)GUI.HorizontalSlider(new Rect(150, 179, OptionsWindow.width - 325, 12),SFXVolSlider, 0.0f, 200.0f); GUI.Label(new Rect(25, 200, 100, 30), "Music Volume", optionsStyle); MusicVolSlider = (int)GUI.HorizontalSlider(new Rect(150, 209, OptionsWindow.width - 325, 12),MusicVolSlider, 0.0f, 200.0f); if (GUI.Button(new Rect((OptionsWindow.width / 2) - 100, OptionsWindow.height - 80, 70, 70), "", CancelButton)) selMenu = SelectedMenu.MAINMENU; if (GUI.Button(new Rect((OptionsWindow.width / 2) + 25, OptionsWindow.height - 80, 70, 70), "", ApplyButton)) { // Do crap selMenu = SelectedMenu.MAINMENU; UIMessage("Settings saved... NOT! :D"); } }
public override bool OnKeyDown(KeyboardKeyEventArgs e) { //Console.WriteLine (e.Key); if (SelectedMenu != null) { if (e.Key == Key.Escape) { SelectedMenu = null; } else { if (ModifierKeys.AltPressed && SelectedMenu.OnKeyDown(e)) { Invalidate(); return(true); } } } /*** * else if (e.Key == Key.F10) { * Widget wmenu = MainMenuWidget; * if (wmenu != null) { * wmenu.Select (); * } * if (base.OnKeyDown (e)) { * Invalidate (); * return true; * } * } ***/ Widget formerlyFocusedWidget = FocusedWidget; try { if (FocusedWidget != null && FocusedWidget != this && FocusedWidget.OnKeyDown(e)) { return(true); } if (e.Key == OpenTK.Input.Key.Tab) { if (e.Shift) { SelectPrevWidget(); } else { SelectNextWidget(); } //this.LogVerbose ("Widget focused: {0}", FocusedWidget != null ? FocusedWidget.Name : "null"); return(true); } // bubble up from focused if (FocusedWidget != null) { Widget parent = FocusedWidget.Parent; while (parent != null && parent != this) { if (parent.OnKeyDown(e)) { return(true); } parent = parent.Parent; } } return(base.OnKeyDown(e)); } catch (Exception ex) { ex.LogError(); } finally { if ((FocusedWidget == null || FocusedWidget == this) && formerlyFocusedWidget != null && !formerlyFocusedWidget.IsDisposed) { formerlyFocusedWidget.Focus(); } } return(false); }
void DoContinue(int wid) { loadScroll = GUI.BeginScrollView(new Rect(5, 15, ContinueWindow.width - 10, ContinueWindow.height - 120), loadScroll, new Rect(5, 15, ContinueWindow.width - 30, (profileList.Length * 120) + 5)); int i = 0; foreach(Profile p in profileList) { if (GUI.Button(new Rect(10, (120 * i) + 20, 480, 120), "", ContinueProfileButton)) { // Load the game. UIMessage("Profile " + p.ProfileName + " loaded"); GameData.Instance.SetProfile(p); if (Application.loadedLevel != 0) { GameData.Instance.GameState = GAMESTATE.STARTMENU; Application.LoadLevel(0); } selMenu = SelectedMenu.MAINMENU; } if (GUI.Button(new Rect(425, (120 * i) + 55, 50, 50), "", CancelButton)) { // Delete the profile. myData.DeleteProfile(p.ProfileSlot); UIMessage("Deleted profile " + p.ProfileName); selMenu = SelectedMenu.MAINMENU; } // The text inside the shitter profile thingy texture thing stuff GUI.Label(new Rect(40, (120 * i) + 40, 200, 40), "Profile name: " + p.ProfileName, SmallFont); i++; } GUI.EndScrollView(); if(GUI.Button(new Rect((ContinueWindow.width / 2) - 60, ContinueWindow.height - 45, 120, 30), "", BackToMainMenu)) selMenu=SelectedMenu.MAINMENU; }
private void MyList_ItemTapped(object sender, Syncfusion.ListView.XForms.ItemTappedEventArgs e) { SelectedMenu?.Invoke(sender, e.ItemData as MyMenuItem); }