public void Awake() { FloraButton.onClick.AddListener(() => { menu = ActiveMenu.Flora; }); FaunaButton.onClick.AddListener(() => { menu = ActiveMenu.Fauna; }); menu = ActiveMenu.None; }
public void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { menu = ActiveMenu.None; } }
void EndGoingLeft() { if (activeMenu != firstMenu) { activeMenu -= 1; } else { activeMenu = lastMenu; } switch (activeMenu) { case ActiveMenu.Inventory: es.SetSelectedGameObject(inventoryStartButton); break; case ActiveMenu.Party: es.SetSelectedGameObject(partyStartButton); break; case ActiveMenu.Save: es.SetSelectedGameObject(saveStartButton); break; } isRotating = false; }
private void DisableAdditionalMenus() { fillImage.gameObject.SetActive(false); text.gameObject.SetActive(false); background.gameObject.SetActive(false); visual.gameObject.SetActive(false); activeMenu = ActiveMenu.None; }
public void SwitchTo (ActiveMenu a) { lastMenu = thisMenu; thisMenu = a; switch (thisMenu) { case ActiveMenu.main: ActivateTotem (); ActivateMainButtons (); getSubMenu (lastMenu).Hide (); switch (lastMenu) { case ActiveMenu.startNewGame: StartCoroutine (WaitASec (MainMenu.MenuButton.startGame)); break; case ActiveMenu.optionsMenu: StartCoroutine (WaitASec (MainMenu.MenuButton.options)); break; case ActiveMenu.quit: StartCoroutine (WaitASec (MainMenu.MenuButton.quit)); break; } break; case ActiveMenu.startNewGame: DeActivateMainButtons (); DeActivateTotem (); getSubMenu (a).Show (); break; case ActiveMenu.optionsMenu: switch (lastMenu) { case ActiveMenu.main: DeActivateMainButtons (); getSubMenu (a).Show (); break; case ActiveMenu.resolution: getSubMenu (lastMenu).Hide (); getSubMenu (a).Show (); break; case ActiveMenu.sound: getSubMenu (lastMenu).Hide (); getSubMenu (a).Show (); break; } break; case ActiveMenu.resolution: getSubMenu (lastMenu).Hide (); getSubMenu (a).Show (); break; case ActiveMenu.sound: getSubMenu (lastMenu).Hide (); getSubMenu (a).Show (); break; case ActiveMenu.quit: DeActivateMainButtons (); DeActivateTotem (); getSubMenu (a).Show (); break; } }
public void QualitySettingsMenu() { analog.enabled = false; activeMenu = ActiveMenu.Quality; visual.gameObject.SetActive(true); quality = (int)SaveManager.LoadSetting("Quality"); visual.sprite = quality == 0 ? high : low; }
/// <summary> /// Handles the removal of buttons from the menu bar. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RemoveButtonClick(object sender, EventArgs e) { var menu = ActiveMenu.GetInstance(this); if (menu.Items.Count > 0) { menu.Items.RemoveAt(menu.Items.Count - 1); } }
public void Rumble() { analog.enabled = false; activeMenu = ActiveMenu.Rumble; on = SaveManager.LoadSetting("Rumble") == 1; background.gameObject.SetActive(true); visual.gameObject.SetActive(true); visual.sprite = on ? yes : no; }
public void NavigateMenu() { if (ActiveMenu == null) { OpenMenu(); } else { ActiveMenu.Back(); } }
//private void OnDisable() //{ // menuEvents.ChangeMenu.RemoveListener(SetActiveMenu); //} public void SetActiveMenu(ActiveMenu activeMenu) { switch (activeMenu) { case ActiveMenu.Main: mainMenu.SetAsLastSibling(); break; case ActiveMenu.Control: controlMenu.SetAsLastSibling(); break; default: break; } }
public void MusicVolume() { analog.enabled = false; activeMenu = ActiveMenu.Music; fillImage.gameObject.SetActive(true); text.gameObject.SetActive(true); float value = SaveManager.LoadSetting("MusicVolume"); fillImage.fillAmount = value; text.text = (fillImage.fillAmount * 100).ToString("000") + "%"; musicBus = FMODUnity.RuntimeManager.GetBus("bus:/MyMaster/MUSIC"); musicBus.setVolume(value); }
private void Update() { if (!analog || analog.enabled || activeMenu == ActiveMenu.None) { return; } if (prevActiveMenu != activeMenu) { prevActiveMenu = activeMenu; return; } if (activeMenu == ActiveMenu.Music || activeMenu == ActiveMenu.SoundEffect) { xInput = Input.GetAxis("Horizontal"); if (xInput == 0) { xInputHolder = 0; return; } float diff = xInput - xInputHolder; xInputHolder += diff * inputSpeed * Time.unscaledDeltaTime; fillImage.fillAmount = fillImage.fillAmount + xInputHolder; text.text = (fillImage.fillAmount * 100).ToString("000") + "%"; musicBus.setVolume(fillImage.fillAmount); } if (Input.GetButtonDown("Jump")) { if (activeMenu == ActiveMenu.Rumble) { on = !on; visual.sprite = on ? yes : no; } if (activeMenu == ActiveMenu.Quality) { quality = (quality + 1) % 2; visual.sprite = quality == 0 ? high : low; QualitySettings.SetQualityLevel(quality, false); } } }
private void EkleButon(string yazi, EventHandler handler) //Yeni sekme + butonu oluşturmak { IActiveMenu menu = ActiveMenu.GetInstance(this); ActiveButton btn = new ActiveButton(); btn.Text = null; btn.Dock = DockStyle.Fill; btn.Visible = false; menu.Items.Add(btn); ActiveButton button = new ActiveButton(); button.Font = new Font("Symbol", 12, FontStyle.Regular); button.Text = yazi; button.FlatStyle = FlatStyle.Flat; int argbRenk = (int)Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM", "ColorizationColor", null); //Regeditte kayıtlı olan renk değerinin ondalık değeri string rif = ConverterToHex(System.Drawing.Color.FromArgb(argbRenk)); Color renk = HexToColor(rif); if (renk == Color.White || renk == Color.Black) { button.ForeColor = Color.Black; if (renk == Color.White) { button.FlatAppearance.BorderColor = Color.FromKnownColor(KnownColor.Highlight); } else { button.FlatAppearance.BorderColor = Color.Black; } button.BackColor = renk; } else { button.ForeColor = Color.White; button.FlatAppearance.BorderColor = button.ForeColor; button.BackColor = renk; } SetStyle(ControlStyles.SupportsTransparentBackColor, true); //Transparan renk kodlarında destekelemi ve hata vermemesi için transparan desteği eklemek //button.FlatAppearance.BorderColor = //Color.FromKnownColor(KnownColor.Highlight); button.Cursor = Cursors.Hand; button.ForeColor = Color.Black; menu.ToolTip.SetToolTip(button, "Yeni Sekme"); button.Click += handler; menu.Items.Add(button); }
private void EkleButon(string yazi, EventHandler handler) //Yeni sekme + butonu oluşturmak { IActiveMenu menu = ActiveMenu.GetInstance(this); ActiveButton buttonNull = new ActiveButton(); buttonNull.Text = null; buttonNull.Dock = DockStyle.Fill; buttonNull.Hide(); menu.Items.Add(buttonNull); ActiveButton button = new ActiveButton(); button.Text = yazi; button.Cursor = Cursors.Hand; button.ForeColor = Color.Black; menu.ToolTip.SetToolTip(button, "Yeni Sekme"); button.Click += handler; menu.Items.Add(button); }
//переключает панельки void SetActivMenu(ActiveMenu _activeMenu) { currentActiveMenu = _activeMenu; HideAllMenu(); switch (currentActiveMenu) { case ActiveMenu.MAIN_MENU: ActiveMainMenu(); // показываем меню break; case ActiveMenu.SETTINGS: ActiveSettingsPanel(); //включаем панель настроек break; case ActiveMenu.GAME: ActiveGameInterface(); //включаем интерфейс игры break; case ActiveMenu.VICTORY_PANEL: ActiveVictoryPanel(); //включаем панель победы break; case ActiveMenu.LOSS_PANEL: ActiveLosePanel(); //включаем панель проигрыша break; case ActiveMenu.CONFIRMATION_PANEL: ActiveConfirmationPanel(); //включаем панель подтверждения выбора break; case ActiveMenu.MULTIPLAYER_RESULT_PANEL: //включаем панель результата игры по мультиплееру ActiveMultiplayerResultPanel(); break; case ActiveMenu.OPPONENT_PANEL_MULTIPLAYER: //включаем панель опонентов перед игрой в мультиплеер ActivePanelOpponents(); break; } SetActiveMenuEvent?.Invoke(currentActiveMenu); }
private void EkleButon(string yazi, EventHandler handler, string aciklama, Font fnt, FlatStyle flt, Color clr) //Yeni sekme + butonu oluşturmak { IActiveMenu menu = ActiveMenu.GetInstance(this); if (bos == 0) { ActiveButton btn = new ActiveButton(); btn.Text = null; btn.Dock = DockStyle.Fill; btn.Visible = false; menu.Items.Add(btn); bos++; } ActiveButton button = new ActiveButton(); button.Text = yazi; button.Font = fnt;//new Font("symbol", 12, FontStyle.Regular); button.Cursor = Cursors.Hand; if (button.Text == "") { // button.Image = Properties.Resources.search_13_16; button.ForeColor = Color.Black; } button.BackColor = clr; button.FlatStyle = flt; button.FlatAppearance.BorderSize = 0; //button.FlatAppearance.BorderColor = Color.FromArgb(30,30,30); //button.Image = Properties.Resources.ekle; menu.ToolTip.SetToolTip(button, aciklama); button.Click += handler; // = ContentAlignment.TopLeft; //button.Image = Properties.Resources.ekle; menu.Items.Add(button); if (bos == 1) { ActiveButton btn = new ActiveButton(); btn.Text = null; btn.Dock = DockStyle.Fill; btn.Visible = false; menu.Items.Add(btn); bos++; } }
public int ActiveForm([System.Web.Http.FromBody] ActiveMenu activeMenu) { //var Jobj = { }; //Jobj.OMID = MenuId; //Jobj.TorSIDs = TableList; //Jobj.OrgId = OrgId; int status = 0; int FID = activeMenu.OMID; int OrgId = activeMenu.OrgId; HG_OrganizationDetails hG_OrganizationDetails = new HG_OrganizationDetails().GetOne(OrgId); string OrgType = hG_OrganizationDetails.OrgTypes != null ? hG_OrganizationDetails.OrgTypes : "1"; List <FeedbkForm> FeedBackList = FeedbkForm.GetAll(OrgId); FeedbkForm FeedBkObj = FeedBackList.Find(x => x.Id == FID); FeedBkObj.Status = true; FeedBkObj.Save(); List <HG_Tables_or_Sheat> TorSlist = new HG_Tables_or_Sheat().GetAll(int.Parse(OrgType)); var AlreadySelectedList = TorSlist.FindAll(x => x.FDBKId == FID); Int64[] items = activeMenu.TorSIDs; HashSet <Int64> hashKeys = new HashSet <Int64>(); if (items != null && items.Length > 0) { hashKeys = new HashSet <Int64>(items); } var RemovedTorSList = AlreadySelectedList.FindAll(x => !hashKeys.Contains(x.Table_or_RowID)); List <HG_Tables_or_Sheat> OnlyApplytoTorS = TorSlist.FindAll(x => hashKeys.Contains(x.Table_or_RowID)); foreach (var TorSobj in OnlyApplytoTorS) { TorSobj.FDBKId = FID; TorSobj.save(); } foreach (var TorSobj in RemovedTorSList) { TorSobj.FDBKId = 0; TorSobj.save(); } return(status); }
/// <summary> /// Helper method for adding items to the menu bar. /// </summary> /// <param name="text"></param> /// <param name="handler"></param> private IActiveButton AddButton(string text, Color backColor, EventHandler handler) { // get an instance of IActiveMenu used to attach // buttons to the form var menu = ActiveMenu.GetInstance(this); // define a new button var button = menu.Items.CreateItem(text, handler); button.ToolTipText = "Tooltip " + button.Text; button.BackColor = backColor; // add the button to the menu menu.Items.Add(button); errorLabel.Text = ""; buttonText.Text = buttonInt++.ToString(); return(button); }
/// <summary> /// Helper method for adding items to the menu bar. /// </summary> /// <param name = "text"></param> /// <param name = "handler"></param> private void AddButton(string text, EventHandler handler) { // get an instance of IActiveMenu used to attach // buttons to the form IActiveMenu menu = ActiveMenu.GetInstance(this); // define a new button ActiveButton button = new ActiveButton(); button.Text = text; menu.ToolTip.SetToolTip(button, "Tooltip " + button.Text); button.BackColor = colorSwitch.BackColor; button.Click += handler; // add the button to the menu menu.Items.Add(button); errorLabel.Text = ""; buttonText.Text = (buttonInt++).ToString(); }
public Menu getSubMenu(ActiveMenu menu) { switch (menu) { case ActiveMenu.startNewGame: return((Menu)menuStart); case ActiveMenu.resolution: return((Menu)menuResolution); case ActiveMenu.sound: return((Menu)menuSound); case ActiveMenu.optionsMenu: return((Menu)menuOptions); case ActiveMenu.quit: return((Menu)menuQuit); } return(null); }
public Menu getSubMenu (ActiveMenu menu) { switch (menu) { case ActiveMenu.startNewGame: return (Menu)menuStart; case ActiveMenu.resolution: return (Menu)menuResolution; case ActiveMenu.sound: return (Menu)menuSound; case ActiveMenu.optionsMenu: return (Menu)menuOptions; case ActiveMenu.quit: return (Menu)menuQuit; } return null; }
public void SwitchTo(ActiveMenu a) { lastMenu = thisMenu; thisMenu = a; switch (thisMenu) { case ActiveMenu.main: ActivateTotem(); ActivateMainButtons(); getSubMenu(lastMenu).Hide(); switch (lastMenu) { case ActiveMenu.startNewGame: StartCoroutine(WaitASec(MainMenu.MenuButton.startGame)); break; case ActiveMenu.optionsMenu: StartCoroutine(WaitASec(MainMenu.MenuButton.options)); break; case ActiveMenu.quit: StartCoroutine(WaitASec(MainMenu.MenuButton.quit)); break; } break; case ActiveMenu.startNewGame: DeActivateMainButtons(); DeActivateTotem(); getSubMenu(a).Show(); break; case ActiveMenu.optionsMenu: switch (lastMenu) { case ActiveMenu.main: DeActivateMainButtons(); getSubMenu(a).Show(); break; case ActiveMenu.resolution: getSubMenu(lastMenu).Hide(); getSubMenu(a).Show(); break; case ActiveMenu.sound: getSubMenu(lastMenu).Hide(); getSubMenu(a).Show(); break; } break; case ActiveMenu.resolution: getSubMenu(lastMenu).Hide(); getSubMenu(a).Show(); break; case ActiveMenu.sound: getSubMenu(lastMenu).Hide(); getSubMenu(a).Show(); break; case ActiveMenu.quit: DeActivateMainButtons(); DeActivateTotem(); getSubMenu(a).Show(); break; } }
// Start is called before the first frame update void Start() { areYouSureMenu.SetActive(false); activeMenu = firstMenu; lastMenu = ActiveMenu.Save; }
private void DrawMenuButtons(Rect content, float faktWidth, float minWidth, float minSpace) { //Breite nach Prozent von dem Content float buttonW = content.width * faktWidth; //Volle Breite von Content wenn kleiner als min if(buttonW < minWidth){ buttonW = content.width; } //AspektRatio von Button float buttonAspRatio = GetAspectRatioHW (_texMenuButton); //Die Höhe errechnen anhand der Breite float buttonH = buttonW * buttonAspRatio; //Prüfen ob alle 3 Buttons mit Platz dazwischen in Content passen if (((buttonH * 3) + (minSpace * 4)) > content.height) { //Höhe auf Resthöhe nach Abzug des MindestAbstandes buttonH = (content.height - (4 * minSpace)) / 3; //AspektRatio neu Berechnen um Breite zu bestimmen buttonAspRatio = GetAspectRatioWH (_texMenuButton); //Breite des Button neu berechnen buttonW = buttonH * buttonAspRatio; } //Zwischen Abstand der Buttons berechnen float buttonFreeVSpace = (content.height - (buttonH * 3)) / 4; float buttonFreeHSpace = (content.width - buttonW) / 2; //Stimmt die Schriftgröße int fontSize = (int)( buttonH * 0.3f) ; if(fontSize > 0){ GUI.skin.button.fontSize = fontSize; } if (GUI.Button (new Rect (content.x + buttonFreeHSpace, content.y + (buttonFreeVSpace * 1) + (buttonH * 0), buttonW, buttonH), "PLAY")) { if(_activeMenu == ActiveMenu.NONE){ _activeMenu = ActiveMenu.PLAY; } } if (GUI.Button (new Rect (content.x + buttonFreeHSpace, content.y + (buttonFreeVSpace * 2) + (buttonH * 1), buttonW, buttonH), "Highscore")) { if(_activeMenu == ActiveMenu.NONE){ _activeMenu = ActiveMenu.HIGHSCORE; } } if (GUI.Button (new Rect (content.x + buttonFreeHSpace, content.y + (buttonFreeVSpace * 3) + (buttonH * 2), buttonW, buttonH), "Quit")) { if(_activeMenu == ActiveMenu.NONE){ _activeMenu = ActiveMenu.QUIT; } } }
// Use this for initialization private void Awake() { //Aktives Menu auf Standard einstellen _activeMenu = ActiveMenu.START; //Andere Menu teile laden _highscore = this.GetComponent <GuiHighscoreMenu> (); _credits = this.GetComponent <GuiCreditsMenu> (); //Texturen und Fonts laden _texMenuBackground = Resources.Load<Texture2D> ("GUI/Textures/TexGuiBackground"); _texMenuButton = Resources.Load<Texture2D> ("GUI/Textures/TexGuiButton"); _texMenuButtonHover = Resources.Load<Texture2D> ("GUI/Textures/TexGuiButtonHover"); _texMetalDoorTop = Resources.Load<Texture2D> ("GUI/Textures/TexGuiMetalDoorTop"); _texMetalDoorBottom = Resources.Load<Texture2D> ("GUI/Textures/TexGuiMetalDoorBottom"); _font = Resources.Load <Font> ("GUI/Fonts/FntDigitalNumbers"); _texGuiBackground = Resources.Load<Texture2D> ("GUI/Textures/TexGuiBackground2"); _texMenuBackground2 = Resources.Load<Texture2D> ("GUI/Textures/TexGuiScoreBackground"); //Texture assigned? if (!_texMenuBackground) { Debug.LogError("Can't find Texture 'TexGuiBackground' on path 'Resources/GUI/Textures' "); return; } //Texture assigned? if (!_texMenuButton) { Debug.LogError("Can't find Texture 'TexGuiButton' on path 'Resources/GUI/Textures' "); return; } //Texture assigned? if (!_texMenuButtonHover) { Debug.LogError("Can't find Texture 'TexGuiButtonHover' on path 'Resources/GUI/Textures' "); return; } //Texture assigned? if (!_texMetalDoorTop) { Debug.LogError("Can't find Texture 'TexGuiMetalDoorTop' on path 'Resources/GUI/Textures' "); return; } //Texture assigned? if (!_texMetalDoorBottom) { Debug.LogError("Can't find Texture 'TexGuiMetalDoorBottom' on path 'Resources/GUI/Textures' "); return; } //Texture assigned? if (!_texGuiBackground) { Debug.LogError("Can't find Texture 'TexGuiBackground2' on path 'Resources/GUI/Textures' "); return; } //Texture assigned? if (!_texMenuBackground2) { Debug.LogError("Can't find Texture 'TexGuiScoreBackground' on path 'Resources/GUI/Textures' "); return; } //Font assigned? if (!_font) { Debug.LogError("Can't find Font 'FntDigitalNumbers' on path 'Resources/GUI/Textures'"); return; } }
private void OnGUI() { SetGuiSkin (); //Gui Hintergrund komplett GUI.DrawTextureWithTexCoords(new Rect(0.0f,0.0f,Screen.width,Screen.height), _texGuiBackground,new Rect(0, 0, Screen.width / (_texGuiBackground.width/1.0f), Screen.height / (_texGuiBackground.height/1.0f))); Rect menuContent = DrawBackground (0.3f); DrawMenuButtons (menuContent,0.8f,300.0f, 20.0f); switch(_activeMenu){ case ActiveMenu.PLAY: Application.LoadLevel(_gameScene); break; case ActiveMenu.HIGHSCORE: AnimateMenuOnScreen (false); //Wenn das Menu intern geschlossen wird, wieder Standard Menu setzen if(_highscore.StartMenuHighscore(_speed)){ _activeMenu = ActiveMenu.NONE; } break; case ActiveMenu.QUIT: AnimateMenuOnScreen (false); _credits.StartMenuCredits(_speed); break; case ActiveMenu.NONE: AnimateMenuOnScreen (true); break; case ActiveMenu.START: DrawMetalDoor(); break; } }
private void DrawMetalDoor() { float doorTopH = Screen.height * 0.56f; float doorBottomH = Screen.height * 0.50f; //Bildschirm Offen also Menu zeigen if(_metalDoorBottomPosY >= doorBottomH && _metalDoorTopPosY <= (0.0f - doorTopH)){ _activeMenu = ActiveMenu.NONE; } if(_metalDoorTopPosY > (0.0f - doorTopH)){ _metalDoorTopPosY -= 50.0f * Time.deltaTime; } if(_metalDoorBottomPosY < doorBottomH){ _metalDoorBottomPosY += 50.0f * Time.deltaTime; } GUI.DrawTexture(new Rect(0.0f,_metalDoorTopPosY, Screen.width,doorTopH), _texMetalDoorTop, ScaleMode.StretchToFill, true, 0.0f); GUI.DrawTexture(new Rect(0.0f,_metalDoorBottomPosY + Screen.height * 0.5f, Screen.width,doorBottomH), _texMetalDoorBottom, ScaleMode.StretchToFill, true, 0.0f); }