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>
This commit is contained in:
@ -86,10 +86,25 @@ namespace GrassCutter
|
||||
|
||||
void OnAnnouncement(string a) => Toast(Loc.Unpack(a), ToastKind.Info);
|
||||
|
||||
// closed sectors add up on one line instead of a toast and a chime each: a tractor closes them back to back
|
||||
Label _closedLine;
|
||||
int _closedCount;
|
||||
double _closedPay;
|
||||
float _closedAt = -99f, _chimeAt = -99f;
|
||||
|
||||
void OnSectorClosed(int id, double pay)
|
||||
{
|
||||
Toast(Loc.F("Sector {0:N0} mown clean! +{1}", id + 1, UIK.Money(pay)), ToastKind.Money);
|
||||
Sfx.Play("perk_unlock", 0.7f);
|
||||
bool fresh = _closedLine == null || _closedLine.parent == null || Time.unscaledTime - _closedAt > 8f;
|
||||
_closedAt = Time.unscaledTime;
|
||||
if (fresh) { _closedCount = 0; _closedPay = 0d; }
|
||||
_closedCount++;
|
||||
_closedPay += pay;
|
||||
string text = _closedCount == 1
|
||||
? Loc.F("Sector {0:N0} mown clean! +{1}", id + 1, UIK.Money(pay))
|
||||
: Loc.F("{0} sectors mown clean +{1}", _closedCount, UIK.Money(_closedPay));
|
||||
if (fresh) _closedLine = Toast(text, ToastKind.Money, 5f);
|
||||
else { _closedLine.text = text; Linger(_closedLine, 5f); }
|
||||
if (Time.unscaledTime - _chimeAt > 45f) { _chimeAt = Time.unscaledTime; Sfx.Play("perk_unlock", 0.3f); }
|
||||
}
|
||||
|
||||
void OnMarkFound(string who, int id, double pay)
|
||||
@ -222,17 +237,26 @@ namespace GrassCutter
|
||||
if (Instance != null) Instance._toasts.Clear();
|
||||
}
|
||||
|
||||
public static void Toast(string text, ToastKind kind = ToastKind.Info)
|
||||
public static void Toast(string text, ToastKind kind = ToastKind.Info) => Instance?.Toast(text, kind, 3.5f);
|
||||
|
||||
/// <summary>A line under the compass, out of the way of the phone and the hands: three at most, gone in a few seconds.</summary>
|
||||
Label Toast(string text, ToastKind kind, float hold)
|
||||
{
|
||||
var h = Instance;
|
||||
if (h == null) return;
|
||||
// don't stack the same message
|
||||
foreach (var c in h._toasts.Children()) if (c is Label l && l.text == text) { UIK.Punch(l, 0.1f); return; }
|
||||
var t = UIK.Text(text, "toast t-body", h._toasts, false);
|
||||
// don't stack the same message: the one showing stays a little longer
|
||||
foreach (var c in _toasts.Children()) if (c is Label l && l.text == text) { Linger(l, hold); return l; }
|
||||
var t = UIK.Text(text, "toast t-body", _toasts, false);
|
||||
t.AddToClassList(kind switch { ToastKind.Good => "toast-good", ToastKind.Warn => "toast-warn", ToastKind.Money => "toast-money", _ => "" });
|
||||
UIK.SlideIn(t, new Vector2(300, 0), 0f, 0.4f);
|
||||
Tween.Delay(t, 4f, () => UIK.Fade(t, 0f, 0.4f, () => t.RemoveFromHierarchy()));
|
||||
while (h._toasts.childCount > 5) h._toasts.RemoveAt(0);
|
||||
UIK.SlideIn(t, new Vector2(0, -24), 0f, 0.3f);
|
||||
Linger(t, hold);
|
||||
while (_toasts.childCount > 3) _toasts.RemoveAt(0);
|
||||
return t;
|
||||
}
|
||||
|
||||
static void Linger(Label t, float hold)
|
||||
{
|
||||
Tween.Kill(t);
|
||||
t.style.opacity = 1f;
|
||||
Tween.Delay(t, hold, () => UIK.Fade(t, 0f, 0.4f, () => t.RemoveFromHierarchy()));
|
||||
}
|
||||
|
||||
public static void OnLocalPlayerSpawned(PlayerAgent p)
|
||||
@ -277,14 +301,33 @@ namespace GrassCutter
|
||||
void OnDeposited(Vector3 at, double pay, double kg)
|
||||
{
|
||||
var ear = CameraFx.Cam ? CameraFx.Cam.transform.position : at;
|
||||
if ((ear - at).sqrMagnitude < 30f * 30f) Sfx.PlayAt("cash_register", at, 0.2f, 1f, 0.08f, 0.35f);
|
||||
FloatText(Loc.F("+{0} · {1} for Earth", UIK.Money(pay), GameDefs.Kilos(kg)), at + Planet.Up(at) * 0.8f, new Color(0.45f, 1f, 0.62f), 0.7f);
|
||||
if (_local != null && (at - _local.transform.position).sqrMagnitude < 196f) Receipt(pay, kg);
|
||||
bool mine = _local != null && (at - _local.transform.position).sqrMagnitude < 196f;
|
||||
// belts and drones hand in all the time: the till rings for your own hand-ins, and then not every second
|
||||
if (mine && Time.unscaledTime - _tillAt > 2.5f && (ear - at).sqrMagnitude < 30f * 30f)
|
||||
{
|
||||
_tillAt = Time.unscaledTime;
|
||||
Sfx.PlayAt("cash_register", at, 0.2f, 1f, 0.08f, 0.35f);
|
||||
}
|
||||
// one number per spot, adding up while it keeps arriving
|
||||
bool same = _floatLine != null && _floatLine.parent != null && Time.unscaledTime - _floatAt < 1.2f && (at - _floatSpot).sqrMagnitude < 64f;
|
||||
if (same) { _floatPay += pay; _floatKg += kg; }
|
||||
else { _floatPay = pay; _floatKg = kg; _floatSpot = at; }
|
||||
_floatAt = Time.unscaledTime;
|
||||
var line = Loc.F("+{0} · {1} for Earth", UIK.Money(_floatPay), GameDefs.Kilos(_floatKg));
|
||||
if (same) _floatLine.text = line;
|
||||
else _floatLine = FloatText(line, at + Planet.Up(at) * 0.8f, new Color(0.45f, 1f, 0.62f), 0.7f);
|
||||
if (mine) Receipt(pay, kg);
|
||||
}
|
||||
|
||||
/// <summary>What the depot took, added up while it keeps arriving.</summary>
|
||||
Label _floatLine;
|
||||
Vector3 _floatSpot;
|
||||
double _floatPay, _floatKg;
|
||||
float _floatAt = -99f, _tillAt = -99f, _tickUntil;
|
||||
|
||||
void Receipt(double pay, double kg)
|
||||
{
|
||||
_tickUntil = Time.unscaledTime + 1.5f;
|
||||
if (Time.unscaledTime - _slipAt > 3f) _slipKg = _slipPay = 0d;
|
||||
_slipAt = Time.unscaledTime;
|
||||
_slipKg += kg;
|
||||
@ -433,7 +476,8 @@ namespace GrassCutter
|
||||
double diff = _targetMoney - _shownMoney;
|
||||
_shownMoney += diff * Mathf.Min(1f, Time.unscaledDeltaTime * 9f);
|
||||
if (System.Math.Abs(_shownMoney - _targetMoney) < 0.02) _shownMoney = _targetMoney;
|
||||
if (diff > 0 && Time.unscaledTime - _lastTick > 0.07f) { _lastTick = Time.unscaledTime; Sfx.Play("coin_tick", 0.09f, 1.2f, 0.1f); }
|
||||
// only while your own hand-in counts up: the robots' and belts' money comes in quietly
|
||||
if (diff > 0 && Time.unscaledTime < _tickUntil && Time.unscaledTime - _lastTick > 0.12f) { _lastTick = Time.unscaledTime; Sfx.Play("coin_tick", 0.07f, 1.2f, 0.1f); }
|
||||
}
|
||||
_money.text = UIK.Money(_shownMoney);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user