Files
grass-cutters/Assets/Scripts/UI/StationScreen.cs
NiemandKG 27d075103b Feedback round: bots that keep working, Sky Mower, calmer HUD, faster menus, new map
- Robot docks and drone pads with no belt ship straight to Earth; robots widen
  their rings up to 4x once everything in reach is mown, travel 2.5x faster
  empty, hoppers 60/150 kg. Drone reach 70 m + 25 m per upgrade.
- New Sky Mower: a big mowing drone on a pad, 91 sectors, flies over the grass.
- Cut paint follows the blade as a strip, no disc ahead of the machine.
- Sector toasts aggregate, chimes and till sounds throttled, toasts moved and
  narrowed.
- Menus no longer rebuild on every money change (price tint follows the
  wallet), scroll position kept.
- Map drawn as one mesh, opens near the player, ME / + / - / GLOBE, scale bar.
- Key-art still (x_key) and -shotsize for the store stills; -demobots test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 15:38:37 +06:00

53 lines
2.3 KiB
C#

using System;
using UnityEngine;
using UnityEngine.UIElements;
namespace GrassCutter
{
/// <summary>The twelve stations with how far each is, and a ticket to the ones you've found.</summary>
public class StationScreen
{
public VisualElement Card { get; }
public StationScreen(VisualElement layer, Action close)
{
Card = UIK.El("card", layer);
Card.pickingMode = PickingMode.Position;
Card.style.width = 620;
var header = UIK.El("card-header", Card);
UIK.Text(Loc.T("STATIONS"), "t-h1 t-dark", header);
UIK.Btn("X", close, "btn btn-red btn-small", header);
var ts = TeamState.Instance;
var me = PlayerAgent.Local;
if (!ts || !me) return;
var list = new ScrollView(ScrollViewMode.Vertical);
list.AddToClassList("tune-list");
Card.Add(list);
int here = Stations.Nearest(me.transform.position);
var up = Planet.Up(me.transform.position);
int hidden = 0;
for (int i = 0; i < Stations.Count; i++)
{
int id = i;
bool open = ts.StationOpen(i);
if (!open) { hidden++; continue; }
var row = UIK.El("tune-row", list.contentContainer);
var names = UIK.El("tune-names", row);
UIK.Text(Stations.Name(i), "t-small t-dark", names, false);
float metres = Mathf.Acos(Mathf.Clamp(Vector3.Dot(up, Stations.Dir(i)), -1f, 1f)) * Planet.Radius;
UIK.Text(Compass.Distance(metres), "tune-effect", names, false);
bool there = i == here;
var go = UIK.Btn(there ? Loc.T("HERE") : UIK.Money(GameDefs.TravelPrice), () =>
{
if (there || !UIK.CanPay(GameDefs.TravelPrice)) { Sfx.Play("error", 0.7f); return; }
ts.TravelRpc(id);
Sfx.Play("cash_register", 0.9f);
close();
}, there ? "btn btn-grey btn-small" : "btn btn-small", row);
if (!there) UIK.Costs(go, GameDefs.TravelPrice);
}
if (hidden > 0) UIK.Text(Loc.F("{0} more out there. Walk up to one and it opens.", hidden), "tune-effect", list.contentContainer, false);
}
}
}