Exemple #1
0
        public BaseGame(GameManager gameManager, string scoreUnits, ScoreCenter.SortDirection direction)
        {
            this.ScoreUnits = scoreUnits;
            this.SortDirection = direction;
            this.GameManager = gameManager;

            if (null == _unknownTexture)
            {
                _unknownTexture = this.GameManager.Game.Content.Load<Texture2D>(@"Textures\logo_unknown");
            }
            this.Logo = _unknownTexture;
            this.Variation = string.Empty;
        }
        public FingerGames()
        {
            _instance = this;
            _graphics = new GraphicsDeviceManager(this);
            _graphics.IsFullScreen = true;

            Content.RootDirectory = "Content";

            // Frame rate is 30 fps by default for Windows Phone.
            TargetElapsedTime = TimeSpan.FromTicks(333333);

            _gameStages.Add(Stage.InGame, new InGameStage(this));
            _gameStages.Add(Stage.Intro, new IntroStage(this));
            _gameStages.Add(Stage.SelectGame, new SelectGameStage(this));
            _gameStages.Add(Stage.Trial, new TrialStage(this));
            _gameStages.Add(Stage.Help, new HelpStage(this));
            _activeStage = _gameStages[Stage.Intro];

            _gameManager = new GameManager(GetWindowsLiveAnonymousID(), this, new GamePlayer[] { new GamePlayer(0, "Default") });
        }
        public void Prepare(GameManager gameManager, string scoreUnits)
        {
            _scoreLabel.Text = scoreUnits;
            _showContinueButton = false;

            while (_nameScorePanel.Children.Count > 1)
            {
                _nameScorePanel.Children.RemoveAt(1);
            }
            while (_scoreScorePanel.Children.Count > 1)
            {
                _scoreScorePanel.Children.RemoveAt(1);
            }
            while (_totalScorePanel.Children.Count > 1)
            {
                _totalScorePanel.Children.RemoveAt(1);
            }

            if (gameManager.Players.Count > 1)
            {
                _isScoreLoading = false;
                _totalLabel.Text = "Overall";
                foreach (GamePlayer player in gameManager.Players)
                {
                    XnaLabel nameLabel = new XnaButton(new Rectangle(0, 0, 300, 60));
                    nameLabel.Text = player.Name;
                    nameLabel.Font = _menuFont;
                    nameLabel.HorizontalAlignment = HorizontalAlignment.Left;

                    _nameScorePanel.AddChild(nameLabel);

                    XnaButton scoreLabel = new XnaButton(new Rectangle(0, 0, 250, 60));
                    scoreLabel.Text = string.Format("{0:0000.0}", player.Score);
                    scoreLabel.Font = _menuFont;
                    scoreLabel.HorizontalAlignment = HorizontalAlignment.Center;

                    _scoreScorePanel.AddChild(scoreLabel);

                    XnaButton totalLabel = new XnaButton(new Rectangle(0, 0, 250, 60));
                    totalLabel.Text = string.Format("{0:0000.0}", player.OverallScore);
                    totalLabel.Font = _menuFont;
                    totalLabel.HorizontalAlignment = HorizontalAlignment.Center;

                    _totalScorePanel.AddChild(totalLabel);
                }
            }
            else
            {
                _totalLabel.Text = "Rank";
                _isScoreLoading = true;
                ScoreCenterManager.RegisterScore(gameManager.GameName, gameManager.GameVariation, (float)gameManager.Players[0].Score, gameManager.SortDirection, new EventHandler<ScoreCenter.RegisterScoreCompletedEventArgs>(ScoresReady));
            }
        }