Exemple #1
0
 void ReleaseDesignerOutlets()
 {
     if (BottomMenu != null)
     {
         BottomMenu.Dispose();
         BottomMenu = null;
     }
     if (btnComments != null)
     {
         btnComments.Dispose();
         btnComments = null;
     }
     if (btnRates != null)
     {
         btnRates.Dispose();
         btnRates = null;
     }
     if (btnStatistic != null)
     {
         btnStatistic.Dispose();
         btnStatistic = null;
     }
     if (MainBackground != null)
     {
         MainBackground.Dispose();
         MainBackground = null;
     }
     if (NavigationBar != null)
     {
         NavigationBar.Dispose();
         NavigationBar = null;
     }
 }
Exemple #2
0
 public bool GameOverFunc()
 {
     _state          = GameStates.PostGame;
     _background     = new MainBackground();
     _postGameScreen = new PostGameScreen();
     return(true);
 }
Exemple #3
0
        public ControlsMapping(MainBackground mainBackground, IControlsRepository controlsRepository)
        {
            _mainBackground     = mainBackground;
            _controlsRepository = controlsRepository;

            FillMapppings();
        }
Exemple #4
0
 public void ReplaceBackground(SoundType sound)
 {
     MainBackground.Stop();
     MainBackground.Dispose();
     MainBackground       = GetAndPlay(sound, true);
     MainBackground.Pitch = BackgroundPitch;
 }
Exemple #5
0
 public void ResumeBackground()
 {
     if (SecondaryBackground == null)
     {
         MainBackground.Resume();
         MainBackground.Pitch = BackgroundPitch;
     }
 }
        public async void ExecuteTurnAsync(MainBackground boardForm, Button selectedButton, Player currPlayer)
        {
            SetButtonAvailability(boardForm, false);

            await ExecuteTurnAsync(selectedButton, currPlayer, boardForm);

            //SetButtonAvailability(boardForm, true); //todo odkomentowac???
        }
Exemple #7
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            try
            {
                InputService.Update(gameTime);
                _background?.Update(gameTime);
                switch (_state)
                {
                case GameStates.MainMenu:
                    _mainMenu.Update();
                    break;

                case GameStates.GameSetup:
                    _gameSetup.Update();
                    break;

                case GameStates.Game:
                    _players.ForEach(p => p.Update(gameTime));
                    Globals.GameState.Update(gameTime);
                    if (Level.TimeRemaining <= TimeSpan.Zero && !Globals.GameState.Enemies.Any(e => e.IsSpawnedEnemy))
                    {
                        _state              = GameStates.Intermission;
                        _background         = new MainBackground();
                        _intermissionScreen = new IntermissionScreen();
                        Level.LevelComplete();
                    }
                    break;

                case GameStates.Intermission:
                    _intermissionScreen.Update();
                    if (_intermissionScreen.Ready)
                    {
                        _intermissionScreen = null;
                        _background         = null;
                        _state = GameStates.Game;
                        Level.StartLevel();
                    }
                    return;

                case GameStates.PostGame:
                    _postGameScreen.Update();
                    if (_postGameScreen.Ready)
                    {
                        _postGameScreen = null;
                        _state          = GameStates.MainMenu;
                        _players.ForEach(p => p.GameOver());
                        Globals.GameState = new GameState(_players);
                        _mainMenu         = new MainMenu(SetupGameFunc);
                    }
                    return;
                }
                base.Update(gameTime);
            }
            catch (Exception e)
            {
                var a = 5;
            }
        }
Exemple #8
0
 public void ResumeBackgroundStopSecondaryTrack()
 {
     if (SecondaryBackground != null)
     {
         SecondaryBackground.Stop();
         PlayingList.Remove(SecondaryBackground);
         SecondaryBackground.Dispose();
         SecondaryBackground = null;
     }
     MainBackground.Resume();
     MainBackground.Pitch = BackgroundPitch;
 }
        public TurnLogic(MainBackground mainBackground, IJudge judge, ISocketConnection socketConnection, IControlsMapping controlsMappins, IControlsRepository controlsRepository)
        {
            _mainBackground     = mainBackground;
            _judge              = judge;
            _socketConnection   = socketConnection;
            _controlsMappings   = controlsMappins;
            _controlsRepository = controlsRepository;

            _socketConnection.SetEnemyMoveAction(EnemyMove);
            _judge.GameOver      = GameOver;
            _imagesContainerPath = (Directory.GetCurrentDirectory().GetDirectoryName(2) + @"\ImagesContainer\");
        }
        private void SetButtonAvailability(MainBackground form, bool value)
        {
            foreach (var control in form.Controls)
            {
                if (control is Control)
                {
                    if (!form.ProtectedControls.Any(c => c == control) && !ClickedButtons.Any(b => b == control))
                    {
                        ((Control)control).Enabled = value;
                    }
                }

                form.Controls["gameBoard"].Focus();
            }
        }
Exemple #11
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            Globals.SpriteDrawer = new SpriteBatch(GraphicsDevice);
            Globals.Initialize();
            TextureCacheFactory.Initialize(GraphicsDevice);
            InputService.Initialize();
            SkillConstants.Initialize();
            XmlStorage.Initialize();
            TextureCacheFactory.Get("Entities/Zomb-King.png");
            Level.GameOverFunc = GameOverFunc;
            Globals.Map        = new Map(GraphicsDevice, MapTypes.Dungeon, Globals.ViewportBounds);
            _mainMenu          = new MainMenu(SetupGameFunc);
            _background        = new MainBackground();

            base.Initialize();
        }
Exemple #12
0
 public void Reset()
 {
     MainBackground.Stop();
     MainBackground.Dispose();
     if (SecondaryBackground != null)
     {
         SecondaryBackground.Stop();
         SecondaryBackground.Dispose();
         SecondaryBackground = null;
     }
     PlayingList.Clear();
     PoolList.Clear();
     InitializeSoundPool();
     MainBackground       = GetAndPlay(SoundType.Background, true);
     BackgroundPitch      = 0;
     MainBackground.Pitch = BackgroundPitch;
 }
Exemple #13
0
 private bool PlayGameFunc(List <Tuple <bool, string, List <Item>, List <Item> > > players)
 {
     _gameSetup  = null;
     _background = null;
     _state      = GameStates.Game;
     for (var i = 0; i < players.Count; i++)
     {
         _players[i].Name  = players[i].Item2;
         _players[i].Items = players[i].Item4;
         if (players[i].Item1)
         {
             _players[i].JoinGame(players[i].Item3);
         }
     }
     Globals.Map.StartingGame();
     Level.StartLevel();
     return(true);
 }
 void ReleaseDesignerOutlets()
 {
     if (BottomMenu != null)
     {
         BottomMenu.Dispose();
         BottomMenu = null;
     }
     if (btnComments != null)
     {
         btnComments.Dispose();
         btnComments = null;
     }
     if (btnRates != null)
     {
         btnRates.Dispose();
         btnRates = null;
     }
     if (btnStatistic != null)
     {
         btnStatistic.Dispose();
         btnStatistic = null;
     }
     if (MainBackground != null)
     {
         MainBackground.Dispose();
         MainBackground = null;
     }
     if (MainLabel != null)
     {
         MainLabel.Dispose();
         MainLabel = null;
     }
     if (OverlayView != null)
     {
         OverlayView.Dispose();
         OverlayView = null;
     }
 }
        private async Task ExecuteTurnAsync(Button selectedButton, Player currPlayer, MainBackground boardForm)
        {
            var opposedPlayer = currPlayer == DataStatic.Me ? DataStatic.Enemy : DataStatic.Me;

            boardForm.SetTurnMsg(opposedPlayer);

            SetControlsStatus(selectedButton, currPlayer);

            if (currPlayer == DataStatic.Me)
            {
                await _socketConnection.SendAsync(selectedButton);
            }

            _judge.Move(currPlayer, selectedButton);
        }
 private void MainSound_Ended(object sender, RoutedEventArgs e)
 {
     MainBackground.Play();
 }
 public ControlsPrepare(MainBackground form, IControlsRepository controlsRepository, ITurnLogic turnLogic)
 {
     _form = form;
     _controlsRepository = controlsRepository;
     _turnLogic          = turnLogic;
 }
Exemple #18
0
 public void PauseBackground()
 {
     MainBackground.Pause();
 }