存档完善和修复
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using BaseGames.Core;
|
||||
using BaseGames.Core.Events;
|
||||
@@ -53,18 +52,14 @@ namespace BaseGames.World.Map
|
||||
|
||||
public void OnSave(SaveData data)
|
||||
{
|
||||
data.Map.ExploredRooms ??= new List<string>();
|
||||
data.Map.ExploredRooms.Clear();
|
||||
data.Map.ExploredRooms.AddRange(_exploredRooms);
|
||||
data.Map.MappedRooms ??= new List<string>();
|
||||
data.Map.MappedRooms.Clear();
|
||||
data.Map.MappedRooms.AddRange(_mappedRooms);
|
||||
data.Map.ExploredRooms = new HashSet<string>(_exploredRooms);
|
||||
data.Map.MappedRooms = new HashSet<string>(_mappedRooms);
|
||||
}
|
||||
|
||||
public void OnLoad(SaveData data)
|
||||
{
|
||||
_exploredRooms = new HashSet<string>(data.Map.ExploredRooms ?? new System.Collections.Generic.List<string>());
|
||||
_mappedRooms = new HashSet<string>(data.Map.MappedRooms ?? new System.Collections.Generic.List<string>());
|
||||
_exploredRooms = data.Map.ExploredRooms != null ? new HashSet<string>(data.Map.ExploredRooms) : new HashSet<string>();
|
||||
_mappedRooms = data.Map.MappedRooms != null ? new HashSet<string>(data.Map.MappedRooms) : new HashSet<string>();
|
||||
}
|
||||
|
||||
// ── 事件驱动房间发现 ──────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user