コード例 #1
0
ファイル: MenuState.cs プロジェクト: ThereGoesMySanity/OpenFE
 public void Draw(SpriteBatch spriteBatch, GameTime gameTime, Font f, GUI gui)
 {
     for (int i = 0; i < options.Length; i++)
     {
         f.DrawText(options[i], 120 - f.TextSize(options[i]) / 2,
                    80 + (i - options.Length / 2) * 10, spriteBatch,
                    currentOption == i ? Color.Green : Color.White);
     }
 }
コード例 #2
0
        public void DrawGUIBattle(SpriteBatch spriteBatch, Font f, Battle b)
        {
            spriteBatch.Draw(battleGUI, screen1,
                             new Rectangle(0, sides[b.One.Type], 120, 160), Color.White);
            spriteBatch.Draw(battleGUI, screen2,
                             new Rectangle(120, sides[b.Two.Type], 120, 160), Color.White);
            f.DrawNumbersLeft(b.Hit.Item1, 39, 112, spriteBatch);
            f.DrawNumbersLeft(b.Crit.Item1, 39, 120, spriteBatch);
            f.DrawNumbersLeft(b.Dmg.Item1, 39, 128, spriteBatch);
            f.DrawNumbersLeft(b.Hit.Item2, 237, 112, spriteBatch);
            f.DrawNumbersLeft(b.Crit.Item2, 237, 120, spriteBatch);
            f.DrawNumbersLeft(b.Dmg.Item2, 237, 128, spriteBatch);
            f.DrawNumbersLeft(b.One.HP, 25, 145, spriteBatch);
            f.DrawNumbersLeft(b.Two.HP, 145, 145, spriteBatch);
            f.DrawText(b.One.Weapon.Name, 88 - f.TextSize(b.One.Weapon.Name) / 2, 120, spriteBatch);
            f.DrawText(b.Two.Weapon.Name, 167 - f.TextSize(b.Two.Weapon.Name) / 2, 120, spriteBatch);
            DrawHP(b.One.HP, b.One.Stats["HP"].Value, 1, spriteBatch);
            DrawHP(b.Two.HP, b.Two.Stats["HP"].Value, 2, spriteBatch);
            f.DrawText(b.One.Name, 28 - f.TextSize(b.One.Name) / 2, 8, spriteBatch);
            f.DrawText(b.Two.Name, 212 - f.TextSize(b.Two.Name) / 2, 8, spriteBatch);

            int adv = b.One.Weapon.advantage(b.Two.Weapon);

            switch (adv)
            {
            case -1:
                disadvantage.Draw(spriteBatch, 54, 126);
                advantage.Draw(spriteBatch, 133, 126);
                break;

            case 1:
                advantage.Draw(spriteBatch, 133, 126);
                disadvantage.Draw(spriteBatch, 54, 126);
                break;
            }
        }