feat(ui): add persistent bilingual settings and combat HUD

This commit is contained in:
2026-11-12 18:01:54 +08:00
parent 0857e291d5
commit 97fbf187e3
54 changed files with 3046 additions and 52 deletions
+29 -3
View File
@@ -26,6 +26,11 @@ namespace Ironspore
{
get; private set;
}
public int Rounds { get; private set; }
public float ReloadRemaining { get; private set; }
public float SecondaryCooldown => Mathf.Max(0, sideCooldown);
public float Heading => yaw;
public EquipmentDefinition Primary { get; private set; }
GameSession game;
CharacterController motor;
Camera view;
@@ -67,6 +72,13 @@ namespace Ironspore
}
public void ApplyLoadout()
{
var primary = game.Part(0, game.Run.equipment[0]);
if (Primary != primary)
{
Primary = primary;
Rounds = primary.magazineSize;
ReloadRemaining = 0;
}
visual.localScale = game.chassis[game.Run.chassis].modelScale;
}
public void RequireFreshTrigger()
@@ -79,6 +91,12 @@ namespace Ironspore
return;
var frame = game.chassis[game.Run.chassis];
float dt = Time.deltaTime;
if (ReloadRemaining > 0)
{
ReloadRemaining = Mathf.Max(0, ReloadRemaining - dt);
if (ReloadRemaining == 0)
Rounds = Primary.magazineSize;
}
boostCooldown -= dt;
shotCooldown -= dt;
sideCooldown -= dt;
@@ -88,8 +106,10 @@ namespace Ironspore
if (!game.MenuOpen)
{
Vector2 look = game.Action("Look").ReadValue<Vector2>();
yaw += look.x * .105f;
pitch = Mathf.Clamp(pitch - look.y * .105f, -72, 75);
float sensitivity = .105f * game.Settings.LookSensitivity
* (game.Action("Aim").IsPressed() ? game.Settings.AimSensitivity : 1);
yaw += look.x * sensitivity;
pitch = Mathf.Clamp(pitch - look.y * sensitivity, -72, 75);
if (game.Action("View").WasPressedThisFrame())
FirstPerson = !FirstPerson;
if (game.Action("Guard").WasPressedThisFrame() && Energy >= 20)
@@ -139,8 +159,14 @@ namespace Ironspore
{
if (!game.Action("Fire").IsPressed())
freshTrigger = false;
if (!freshTrigger && game.Action("Fire").IsPressed() && shotCooldown <= 0)
if (game.Action("Reload").WasPressedThisFrame() && Rounds < Primary.magazineSize && ReloadRemaining == 0)
ReloadRemaining = Primary.reloadSeconds;
if (!freshTrigger && game.Action("Fire").IsPressed() && shotCooldown <= 0 && ReloadRemaining == 0 && Rounds > 0)
{
Shoot(false);
if (--Rounds == 0)
ReloadRemaining = Primary.reloadSeconds;
}
if (game.Action("Secondary").WasPressedThisFrame() && sideCooldown <= 0 && Energy >= 15)
{
Energy -= 15;