示例#1
0
        private void InitializeUIGameField()
        {
            picGameField.BackgroundImage       = Resources.Background;
            picGameField.BackgroundImageLayout = ImageLayout.Stretch;
            _spriteController         = new SpriteController(picGameField);
            _spriteController.DoTick += OnGameIteration;

            SpriteInitializer.InitializeSprites(_spriteController, null);

            lblHealth.Parent         = picGameField;
            lblHealth.BackColor      = Color.Transparent;
            lblKills.Parent          = picGameField;
            lblKills.BackColor       = Color.Transparent;
            lblHealthValue.Parent    = picGameField;
            lblHealthValue.BackColor = Color.Transparent;
            lblKillsValue.Parent     = picGameField;
            lblKillsValue.BackColor  = Color.Transparent;
            lblHealthValue.Text      = $"{_game.Player.Health}";
            lblEmojiValue.Parent     = picGameField;
            lblEmojiValue.BackColor  = Color.Transparent;
            lblEmojiValue.Text       = $"{_game.Player.Smiles}";
            lblEmoji.Parent          = picGameField;
            lblEmoji.BackColor       = Color.Transparent;

            DrawUIObtacles();
            DrawUIEmoticons();
        }
示例#2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            this.spriteBatch = new SpriteBatch(GraphicsDevice);
            this.spriteData  = new SpriteData();

            this.background = Content.Load <Texture2D>(@"Content\Background");

            SpriteInitializer.InitializeSprites(this.spriteData, Content);

            this.emoticon   = new Emoticon("OnfireEmoticon");
            this.sprite     = spriteData.DuplicateSprite(this.emoticon.Name);
            this.uiEmoticon = new UIEmoticon(this.sprite, this.emoticon);
            this.uiEmoticon.Sprite.AnimationIndex = 3;

            this.hero   = new Hero("LightHero");
            this.sprite = spriteData.DuplicateSprite(this.hero.Name);
            this.uiHero = new UIHero(this.sprite, this.hero);

            StartGame();
        }