48 lines
1.8 KiB
C#
48 lines
1.8 KiB
C#
using System.Collections.Generic;
|
||
using Cielonos.MainGame.Buffs.Character;
|
||
using Cielonos.MainGame.Inventory;
|
||
using UnityEngine;
|
||
|
||
namespace Cielonos.MainGame
|
||
{
|
||
public partial class SceneSubmodule
|
||
{
|
||
public partial class CityArenaBeginningProcessor
|
||
{
|
||
public void Process()
|
||
{
|
||
if (InfoTransistor.Instance != null)
|
||
{
|
||
ApplyInvincible();
|
||
ApplyStartItems();
|
||
}
|
||
}
|
||
}
|
||
|
||
public partial class CityArenaBeginningProcessor
|
||
{
|
||
private void ApplyInvincible()
|
||
{
|
||
if (InfoTransistor.GetInfo<bool>("ApplyInvincible"))
|
||
{
|
||
new Invincible(99999f).Apply(MainGameManager.Player);
|
||
}
|
||
}
|
||
|
||
private void ApplyStartItems()
|
||
{
|
||
// 1. 获取在上一场景(如 Fortress)触发事件而暂存在 InfoTransistor 中的额外初始装备
|
||
PlayerInventorySaveData saveData = InfoTransistor.GetInfo<PlayerInventorySaveData>("StartInventory");
|
||
if (saveData != null && MainGameManager.Player != null)
|
||
{
|
||
// 2. 应用这些存档数据(注意:ApplySaveData 内部会先调用 ClearInventory 清空所有的默认硬编码装备)
|
||
MainGameManager.Player.inventorySc.ApplySaveData(saveData);
|
||
InfoTransistor.SetInfo<PlayerInventorySaveData>("StartInventory", null);
|
||
|
||
// 3. 存档恢复完毕后,再次追加所有的默认硬编码装备,确保基础物品与事件物品并存
|
||
MainGameManager.Player.inventorySc.GrantInitialEquipments();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} |