Run Re-Do
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using ProjectM.Simulation;
|
||||
using Unity.Entities;
|
||||
using Unity.NetCode;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ProjectM.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// Client-side meta-purchase sender: a static enqueue (the Step-14 base meta-shop panel / execute_code) drained
|
||||
/// into <see cref="MetaSpendRequest"/> RPCs. Carries only the upgrade ID — the tier is server-computed and the
|
||||
/// server re-validates everything (Staging gate, class mask, MaxTier, prereq, Aether affordability), so a stale
|
||||
/// or forged request is simply dropped. A real QUEUE (unlike the single-slot boon pick) — two rapid clicks on
|
||||
/// two different shop rows must both arrive. Statics reset on play-enter (the stale-bridge hazard).
|
||||
/// </summary>
|
||||
[WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation)]
|
||||
public partial class MetaSpendSendSystem : SystemBase
|
||||
{
|
||||
static readonly Queue<byte> s_Queue = new();
|
||||
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
static void ResetStatics() => s_Queue.Clear();
|
||||
|
||||
/// <summary>Queue a permanent-upgrade purchase by catalog id. The shop row click + execute_code drive this.</summary>
|
||||
public static void RequestPurchase(byte upgradeId) => s_Queue.Enqueue(upgradeId);
|
||||
|
||||
protected override void OnCreate()
|
||||
{
|
||||
RequireForUpdate<NetworkId>();
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
while (s_Queue.Count > 0)
|
||||
{
|
||||
var req = EntityManager.CreateEntity(typeof(MetaSpendRequest), typeof(SendRpcCommandRequest));
|
||||
EntityManager.SetComponentData(req, new MetaSpendRequest { UpgradeId = s_Queue.Dequeue() });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f3197b4ede6dea41a6c4c93ffa51b42
|
||||
Reference in New Issue
Block a user