feat(sdk): migrate to EventBus 2.0
Replace the legacy EventBase runtime with generated multi-bus bindings and explicit scheduling. Migrate app, data, network, demo, and mod consumers; add generated network-event registration and owner-scoped mod content overrides.
This commit is contained in:
@@ -69,7 +69,7 @@ namespace ReplacedPerson.Runtime
|
||||
var result = Match.Apply(command);
|
||||
if (result.Accepted && !result.Duplicate)
|
||||
{
|
||||
EventBus.TriggerEvent(new ReplacedCardsCommittedEvent
|
||||
EventBus.Post(new ReplacedCardsCommittedEvent
|
||||
{
|
||||
PlayerIndex = 0,
|
||||
NormalCardIds = submission.NormalCardIds.ToArray(),
|
||||
@@ -87,7 +87,7 @@ namespace ReplacedPerson.Runtime
|
||||
{
|
||||
if (!Content.Current.Cards.ContainsKey(cardId)) throw new ArgumentException("Unknown card: " + cardId);
|
||||
_saveData.CollectedCards.Add(cardId);
|
||||
EventBus.TriggerEvent(new ReplacedRewardEvent { RewardId = cardId });
|
||||
EventBus.Post(new ReplacedRewardEvent { RewardId = cardId });
|
||||
Changed?.Invoke();
|
||||
}
|
||||
|
||||
@@ -106,11 +106,11 @@ namespace ReplacedPerson.Runtime
|
||||
try
|
||||
{
|
||||
await ShrinkSave.SaveSlotAsync(slot, new SaveOptions { SlotName = "被替代之人" });
|
||||
EventBus.TriggerEvent(new ReplacedSaveEvent { Operation = "save", Success = true });
|
||||
EventBus.Post(new ReplacedSaveEvent { Operation = "save", Success = true });
|
||||
}
|
||||
catch
|
||||
{
|
||||
EventBus.TriggerEvent(new ReplacedSaveEvent { Operation = "save", Success = false });
|
||||
EventBus.Post(new ReplacedSaveEvent { Operation = "save", Success = false });
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@@ -120,12 +120,12 @@ namespace ReplacedPerson.Runtime
|
||||
try
|
||||
{
|
||||
await ShrinkSave.LoadSlotAsync(slot);
|
||||
EventBus.TriggerEvent(new ReplacedSaveEvent { Operation = "load", Success = true });
|
||||
EventBus.Post(new ReplacedSaveEvent { Operation = "load", Success = true });
|
||||
Changed?.Invoke();
|
||||
}
|
||||
catch
|
||||
{
|
||||
EventBus.TriggerEvent(new ReplacedSaveEvent { Operation = "load", Success = false });
|
||||
EventBus.Post(new ReplacedSaveEvent { Operation = "load", Success = false });
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ namespace ReplacedPerson.Runtime
|
||||
var before = Match.State.Clone();
|
||||
var result = Match.Apply(command);
|
||||
if (!result.Accepted) throw new InvalidOperationException("AI produced illegal command: " + result.ErrorCode);
|
||||
EventBus.TriggerEvent(new ReplacedCardsCommittedEvent
|
||||
EventBus.Post(new ReplacedCardsCommittedEvent
|
||||
{
|
||||
PlayerIndex = 1,
|
||||
NormalCardIds = submission.NormalCardIds.ToArray(),
|
||||
@@ -194,7 +194,7 @@ namespace ReplacedPerson.Runtime
|
||||
{
|
||||
if (Match == null) return;
|
||||
var state = after ?? Match.State;
|
||||
EventBus.TriggerEvent(new ReplacedMatchPhaseEvent
|
||||
EventBus.Post(new ReplacedMatchPhaseEvent
|
||||
{
|
||||
Round = state.Round,
|
||||
MatchPhase = state.Phase,
|
||||
@@ -204,7 +204,7 @@ namespace ReplacedPerson.Runtime
|
||||
if (before == null || !SameResolution(before.LastResolution, state.LastResolution))
|
||||
foreach (var slot in state.LastResolution)
|
||||
{
|
||||
EventBus.TriggerEvent(new ReplacedDiceEvent
|
||||
EventBus.Post(new ReplacedDiceEvent
|
||||
{
|
||||
Slot = slot.SlotIndex,
|
||||
PlayerOneRoll = slot.PlayerOneRoll,
|
||||
@@ -216,7 +216,7 @@ namespace ReplacedPerson.Runtime
|
||||
{
|
||||
var damage = Math.Max(0, before.Players[i].Health - state.Players[i].Health);
|
||||
if (damage > 0)
|
||||
EventBus.TriggerEvent(new ReplacedDamageEvent { TargetPlayer = i, Amount = damage, RemainingHealth = state.Players[i].Health });
|
||||
EventBus.Post(new ReplacedDamageEvent { TargetPlayer = i, Amount = damage, RemainingHealth = state.Players[i].Health });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ namespace ReplacedPerson.Runtime
|
||||
var target = reward.StartsWith("ornament.", StringComparison.Ordinal) ? _saveData.Ornaments : _saveData.CollectedCards;
|
||||
if (target.Contains(reward)) continue;
|
||||
target.Add(reward);
|
||||
EventBus.TriggerEvent(new ReplacedRewardEvent { RewardId = reward });
|
||||
EventBus.Post(new ReplacedRewardEvent { RewardId = reward });
|
||||
}
|
||||
_saveData.ChapterProgress = Math.Max(_saveData.ChapterProgress, ActiveEnemyId == "greed.full" ? 2 : 1);
|
||||
_saveData.RecentReplay = Match.Replay.Select(value => value.Clone()).ToList();
|
||||
|
||||
Reference in New Issue
Block a user