public ScoreboardPanel()
        {
            this.entity = new Entity("scoreboardPanel").AddComponent(new Transform2D())
                .AddComponent(new PanelControl(300, 100))
                .AddComponent(new PanelControlRenderer());
            Configuration config = new Configuration();
            config.ReadConfiguration();

            this.timeText = new TextBlock("timeText")
            {
                Width = 132,
                Height = 42,
                Text = this.time.ToString(@"mm\:ss\:ff"),
                Margin = new Thickness(34, 19, 0, 0),
                Foreground = Color.LightGreen,
            };
            this.entity.AddChild(this.timeText.Entity);

            _scoreText = new TextBlock("scoreText")
            {
                Width = 132,
                Height = 42,
                Text = string.Format("{0:0000}", _scores),
                Margin = new WaveEngine.Framework.UI.Thickness(207, 19, 0,0)
            };
            this.entity.AddChild(_scoreText.Entity);
        }
Exemple #2
0
        private void CreateBoard()
        {
            Configuration config = new Configuration();
            config.ReadConfiguration();
            foreach (BoardConfiguration boardConfig in config.Levels[_currentLevel].Boards)
            {
                Board board = new Board(boardConfig, tileSide);
                board.Entity.Name = boardConfig.Name;
                board.ChanceSpecial1 = boardConfig.Special1Chance;
                board.MatchRewards = config.Levels[_currentLevel].MatchRewards;

                string[] selectedSprites = new string[boardConfig.Tiles];
                for (int i = 0; i < boardConfig.Tiles; i++)
                {
                    selectedSprites[i] = tileSprites[i];
                }
                List<Entity> tiles = board.GenerateRandomBoard(WaveContent.Tiles_spritesheet, selectedSprites);

                EntityManager.Add(board);

                EntityManager.Add(tiles);
            }
            scoreboardPanel.Time = TimeSpan.Zero;
        }
Exemple #3
0
        private void NextLevel()
        {
            Configuration config = new Configuration();
            config.ReadConfiguration();
            _currentLevel++;
            if (_currentLevel >= config.Levels.Count)
            {
                _messagePanel.Type = MessagePanel.MessageType.Win;
                WaveServices.TimerFactory.CreateTimer("timer", TimeSpan.FromSeconds(2.5f), () =>
                {
                    WaveServices.ScreenContextManager.To(
                new ScreenContext(new MainMenuScene()), new SpinningSquaresTransition(TimeSpan.FromSeconds(1.5f)));
                }, false);
                return;
            }
            List<string> names = new List<string>();
            List<Entity> tiles = new List<Entity>();
            foreach(Board board in EntityManager.FindAllByTag("board"))
            {
                names.Add(board.Name);

                foreach(var t in board.Tiles)
                {
                    tiles.Add(t.Entity);
                }
            }
            foreach(Entity tile in tiles)
            {
                EntityManager.Remove(tile);
            }
            foreach (string name in names)
            {
                EntityManager.Remove(name);
            }
            CreateBoard();
            _currentState = States.GamePlay;
        }