多轮审查和修复

This commit is contained in:
2026-05-12 15:34:08 +08:00
parent f55d2a57c3
commit ebbbb7332e
805 changed files with 838724 additions and 1905 deletions

View File

@@ -0,0 +1,46 @@
using UnityEngine;
using BaseGames.Player;
using BaseGames.Core.Events;
namespace BaseGames.Quest
{
/// <summary>
/// 任务奖励 SO架构 22_QuestChallengeModule §4
/// 由 QuestManager.CompleteQuest() 调用 Apply() 发放奖励。
/// 资产路径: Assets/ScriptableObjects/Quest/Reward_{questId}.asset
/// </summary>
[CreateAssetMenu(menuName = "Quest/Reward")]
public class RewardSO : ScriptableObject
{
public int geo; // Geo 货币奖励
public int soulBonus; // 灵魂槽扩展(+MaxSoulPower
public string[] itemIds; // 物品/护符 ID 列表(通过 InventoryManager 发放)
public int affinityBonus; // 对发布 NPC 的好感度增量(存入 SaveData.World.NpcRelations
public string unlockDialogueKey; // 解锁 NPC 新台词集合 key架构 §4
[Tooltip("是否解锁能力AbilityType 无 None 值,用 bool 标识)")]
public bool unlocksAbility; // ⚠️ AbilityType 无 None用 bool 标识
public AbilityType unlockedAbility; // 仅当 unlocksAbility == true 有效
[Header("物品发放事件")]
[Tooltip("EVT_CollectiblePickup向 QuestManager/EquipmentManager 广播 itemId")]
[SerializeField] private StringEventChannelSO _onCollectiblePickup;
/// <summary>将奖励应用到游戏状态(由 QuestManager.CompleteQuest 调用)。</summary>
public void Apply(PlayerStats player)
{
if (player == null) return;
if (geo > 0) player.AddGeo(geo);
if (soulBonus > 0) player.AddSoulPower(soulBonus);
if (unlocksAbility) player.UnlockAbility(unlockedAbility);
// 通过 EVT_CollectiblePickup 事件频道广播每个物品 ID
if (itemIds != null && _onCollectiblePickup != null)
{
foreach (var id in itemIds)
_onCollectiblePickup.Raise(id);
}
}
}
}