Пример #1
0
        protected override void Initialize()
        {
            LogHelper.Log("Game Root: Initialize..");

            _fpsCounter = new FpsCounter(this);

            Components.Add(_fpsCounter);

            _graphCanvas = new GraphCanvas(this)
            {
                Position = new Vector2(660, 256),
                Size     = new Size2(600, 100)
            };
            Components.Add(_graphCanvas);

            _fpsCounter.OnFpsUpdate += (sender, args) =>
            {
                FpsCounter fpsCounter = (FpsCounter)sender;
                _graphCanvas.PushValue(fpsCounter.FramesPerSecond);
            };

            base.Initialize();

            LogHelper.Log("Game Root: End Initialize..");
        }
Пример #2
0
        public override void Initialize()
        {
            base.Initialize();

            _spriteBatch = new SpriteBatch(_game.GraphicsDevice);

            FindSystem <MusicSystem>().Music = Beatmap.Music;
            MediaPlayer.Volume = Settings.SongVolumeF;

            FindSystem <HealthSystem>().HpDrainRate = Beatmap.Settings.Difficulty.HpDrainRate;

            ScoreGraph = new GraphCanvas(_game)
            {
                Position             = new Vector2(Skin.Settings.PlayfieldPositionX, 300),
                Size                 = new Size2(Skin.PlayfieldLineTexture.Width * 2, 100),
                MinValue             = -158,
                MaxValue             = 158,
                Font                 = Skin.Font,
                ShouldDrawBackground = false,
                ShouldDrawBars       = false,
                CellSize             = new Size2(5, 20)
            };
            _game.Components.Add(ScoreGraph);

            FindSystem <ScoreV1System>().OnScoreGet += (sender, handler) =>
            {
                ScoreGraph.PushValue(handler.Offset);
            };

            InitializeAllHitObjects();
        }