Files
Cielonos/Assets/Scripts/MainGame/Managers/SceneSubmodule/CityArenaBeginningProcessor.cs

48 lines
1.8 KiB
C#
Raw Normal View History

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