コード例 #1
0
 public void Draw()
 {
     if (!IsVisible)
     {
         return;
     }
     DX.DrawBox(X - 1, Y - 1, X + Width + 1, Y + Height + 1, WindowBaseColor, DX.TRUE);
     DX.DrawBox(X - 1, Y - 1, X + Width + 1, Y + Height + 1, WindowFrameColor, DX.FALSE);
     ReloadButton.Draw();
     CloseButton.Draw();
     if (!IsHaveInfo)
     {
         FontAsset.Draw(TextFont, "Please Reload",
                        X + Width / 2 - FontAsset.GetDrawTextWidth(TextFont, "Please Reload") / 2,
                        Y + 60, TextColor
                        );
     }
     else if (IsReloading)
     {
         FontAsset.Draw(TextFont, "Loading...",
                        X + Width / 2 - FontAsset.GetDrawTextWidth(TextFont, "Loading...") / 2,
                        Y + 60, TextColor
                        );
     }
     else
     {
         foreach (var button in MatchesListButtons)
         {
             button.Draw();
             button.DrawText();
         }
     }
 }
コード例 #2
0
ファイル: LevelScreen.cs プロジェクト: Fedaykin1/Games
        public override void Draw(SpriteBatch spriteBatch)
        {
            MapManager.Instance.Draw(spriteBatch);
            LevelManager.Instance.Draw(spriteBatch);
            Actor.Instance.Draw(spriteBatch);

            // Affichage des boutons
            design_button.Draw(spriteBatch);
            fire_button.Draw(spriteBatch);
            water_button.Draw(spriteBatch);
            next_button.Draw(spriteBatch);
            previous_button.Draw(spriteBatch);
            refresh_button.Draw(spriteBatch);
            sound_button.Draw(spriteBatch);
            music_button.Draw(spriteBatch);
            menu_button.Draw(spriteBatch);

            // Affichage du score
            int current_moves = LevelManager.Instance.currentLevel.moves;
            int min_moves     = LevelManager.Instance.currentLevel.min_moves;

            spriteBatch.DrawString(ScreenManager.Instance.sprite_font,
                                   string.Format("{0} ({1})", current_moves, min_moves),
                                   position_texte_score, Color.Black, 0, Vector2.Zero, 1.5f, SpriteEffects.None, 0);

            // info-bulles sur le score
            MouseState current_state = Mouse.GetState();
            Rectangle  mouse_rect    = new Rectangle(current_state.X, current_state.Y, 1, 1);
            Rectangle  score_rect    = new Rectangle(0, 0, 64, 32);

            if (info_bulle.Length > 0 && mouse_rect.Intersects(score_rect))
            {
                spriteBatch.DrawString(ScreenManager.Instance.sprite_font, info_bulle, new Vector2(0, 1.3f * 32), Color.White);
            }

            // Affichage de l'information du niveau (sur le coté)
            string level      = string.Format("LEVEL {0}", LevelManager.Instance.levelIndex + 1);
            int    position_y = 2 * Tile.Height;

            foreach (char c in level)
            {
                float scale = 1;
                Color color = Color.LightGray;
                if (System.Char.IsDigit(c))
                {
                    scale = 2;

                    if (MenuScreen.levels.difficulty[LevelManager.Instance.levelIndex] == 0)
                    {
                        color = Color.LightGreen;
                    }
                    else if (MenuScreen.levels.difficulty[LevelManager.Instance.levelIndex] == 1)
                    {
                        color = Color.Orange;
                    }
                    else if (MenuScreen.levels.difficulty[LevelManager.Instance.levelIndex] == 2)
                    {
                        color = Color.Red;
                    }
                    else if (MenuScreen.levels.difficulty[LevelManager.Instance.levelIndex] == 3)
                    {
                        color = Color.Violet;
                    }
                    else if (MenuScreen.levels.difficulty[LevelManager.Instance.levelIndex] == 4)
                    {
                        color = Color.Aqua;
                    }
                    else
                    {
                        color = Color.White;
                    }
                }

                position_title = new Vector2(ScreenManager.Instance.Dimension.X - 20, position_y);
                spriteBatch.DrawString(ScreenManager.Instance.sprite_font,
                                       c.ToString(), position_title, color, 0,
                                       Vector2.Zero, scale, SpriteEffects.None, 0);

                position_y += Tile.Height;
            }

            base.Draw(spriteBatch);
        }