/// <summary> /// Initializing the screen (adding all items, and registering as observer) /// </summary> public override void Initialize() { base.Initialize(); int currentSoundFXVolume = (int)(m_SoundManager.SoundFXVolume * k_VolumeChangeValue); int currentMusicVolume = (int)(m_SoundManager.MusicVolume * k_VolumeChangeValue); m_SoundEffetsVolumeItem = new OptionsMenuItem( Game, m_EffectVolumeTexts, currentSoundFXVolume, m_SoundEffetsVolumeItem_Modified); m_MusicVolumeItem = new OptionsMenuItem( Game, m_MusicVolumeTexts, currentMusicVolume, m_MusicVolumeItem_Modified); m_ToggleSoundItem = new OptionsMenuItem( Game, new List<string>(k_ToggleSoundText), m_ToggleSoundItem_Modified); m_DoneItem = new MenuItem(Game, "Done", m_DoneItem_Executed); Add(m_SoundEffetsVolumeItem); Add(m_MusicVolumeItem); Add(m_ToggleSoundItem); Add(m_DoneItem); }
/// <summary> /// Adds all items to menu /// </summary> public override void Initialize() { base.Initialize(); m_PlayersMenuItem = new OptionsMenuItem( Game, new List<string>(m_PlayersText), m_PlayersItem_Modified); m_DisplayOptionsItem = new MenuItem(Game, "Screen Options", displayOptionsItem_Executed); m_SoundOptionsItem = new MenuItem(Game, "Sound Options", soundOptionsItem_Executed); m_PlayItem = new MenuItem(Game, "Play", playItem_Executed); m_QuitItem = new MenuItem(Game, "Quit", quitItem_Executed); Add(m_PlayersMenuItem); Add(m_DisplayOptionsItem); Add(m_SoundOptionsItem); Add(m_PlayItem); Add(m_QuitItem); }
/// <summary> /// Setting current item according to selected item /// </summary> /// <param name="i_Item"></param> private void item_Selected(MenuItem i_Item) { int newSelectedItem = m_MenuItems.IndexOf(i_Item); if (newSelectedItem != m_CurrentMenuItem) { setCurrentItem(newSelectedItem); } }