2026-11-08 12:57:20 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using GladiatorIdle.Gfx;
|
|
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
|
|
using D = GladiatorIdle.Gfx.Draw;
|
|
|
|
|
|
|
|
|
|
|
|
namespace GladiatorIdle.Arena
|
|
|
|
|
|
{
|
|
|
|
|
|
/// Fähigkeitenbaum: drei Zweige (Angriff, Verteidigung, Kampfstil der Klasse), je vier Stufen.
|
|
|
|
|
|
/// Eine Stufe braucht 2 × Stufe Punkte im Zweig. Zeigen = Beschreibung, Klick = lernen.
|
|
|
|
|
|
internal sealed partial class HubScene
|
|
|
|
|
|
{
|
|
|
|
|
|
string? _skillHover;
|
|
|
|
|
|
float _learnFlash;
|
|
|
|
|
|
string? _learnedId;
|
|
|
|
|
|
|
|
|
|
|
|
void DrawSkills(SpriteBatch sb, RectangleF r)
|
|
|
|
|
|
{
|
3D-Arena (Duell, Hub, Freiheit, Erstellung, Bestenliste), Retiarius beidhändig, Waffen je Klasse, Einführung, Willkommen, weniger Reiter, Wirtschaft ohne Taberna, Kantenglättung, Leuchten, weiche Schatten, Gamepad, Absturz-Protokoll
Stand von main 20cd8ba2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 13:24:20 +01:00
|
|
|
|
float x = r.X + 30, y = r.Y + 46;
|
2026-11-08 12:57:20 +01:00
|
|
|
|
D.Text(sb, Assets.SansBold, 22, string.Format(L.t("char.skillpoints"), _game.SkillPoints),
|
3D-Arena (Duell, Hub, Freiheit, Erstellung, Bestenliste), Retiarius beidhändig, Waffen je Klasse, Einführung, Willkommen, weniger Reiter, Wirtschaft ohne Taberna, Kantenglättung, Leuchten, weiche Schatten, Gamepad, Absturz-Protokoll
Stand von main 20cd8ba2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 13:24:20 +01:00
|
|
|
|
new Vector2(x + 650, y - 2), _game.SkillPoints > 0 ? D.Gold : D.Dim);
|
2026-11-08 12:57:20 +01:00
|
|
|
|
if (_ui.Button(sb, new RectangleF(r.Right - 330, y - 22, 300, 44),
|
|
|
|
|
|
string.Format(L.t("char.skillreset"), NumberFormat.Format(_game.SkillResetCost)),
|
|
|
|
|
|
_game.SkillRanks.Count > 0 && _game.Gold >= _game.SkillResetCost, size: 16))
|
|
|
|
|
|
if (_game.ResetSkills()) SoundManager.PlayCoins();
|
|
|
|
|
|
|
|
|
|
|
|
_skillHover = null;
|
|
|
|
|
|
_learnFlash = MathF.Max(0, _learnFlash - 1 / 60f * 2.5f);
|
|
|
|
|
|
var branches = new[] { SkillBranch.Offense, SkillBranch.Defense, SkillBranch.Class };
|
3D-Arena (Duell, Hub, Freiheit, Erstellung, Bestenliste), Retiarius beidhändig, Waffen je Klasse, Einführung, Willkommen, weniger Reiter, Wirtschaft ohne Taberna, Kantenglättung, Leuchten, weiche Schatten, Gamepad, Absturz-Protokoll
Stand von main 20cd8ba2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 13:24:20 +01:00
|
|
|
|
float colW = (r.Width - 60) / 3, top = y + 66, rowH = 132;
|
2026-11-08 12:57:20 +01:00
|
|
|
|
for (int b = 0; b < 3; b++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var branch = branches[b];
|
|
|
|
|
|
float cx = r.X + 30 + colW * b + colW / 2;
|
|
|
|
|
|
int pts = _game.BranchPoints(branch);
|
|
|
|
|
|
D.Text(sb, Assets.Serif, 24, $"{L.t("branch." + branch.ToString().ToLowerInvariant()).ToUpperInvariant()} · {pts}", // i18n-ok
|
|
|
|
|
|
new Vector2(cx, top), D.Gold, Align.Center);
|
|
|
|
|
|
var skills = SkillDef.For(_game.Class).Where(s => s.Branch == branch).OrderBy(s => s.Tier).ToList();
|
|
|
|
|
|
// Verbindungslinien zwischen den Stufen
|
|
|
|
|
|
for (int i = 0; i + 1 < skills.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
float y0 = top + 82 + i * rowH, y1 = y0 + rowH;
|
|
|
|
|
|
bool open = pts >= skills[i + 1].Requires;
|
|
|
|
|
|
D.Rect(sb, new RectangleF(cx - 2, y0 + 80, 4, y1 - y0 - 124), open ? D.Gold * 0.7f : D.Border * 0.6f);
|
|
|
|
|
|
}
|
|
|
|
|
|
foreach (var s in skills) DrawSkillNode(sb, s, new Vector2(cx, top + 82 + s.Tier * rowH), pts);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Beschreibung (Zeigen) oder Hinweis
|
|
|
|
|
|
var info = new RectangleF(r.X + 30, r.Bottom - 96, r.Width - 60, 76);
|
|
|
|
|
|
Ui.Panel(sb, info, D.Border, 0.9f);
|
|
|
|
|
|
if (_skillHover is string id)
|
|
|
|
|
|
{
|
|
|
|
|
|
var s = SkillDef.Get(id);
|
|
|
|
|
|
string head = L.t(s.Key) + (s.Active ? " · " + L.t("char.skill.active") : ""); // i18n-ok
|
|
|
|
|
|
D.Text(sb, Assets.SansBold, 21, head, new Vector2(info.X + 20, info.Y + 22), s.Active ? new Color(255, 170, 70) : D.Gold);
|
|
|
|
|
|
D.Text(sb, Assets.Sans, 18, L.t(s.Desc), new Vector2(info.X + 20, info.Y + 52), D.Sand);
|
|
|
|
|
|
}
|
|
|
|
|
|
else D.Text(sb, Assets.Sans, 18, L.t("char.skill.hint"), info.Center, D.Dim, Align.Center);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DrawSkillNode(SpriteBatch sb, SkillDef s, Vector2 c, int branchPts)
|
|
|
|
|
|
{
|
|
|
|
|
|
int rank = _game.SkillRank(s.Id);
|
|
|
|
|
|
bool unlocked = branchPts >= s.Requires, can = _game.CanLearn(s), max = rank >= s.MaxRank;
|
|
|
|
|
|
var r = new RectangleF(c.X - 44, c.Y - 44, 88, 88);
|
|
|
|
|
|
bool hover = _ui.Hover(r);
|
|
|
|
|
|
if (hover) _skillHover = s.Id;
|
|
|
|
|
|
|
|
|
|
|
|
if (can) D.Glow(sb, c, new Vector2(150 + 12 * MathF.Sin((float)_t * 4)), D.Gold * 0.45f);
|
|
|
|
|
|
if (_learnedId == s.Id && _learnFlash > 0) D.Glow(sb, c, new Vector2(200 + 120 * (1 - _learnFlash)), Color.White * _learnFlash);
|
|
|
|
|
|
if (Assets.Sprite(s.Icon) is Texture2D icon)
|
|
|
|
|
|
{
|
|
|
|
|
|
var tint = !unlocked ? new Color(55, 48, 40) : rank == 0 ? new Color(150, 140, 125) : Color.White;
|
|
|
|
|
|
sb.Draw(icon, c, null, tint, 0, new Vector2(icon.Width / 2f, icon.Height / 2f), (hover ? 88f : 80f) / icon.Width, SpriteEffects.None, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (s.Active) D.Text(sb, Assets.SansBold, 14, L.t("char.skill.active").ToUpperInvariant(), c + new Vector2(56, 0), new Color(255, 170, 70));
|
|
|
|
|
|
|
|
|
|
|
|
// Rang als Punkte unter dem Medaillon
|
|
|
|
|
|
for (int i = 0; i < s.MaxRank; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var p = c + new Vector2((i - (s.MaxRank - 1) / 2f) * 18, 50);
|
|
|
|
|
|
sb.Draw(Assets.Disc, p, null, i < rank ? D.Gold : new Color(40, 32, 24), 0, new Vector2(64), 14f / 128, SpriteEffects.None, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
string label = unlocked ? L.t(s.Key) : string.Format(L.t("char.skill.requires"), s.Requires);
|
|
|
|
|
|
D.Text(sb, Assets.SansBold, 16, label, c + new Vector2(0, 70), !unlocked ? D.Dim : max ? D.Gold : Color.White, Align.Center);
|
|
|
|
|
|
|
|
|
|
|
|
if (can && _ui.Hit(r) && _game.Learn(s.Id))
|
|
|
|
|
|
{
|
|
|
|
|
|
SoundManager.PlayLevelUp();
|
|
|
|
|
|
_learnedId = s.Id; _learnFlash = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|