Beispiel #1
0
 private void InitializeComponents()
 {
     if (mainModel == null)
     {
         mainModel = GetComponent <MainModel>();
     }
     if (camera == null)
     {
         camera = GetComponent <PixelPerfectCamera>();
     }
     if (gameBoard == null)
     {
         gameBoard = GetComponent <IGameBoard>();
     }
     if (dataService == null)
     {
         dataService = GetComponent <IDataService>();
     }
     if (inputController == null)
     {
         inputController = GetComponent <IInput>();
     }
     if (screensManager == null)
     {
         screensManager = GetComponent <IScreensManager>();
     }
     if (gameStatesFactory == null)
     {
         gameStatesFactory = GetComponent <IGameStatesFactory>();
     }
 }
Beispiel #2
0
 public MenuItemsCreator(BaseGame i_Game, GameScreen i_GameScreen)
 {
     m_Game                = i_Game;
     m_GameScreen          = i_GameScreen;
     m_MenuItems           = new List <MenuItem>();
     m_ScreensManager      = m_Game.Services.GetService(typeof(IScreensManager)) as IScreensManager;
     m_GameSettingsManager = m_Game.Services.GetService(typeof(IGameSettingsManager)) as IGameSettingsManager;
 }
		/// <summary>
		/// Inicjalizuje kontroler.
		/// Wywoływane przez IGameState.
		/// </summary>
		/// <param name="screens">Manager ekranów, do którego może się kontroler podpiąć.</param>
		/// <param name="input">Wejście, do którego może się kontroler podpiąć.</param>
		public void Initialize(IScreensManager screens, IInput input)
		{
			this.Container.Player1 = this.Player;
			this.Container.Player1Queue = this.GameState.Controller.Player1Queue;

			var screen = new ControlerScreen(this.Container);
			screens.AddAndActivate(screen);
			screens.MoveToFront(screen);
		}
Beispiel #4
0
        public override List <MenuItem> MakeMenu()
        {
            IScreensManager m_ScreensManager = m_Game.Services.GetService(typeof(IScreensManager)) as IScreensManager;
            List <float>    volumeList       = new List <float> {
                0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
            };

            volumeList.Reverse();
            List <float> realVolumeList = new List <float> {
                0, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f
            };

            realVolumeList.Reverse();
            ToggleMenuItem <float, float> changeBackgroundMusicVolumeMenuItem    = new ToggleMenuItem <float, float>(m_Game, m_GameScreen, volumeList, realVolumeList, "Background Music Volume: ");
            ToggleMenuItem <float, float> changeSoundsEffectsMusicVolumeMenuItem = new ToggleMenuItem <float, float>(m_Game, m_GameScreen, volumeList, realVolumeList, "Sounds Effects Volume: ");

            if (!m_SoundsManager.ToggleSound)
            {
                m_SoundsManager.ToggleSound = !m_SoundsManager.ToggleSound;
                changeBackgroundMusicVolumeMenuItem.CorrespondingToggledItem    = m_GameSettingsManager.BackgroundVolume;
                changeSoundsEffectsMusicVolumeMenuItem.CorrespondingToggledItem = m_GameSettingsManager.SoundEffectsVolume;
                m_SoundsManager.ToggleSound = !m_SoundsManager.ToggleSound;
            }
            else
            {
                changeBackgroundMusicVolumeMenuItem.CorrespondingToggledItem    = m_GameSettingsManager.BackgroundVolume;
                changeSoundsEffectsMusicVolumeMenuItem.CorrespondingToggledItem = m_GameSettingsManager.SoundEffectsVolume;
            }

            changeBackgroundMusicVolumeMenuItem.Toggle += backgroundVolumeChanged;
            m_MenuItems.Add(changeBackgroundMusicVolumeMenuItem);

            changeSoundsEffectsMusicVolumeMenuItem.Toggle += soundsEffectsVolumeChanged;
            m_MenuItems.Add(changeSoundsEffectsMusicVolumeMenuItem);

            m_SoundToggleMenuItem.CorrespondingToggledItem = m_GameSettingsManager.MusicToggle;
            m_SoundToggleMenuItem.Toggle += soundToggleChanged;
            m_MenuItems.Add(m_SoundToggleMenuItem);

            EnterMenuItem done = new EnterMenuItem(m_Game, "Done", m_GameScreen);

            done.EnterPressed += Done_EnterPressed;
            m_MenuItems.Add(done);
            return(m_MenuItems);
        }
        public override List <MenuItem> MakeMenu()
        {
            IScreensManager m_ScreensManager = m_Game.Services.GetService(typeof(IScreensManager)) as IScreensManager;

            ToggleMenuItem <string, bool> mouseVisibilityToggleMenuItem = new ToggleMenuItem <string, bool>(m_Game, m_GameScreen, new List <string> {
                "Visible", "Invisible"
            }, new List <bool> {
                true, false
            }, "Mouse Visability: ");

            mouseVisibilityToggleMenuItem.CorrespondingToggledItem = m_GameSettingsManager.MouseVisibility;
            mouseVisibilityToggleMenuItem.Toggle += mouseVisibilityChanged;
            m_MenuItems.Add(mouseVisibilityToggleMenuItem);

            ToggleMenuItem <string, bool> allowResizingToggleMenuItem = new ToggleMenuItem <string, bool>(m_Game, m_GameScreen, new List <string> {
                "Off", "On"
            }, new List <bool> {
                false, true
            }, "Allow Window Resizing: ");

            allowResizingToggleMenuItem.CorrespondingToggledItem = m_GameSettingsManager.AllowWindowResize;
            allowResizingToggleMenuItem.Toggle += allowingWindowResizingChanged;
            m_MenuItems.Add(allowResizingToggleMenuItem);

            ToggleMenuItem <string, bool> fullScreenToggleMenuItem = new ToggleMenuItem <string, bool>(m_Game, m_GameScreen, new List <string> {
                "Off", "On"
            }, new List <bool> {
                false, true
            }, "Full Screen Mode: ");

            fullScreenToggleMenuItem.CorrespondingToggledItem = m_GameSettingsManager.FullScreen;
            fullScreenToggleMenuItem.Toggle += fullScreenToggled;
            m_MenuItems.Add(fullScreenToggleMenuItem);

            EnterMenuItem done = new EnterMenuItem(m_Game, "Done", m_GameScreen);

            done.EnterPressed += Done_EnterPressed;
            m_MenuItems.Add(done);
            return(m_MenuItems);
        }
		/// <summary>
		/// Inicjalizuje kontroler.
		/// Wywoływane przez IGameState.
		/// </summary>
		/// <param name="screens">Manager ekranów, do którego może się kontroler podpiąć.</param>
		/// <param name="input">Wejście, do którego może się kontroler podpiąć.</param>
		public void Initialize(IScreensManager screens, IInput input)
		{
			this.Container.Player2 = this.Player;
			this.Container.Player2Queue = this.GameState.Controller.Player2Queue;
		}
Beispiel #7
0
 public override void Initialize()
 {
     m_InputManager    = Game.Services.GetService(typeof(IInputManager)) as IInputManager;
     m_IScreensManager = Game.Services.GetService(typeof(IScreensManager)) as IScreensManager;
 }