Journey encounters and 360 camera, Ludus training ground, offline gold fix, new music, settings layout, grounded KO, thraex shield, arena name chant

Stand von main 9c35eff2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 10:47:49 +01:00
parent 0454683fc3
commit c516679674
26 changed files with 856 additions and 151 deletions

View File

@@ -120,6 +120,8 @@ namespace GladiatorIdle.Arena
public bool? Spared => _spared;
public float MissioTime => _missio ? _missioT : -1;
public bool Over => _phase == Phase.End;
/// Testläufe: Zeit seit dem Ende des Kampfs.
public float EndTime => _phase == Phase.End ? _phaseTime : -1;
sealed class Floater { public string Text = ""; public Vector2 Pos; public Color Color; public float Size, Age, Life = 1.1f; public bool Big; }
readonly List<Floater> _floaters = new();
@@ -136,6 +138,36 @@ namespace GladiatorIdle.Arena
public TutStep Tutorial => _tut;
public bool TutorialRan { get; private set; }
// ── Training im Ludus: 30 s Übung, jede gelungene Aktion zählt ──
public Stat? Training { get; private set; }
public int TrainActions { get; private set; }
float _trainPop;
public void StartTraining(Stat s)
{
Training = s;
Duel.GuardHp = true;
Duel.EnemyDamageMult = 0.25;
if (s is Stat.Strength or Stat.Showmanship) Duel.EnemyPassive = true; // der Doctore hält still
else Duel.EnemyAttacksOnly = true; // der Doctore greift an: blocken bzw. ausweichen
}
void TrainEvent(DuelEvent e)
{
if (Training is not Stat s || _phase != Phase.Fight) return;
int n = s switch
{
Stat.Strength => e.Type == DuelEventType.Hit && e.ByPlayer ? 1 : 0,
// Ausdauer: nur rechtzeitiges Blocken zählt (Block kurz vor dem Hieb gesetzt), Dauerblock bringt nichts
Stat.Endurance => !e.ByPlayer ? 0 : e.Type == DuelEventType.Parry ? 2
: e.Type == DuelEventType.Blocked && Duel.Time - Duel.Player.BlockSince < 0.5 ? 1 : 0,
Stat.Agility => e.Type == DuelEventType.Dodged && e.ByPlayer ? 1 : 0,
_ => e.ByPlayer && e.Type is DuelEventType.Leap or DuelEventType.Special or DuelEventType.Super ? 2
: e.Type == DuelEventType.Hit && e.ByPlayer ? (e.Crit ? 2 : 1) : 0,
};
if (n > 0) { TrainActions += n; _trainPop = 1; _crowd.Excite(0.08f); }
}
public void StartTutorial()
{
TutorialRan = true;
@@ -284,7 +316,6 @@ namespace GladiatorIdle.Arena
if (!_announced)
{
_announced = true;
NameVoice.Play(NameVoice.Kind.Enter, 1f, 8); // „Gladiator Spartacus!“
if (_enemy.IsChampion) // Champion: von unten nah heran, dann hoch und zurück
Cine(Pivot.Enemy, new(0.01f, -35, -24, 1700), new(1.7f, -55, -16, 1550), new(COUNTDOWN, 0, 0, 0));
else if (_tut == TutStep.Off) // volle Umrundung beider Kämpfer
@@ -305,18 +336,27 @@ namespace GladiatorIdle.Arena
TutUpdate(realDt, input);
Duel.Step(dt);
HandleEvents();
_trainPop = MathF.Max(0, _trainPop - realDt * 3);
if (Training != null && Duel.Time >= Balance.TRAIN_TIME)
{
// Übung vorbei: kein Sieger, kein Gnadenstoß
_phase = Phase.End; _phaseTime = 0; Won = true; _missio = false;
Duel.EnemyPassive = true; Duel.EnemyAttacksOnly = false;
SoundManager.PlayVictory(); SoundManager.PlayCheer();
break;
}
if (Duel.Over)
{
_phase = Phase.End; _phaseTime = 0; Won = Duel.PlayerWon;
// Gnadenstoß: nicht in der Einführung und nicht gegen Legenden
_missio = !TutorialRan && _enemy.Display == null;
if (Won && !_missio) NameVoice.Play(NameVoice.Kind.Chant, 1f, 0);
if (Won) NameVoice.Play(NameVoice.Kind.Chant, 1f, 0); // jeder Sieg: die Menge ruft den Namen
_crowdMercy = Duel.DamageToPlayer >= Duel.Player.MaxHp * 0.3 || Duel.Time >= 25; // tapferer Gegner
if (!Won) _spared = Duel.PlayerParries >= 2 || Duel.Enemy.Hp <= Duel.Enemy.MaxHp * 0.5 || Duel.Time >= 30;
_cam.FocusX = Won ? _pv.X : _ev.X;
// Kinomoment: Kamera kippt nach unten, Nahansicht auf den Sieger über dem Gefallenen
Cine(Pivot.Winner, new(0.6f, Won ? 35 : -35, -20, 1500), new(2.8f, Won ? 70 : -70, -17, 1450));
if (Won) SoundManager.PlayVictory(); else SoundManager.PlayDefeat();
if (Won) { SoundManager.PlayVictory(); SoundManager.PlayCheer(); } else SoundManager.PlayDefeat();
}
break;
case Phase.End:
@@ -458,6 +498,7 @@ namespace GladiatorIdle.Arena
foreach (var e in Duel.Events)
{
TutEvent(e);
TrainEvent(e);
var targetView = e.ByPlayer ? _ev : _pv;
var actorView = e.ByPlayer ? _pv : _ev;
var target = e.ByPlayer ? Duel.Enemy : Duel.Player;
@@ -845,16 +886,25 @@ namespace GladiatorIdle.Arena
if (n >= 1)
D.Text(sb, Assets.Serif, 200, n.ToString(NumberFormat.Culture), new Vector2(Camera.W / 2, 420),
D.Gold * (1 - k * 0.7f), Align.Center, 1.5f - 0.5f * k);
D.Text(sb, Assets.SansBold, 28, L.t(_enemy.Display != null ? "duel.legend" : _enemy.IsChampion ? "duel.champion" : "duel.practice").ToUpperInvariant(),
D.Text(sb, Assets.SansBold, 28, (Training is Stat tt ? string.Format(L.t("ludus.train.title"), L.t(TextKeys.Of(tt))) : L.t(_enemy.Display != null ? "duel.legend" : _enemy.IsChampion ? "duel.champion" : "duel.practice")).ToUpperInvariant(),
new Vector2(Camera.W / 2, 600), D.Sand, Align.Center);
}
if (Training is Stat ts && _phase == Phase.Fight)
{
// Übung: Zeit, Zähler, Hinweis
double left = Math.Max(0, Balance.TRAIN_TIME - Duel.Time);
D.Text(sb, Assets.Serif, 34, string.Format(L.t("ludus.train.title"), L.t(TextKeys.Of(ts))), new Vector2(Camera.W / 2, 150), D.Gold, Align.Center);
D.Text(sb, Assets.SansBold, 26, $"{left:0}s · " + string.Format(L.t("ludus.train.count"), TrainActions), new Vector2(Camera.W / 2, 196), // i18n-ok
Color.Lerp(Color.White, D.Gold, _trainPop), Align.Center, 1 + 0.15f * _trainPop);
D.Text(sb, Assets.Sans, 20, L.t("ludus.train.hint." + ts.ToString().ToLowerInvariant()), new Vector2(Camera.W / 2, 236), D.Sand, Align.Center);
}
if (_phase == Phase.End && _missio && _decidedAt < 0) DrawMissio(sb);
else if (_phase == Phase.End)
{
float since = _missio ? _missioT - _decidedAt : _phaseTime;
float k = MathHelper.Clamp(since / 0.6f, 0, 1);
D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), Color.Black * (0.35f * k));
D.Text(sb, Assets.Serif, 170, L.t(Won ? "duel.win" : "duel.lose"), new Vector2(Camera.W / 2, 400),
D.Text(sb, Assets.Serif, 170, Training != null ? L.t("ludus.train.done") : L.t(Won ? "duel.win" : "duel.lose"), new Vector2(Camera.W / 2, 400),
(Won ? D.Gold : D.Red) * k, Align.Center, 1 + 0.4f * (1 - k));
if (_missio)
{
@@ -929,7 +979,7 @@ namespace GladiatorIdle.Arena
if (!Won) { if (mercy) SoundManager.PlayCheer(); else SoundManager.PlayBoo(); return; }
_mercy = mercy;
bool match = mercy == _crowdMercy;
if (match) { _crowd.Wave(); SoundManager.PlayCheer(); NameVoice.Play(_enemy.IsChampion ? NameVoice.Kind.Win : NameVoice.Kind.Chant, 1f, 0); }
if (match) { _crowd.Wave(); SoundManager.PlayCheer(); if (_enemy.IsChampion) NameVoice.Play(NameVoice.Kind.Win, 1f, 0); }
else SoundManager.PlayBoo();
if (!mercy) { _pv.HoldClip = "powerup"; _cam.Shake(0.35f); SoundManager.PlayFury(); } // Kampfschrei, keine Tötung
Big(L.t(mercy ? "missio.mitte" : "missio.iugula"), mercy ? D.Gold : new Color(255, 120, 70));

View File

@@ -20,6 +20,7 @@ namespace GladiatorIdle.Arena
float _mTime, _mBlend = 1;
bool _mFree;
float _lift; // Höhe über dem Boden (Sprungangriff)
float _ground, _restLow; // Absenken liegender Figuren (Modell-Einheiten), tiefster Punkt der Grundhaltung
public bool Is3D => _model != null;
@@ -44,6 +45,7 @@ namespace GladiatorIdle.Arena
_model.SetColor(color);
var idle = Clip3("idle");
_model.Pose(idle, 0, true);
_restLow = _model.LowestY();
double tColor = sw.Elapsed.TotalMilliseconds;
// Einpassen hängt nur von der Figur ab (sortiert alle Punkte): einmal je Bild-Name rechnen
if (!_fitCache.TryGetValue(_art, out _fit)) _fitCache[_art] = _fit = _model.FitNow();
@@ -172,6 +174,9 @@ namespace GladiatorIdle.Arena
_mBlend = MathF.Min(1, _mBlend + realDt / 0.12f);
_mTime = t;
m.Pose(Clip3(name), t, loop, _mBlend, rootY: f.State == DuelState.Leap ? 0.15f : 1);
// am Boden liegend: tiefster Punkt auf den Boden (die Todesbewegung passt nicht genau zur Figur)
float ground = f.State == DuelState.Down ? m.LowestY() - _restLow : 0;
_ground += (ground - _ground) * MathF.Min(1, realDt * 12);
// Sprungangriff: eigene Flugkurve (der Clip springt kaum und passt nicht zur kurzen Sprungzeit)
float air = (float)Duel.LEAP_HIT + 0.08f, leapT = (float)f.StateTime;
float lift = f.State == DuelState.Leap && leapT < air ? MathF.Sin(MathF.PI * leapT / air) * 0.55f * Stage.FigH : 0;
@@ -186,7 +191,7 @@ namespace GladiatorIdle.Arena
{
float s = Stage.FigH / 180f * (1 + grow);
float yaw = Facing * MathHelper.ToRadians(72); // zum Gegner, leicht zum Betrachter gedreht
return _fit * Matrix.CreateRotationY(yaw)
return Matrix.CreateTranslation(0, -_ground, 0) * _fit * Matrix.CreateRotationY(yaw)
* Matrix.CreateScale(s * (1 - _sq * 0.04f), -s * (1 + _sq * 0.06f), s) // y nach unten
* Matrix.CreateRotationZ(_lean * Facing)
* Matrix.CreateTranslation(X + _off * Facing * 0.35f * Stage.Scale, Stage.FloorY - _lift, 0);

View File

@@ -0,0 +1,302 @@
using System;
using System.Collections.Generic;
using GladiatorIdle.Gfx;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using D = GladiatorIdle.Gfx.Draw;
namespace GladiatorIdle.Arena
{
/// <summary>
/// Begegnungen auf der Reise: Zu jeder Tagebuchzeile spielt eine kurze Szene am Weg – Kampf
/// gegen Räuber, Lager am Feuer, Fund in einer Ruine, Fest im Dorf. Dazu wechselnde Kamerafahrten
/// (360°-Umrundung, Untersicht, weit von oben, seitlich), die Figuren bleiben immer im Bild.
/// </summary>
internal sealed partial class HubScene
{
enum EncKind { None, Fight, Camp, Find, Village }
sealed class EncFig
{
public FighterView View = null!;
public DuelFighter F = new() { X = 0, Facing = -1, MaxHp = 1, Hp = 1 };
public float X, HomeX;
}
EncKind _enc;
float _encT, _encX, _encDelay = -1;
int _encLog, _encBeat;
bool _encStopped;
readonly List<EncFig> _encFigs = new();
Mesh3D? _encMesh;
float _jShotT, _encIdle; int _jShotKind = -1;
/// Tagebuchzeile der laufenden Szene (0 = keine) – das Tagebuch zeigt sie an.
int EncLogShown => _enc != EncKind.None || _encDelay >= 0 ? _encLog : 0;
float _jScale = 1; Vector2 _jOff; int _jVw = 1, _jVh = 1;
const float ENC_STOP = 360; // so weit vor der Szenenmitte bleibt der Held stehen
static EncKind KindOf(int log) => log switch
{
1 or 2 or 6 or 8 or 9 => EncKind.Fight,
12 => EncKind.Camp,
4 or 10 or 11 => EncKind.Find,
_ => EncKind.Village,
};
/// Neue Tagebuchzeile: nach kurzer Zeit taucht die passende Szene vor dem Helden auf.
void QueueEncounter(int log) { _encLog = log; _encDelay = 2.5f; }
/// Testläufe: diese Begegnung sofort (die laufende endet).
public void DevEncounter(int log)
{
_enc = EncKind.None; _encFigs.Clear(); _encMesh = null; _encStopped = false; _jCam.StopCine();
_encLog = log; _encDelay = 0.2f; _encIdle = 0;
}
void StartEncounter(int log)
{
_enc = KindOf(log);
_encT = 0; _encBeat = 0; _encStopped = false;
_encX = _jX + 1100;
_encFigs.Clear();
var rng = new Random(log * 31 + (int)_jX);
string[] arts = _enc switch
{
EncKind.Fight => log switch
{
2 => new[] { "champ_doctore" },
9 => new[] { "foe_brawler" },
_ => rng.Next(2) == 0 ? new[] { "foe_recruit", "foe_slave" } : new[] { "foe_hoplomachus", "foe_recruit" },
},
EncKind.Village => new[] { "foe_slave", "foe_recruit", "foe_slave" },
_ => Array.Empty<string>(),
};
for (int i = 0; i < arts.Length; i++)
{
var f = new EncFig { View = new FighterView(arts[i], 0.3f * i, -1, 0) };
// Kampf: Gegner kommen von vorn auf den Weg; Dorf: Bewohner warten am Weg
f.HomeX = _enc == EncKind.Fight ? _encX - ENC_STOP + 300 + 260 * i : _encX + 120 + 230 * i;
f.X = _enc == EncKind.Fight ? f.HomeX + 900 : f.HomeX;
f.F.Facing = -1;
_encFigs.Add(f);
}
BuildEncounterMesh(rng);
}
/// Kulisse der Szene: Lagerfeuer, Ruine oder Hütten (einfache Körper, Steine und Holz).
void BuildEncounterMesh(Random rng)
{
float floor = Stage.FloorY, x = _encX;
var m = new Mesh3D { Tex = Assets.Pixel };
switch (_enc)
{
case EncKind.Camp:
for (int i = 0; i < 6; i++)
{
float a = i * MathF.PI / 3;
m.Box(new Vector3(x + 46 * MathF.Cos(a), floor - 8, 40 + 46 * MathF.Sin(a)), new Vector3(70, 14, 16), new Color(92, 64, 40));
}
for (int i = 0; i < 8; i++) // Steinkreis
{
float a = i * MathF.PI / 4;
m.Box(new Vector3(x + 88 * MathF.Cos(a), floor - 10, 40 + 88 * MathF.Sin(a)), new Vector3(26, 20, 24), new Color(120, 116, 108));
}
break;
case EncKind.Find:
for (int i = 0; i < 5; i++)
{
float h = i == 3 ? 160 : 430 - 30 * rng.Next(3);
float cx = x - 260 + 150 * i;
m.Box(new Vector3(cx, floor - h / 2, -330), new Vector3(52, h, 52), new Color(196, 188, 170));
m.Box(new Vector3(cx, floor - 10, -330), new Vector3(78, 20, 78), new Color(176, 168, 150));
}
m.Box(new Vector3(x - 110, floor - 450, -330), new Vector3(360, 34, 70), new Color(186, 178, 160)); // Rest des Gebälks
m.Box(new Vector3(x + 260, floor - 18, -200), new Vector3(150, 36, 60), new Color(170, 162, 146)); // umgestürzte Trommel
break;
case EncKind.Village:
for (int i = 0; i < 3; i++)
{
float cx = x - 300 + 360 * i, cz = -520 - 120 * (i % 2);
m.Box(new Vector3(cx, floor - 110, cz), new Vector3(230, 220, 190), new Color(150, 120, 88));
m.Box(new Vector3(cx, floor - 250, cz), new Vector3(270, 60, 230), new Color(150, 128, 70)); // Strohdach
m.Box(new Vector3(cx, floor - 300, cz), new Vector3(180, 40, 160), new Color(140, 118, 64));
m.Box(new Vector3(cx, floor - 60, cz + 96), new Vector3(60, 120, 4), new Color(70, 50, 34)); // Tür
}
break;
}
m.Freeze();
_encMesh = m.VA is { Length: > 0 } ? m : null;
}
/// Szene fortschreiben; true, solange der Held stehen bleibt.
bool UpdateEncounter(float dt, bool calm)
{
if (_encDelay >= 0) { _encDelay -= dt; if (_encDelay < 0) StartEncounter(_encLog); }
// beim Zuschauen nicht lange nur laufen: alle ~20 s die nächste Begegnung
if (_enc == EncKind.None && _encDelay < 0 && (_encIdle += dt) > 18)
{
_encIdle = 0;
int next; do next = 1 + Random.Shared.Next(Adventures.LOG_LINES); while (next == _encLog);
QueueEncounter(next);
}
if (_enc == EncKind.None) return false;
bool hold = _jX >= _encX - ENC_STOP;
if (hold && !_encStopped)
{
_encStopped = true;
_jShotT = 0;
// Fahrt passend zur Szene
var pivotX = _encX - ENC_STOP / 2;
_jCam.CinePivot = new Vector3(pivotX, Stage.FloorY - Stage.FigH * 0.55f, 0);
if (_enc == EncKind.Fight) _jCam.Orbit(-26, -9, 500);
else if (_enc == EncKind.Find) _jCam.Shot(new Camera.Key(0.01f, -40, -20, 900), new Camera.Key(6, 30, -12, 700), new Camera.Key(11, 60, -6, 500));
else _jCam.Orbit(16, -4, 450);
}
if (_encStopped) _encT += dt;
float t = _encT;
foreach (var f in _encFigs)
{
// auf den Platz gehen, dann dort bleiben
if (_encStopped && MathF.Abs(f.X - f.HomeX) > 1) f.X += MathF.Sign(f.HomeX - f.X) * MathF.Min(MathF.Abs(f.HomeX - f.X), 320 * dt);
f.F.StateTime += dt;
}
switch (_enc)
{
case EncKind.Fight when _encStopped && t > 2.4f:
{
// Schlagabtausch im Takt: gerade Takte schlägt der Held, ungerade der Gegner
int beat = (int)((t - 2.4f) / 0.95f);
var foe = FirstStanding();
if (beat != _encBeat && foe != null)
{
_encBeat = beat;
if (beat >= 6)
{
foreach (var f in _encFigs) if (f.F.State != DuelState.Down) { f.F.Set(DuelState.Down); }
SoundManager.PlayKo();
_jDummy.Set(DuelState.Victory);
}
else if (beat % 2 == 0)
{
_jDummy.Set(DuelState.Strike); SoundManager.PlaySwing();
foe.F.Set(beat == 4 ? DuelState.Down : DuelState.Hit);
if (beat == 4) SoundManager.PlayKo(); else SoundManager.PlayHit();
if (!calm) _jfx.Sparks(new Vector2(foe.X - 60, Stage.FloorY - Stage.FigH * 0.55f), 10, new Color(255, 220, 140), MathF.PI, 1.2f, 260);
}
else
{
foe.F.Set(DuelState.Strike); SoundManager.PlaySwing();
_jDummy.Set(DuelState.Block); SoundManager.PlayBlock();
}
}
if (_jDummy.State is DuelState.Strike or DuelState.Block && _jDummy.StateTime > 0.45f) _jDummy.Set(DuelState.Ready);
foreach (var f in _encFigs)
if (f.F.State is DuelState.Strike or DuelState.Hit && f.F.StateTime > 0.5f) f.F.Set(DuelState.Ready);
break;
}
case EncKind.Find when _encStopped && t > 2.6f && _jDummy.State != DuelState.Victory:
_jDummy.Set(DuelState.Victory); SoundManager.PlayUnlock();
break;
case EncKind.Village when _encStopped && t > 0.8f:
foreach (var f in _encFigs) if (f.F.State != DuelState.Victory) f.F.Set(DuelState.Victory);
if (t > 1.5f && _jDummy.State != DuelState.Victory) { _jDummy.Set(DuelState.Victory); SoundManager.PlayCheer(); }
break;
}
foreach (var f in _encFigs) f.View.Update(dt, dt, f.F, f.X, calm);
float len = _enc == EncKind.Fight ? 10.5f : 9f;
if (_encStopped && t > len)
{
// weiter: Szene bleibt am Weg zurück, bis sie aus dem Bild ist
_jDummy.Set(DuelState.Ready);
_encStopped = false; _encT = -999;
_jCam.StopCine();
}
if (!_encStopped && _encT < -1 && _jX > _encX + 2600) { _enc = EncKind.None; _encFigs.Clear(); _encMesh = null; }
return _encStopped;
}
EncFig? FirstStanding()
{
foreach (var f in _encFigs) if (f.F.State != DuelState.Down) return f;
return null;
}
/// Kamera beim Wandern: alle ~11 s eine andere Einstellung (nie zweimal dieselbe).
void UpdateJourneyCamera(float dt, bool calm)
{
if (calm || _encStopped) return;
_jShotT -= dt;
if (_jShotT > 0) return;
int kind;
do kind = Random.Shared.Next(4); while (kind == _jShotKind);
_jShotKind = kind;
_jShotT = 10 + 4 * (float)Random.Shared.NextDouble();
switch (kind)
{
case 0: _jCam.Orbit(Random.Shared.Next(2) == 0 ? 30 : -30, -6, 600); break; // Umrundung 360°
case 1: _jCam.Shot(new Camera.Key(0.01f, -70, -22, 1500), new Camera.Key(_jShotT, -40, -16, 1300)); break; // von vorn unten
case 2: _jCam.Shot(new Camera.Key(0.01f, 25, 15, 150), new Camera.Key(_jShotT, -25, 11, 300)); break; // weit von oben
default: _jCam.StopCine(); break; // seitlich
}
}
/// Figuren der Szene im Bild halten (Kopf und Füße aller Beteiligten).
void KeepJourneyInView(float dt)
{
Span<Vector3> pts = stackalloc Vector3[2 + 2 * Math.Min(_encFigs.Count, 3)];
pts[0] = new(_jX - 90, Stage.FloorY - Stage.FigH * 1.1f, 0); pts[1] = new(_jX + 90, Stage.FloorY + 12, 0);
int n = 2;
if (_encStopped)
for (int i = 0; i < _encFigs.Count && n + 1 < pts.Length; i++)
{
pts[n++] = new(_encFigs[i].X, Stage.FloorY - Stage.FigH * 1.1f, 0);
pts[n++] = new(_encFigs[i].X, Stage.FloorY + 12, 0);
}
_jCam.KeepInView(pts[..n], _jScale, _jOff, _jVw, _jVh, dt);
}
/// Kulisse und Figuren der Szene zeichnen (im 3D-Durchgang der Reise, nach dem Bewuchs).
void DrawEncounterSet(GraphicsDevice gd)
{
if (_enc == EncKind.None || _encMesh == null || _jFx == null) return;
_jFx.Texture = Assets.Pixel; _jFx.DiffuseColor = Vector3.One; _jFx.World = Matrix.Identity;
foreach (var pass in _jFx.CurrentTechnique.Passes)
{
pass.Apply();
gd.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, _encMesh.VA, 0, _encMesh.VA!.Length, _encMesh.IA, 0, _encMesh.IA!.Length / 3);
}
}
void DrawEncounterFigures(GraphicsDevice gd, BasicEffect fx, Matrix v3, Matrix p3, ArenaLook look, bool calm)
{
foreach (var f in _encFigs)
{
f.View.UseCamera3D(v3, p3);
f.View.SetLighting(look);
f.View.DrawBody(gd, fx, f.F, calm);
}
}
FighterView[] EncShadowFigs()
{
var a = new FighterView[1 + _encFigs.Count];
a[0] = _jHero!;
for (int i = 0; i < _encFigs.Count; i++) a[i + 1] = _encFigs[i].View;
return a;
}
/// Lagerfeuer: Glut und Flammen (additiv), Funken.
void DrawCampFire(SpriteBatch sb, bool calm)
{
if (_enc != EncKind.Camp || _jPlane == null) return;
var at = new Vector2(_encX, Stage.FloorY - 30);
float fl = 0.8f + 0.2f * MathF.Sin((float)_t * 21) * MathF.Sin((float)_t * 6.3f);
sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullNone, _jPlane);
D.Glow(sb, new Vector2(_encX, Stage.FloorY), new Vector2(1500 * fl, 360), new Color(255, 130, 40) * 0.45f);
D.Glow(sb, at, new Vector2(150 * fl, 210 * fl), new Color(255, 150, 50));
D.Glow(sb, at + new Vector2(0, 20), new Vector2(80, 110 * fl), new Color(255, 236, 170));
sb.End();
if (!calm && Random.Shared.NextDouble() < 0.6) _jfx.Sparks(at, 1, new Color(255, 180, 80), -MathF.PI / 2, 0.6f, 160);
}
}
}

View File

@@ -38,7 +38,7 @@ namespace GladiatorIdle.Arena
Mesh3D? _jGround, _jPath, _jStone;
string? _jRegion;
float _jX;
int _jLine = -1; float _jLineT;
int _jLine = -1, _jLogShown; float _jLineT;
/// Testlauf: Tageszeit (0 Morgen, 0,25 Mittag, 0,5 Abend, 0,75 Nacht) statt aus der Reisezeit.
public float? DevDayPhase;
// feste Puffer (keine neuen Objekte je Bild)
@@ -54,6 +54,10 @@ namespace GladiatorIdle.Arena
_jHero ??= Assets.Has(hero) ? new FighterView(hero, 0.5f, _game.Look.Color) : new FighterView(Art.Fighter(_game.Class), 0.5f);
_jCam.FollowX = 300; _jCam.FollowZoom = 1.0f;
_jCam.Center = new Vector2(300, Camera.H / 2 + 40);
_jCam.StopCine(); _jCam.Ring = null;
_enc = EncKind.None; _encDelay = -1; _encFigs.Clear(); _encMesh = null; _encStopped = false;
_jShotT = 5; _jShotKind = 3;
_jDummy.Set(DuelState.Ready);
SoundManager.PlayDrawer();
}
@@ -61,10 +65,15 @@ namespace GladiatorIdle.Arena
{
if (_game.Away is not { } away) { _overlay = Overlay.Map; return; }
bool calm = AppSettings.ReduceMotion;
_jX += WALK_SPEED * dt;
bool hold = UpdateEncounter(dt, calm);
if (!hold) _jX += WALK_SPEED * dt;
_jDummy.StateTime += dt;
_jHero!.Update(dt, dt, _jDummy, _jX, calm);
_jCam.FollowX = _jX + 260;
if (!hold) _jCam.CinePivot = new Vector3(_jX, Stage.FloorY - Stage.FigH * 0.6f, 0);
UpdateJourneyCamera(dt, calm);
_jCam.Update(dt, _jX, _jX, calm);
KeepJourneyInView(dt);
_jfx.Calm = calm;
_jfx.Update(dt);
if (_jRegion != away.Region) BuildJourney(away.Region);
@@ -80,8 +89,8 @@ namespace GladiatorIdle.Arena
Mesh3D Grid(string tex, Vector3 tint, float z0, float z1, float y, int nz)
{
var m = new Mesh3D { Tex = Assets.Sprite(tex, "jpg"), Wrap = true, Tint = tint };
const int NX = 30;
float x0 = -4200, x1 = 4200;
const int NX = 44;
float x0 = -6600, x1 = 6600;
for (int i = 0; i < NX; i++)
for (int k = 0; k < nz; k++)
{
@@ -94,7 +103,7 @@ namespace GladiatorIdle.Arena
m.Freeze();
return m;
}
_jGround = Grid(land.Ground, land.GroundTint, -3000, 900, floor, 10);
_jGround = Grid(land.Ground, land.GroundTint, -5000, 5000, floor, 24); // auch hinter der Kamera (360°-Fahrten)
_jPath = Grid(land.Path, land.PathTint, -230, 150, floor - 0.6f, 2);
// Meilenstein
_jStone = new Mesh3D { Tex = Assets.Pixel };
@@ -140,6 +149,7 @@ namespace GladiatorIdle.Arena
bool calm = AppSettings.ReduceMotion;
int vw = gd.Viewport.Width, vh = gd.Viewport.Height;
_jScale = scale; _jOff = offset; _jVw = vw; _jVh = vh;
var v3 = _jCam.View3(); var p3 = _jCam.Proj3(scale, offset, vw, vh);
var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
_jFx ??= new BasicEffect(gd) { TextureEnabled = true, VertexColorEnabled = true, PreferPerPixelLighting = true };
@@ -150,12 +160,13 @@ namespace GladiatorIdle.Arena
float camX = _jCam.Center.X;
// fernes Regionsbild (gespiegelt wiederholt, langsamer als der Weg: Parallaxe)
if (Picture(reg.Art) is Texture2D pic)
float picA = _jCam.PlaneAlpha; // Bild nur im Blick nach vorn, beim Drehen in den Nebel ausblenden
if (picA > 0.01f && Picture(reg.Art) is Texture2D pic)
{
const float Z = -5200, W = 7000;
float h = W * pic.Height / pic.Width, bottom = Stage.FloorY + 900, top = bottom - h * 1.15f;
float xl = camX - 9000, xr = camX + 9000, shift = camX * 0.8f;
var c = new Color(sky * (0.92f - 0.55f * night));
var c = new Color(Vector3.Lerp(fog, sky * (0.92f - 0.55f * night), picA));
float u0 = (xl - shift) / W, u1 = (xr - shift) / W;
_jBack[0] = new(new Vector3(xl, top, Z), c, new Vector2(u0, 0)); _jBack[1] = new(new Vector3(xr, top, Z), c, new Vector2(u1, 0));
_jBack[2] = new(new Vector3(xr, bottom, Z), c, new Vector2(u1, 1)); _jBack[3] = _jBack[0]; _jBack[4] = _jBack[2];
@@ -192,7 +203,7 @@ namespace GladiatorIdle.Arena
}
// Meilensteine alle 4 Felder
_jFx.Texture = Assets.Pixel; _jFx.DiffuseColor = Vector3.One;
int c0 = (int)MathF.Floor((camX - 4200) / CELL), c1 = (int)MathF.Ceiling((camX + 4200) / CELL);
int c0 = (int)MathF.Floor((camX - 5600) / CELL), c1 = (int)MathF.Ceiling((camX + 5600) / CELL);
for (int cell = c0; cell <= c1; cell++)
if (cell % 4 == 0)
{
@@ -205,7 +216,7 @@ namespace GladiatorIdle.Arena
}
// Bäume, Büsche, Felsen: je Feld fest ausgewürfelt
foreach (var key in land.Props) if (!_jProps.ContainsKey(key)) _jProps[key] = (new VertexPositionColorTexture[6 * 400], 0);
foreach (var key in land.Props) if (!_jProps.ContainsKey(key)) _jProps[key] = (new VertexPositionColorTexture[6 * 600], 0);
var counts = new Dictionary<string, int>(_jProps.Count);
foreach (var k in _jProps.Keys) counts[k] = 0;
var light = new Color(Vector3.Clamp(amb + sun * 0.55f, Vector3.Zero, Vector3.One));
@@ -222,6 +233,7 @@ namespace GladiatorIdle.Arena
float zr = (float)rng.NextDouble();
// nah am Weg nur Kleines, weiter hinten auch Bäume; selten etwas ganz vorn
float z = zr < 0.45f ? -240 - 520 * (float)rng.NextDouble() : -800 - 2000 * (float)rng.NextDouble();
if (zr > 0.8f) z = 2900 + 1600 * (float)rng.NextDouble(); // hinter der Kamera: sichtbar beim Umrunden
if (!small && z > -380) continue; // Bäume nicht direkt am Weg
float size = (small ? 170 : 720) * (0.75f + 0.55f * (float)rng.NextDouble());
int k = counts[kind];
@@ -250,11 +262,13 @@ namespace GladiatorIdle.Arena
}
}
DrawEncounterSet(gd);
// Gladiator mit Schatten; nachts mit Fackel
var look = new ArenaLook("wood", sunDir, sun, amb, fog, 1600, 6200, Vector3.One, Color.White, 0, false, 0, 1);
_jHero.UseCamera3D(v3, p3);
_jHero.SetLighting(look);
Stage3D.SoftShadows(gd, sb, sunDir, 0.42f * (1 - 0.6f * night), _jHero);
Stage3D.SoftShadows(gd, sb, sunDir, 0.42f * (1 - 0.6f * night), EncShadowFigs());
var torch = _jHero.Chest + new Vector2(70, -40);
if (night > 0.01f)
{
@@ -267,6 +281,8 @@ namespace GladiatorIdle.Arena
}
Stage3D.BeginFigures(gd);
_jHero.DrawBody(gd, fx, _jDummy, calm);
DrawEncounterFigures(gd, fx, v3, p3, look, calm);
DrawCampFire(sb, calm);
sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullNone, _jPlane);
if (night > 0.01f)
{
@@ -291,13 +307,15 @@ namespace GladiatorIdle.Arena
// Tagebuch: Zeilen nach Fortschritt, fest ausgewählt je Reise
int lines = 2 + 2 * away.Duration;
int idx = Math.Min(lines - 1, (int)(k2 * lines));
if (idx != _jLine) { _jLine = idx; _jLineT = 0; }
var order = new int[Adventures.LOG_LINES];
for (int i = 0; i < order.Length; i++) order[i] = i + 1;
new Random(away.Region.GetHashCode() ^ (away.Duration * 7919) ^ (int)(away.Chance * 1000)).Shuffle(order);
if (idx != _jLine) { _jLine = idx; _jLineT = 0; QueueEncounter(order[idx % order.Length]); }
int lineDay = day;
float la = MathHelper.Clamp(_jLineT / 1.2f, 0, 1);
string diary = $"{string.Format(L.t("exp.day"), lineDay)}: {L.t("expedition.log." + order[idx % order.Length])}"; // i18n-ok
int logNo = EncLogShown > 0 ? EncLogShown : order[idx % order.Length];
if (logNo != _jLogShown) { _jLogShown = logNo; _jLineT = 0; }
string diary = $"{string.Format(L.t("exp.day"), lineDay)}: {L.t("expedition.log." + logNo)}"; // i18n-ok
D.Text(sb, Assets.Serif, 28, diary, new Vector2(Camera.W / 2 + 2, 172), Color.Black * (0.7f * la), Align.Center);
D.Text(sb, Assets.Serif, 28, diary, new Vector2(Camera.W / 2, 170), new Color(250, 236, 205) * la, Align.Center);

View File

@@ -472,27 +472,51 @@ namespace GladiatorIdle.Arena
D.Text(sb, Assets.SansBold, 21, value, new Vector2(x + 320, y), Color.White, Align.Right);
}
/// Ludus: Wert zum Üben gewählt (das Spiel startet die Übung).
public Stat? ChosenTraining;
void DrawLudus(SpriteBatch sb, RectangleF r)
{
float x = r.X + 30, y = r.Y + 40;
D.Text(sb, Assets.Serif, 30, L.t("main.ludus"), new Vector2(x, y), D.Gold);
y += 40;
// Trainingsplatz: Kraft (Energie) und vier Übungen
int full = (int)_game.TrainEnergy;
for (int i = 0; i < Balance.TRAIN_ENERGY_MAX; i++)
{
var pip = new RectangleF(r.Right - 60 - (Balance.TRAIN_ENERGY_MAX - i) * 34, y + 6, 26, 26);
D.Rect(sb, pip, i < full ? D.Gold : new Color(60, 46, 30));
D.Frame(sb, pip, D.Border, 2);
}
string energy = _game.TrainEnergyNextIn > 0 ? string.Format(L.t("ludus.train.next"), NumberFormat.Duration(_game.TrainEnergyNextIn)) : L.t("ludus.train.full");
D.Text(sb, Assets.Sans, 17, energy, new Vector2(r.Right - 60 - Balance.TRAIN_ENERGY_MAX * 34 - 16, y + 10), D.Sand, Align.Right);
y += 46;
D.TextWrap(sb, Assets.Sans, 18, L.t("ludus.train.intro"), new RectangleF(x, y, r.Width - 60, 50), D.Dim);
y += 50;
float bw = (r.Width - 60 - 3 * 12) / 4;
for (int i = 0; i < 4; i++)
{
var st = (Stat)i;
var b = new RectangleF(x + i * (bw + 12), y, bw, 74);
if (_ui.Button(sb, b, L.t(TextKeys.Of(st)), _game.CanTrain, size: 20, accent: D.Gold) && _game.CanTrain) { ChosenTraining = st; SoundManager.PlayClick(); }
D.Text(sb, Assets.Sans, 15, string.Format(L.t("ludus.train.per"), NumberFormat.Format(_game.TrainXpPerAction(st))), new Vector2(b.Center.X, b.Bottom + 14), D.Dim, Align.Center);
}
y += 112;
foreach (var u in UpgradeDef.All)
{
var row = new RectangleF(x, y, r.Width - 60, 84);
var row = new RectangleF(x, y, r.Width - 60, 72);
D.Rect(sb, row, new Color(30, 22, 15) * 0.9f);
D.Frame(sb, row, D.Border, 2);
if (Assets.Sprite(Art.Upgrade(u)) is Texture2D icon)
sb.Draw(icon, new Vector2(row.X + 42, row.Center.Y), null, Color.White, 0, new Vector2(icon.Width / 2f, icon.Height / 2f), 64f / icon.Width, SpriteEffects.None, 0);
int level = _game.UpgradeLevel(u.Id);
D.Text(sb, Assets.SansBold, 21, L.t(u.Key), new Vector2(row.X + 86, row.Y + 24), Color.White);
D.Text(sb, Assets.Sans, 17, string.Format(L.t("ludus.level"), level), new Vector2(row.X + 86, row.Y + 56), D.Sand);
D.Text(sb, Assets.SansBold, 21, L.t(u.Key), new Vector2(row.X + 86, row.Y + 20), Color.White);
D.Text(sb, Assets.Sans, 17, string.Format(L.t("ludus.level"), level), new Vector2(row.X + 86, row.Y + 50), D.Sand);
string desc = u.Stat is Stat s ? string.Format(L.t("upgrade.trainer.desc"), L.t(TextKeys.Of(s))) : L.t(u.Key + ".desc");
D.TextWrap(sb, Assets.Sans, 17, desc, new RectangleF(row.X + 330, row.Y + 14, row.Width - 330 - 260, 64), D.Dim);
D.TextWrap(sb, Assets.Sans, 17, desc, new RectangleF(row.X + 330, row.Y + 8, row.Width - 330 - 260, 60), D.Dim);
double cost = _game.UpgradeCost(u.Id);
if (_ui.Button(sb, new RectangleF(row.Right - 240, row.Y + 16, 224, 52), string.Format(L.t("btn.buy"), NumberFormat.Format(cost)), _game.Gold >= cost, size: 19))
if (_ui.Button(sb, new RectangleF(row.Right - 240, row.Y + 12, 224, 48), string.Format(L.t("btn.buy"), NumberFormat.Format(cost)), _game.Gold >= cost, size: 19))
if (_game.Buy(u.Id)) SoundManager.PlayPurchase();
y += 92;
y += 78;
}
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using GladiatorIdle.Gfx;
using Microsoft.Xna.Framework;
@@ -43,69 +43,88 @@ namespace GladiatorIdle.Arena
public void Draw(SpriteBatch sb, float scale, Vector2 offset)
{
var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
// weich einblenden: Hintergrund dunkelt ab, Tafel wächst leicht aus der Mitte
if (!_wasOpen) { _openedAt = Environment.TickCount64; _wasOpen = true; }
float k = MathHelper.Clamp((Environment.TickCount64 - _openedAt) / 220f, 0, 1);
k = 1 - (1 - k) * (1 - k);
var ui = Matrix.CreateTranslation(-Camera.W / 2f, -Camera.H / 2f, 0) * Matrix.CreateScale(0.94f + 0.06f * k)
* Matrix.CreateTranslation(Camera.W / 2f, Camera.H / 2f, 0) * Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
var flat = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, flat);
D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), Color.Black * (0.65f * k));
sb.End();
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui);
D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), Color.Black * 0.6f);
var r = new RectangleF(Camera.W / 2 - 420, 24, 840, 1032);
Ui.Panel(sb, r, D.Gold, 0.97f);
float x = r.X + 50, y = r.Y + 60, w = r.Width - 100;
D.Text(sb, Assets.Serif, 40, L.t("main.settings").ToUpperInvariant(), new Vector2(r.Center.X, y), D.Gold, Align.Center);
// Audio
y += 70;
D.Text(sb, Assets.SansBold, 18, L.t("settings.sec.audio"), new Vector2(x, y), D.Dim);
y += 40;
Volume(sb, x, y, w, L.t("settings.row.music"), () => AppSettings.MusicVolume, v => AppSettings.MusicVolume = v); y += 56;
Volume(sb, x, y, w, L.t("settings.row.sfx"), () => AppSettings.SfxVolume, v => AppSettings.SfxVolume = v); y += 56;
Volume(sb, x, y, w, L.t("settings.vol.voice"), () => AppSettings.VoiceVolume, v => AppSettings.VoiceVolume = v); y += 56;
Toggle(sb, x, y, w, Plain(L.t(AppSettings.Muted ? "settings.muted" : "settings.sound.on")), !AppSettings.Muted,
// breite, flache Tafel in der Bildmitte: links Ton, rechts Anzeige, unten Sprache und Zurück
const float W = 1560, H = 650;
var r = new RectangleF((Camera.W - W) / 2, (Camera.H - H) / 2, W, H);
Ui.Panel(sb, r, D.Gold, 1f);
D.Text(sb, Assets.Serif, 38, L.t("main.settings").ToUpperInvariant(), new Vector2(r.Center.X, r.Y + 52), D.Gold, Align.Center);
D.Rect(sb, new RectangleF(r.Center.X - 160, r.Y + 84, 320, 2), D.Gold * 0.5f);
float colW = (W - 150) / 2, xl = r.X + 50, xr = r.X + 100 + colW, top = r.Y + 130;
D.Rect(sb, new RectangleF(r.Center.X - 1, top - 10, 2, 360), D.Border * 0.8f);
// links: Ton
float y = top;
D.Text(sb, Assets.SansBold, 18, L.t("settings.sec.audio").ToUpperInvariant(), new Vector2(xl, y), D.Dim);
y += 46;
Volume(sb, xl, y, colW, L.t("settings.row.music"), () => AppSettings.MusicVolume, v => AppSettings.MusicVolume = v); y += 54;
Volume(sb, xl, y, colW, L.t("settings.row.sfx"), () => AppSettings.SfxVolume, v => AppSettings.SfxVolume = v); y += 54;
Volume(sb, xl, y, colW, L.t("settings.vol.voice"), () => AppSettings.VoiceVolume, v => AppSettings.VoiceVolume = v); y += 54;
Toggle(sb, xl, y, colW, Plain(L.t(AppSettings.Muted ? "settings.muted" : "settings.sound.on")), !AppSettings.Muted,
() => { AppSettings.Muted = !AppSettings.Muted; if (!AppSettings.Muted) SoundManager.StartAmbient(); });
y += 56;
Toggle(sb, x, y, w, L.t("settings.narration"), AppSettings.Narration, () => AppSettings.Narration = !AppSettings.Narration);
y += 56;
Toggle(sb, x, y, w, L.t("settings.namecalls"), AppSettings.NameCalls, () => AppSettings.NameCalls = !AppSettings.NameCalls);
y += 54;
Toggle(sb, xl, y, colW, L.t("settings.narration"), AppSettings.Narration, () => AppSettings.Narration = !AppSettings.Narration);
y += 54;
Toggle(sb, xl, y, colW, L.t("settings.namecalls"), AppSettings.NameCalls, () => AppSettings.NameCalls = !AppSettings.NameCalls);
// Anzeige
y += 80;
D.Text(sb, Assets.SansBold, 18, L.t("settings.sec.display"), new Vector2(x, y), D.Dim);
y += 40;
Toggle(sb, x, y, w, L.t("settings.fullscreen"), AppSettings.Fullscreen, _toggleFullscreen);
y += 56;
Toggle(sb, x, y, w, L.t("settings.reducemotion"), AppSettings.ReduceMotion, () => AppSettings.ReduceMotion = !AppSettings.ReduceMotion);
y += 56;
Toggle(sb, x, y, w, L.t("settings.antialias"), AppSettings.AntiAlias, () => AppSettings.AntiAlias = !AppSettings.AntiAlias);
y += 56;
Toggle(sb, x, y, w, L.t("settings.bloom"), AppSettings.Bloom, () => AppSettings.Bloom = !AppSettings.Bloom);
y += 56;
D.Text(sb, Assets.Sans, 22, L.t("settings.framerate"), new Vector2(x, y), D.Sand);
// rechts: Anzeige
y = top;
D.Text(sb, Assets.SansBold, 18, L.t("settings.sec.display").ToUpperInvariant(), new Vector2(xr, y), D.Dim);
y += 46;
Toggle(sb, xr, y, colW, L.t("settings.fullscreen"), AppSettings.Fullscreen, _toggleFullscreen);
y += 54;
Toggle(sb, xr, y, colW, L.t("settings.reducemotion"), AppSettings.ReduceMotion, () => AppSettings.ReduceMotion = !AppSettings.ReduceMotion);
y += 54;
Toggle(sb, xr, y, colW, L.t("settings.antialias"), AppSettings.AntiAlias, () => AppSettings.AntiAlias = !AppSettings.AntiAlias);
y += 54;
Toggle(sb, xr, y, colW, L.t("settings.bloom"), AppSettings.Bloom, () => AppSettings.Bloom = !AppSettings.Bloom);
y += 54;
D.Text(sb, Assets.Sans, 22, L.t("settings.framerate"), new Vector2(xr, y), D.Sand);
var rates = new[] { "settings.fps.vsync", "settings.fps.120", "settings.fps.max" };
for (int i = 0; i < rates.Length; i++)
if (_ui.Button(sb, new RectangleF(x + w - 3 * 150 - 20 + i * 160, y - 22, 150, 44), L.t(rates[i]), selected: AppSettings.FrameLimit == i, size: 18)
if (_ui.Button(sb, new RectangleF(xr + colW - 3 * 132 + i * 132, y - 20, 124, 40), L.t(rates[i]), selected: AppSettings.FrameLimit == i, size: 17)
&& AppSettings.FrameLimit != i)
{ AppSettings.FrameLimit = i; Save(); ApplyGraphics(); }
y += 56;
D.Text(sb, Assets.Sans, 22, L.t("settings.row.language"), new Vector2(x, y), D.Sand);
y += 54;
D.Text(sb, Assets.Sans, 22, L.t("settings.row.language"), new Vector2(xr, y), D.Sand);
var langs = new[] { (L.Lang.De, "Deutsch"), (L.Lang.En, "English"), (L.Lang.Es, "Español") }; // i18n-ok
for (int i = 0; i < langs.Length; i++)
{
var (lang, name) = langs[i];
if (_ui.Button(sb, new RectangleF(x + w - 3 * 150 - 20 + i * 160, y - 22, 150, 44), name, selected: L.Current == lang, size: 18))
if (_ui.Button(sb, new RectangleF(xr + colW - 3 * 132 + i * 132, y - 20, 124, 40), name, selected: L.Current == lang, size: 17))
if (L.Current != lang && DevShot.Lang == null) L.Set(lang);
}
y += 70;
// unten: Einführung, Zurück, Hinweis
float by = r.Bottom - 110;
D.Rect(sb, new RectangleF(r.X + 50, by - 24, W - 100, 2), D.Border * 0.8f);
if (Tutorial() is bool seen)
{
D.Text(sb, Assets.Sans, 22, L.t("settings.tutorial"), new Vector2(x, y), D.Sand);
if (_ui.Button(sb, new RectangleF(x + w - 300, y - 22, 300, 44), L.t(seen ? "settings.tutorial.replay" : "settings.tutorial.next"), seen, size: 18))
D.Text(sb, Assets.Sans, 20, L.t("settings.tutorial"), new Vector2(xl, by + 32), D.Sand);
if (_ui.Button(sb, new RectangleF(xl + 260, by + 10, 280, 44), L.t(seen ? "settings.tutorial.replay" : "settings.tutorial.next"), seen, size: 17))
ReplayTutorial();
}
if (_ui.Button(sb, new RectangleF(r.Center.X - 160, r.Bottom - 100, 320, 64), L.t("select.back"), selected: true, size: 26))
if (_ui.Button(sb, new RectangleF(r.Right - 50 - 300, by + 2, 300, 60), L.t("select.back"), selected: true, size: 24))
Open = false;
D.Text(sb, Assets.Sans, 15, $"{Credits.COPYRIGHT} · {Credits.MAIL}", new Vector2(r.Center.X, r.Bottom - 20), D.Dim, Align.Center); // i18n-ok
D.Text(sb, Assets.Sans, 14, $"{Credits.COPYRIGHT} · {Credits.MAIL}", new Vector2(r.Center.X, r.Bottom - 22), D.Dim, Align.Center); // i18n-ok
sb.End();
if (!Open) _wasOpen = false;
}
long _openedAt;
bool _wasOpen;
void Volume(SpriteBatch sb, float x, float y, float w, string label, Func<int> get, Action<int> set)
{
D.Text(sb, Assets.Sans, 22, label, new Vector2(x, y), D.Sand);
@@ -113,7 +132,7 @@ namespace GladiatorIdle.Arena
for (int i = 0; i < steps.Length; i++)
{
int v = steps[i];
var r = new RectangleF(x + w - steps.Length * 86 + i * 86, y - 20, 78, 40);
var r = new RectangleF(x + w - steps.Length * 70 + i * 70, y - 20, 64, 40);
if (_ui.Button(sb, r, v.ToString(NumberFormat.Culture), selected: get() == v, size: 17)) { set(v); Save(); SoundManager.PlayClick(); }
}
}
@@ -121,7 +140,7 @@ namespace GladiatorIdle.Arena
void Toggle(SpriteBatch sb, float x, float y, float w, string label, bool on, Action flip)
{
D.Text(sb, Assets.Sans, 22, label, new Vector2(x, y), D.Sand);
if (_ui.Button(sb, new RectangleF(x + w - 170, y - 20, 170, 40), L.t(on ? "settings.on" : "settings.off"), selected: on, size: 18))
if (_ui.Button(sb, new RectangleF(x + w - 150, y - 20, 150, 40), L.t(on ? "settings.on" : "settings.off"), selected: on, size: 18))
{
flip();
Save();