예제 #1
0
 /// <summary>
 /// СОздаем новый ХУД объект используя ScreenManager
 /// </summary>
 public HudScreen(ScreenManager screenManager, Player player)
 {
     // проверяем параметр
     if (screenManager == null)
     {
         throw new ArgumentNullException("screenManager");
     }
     this.screenManager = screenManager;
 }
예제 #2
0
 /// <summary>
 /// Рисем портрет данного игрока на данной позиции.
 /// </summary>
 private void DrawPortrait(Player player, Vector2 position,
     PlankState plankState)
 {
     switch (plankState)
     {
         case PlankState.Active:
             screenManager.SpriteBatch.Draw(player.Portrait,
                 position, Color.White);
             break;
         //case PlankState.InActive:
         //    screenManager.SpriteBatch.Draw(player.InactivePortraitTexture,
         //        position, Color.White);
            // break;
         //case PlankState.CantUse:
         //    screenManager.SpriteBatch.Draw(player.UnselectablePortraitTexture,
         //        position, Color.White);
         //    break;
     }
 }
예제 #3
0
        /// <summary>
        /// Рисуем детали о игроке
        /// </summary>
        /// <param name="playerIndex">Показатель детлей о игроке, которые нужно отрисовать</param>
        /// <param name="position">Место где прорисовать</param>
        private void DrawCombatPlayerDetails(Player player, Vector2 position)
        {
            SpriteBatch spriteBatch = screenManager.SpriteBatch;

            PlankState plankState = new PlankState();
            bool isPortraitActive = false;
            bool isCharDead = false;
            Color color;

            portraitPosition.X = position.X + 7f;
            portraitPosition.Y = position.Y + 7f;

            namePosition.X = position.X + 84f;
            namePosition.Y = position.Y + 12f;

            levelPosition.X = position.X + 84f;
            levelPosition.Y = position.Y + 39f;

            detailPosition.X = position.X + 25f;
            detailPosition.Y = position.Y + 66f;

            position.X -= 2;
            position.Y -= 4;

            //if (player.IsTurnTaken)
            //{
            //    plankState = PlankState.CantUse;

            //    isPortraitActive = false;
            //}
            //else
            //{
            //    plankState = PlankState.InActive;

            //    isPortraitActive = true;
            //}
            //движоок
            //if (((CombatEngine.HighlightedCombatant == player) && !player.IsTurnTaken) ||
            //   (CombatEngine.PrimaryTargetedCombatant == player) ||
            //  (CombatEngine.SecondaryTargetedCombatants.Contains(player)))
            // {
            // plankState = PlankState.Active;
            //}

            //if (player.IsDeadOrDying)
            //{
            //    isCharDead = true;
            //    isPortraitActive = false;
            //    plankState = PlankState.CantUse;
            //}

            // Рисует информационную плитку
            if (plankState == PlankState.Active)
            {
                color = activeNameColor;

                spriteBatch.Draw(activeCharInfoTexture, position, Color.White);

                // Рисует скобки
                // if ((CombatEngine.HighlightedCombatant == player) && !player.IsTurnTaken)
                // {
                //      spriteBatch.Draw(selectionBracketTexture, position, Color.White);
                //  }

                //if (isPortraitActive &&
                //    (CombatEngine.HighlightedCombatant == player) &&
                //    (CombatEngine.HighlightedCombatant.CombatAction == null) &&
                //    !CombatEngine.IsDelaying)
                //{
                //        position.X += activeCharInfoTexture.Width / 2;
                //        position.X -= combatPopupTexture.Width / 2;
                //        position.Y -= combatPopupTexture.Height;
                //        // Рисует действие
                //        DrawActionsMenu(position);
                //    }
                //}
                //else if (plankState == PlankState.InActive)
                //{
                //    color = inActiveNameColor;
                //    spriteBatch.Draw(inActiveCharInfoTexture, position, Color.White);
                //}
                //else
                //{
                //    color = Color.Black;
                //    spriteBatch.Draw(cantUseCharInfoTexture, position, Color.White);
                //}

                if (isCharDead)
                {
                    spriteBatch.Draw(deadPortraitTexture, portraitPosition, Color.White);
                }
                else
                {
                    // Рисует портрет игрока
                    DrawPortrait(player, portraitPosition, plankState);
                }

                // Рисует имя игрока
                spriteBatch.DrawString(HudFont,
                    player.Name,
                    namePosition, color);

                color = Color.Black;
                // РИсует детали о игроке
                spriteBatch.DrawString(HudFont,
                    "Lvl: " + player.Level,
                    levelPosition, color);

                spriteBatch.DrawString(HudFont,
                    "HP: " + player.HP +
                    "/" + player.HPLeft,
                    detailPosition, color);

                detailPosition.Y += 30f;
                spriteBatch.DrawString(HudFont,
                    "SP: " + player.SP +
                    "/" + player.SPLeft,
                    detailPosition, color);
            }
        }
예제 #4
0
        /// <summary>
        /// Рисует детали о ироке
        /// </summary>
        /// <param name="playerIndex">Показатель детлей о игроке, которые нужно отрисовать</param>
        /// <param name="position">Место где прорисовать</param>
        private void DrawNonCombatPlayerDetails(Player player, Vector2 position)
        {
            SpriteBatch spriteBatch = screenManager.SpriteBatch;

            PlankState plankState;
            bool isCharDead = false;
            Color color;

            portraitPosition.X = position.X + 7f;
            portraitPosition.Y = position.Y + 7f;

            namePosition.X = position.X + 84f;
            namePosition.Y = position.Y + 12f;

            levelPosition.X = position.X + 84f;
            levelPosition.Y = position.Y + 39f;

            detailPosition.X = position.X + 25f;
            detailPosition.Y = position.Y + 66f;

            position.X -= 2;
            position.Y -= 4;

            plankState = PlankState.Active;

            // Рисуем инф. плитку
            if (plankState == PlankState.Active)
            {
                color = activeNameColor;

                spriteBatch.Draw(activeCharInfoTexture, position, Color.White);
            }
            else if (plankState == PlankState.InActive)
            {
                color = inActiveNameColor;
                spriteBatch.Draw(inActiveCharInfoTexture, position, Color.White);
            }
            else
            {
                color = Color.Black;
                spriteBatch.Draw(cantUseCharInfoTexture, position, Color.White);
            }

            if (isCharDead)
            {
                spriteBatch.Draw(deadPortraitTexture, portraitPosition, Color.White);
            }
            else
            {
                // Рисуем портрет,
                DrawPortrait(player, portraitPosition, plankState);
            }

            // имя,
            spriteBatch.DrawString(HudFont,
                player.Name,
                namePosition, color);

            color = Color.Black;
            // и детали.
            spriteBatch.DrawString(HudFont,
                "Lvl: " + player.Level,
                levelPosition, color);

            spriteBatch.DrawString(HudFont,
                "HP: " + player.HP +
                "/" + player.HP,
                detailPosition, color);

            detailPosition.Y += 30f;
            spriteBatch.DrawString(HudFont,
                "MP: " + player.SP +
                "/" + player.SPLeft,
                detailPosition, color);
        }
예제 #5
0
 /// <summary>
 /// Событие обработчика, если выбран компонент меню 3D тест.
 /// <summary>
 void testMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     var player = new Player(null, new ContentManager(ScreenManager.Game.Services, "Content"),100,100,10,10,1,"TestPlayer");
     LoadingScreen.Load(ScreenManager, true, e.PlayerIndex,
         new GameScreen[] { new HudScreen(ScreenManager, player)  });
 }