Neue Töne, Reiter mit Anleitung, Klingen geeicht, Sprung, Vorschaubilder aus 3D
Stand von main 262a2009. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,13 @@ namespace GladiatorIdle.Arena
|
||||
readonly Particles _fx = new();
|
||||
readonly Texture2D? _backdrop = Assets.Sprite("arena_ludus", "jpg");
|
||||
FighterView _preview = null!;
|
||||
// Vorschaubilder der Vorlagen: aus den 3D-Figuren gerendert (je Klasse einmal geladen)
|
||||
const int THUMB_W = 296, THUMB_H = 340;
|
||||
readonly System.Collections.Generic.Dictionary<GladiatorClass, FighterView[]> _thumbFigs = new();
|
||||
readonly RenderTarget2D?[] _thumbs = new RenderTarget2D?[Appearance.PRESETS];
|
||||
bool _thumbsDirty = true;
|
||||
int _thumbTint = -1;
|
||||
GladiatorClass _thumbClass = (GladiatorClass)(-1);
|
||||
readonly DuelFighter _dummy = new() { IsPlayer = true, X = 0, Facing = 1, MaxHp = 1, Hp = 1 };
|
||||
double _t, _showAt = 2.5;
|
||||
int _show;
|
||||
@@ -97,6 +104,7 @@ namespace GladiatorIdle.Arena
|
||||
|
||||
public void Draw(GraphicsDevice gd, SpriteBatch sb, BasicEffect fx, float scale, Vector2 offset)
|
||||
{
|
||||
RenderThumbs(gd, fx);
|
||||
D.UiScale = scale;
|
||||
var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
|
||||
|
||||
@@ -136,6 +144,37 @@ namespace GladiatorIdle.Arena
|
||||
sb.End();
|
||||
}
|
||||
|
||||
/// Vorschaubilder neu rendern, wenn Klasse oder Farbe gewechselt hat (in eigene Bildflächen,
|
||||
/// danach zurück auf das bisherige Ziel; das wird dabei geleert, darum vor allem anderen).
|
||||
void RenderThumbs(GraphicsDevice gd, BasicEffect fx)
|
||||
{
|
||||
if (_thumbClass != Class || _thumbTint != Tint) _thumbsDirty = true;
|
||||
if (!_thumbsDirty) return;
|
||||
if (!_thumbFigs.TryGetValue(Class, out var figs))
|
||||
{
|
||||
figs = new FighterView[Appearance.PRESETS];
|
||||
for (int p = 1; p <= Appearance.PRESETS; p++) figs[p - 1] = new FighterView(Art.Hero(Class, p), 0, Tint);
|
||||
_thumbFigs[Class] = figs;
|
||||
}
|
||||
var idle = new DuelFighter { IsPlayer = true, Facing = 1, MaxHp = 1, Hp = 1 };
|
||||
var previous = gd.GetRenderTargets();
|
||||
for (int i = 0; i < figs.Length; i++)
|
||||
{
|
||||
if (!figs[i].Is3D) { _thumbs[i] = null; continue; }
|
||||
figs[i].SetModelColor(Tint);
|
||||
figs[i].Update(1 / 60f, 1 / 60f, idle, 0, true);
|
||||
_thumbs[i] ??= new RenderTarget2D(gd, THUMB_W, THUMB_H, false, SurfaceFormat.Color, DepthFormat.Depth24);
|
||||
gd.SetRenderTarget(_thumbs[i]);
|
||||
gd.Clear(Color.Transparent);
|
||||
fx.View = Matrix.CreateTranslation(0, -Stage.FloorY, 0) * Matrix.CreateScale(0.95f) * Matrix.CreateTranslation(THUMB_W / 2f, THUMB_H - 8, 0);
|
||||
fx.Projection = Matrix.CreateOrthographicOffCenter(0, THUMB_W, THUMB_H, 0, 0, 1);
|
||||
figs[i].DrawBody(gd, fx, idle, true);
|
||||
}
|
||||
gd.SetRenderTargets(previous);
|
||||
gd.Clear(Color.Black);
|
||||
_thumbClass = Class; _thumbTint = Tint; _thumbsDirty = false;
|
||||
}
|
||||
|
||||
void DrawNameField(SpriteBatch sb)
|
||||
{
|
||||
var r = new RectangleF(170, 968, 600, 68);
|
||||
@@ -172,7 +211,9 @@ namespace GladiatorIdle.Arena
|
||||
var r = new RectangleF(x0 + (p - 1) * 160, 214, 148, 170);
|
||||
bool sel = Preset == p, hover = _ui.Hover(r);
|
||||
D.Rect(sb, r, new Color(30, 22, 15) * 0.9f);
|
||||
if (Assets.Sprite(Art.Hero(Class, p)) is Texture2D t)
|
||||
if (_thumbs[p - 1] is RenderTarget2D th && !th.IsDisposed)
|
||||
sb.Draw(th, new Rectangle((int)r.X + 2, (int)r.Y + 2, (int)r.Width - 4, (int)r.Height - 4), Color.White);
|
||||
else if (Assets.Sprite(Art.Hero(Class, p)) is Texture2D t)
|
||||
{
|
||||
var painted = Assets.Paint(t, Tint);
|
||||
float k = r.Height * 1.02f / t.Height;
|
||||
|
||||
@@ -54,6 +54,8 @@ namespace GladiatorIdle.Arena
|
||||
public bool InIntro => _phase == Phase.Intro;
|
||||
float _phaseTime, _hitstop, _slowmo, _screenFlash;
|
||||
float _furyDark, _emberIn; // Raserei: Abdunkeln der Arena, Takt der Funken
|
||||
DuelState _pState, _eState; // für Töne beim Zustandswechsel
|
||||
bool _pLanded;
|
||||
Color _flashColor = Color.White;
|
||||
float _pLag = 1, _eLag = 1;
|
||||
double _time;
|
||||
@@ -97,6 +99,7 @@ namespace GladiatorIdle.Arena
|
||||
sl[1].Learned = Duel.Perks.HeavyStrike;
|
||||
sl[2].Learned = Duel.Perks.ShieldWall;
|
||||
SoundManager.StartAmbient(enemy.IsChampion ? "music_champion" : "music_arena");
|
||||
SoundManager.PlayAmbience("amb_crowd"); // Publikum im Hintergrund
|
||||
if (enemy.IsChampion && enemy.NameKey.StartsWith("champion.")) // Geschichte, kein Effekt: auch bei "Effekte reduzieren"
|
||||
{
|
||||
string clip = "champintro_" + enemy.NameKey["champion.".Length..];
|
||||
@@ -161,8 +164,9 @@ namespace GladiatorIdle.Arena
|
||||
// Anzeige: Abstand um ein Viertel gespreizt (die Figuren sind breiter als ihre Trefferzone)
|
||||
float mid = (float)(Duel.Player.X + Duel.Enemy.X) / 2;
|
||||
float Spread(double x) => mid + ((float)x - mid) * SPREAD;
|
||||
if (_pv.Update(dt, realDt, Duel.Player, Spread(Duel.Player.X), _calm)) _fx.Dust(new Vector2(_pv.X, Stage.FloorY), 2, 30, 30, 40);
|
||||
if (_ev.Update(dt, realDt, Duel.Enemy, Spread(Duel.Enemy.X), _calm)) _fx.Dust(new Vector2(_ev.X, Stage.FloorY), 2, 30, 30, 40);
|
||||
if (_pv.Update(dt, realDt, Duel.Player, Spread(Duel.Player.X), _calm)) { _fx.Dust(new Vector2(_pv.X, Stage.FloorY), 2, 30, 30, 40); SoundManager.PlayStep(); }
|
||||
if (_ev.Update(dt, realDt, Duel.Enemy, Spread(Duel.Enemy.X), _calm)) { _fx.Dust(new Vector2(_ev.X, Stage.FloorY), 2, 30, 30, 40); SoundManager.PlayStep(); }
|
||||
StateSounds();
|
||||
FuryUpdate(realDt);
|
||||
_cam.Update(realDt, _pv.X, _ev.X, _calm);
|
||||
_fx.Motes(_calm ? 0 : 60, Camera.W, Camera.H);
|
||||
@@ -221,6 +225,28 @@ namespace GladiatorIdle.Arena
|
||||
}
|
||||
}
|
||||
|
||||
/// Töne, die an einem Zustandswechsel hängen: Schwung beim Zuschlagen, Ausweichen, Absprung und
|
||||
/// Landung des Sprungangriffs.
|
||||
void StateSounds()
|
||||
{
|
||||
void For(DuelFighter f, ref DuelState last)
|
||||
{
|
||||
if (f.State == last) return;
|
||||
switch (f.State)
|
||||
{
|
||||
case DuelState.Strike: if (f.Heavy) SoundManager.PlaySwingHeavy(); else SoundManager.PlaySwing(); break;
|
||||
case DuelState.Dodge: SoundManager.PlayWhoosh(); break;
|
||||
case DuelState.Leap: SoundManager.PlayWhoosh(); break;
|
||||
}
|
||||
last = f.State;
|
||||
}
|
||||
For(Duel.Player, ref _pState);
|
||||
For(Duel.Enemy, ref _eState);
|
||||
var p = Duel.Player;
|
||||
if (p.State != DuelState.Leap) _pLanded = false;
|
||||
else if (!_pLanded && p.StateTime >= Duel.LEAP_HIT) { _pLanded = true; SoundManager.PlayLand(); _fx.Dust(new Vector2(_pv.X, Stage.FloorY), 10, 80, 40, 70); }
|
||||
}
|
||||
|
||||
static float Lag(float lag, float value, float dt) => lag <= value ? value : MathF.Max(value, lag - dt * 0.6f);
|
||||
|
||||
void Controls(Input i)
|
||||
@@ -258,6 +284,7 @@ namespace GladiatorIdle.Arena
|
||||
_fx.Sparks(at, last ? 110 : 55, new Color(255, 160, 50), target.Facing > 0 ? MathF.PI : 0, last ? MathF.PI : 1.4f, last ? 1700 : 1300);
|
||||
_fx.Dust(new Vector2(targetView.X, Stage.FloorY), last ? 26 : 12, 160, 120, 110);
|
||||
_crowd.Excite(last ? 1 : 0.5f);
|
||||
SoundManager.PlayFire();
|
||||
if (last) { _crowd.Wave(); SoundManager.PlayCheer(); }
|
||||
}
|
||||
bool heavy = e.ByPlayer && (Duel.Player.Heavy || Duel.Player.State is DuelState.Leap or DuelState.Super);
|
||||
@@ -295,7 +322,7 @@ namespace GladiatorIdle.Arena
|
||||
pv.Parried();
|
||||
_crowd.Excite(0.6f);
|
||||
Big(L.t("duel.parry"), new Color(220, 235, 255));
|
||||
SoundManager.PlayBlock(); SoundManager.PlayCheer();
|
||||
SoundManager.PlayParry(); SoundManager.PlayCheer();
|
||||
break;
|
||||
case DuelEventType.Dodged:
|
||||
Float(L.t("duel.dodged"), targetView.Chest - new Vector2(0, 180), D.Sand, 30);
|
||||
@@ -306,6 +333,7 @@ namespace GladiatorIdle.Arena
|
||||
_cam.Shake(0.45f);
|
||||
_fx.Chips(targetView.Front, 12, new Color(140, 110, 80), target.Facing);
|
||||
Big(L.t("duel.guardbreak"), D.Red);
|
||||
SoundManager.PlayGuardBreak();
|
||||
break;
|
||||
case DuelEventType.Special:
|
||||
_cam.Shake(0.3f); _crowd.Excite(0.35f);
|
||||
@@ -327,7 +355,7 @@ namespace GladiatorIdle.Arena
|
||||
_fx.Ring(new Vector2(_pv.X, Stage.FloorY), new Color(255, 120, 30), 1400, 0.8f); // Druckwelle am Boden
|
||||
_fx.Dust(new Vector2(_pv.X, Stage.FloorY), 40, 260, 70, 130);
|
||||
_crowd.Wave(petals: false);
|
||||
SoundManager.PlayLevelUp(); SoundManager.PlayCheer();
|
||||
SoundManager.PlayFury(); SoundManager.PlayCheer();
|
||||
break;
|
||||
case DuelEventType.SuperReady:
|
||||
Float(L.t("duel.super.ready"), _pv.Chest - new Vector2(0, 230), new Color(255, 170, 60), 34);
|
||||
@@ -347,6 +375,7 @@ namespace GladiatorIdle.Arena
|
||||
_fx.Dust(new Vector2(targetView.X, Stage.FloorY), 20, 120, 120, 110);
|
||||
_crowd.Excite(1f);
|
||||
if (e.ByPlayer) _crowd.Wave();
|
||||
SoundManager.PlayKo();
|
||||
if (e.ByPlayer) SoundManager.PlayCheer(); else SoundManager.PlayBoo();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -19,9 +19,13 @@ namespace GladiatorIdle.Arena
|
||||
string _mClip = "";
|
||||
float _mTime, _mBlend = 1;
|
||||
bool _mFree;
|
||||
float _lift; // Höhe über dem Boden (Sprungangriff)
|
||||
|
||||
public bool Is3D => _model != null;
|
||||
|
||||
/// Teamfarbe der 3D-Figur nachträglich ändern (Vorschaubilder der Erstellung).
|
||||
public void SetModelColor(int color) => _model?.SetColor(color);
|
||||
|
||||
void InitModel(int color)
|
||||
{
|
||||
_model = Model3D.Load(_art);
|
||||
@@ -30,6 +34,7 @@ namespace GladiatorIdle.Arena
|
||||
_model ??= Model3D.Load(DefaultModel);
|
||||
// Vorlage mit dunkler Haut, aber noch ohne eigenes Modell: Haut des Ersatzmodells abdunkeln
|
||||
if (!own && _model != null && DarkSkin.Contains(_art)) _model.SetSkin(1);
|
||||
else if (!own && _model != null && _art.StartsWith("hero_") && _art.EndsWith("_3")) _model.SetSkin(-1); // Vorlage 3: helle Haut
|
||||
if (_model == null || _model.Clips.Count == 0) { _model = null; return; }
|
||||
_model.Arm(_art);
|
||||
_model.SetColor(color);
|
||||
@@ -147,7 +152,11 @@ namespace GladiatorIdle.Arena
|
||||
if (name != _mClip) { m.BeginBlend(); _mBlend = 0; _mClip = name; }
|
||||
_mBlend = MathF.Min(1, _mBlend + realDt / 0.12f);
|
||||
_mTime = t;
|
||||
m.Pose(Clip3(name), t, loop, _mBlend, rootY: f.State == DuelState.Leap ? 0.5f : 1);
|
||||
m.Pose(Clip3(name), t, loop, _mBlend, rootY: f.State == DuelState.Leap ? 0.15f : 1);
|
||||
// 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;
|
||||
_lift += (lift - _lift) * MathF.Min(1, realDt * 30);
|
||||
}
|
||||
|
||||
Matrix ModelWorld(float grow)
|
||||
@@ -157,7 +166,7 @@ namespace GladiatorIdle.Arena
|
||||
return _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, 0);
|
||||
* Matrix.CreateTranslation(X + _off * Facing * 0.35f * Stage.Scale, Stage.FloorY - _lift, 0);
|
||||
}
|
||||
|
||||
void DrawModel(GraphicsDevice gd, BasicEffect scene, Color aura, float grow)
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace GladiatorIdle.Arena
|
||||
D.Text(sb, Assets.SansBold, 17, delta, new Vector2(card.Right - 16, y), dc, Align.Right);
|
||||
float by = card.Bottom - 54, bw = (card.Width - 44) / 2;
|
||||
if (_ui.Button(sb, new RectangleF(card.X + 16, by, bw, 42), L.t("char.equip"), size: 18, accent: D.Green))
|
||||
if (_game.Equip(sel.Id)) SoundManager.PlayBlock();
|
||||
if (_game.Equip(sel.Id)) SoundManager.PlayEquip();
|
||||
if (_ui.Button(sb, new RectangleF(card.X + 28 + bw, by, bw, 42), string.Format(L.t("char.sell"), NumberFormat.Format(Items.SellValue(sel))), size: 16))
|
||||
if (_game.Sell(sel.Id)) { SoundManager.PlayCoins(); _sel = null; }
|
||||
}
|
||||
@@ -142,7 +142,7 @@ namespace GladiatorIdle.Arena
|
||||
D.Text(sb, Assets.SansBold, 15, delta, new Vector2(row.Right - 200, row.Y + 22), dc, Align.Right);
|
||||
double price = Items.Value(it);
|
||||
long id = it.Id;
|
||||
if (_ui.Button(sb, new RectangleF(row.Right - 180, row.Y + 24, 166, 48), NumberFormat.Format(price),
|
||||
if (_ui.Button(sb, new RectangleF(row.Right - 180, row.Y + 24, 166, 48), string.Format(L.t("btn.buy"), NumberFormat.Format(price)),
|
||||
_game.Gold >= price && _game.Inventory.Count < Items.INVENTORY, size: 19))
|
||||
if (_game.BuyFromMerchant(id)) { SoundManager.PlayPurchase(); _sel = id; }
|
||||
ry += 104;
|
||||
@@ -161,7 +161,7 @@ namespace GladiatorIdle.Arena
|
||||
D.Text(sb, Assets.SansBold, 20, L.t("slot." + slot.ToString().ToLowerInvariant()), new Vector2(row.X + 100, row.Y + 30), Color.White);
|
||||
D.Text(sb, Assets.Sans, 16, string.Format(L.t("forge.level"), _game.SlotLevels[i]), new Vector2(row.X + 100, row.Y + 60), D.Sand);
|
||||
double cost = _game.UpgradeSlotCost(slot);
|
||||
if (_ui.Button(sb, new RectangleF(row.Right - 180, row.Y + 24, 166, 48), NumberFormat.Format(cost), _game.Gold >= cost, size: 19))
|
||||
if (_ui.Button(sb, new RectangleF(row.Right - 200, row.Y + 24, 186, 48), string.Format(L.t("btn.forge"), NumberFormat.Format(cost)), _game.Gold >= cost, size: 17))
|
||||
if (_game.UpgradeSlot(slot)) SoundManager.PlayLevelUp();
|
||||
}
|
||||
}
|
||||
|
||||
110
Mono/Arena/HubScene.Guide.cs
Normal file
110
Mono/Arena/HubScene.Guide.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
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
|
||||
{
|
||||
/// Anleitung rechts neben jeder Schublade: wofür der Reiter da ist, drei bis vier Schritte, und ein
|
||||
/// Tipp, der zum aktuellen Spielstand passt (was jetzt sinnvoll ist).
|
||||
internal sealed partial class HubScene
|
||||
{
|
||||
static string GuideId(Drawer d) => d switch
|
||||
{
|
||||
Drawer.Gladiator => "gladiator", Drawer.Ludus => "ludus", Drawer.Forum => "forum",
|
||||
Drawer.Skills => "skills", Drawer.Hall => "hall", _ => "expedition"
|
||||
};
|
||||
|
||||
void DrawGuide(SpriteBatch sb, RectangleF r)
|
||||
{
|
||||
string id = GuideId(_drawer);
|
||||
Ui.Panel(sb, r, D.Border, 0.94f);
|
||||
float x = r.X + 26, w = r.Width - 52, y = r.Y + 34;
|
||||
D.Text(sb, Assets.Serif, 28, L.t("guide.title"), new Vector2(x, y), D.Gold);
|
||||
D.TextWrap(sb, Assets.Serif, 19, L.t($"guide.{id}.what"), new RectangleF(x, y + 30, w, 90), D.Sand);
|
||||
y += 128;
|
||||
for (int i = 1; i <= 4; i++)
|
||||
{
|
||||
string key = $"guide.{id}.{i}";
|
||||
string text = L.t(key);
|
||||
if (text == key || text.Length == 0) break; // weniger als vier Schritte
|
||||
var c = new Vector2(x + 16, y + 12);
|
||||
D.Glow(sb, c, new Vector2(40), D.Gold * 0.25f);
|
||||
D.Text(sb, Assets.SansBold, 19, i.ToString(NumberFormat.Culture), c, D.Gold, Align.Center);
|
||||
D.TextWrap(sb, Assets.Sans, 17, text, new RectangleF(x + 44, y, w - 44, 90), Color.White);
|
||||
y += 96;
|
||||
}
|
||||
|
||||
// Tipp zum Spielstand
|
||||
var (tip, accent) = Tip();
|
||||
var tr = new RectangleF(r.X + 16, r.Bottom - 190, r.Width - 32, 172);
|
||||
D.Rect(sb, tr, new Color(46, 34, 18) * 0.95f);
|
||||
D.Frame(sb, tr, accent, 2);
|
||||
D.Text(sb, Assets.SansBold, 18, L.t("guide.tip"), new Vector2(tr.X + 18, tr.Y + 22), accent);
|
||||
D.TextWrap(sb, Assets.Sans, 18, tip, new RectangleF(tr.X + 18, tr.Y + 44, tr.Width - 36, 120), Color.White);
|
||||
}
|
||||
|
||||
/// Der wichtigste nächste Schritt in diesem Reiter.
|
||||
(string, Color) Tip()
|
||||
{
|
||||
var g = _game;
|
||||
switch (_drawer)
|
||||
{
|
||||
case Drawer.Gladiator:
|
||||
{
|
||||
if (g.AttrPoints > 0) return (string.Format(L.t("tip.gladiator.points"), g.AttrPoints), D.Gold);
|
||||
double now = g.Power();
|
||||
var better = g.Inventory.Where(it => g.PowerWith(it) > now * 1.005).OrderByDescending(g.PowerWith).FirstOrDefault();
|
||||
if (better != null) return (string.Format(L.t("tip.gladiator.better"), ItemName(better)), D.Green);
|
||||
if (g.Inventory.Count >= Items.INVENTORY - 4) return (L.t("tip.gladiator.full"), D.Red);
|
||||
return (L.t("tip.gladiator.none"), D.Sand);
|
||||
}
|
||||
case Drawer.Ludus:
|
||||
{
|
||||
var cheapest = UpgradeDef.All.OrderBy(u => g.UpgradeCost(u.Id)).First();
|
||||
double cost = g.UpgradeCost(cheapest.Id);
|
||||
return g.Gold >= cost
|
||||
? (string.Format(L.t("tip.ludus.afford"), L.t(cheapest.Key)), D.Green)
|
||||
: (string.Format(L.t("tip.ludus.save"), L.t(cheapest.Key), NumberFormat.Format(cost - g.Gold)), D.Sand);
|
||||
}
|
||||
case Drawer.Forum:
|
||||
{
|
||||
double now = g.Power();
|
||||
var buy = g.Merchant.Where(it => g.Gold >= Items.Value(it) && g.PowerWith(it) > now * 1.005)
|
||||
.OrderByDescending(g.PowerWith).FirstOrDefault();
|
||||
if (buy != null)
|
||||
return (string.Format(L.t("tip.forum.buy"), ItemName(buy), NumberFormat.Percent(g.PowerWith(buy) / now - 1)), D.Green);
|
||||
var slot = Enumerable.Range(0, 5).Select(i => (ItemSlot)i).Where(s => g.Equipped[(int)s] != null)
|
||||
.OrderBy(g.UpgradeSlotCost).FirstOrDefault();
|
||||
if (g.Equipped[(int)slot] != null && g.Gold >= g.UpgradeSlotCost(slot))
|
||||
return (string.Format(L.t("tip.forum.forge"), L.t("slot." + slot.ToString().ToLowerInvariant())), D.Green);
|
||||
return (string.Format(L.t("tip.forum.wait"), NumberFormat.Duration(g.MerchantRefreshIn)), D.Sand);
|
||||
}
|
||||
case Drawer.Skills:
|
||||
return g.LearnablePoints > 0
|
||||
? (string.Format(L.t("tip.skills.points"), g.LearnablePoints), D.Gold)
|
||||
: (string.Format(L.t("tip.skills.next"), g.CharLevel / 2 * 2 + 2), D.Sand);
|
||||
case Drawer.Hall:
|
||||
{
|
||||
if (g.Legends.Count == 0) return (L.t("tip.hall.none"), D.Sand);
|
||||
var target = g.Legends.Where(l => !g.LegendsBeaten.Contains(l.Number))
|
||||
.OrderByDescending(l => g.DuelRatio(GameState.LegendEnemy(l))).FirstOrDefault();
|
||||
if (target != null && g.DuelRatio(GameState.LegendEnemy(target)) >= 1)
|
||||
return (string.Format(L.t("tip.hall.beatable"), target.Name, GameState.LEGEND_FAVOR), D.Green);
|
||||
int cheapest = Enum.GetValues<God>().Min(god => Gods.Cost(g.GodLevel(god)));
|
||||
if (g.GodFavor >= cheapest) return (string.Format(L.t("tip.hall.favor"), g.GodFavor), D.Purple);
|
||||
return (L.t(target != null ? "tip.hall.later" : "tip.hall.done"), D.Sand);
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (g.Away is { } a) return (string.Format(L.t("tip.exp.away"), NumberFormat.Duration(a.Left)), D.Gold);
|
||||
var safe = RegionDef.All.Where(g.RegionOpen).Where(r => g.ExpeditionChance(r) >= 0.75).LastOrDefault();
|
||||
if (safe != null) return (string.Format(L.t("tip.exp.safe"), L.t(safe.Key)), D.Green);
|
||||
return (L.t("tip.exp.risky"), D.Red);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,9 @@ namespace GladiatorIdle.Arena
|
||||
if (_ui.Button(sb, new RectangleF(r.Center.X + 90, by, 70, 40), "›", _hallPage < pages - 1, size: 24)) _hallPage++; // i18n-ok
|
||||
}
|
||||
|
||||
if (_game.Away != null && list.Count > 0)
|
||||
D.Text(sb, Assets.Sans, 17, L.t("hall.away"), new Vector2(r.Center.X, y + 80 + HALL_ROWS * rowH + 20), D.Red, Align.Center);
|
||||
|
||||
// Götter: Gunst opfern (wirkt auf alle Gladiatoren)
|
||||
float gy = r.Bottom - 2 * 168 - 26 - 30;
|
||||
D.Text(sb, Assets.Serif, 26, L.t("freedom.gods"), new Vector2(x, gy - 26), D.Gold);
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace GladiatorIdle.Arena
|
||||
double _t;
|
||||
Drawer _drawer;
|
||||
float _drawerK; // 0 zu, 1 offen (gleitet)
|
||||
Drawer _drawerSound; // für den Ton beim Öffnen/Wechseln
|
||||
|
||||
// Meldung nach dem Kampf
|
||||
string[] _toast = Array.Empty<string>();
|
||||
@@ -46,6 +47,7 @@ namespace GladiatorIdle.Arena
|
||||
_hero.Preload();
|
||||
_fx.Calm = AppSettings.ReduceMotion;
|
||||
SoundManager.StartAmbient("music_ludus");
|
||||
SoundManager.PlayAmbience("amb_crowd");
|
||||
}
|
||||
|
||||
public void ShowResult(string[] lines, Color color)
|
||||
@@ -76,6 +78,7 @@ namespace GladiatorIdle.Arena
|
||||
_crowd.Update(dt);
|
||||
_fx.Motes(AppSettings.ReduceMotion ? 0 : 50, Camera.W, Camera.H);
|
||||
_fx.Update(dt);
|
||||
if (_drawer != _drawerSound) { _drawerSound = _drawer; SoundManager.PlayDrawer(); }
|
||||
float target = _drawer == Drawer.None ? 0 : 1;
|
||||
_drawerK += (target - _drawerK) * (1 - MathF.Exp(-dt * 14));
|
||||
if (input.Pressed(Microsoft.Xna.Framework.Input.Keys.Escape) && _drawer != Drawer.None) { _drawer = Drawer.None; input.PrevKeys = input.Keys; }
|
||||
@@ -313,9 +316,12 @@ namespace GladiatorIdle.Arena
|
||||
|
||||
void DrawDrawer(SpriteBatch sb)
|
||||
{
|
||||
float w = _drawer == Drawer.Ludus ? 820 : 1300, x = -w + (w + 40) * Ease(_drawerK);
|
||||
var r = new RectangleF(x, 140, w, Camera.H - 260);
|
||||
// alle Reiter gleich: Inhalt links (1300 breit), Anleitung rechts daneben, beides gleitet herein
|
||||
const float W = 1300, GUIDE = 500;
|
||||
float x = -(W + GUIDE + 20) + (W + GUIDE + 60) * Ease(_drawerK);
|
||||
var r = new RectangleF(x, 140, W, Camera.H - 260);
|
||||
Ui.Panel(sb, r, D.Gold, 0.94f);
|
||||
DrawGuide(sb, new RectangleF(r.Right + 20, r.Y, GUIDE, r.Height));
|
||||
if (_drawer == Drawer.Gladiator) DrawGladiator(sb, r);
|
||||
else if (_drawer == Drawer.Ludus) DrawLudus(sb, r);
|
||||
else if (_drawer == Drawer.Forum) DrawForum(sb, r);
|
||||
@@ -355,7 +361,7 @@ namespace GladiatorIdle.Arena
|
||||
y += 240;
|
||||
if (_ui.Button(sb, new RectangleF(x + 480, y - 22, 220, 44), L.t("char.equipbest"), size: 18))
|
||||
{
|
||||
if (_game.EquipBest() > 0) SoundManager.PlayPurchase();
|
||||
if (_game.EquipBest() > 0) SoundManager.PlayEquip();
|
||||
}
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
@@ -397,9 +403,9 @@ namespace GladiatorIdle.Arena
|
||||
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);
|
||||
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.Text(sb, Assets.Sans, 15, desc.Length > 52 ? desc[..50] + "…" : desc, new Vector2(row.X + 200, row.Y + 56), D.Dim); // i18n-ok
|
||||
D.TextWrap(sb, Assets.Sans, 17, desc, new RectangleF(row.X + 330, row.Y + 14, row.Width - 330 - 260, 64), D.Dim);
|
||||
double cost = _game.UpgradeCost(u.Id);
|
||||
if (_ui.Button(sb, new RectangleF(row.Right - 200, row.Y + 16, 184, 52), NumberFormat.Format(cost), _game.Gold >= cost, size: 20))
|
||||
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 (_game.Buy(u.Id)) SoundManager.PlayPurchase();
|
||||
y += 92;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace GladiatorIdle.Arena
|
||||
string name = Array.Find(Environment.GetCommandLineArgs(), x => x.StartsWith("--model="))?[8..] ?? "hero_murmillo_1";
|
||||
Model = Model3D.Load(gd, name);
|
||||
Model?.Arm(name);
|
||||
if (Model != null) DevShot.Log($"model3d {name}: {Model.BladeLog}");
|
||||
_backdrop = Assets.Sprite("arena_colosseum", "jpg");
|
||||
_fx = new BasicEffect(gd) { VertexColorEnabled = true, LightingEnabled = true, PreferPerPixelLighting = true };
|
||||
_fx.AmbientLightColor = new Vector3(0.42f, 0.38f, 0.36f);
|
||||
|
||||
@@ -131,6 +131,7 @@ namespace GladiatorIdle
|
||||
{
|
||||
_hub = null; _scene = null; _creator = null; _intro = null; _freedom = null; _board = null; _paused = false; _nextLife = false;
|
||||
_menu = new MenuScene(_game != null, _game?.Freedoms ?? 0);
|
||||
SoundManager.StopAmbience();
|
||||
}
|
||||
|
||||
protected override void OnExiting(object sender, ExitingEventArgs args)
|
||||
@@ -459,7 +460,11 @@ namespace GladiatorIdle
|
||||
if (_devTime > 4.2) Shot("h_forum");
|
||||
if (_devTime > 4.4 && !_shots.Contains("h_skills_open")) { _shots.Add("h_skills_open"); _hub!.DevOpen(4); }
|
||||
if (_devTime > 5.1) Shot("h_skills");
|
||||
if (_devTime > 5.5 && _capture == null) { _hub!.DevOpen(0); var offers = _game!.Offers(); _hub.Chosen = offers[Math.Min(1, offers.Count - 1)]; _devTime = 0; }
|
||||
if (_devTime > 5.3 && !_shots.Contains("h_hall_tab")) { _shots.Add("h_hall_tab"); _hub!.DevOpen(5); }
|
||||
if (_devTime > 6.0) Shot("h_hall2");
|
||||
if (_devTime > 6.2 && !_shots.Contains("h_exp_tab")) { _shots.Add("h_exp_tab"); _hub!.DevOpen(6); }
|
||||
if (_devTime > 6.9) Shot("h_exp");
|
||||
if (_devTime > 7.3 && _capture == null) { _hub!.DevOpen(0); var offers = _game!.Offers(); _hub.Chosen = offers[Math.Min(1, offers.Count - 1)]; _devTime = 0; }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -127,12 +127,13 @@ namespace GladiatorIdle.Gfx
|
||||
public Clip? Find(string name) => Clips.Find(c => c.Name == name);
|
||||
|
||||
/// Teamfarbe (Index in Appearance.Colors), -1 = Originalfarben.
|
||||
/// Hautton dunkler (0 = unverändert, 1 = dunkle Haut): für Aussehen-Vorlagen mit dunkler Haut, solange
|
||||
/// Hautton dunkler (0 = unverändert, 1 = dunkle Haut, −1 = helle, blasse Haut): für Aussehen-Vorlagen mit dunkler Haut, solange
|
||||
/// sie das Modell einer anderen Vorlage nutzen. Haut erkannt an Farbton (Orange/Rosa), mittlerer
|
||||
/// Sättigung und Helligkeit — Leder ist dunkler, Metall ungesättigt, Teamfarbe magenta.
|
||||
public void SetSkin(float dark)
|
||||
{
|
||||
if (_texture == null || dark <= 0) return;
|
||||
if (_texture == null || dark == 0) return;
|
||||
bool pale = dark < 0; dark = MathF.Abs(dark); // negativ: hellere, blassere Haut
|
||||
var data = new Color[_texture.Width * _texture.Height];
|
||||
_texture.GetData(data);
|
||||
for (int i = 0; i < data.Length; i++)
|
||||
@@ -148,7 +149,8 @@ namespace GladiatorIdle.Gfx
|
||||
float w = wh * ws * wv * dark;
|
||||
if (w <= 0) continue;
|
||||
// dunkle, warme Haut: Helligkeit stark senken, Sättigung leicht anheben
|
||||
float nv = max * (1 - 0.58f * w), ns = MathF.Min(1, sat * (1 + 0.25f * w));
|
||||
float nv = pale ? MathF.Min(1, max * (1 + 0.16f * w)) : max * (1 - 0.58f * w);
|
||||
float ns = pale ? sat * (1 - 0.35f * w) : MathF.Min(1, sat * (1 + 0.25f * w));
|
||||
float k = nv / max;
|
||||
float nr = r * k, ng = g * k, nb = b * k;
|
||||
float gray = (nr + ng + nb) / 3, boost = ns / MathF.Max(sat, 1e-3f);
|
||||
@@ -390,8 +392,57 @@ namespace GladiatorIdle.Gfx
|
||||
{
|
||||
if (art.Contains("retiarius")) { AddTrident(); AddNet(); }
|
||||
else { AddSword(); AddShield(); }
|
||||
AimBlades();
|
||||
}
|
||||
|
||||
/// Klinge zum Gegner: im Treffermoment des Schlags soll die Waffe so zum Unterarm liegen wie bei den
|
||||
/// Figuren mit sauberem Skelett. Bei manchen Skeletten ist die Hand nach dem Übertragen der
|
||||
/// Bewegungen anders gedreht (Klinge nach hinten oder schräg) – dann wird die Waffe für diese Figur
|
||||
/// einmal so gedreht, dass sie dort liegt, und bleibt in dieser Lage fest an der Hand.
|
||||
void AimBlades()
|
||||
{
|
||||
var clip = Find("slash") ?? (Clips.Count > 0 ? Clips[0] : null);
|
||||
if (clip == null) return;
|
||||
float t = ImpactTime(clip);
|
||||
var keep = (float[])_pose.Clone(); bool posed = _posed;
|
||||
_posed = true;
|
||||
Pose(clip, t, false, 1, true, skin: false);
|
||||
foreach (var p in Props)
|
||||
{
|
||||
if (p.Shield || p.NoAvoid) continue;
|
||||
var m = p.Local * _global[p.Bone];
|
||||
var dir = Vector3.Normalize(new Vector3(m.M11, m.M12, m.M13));
|
||||
var (fa, fu, fs) = ArmFrame(p.Bone);
|
||||
BladeLog = $"blade z {dir.Z:0.00} arm {Vector3.Dot(dir, fa):0.000} up {Vector3.Dot(dir, fu):0.000} side {Vector3.Dot(dir, fs):0.000}"; // i18n-ok
|
||||
// Ziel: Lage wie bei den Figuren mit sauberem Skelett (gemessen an vier Figuren)
|
||||
var target = Vector3.Normalize(fa * 0.31f + fu * 0.36f + fs * 0.88f);
|
||||
float cos = MathHelper.Clamp(Vector3.Dot(dir, target), -1, 1);
|
||||
if (cos < 0.97f)
|
||||
{
|
||||
var axis = Vector3.Cross(dir, target);
|
||||
axis = axis.LengthSquared() > 1e-8f ? Vector3.Normalize(axis) : Vector3.Normalize(new Vector3(m.M21, m.M22, m.M23));
|
||||
var grip = m.Translation;
|
||||
var turn = Matrix.CreateTranslation(-grip) * Matrix.CreateFromAxisAngle(axis, MathF.Acos(cos)) * Matrix.CreateTranslation(grip);
|
||||
p.Local = p.Local * _global[p.Bone] * turn * Matrix.Invert(_global[p.Bone]); // fest zur Hand
|
||||
BladeLog += $" -> {MathHelper.ToDegrees(MathF.Acos(cos)):0} Grad gedreht"; // i18n-ok
|
||||
}
|
||||
}
|
||||
Array.Copy(keep, _pose, keep.Length); _posed = posed; Bones();
|
||||
}
|
||||
|
||||
/// Rahmen am Arm in der jetzigen Haltung: Unterarm-Richtung, oben (Körper), seitlich.
|
||||
(Vector3 A, Vector3 U, Vector3 S) ArmFrame(int hand)
|
||||
{
|
||||
int fore = _parent[hand], hips = Bone("Hips"), head = Bone("Head");
|
||||
var a = Vector3.Normalize(_global[hand].Translation - _global[fore].Translation);
|
||||
var up = _global[head].Translation - _global[hips].Translation;
|
||||
var u = Vector3.Normalize(up - a * Vector3.Dot(up, a));
|
||||
return (a, u, Vector3.Cross(a, u));
|
||||
}
|
||||
|
||||
/// Testläufe: wie die Klinge ausgerichtet wurde.
|
||||
public string BladeLog = "";
|
||||
|
||||
/// Griff in der Faust: x vom kleinen Finger zum Zeigefinger (Waffe), y zur Handfläche, Ursprung im Griff.
|
||||
Matrix Grip(string side)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user