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>
This commit is contained in:
@@ -21,7 +21,14 @@ namespace GladiatorIdle.Arena
|
||||
|
||||
readonly Ui _ui = new();
|
||||
readonly Particles _fx = new();
|
||||
readonly Texture2D? _backdrop = Assets.Sprite("arena_colosseum", "jpg");
|
||||
// Kolosseum in 3D als Bühne; die drei Besten stehen als Figuren ihrer Klasse auf dem Podest
|
||||
readonly Stage3D _stage = new(5, AppSettings.ReduceMotion);
|
||||
readonly Dictionary<string, FighterView> _podiumViews = new();
|
||||
readonly DuelFighter _podiumDummy = new() { IsPlayer = true, Facing = 1, MaxHp = 1, Hp = 1, State = DuelState.Victory };
|
||||
readonly RenderTarget2D?[] _podiumRt = new RenderTarget2D?[3];
|
||||
BasicEffect? _figFx;
|
||||
float _time;
|
||||
const int FIG_W = 220, FIG_H = 300;
|
||||
readonly string _me = Leaderboard.PlayerId;
|
||||
List<LeaderEntry>? _all;
|
||||
bool _loading = true, _offline, _dev;
|
||||
@@ -79,17 +86,47 @@ namespace GladiatorIdle.Arena
|
||||
|
||||
// ── Zeichnen ────────────────────────────────────────────────
|
||||
|
||||
/// Siegerfiguren der Plätze 1–3 in ihre Bildflächen (vor allem anderen: Zielwechsel leert das Bild).
|
||||
void RenderPodium(GraphicsDevice gd, List<LeaderEntry> list)
|
||||
{
|
||||
_figFx ??= new BasicEffect(gd) { VertexColorEnabled = true };
|
||||
_podiumDummy.StateTime = 0.6f + (_time % 4f) * 0.5f; // Siegesjubel immer wieder
|
||||
var previous = gd.GetRenderTargets();
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
_podiumRt[i] = null;
|
||||
if (i >= list.Count || !Enum.TryParse<GladiatorClass>(list[i].Class, out var cls)) continue;
|
||||
string art = Art.Hero(cls, 1);
|
||||
if (!_podiumViews.TryGetValue(art, out var v)) _podiumViews[art] = v = new FighterView(art, i * 0.7f, -1, i == 0 ? 4 : i == 1 ? 7 : 0);
|
||||
v.Update(1 / 60f, 1 / 60f, _podiumDummy, 0, true);
|
||||
if (!v.Is3D) continue;
|
||||
var rt = _podiumRtCache[i] ??= new RenderTarget2D(gd, FIG_W, FIG_H, false, SurfaceFormat.Color, DepthFormat.Depth24);
|
||||
gd.SetRenderTarget(rt);
|
||||
gd.Clear(Color.Transparent);
|
||||
_figFx.View = Matrix.CreateTranslation(0, -Stage.FloorY, 0) * Matrix.CreateScale(0.78f) * Matrix.CreateTranslation(FIG_W / 2f, FIG_H - 6, 0);
|
||||
_figFx.Projection = Matrix.CreateOrthographicOffCenter(0, FIG_W, FIG_H, 0, 0, 1);
|
||||
gd.BlendState = BlendState.AlphaBlend; gd.DepthStencilState = DepthStencilState.None; gd.RasterizerState = RasterizerState.CullNone;
|
||||
v.DrawBody(gd, _figFx, _podiumDummy, true);
|
||||
_podiumRt[i] = rt;
|
||||
}
|
||||
gd.SetRenderTargets(previous);
|
||||
gd.Clear(Color.Black);
|
||||
}
|
||||
readonly RenderTarget2D?[] _podiumRtCache = new RenderTarget2D?[3];
|
||||
|
||||
public void Draw(SpriteBatch sb, float scale, Vector2 offset)
|
||||
{
|
||||
D.UiScale = scale;
|
||||
var gd = sb.GraphicsDevice;
|
||||
_time += 1 / 60f;
|
||||
var ranked = !_loading && !_offline ? Ranked() : new List<LeaderEntry>();
|
||||
RenderPodium(gd, ranked);
|
||||
var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
|
||||
_stage.Cam.Update(1 / 60f, Camera.W / 2 - 1800, Camera.W / 2 + 1800, AppSettings.ReduceMotion);
|
||||
_stage.Prepare(gd, scale, offset);
|
||||
_stage.DrawSet(gd, sb, _time, 0.8f);
|
||||
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui);
|
||||
if (_backdrop != null)
|
||||
{
|
||||
float k = 1.08f * MathF.Max(Camera.W / _backdrop.Width, Camera.H / _backdrop.Height);
|
||||
sb.Draw(_backdrop, new Vector2(Camera.W / 2, Camera.H / 2), null, new Color(0.3f, 0.27f, 0.24f), 0,
|
||||
new Vector2(_backdrop.Width / 2f, _backdrop.Height / 2f), k, SpriteEffects.None, 0);
|
||||
}
|
||||
D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), Color.Black * 0.45f); // Tafeln lesbar
|
||||
sb.End();
|
||||
sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, ui);
|
||||
_fx.DrawAdd(sb);
|
||||
@@ -134,19 +171,27 @@ namespace GladiatorIdle.Arena
|
||||
var r = new RectangleF(x, baseY - h, w, h);
|
||||
D.Rect(sb, r, new Color(30, 22, 15) * 0.92f);
|
||||
D.Frame(sb, r, e.Id == _me ? D.Purple : medal[i], e.Id == _me ? 4 : 3);
|
||||
D.Text(sb, Assets.Serif, 44, (i + 1).ToString(NumberFormat.Culture), new Vector2(r.Center.X, r.Y + 30), medal[i], Align.Center);
|
||||
D.Text(sb, Assets.Serif, 28, e.Name, new Vector2(r.Center.X, r.Y + 72), Color.White, Align.Center);
|
||||
if (h >= 170) D.Text(sb, Assets.Sans, 17, $"{ClassName(e)} · {string.Format(L.t("ludus.level"), e.Level)}", new Vector2(r.Center.X, r.Y + 104), D.Sand, Align.Center); // i18n-ok
|
||||
D.Text(sb, Assets.SansBold, 24, Value(e), new Vector2(r.Center.X, r.Bottom - 26), medal[i], Align.Center);
|
||||
float tx = r.Center.X;
|
||||
if (_podiumRt[i] is RenderTarget2D fig)
|
||||
{
|
||||
// Figur steht links auf der Tafel und ragt nach oben heraus
|
||||
float k = (h + 60) / FIG_H;
|
||||
sb.Draw(fig, new Vector2(r.X + 70, r.Bottom - 8), null, Color.White, 0, new Vector2(FIG_W / 2f, FIG_H - 6), k, SpriteEffects.None, 0);
|
||||
tx = r.X + 230;
|
||||
}
|
||||
D.Text(sb, Assets.Serif, 44, (i + 1).ToString(NumberFormat.Culture), new Vector2(tx, r.Y + 30), medal[i], Align.Center);
|
||||
D.Text(sb, Assets.Serif, e.Name.Length > 11 ? 22 : 28, e.Name, new Vector2(tx, r.Y + 72), Color.White, Align.Center);
|
||||
if (h >= 170) D.Text(sb, Assets.Sans, 16, $"{ClassName(e)} · {string.Format(L.t("ludus.level"), e.Level)}", new Vector2(tx, r.Y + 104), D.Sand, Align.Center); // i18n-ok
|
||||
D.Text(sb, Assets.SansBold, 24, Value(e), new Vector2(tx, r.Bottom - 26), medal[i], Align.Center);
|
||||
}
|
||||
|
||||
// Plätze 4–15
|
||||
float x0 = Camera.W / 2 - 560, y = 512, rowH = 36, wAll = 1120;
|
||||
D.Text(sb, Assets.Sans, 15, L.t("lb.col.rank"), new Vector2(x0 + 20, y), D.Dim);
|
||||
D.Text(sb, Assets.Sans, 15, L.t("lb.col.name"), new Vector2(x0 + 90, y), D.Dim);
|
||||
D.Text(sb, Assets.Sans, 15, L.t("lb.col.class"), new Vector2(x0 + 470, y), D.Dim);
|
||||
D.Text(sb, Assets.Sans, 15, L.t("lb.col.freedoms"), new Vector2(x0 + 760, y), D.Dim, Align.Center);
|
||||
D.Text(sb, Assets.Sans, 15, L.t(_tab == Tab.Power ? "lb.tab.power" : "lb.tab.fastest"), new Vector2(x0 + wAll - 20, y), D.Dim, Align.Right);
|
||||
D.Text(sb, Assets.Sans, 15, L.t("lb.col.rank"), new Vector2(x0 + 20, y), D.Sand);
|
||||
D.Text(sb, Assets.Sans, 15, L.t("lb.col.name"), new Vector2(x0 + 90, y), D.Sand);
|
||||
D.Text(sb, Assets.Sans, 15, L.t("lb.col.class"), new Vector2(x0 + 470, y), D.Sand);
|
||||
D.Text(sb, Assets.Sans, 15, L.t("lb.col.freedoms"), new Vector2(x0 + 760, y), D.Sand, Align.Center);
|
||||
D.Text(sb, Assets.Sans, 15, L.t(_tab == Tab.Power ? "lb.tab.power" : "lb.tab.fastest"), new Vector2(x0 + wAll - 20, y), D.Sand, Align.Right);
|
||||
y += 26;
|
||||
for (int i = 3; i < Math.Min(15, list.Count); i++) { Row(sb, list[i], i, x0, y, wAll, rowH); y += rowH; }
|
||||
int mine = list.FindIndex(e => e.Id == _me);
|
||||
|
||||
Reference in New Issue
Block a user