Delete dead legacy serialization residue
This commit is contained in:
parent
88af85bddd
commit
e1a8d94f57
4 changed files with 9 additions and 1401 deletions
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
|
@ -1,149 +0,0 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MessagePack;
|
||||
using MessagePack.Formatters;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
public class UnityGameObjectFormatter : IMessagePackFormatter<GameObject>
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
private static Dictionary<GameObject,string> _paths = new Dictionary<GameObject, string>();
|
||||
#endif
|
||||
|
||||
public void Serialize(ref MessagePackWriter writer, GameObject value, MessagePackSerializerOptions options)
|
||||
{
|
||||
if(value==null)
|
||||
writer.WriteNil();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
writer.Write(AssetDatabase.GetAssetPath(value));
|
||||
#else
|
||||
string path;
|
||||
if (!_paths.TryGetValue(value, out path))
|
||||
path = "RUNTIME_SERIALIZER_UNKNOWN_RESOURCE";
|
||||
writer.Write(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
public GameObject Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
|
||||
{
|
||||
var path = reader.ReadString();
|
||||
if (string.IsNullOrEmpty(path)) return null;
|
||||
#if UNITY_EDITOR
|
||||
return AssetDatabase.LoadAssetAtPath<GameObject>(path);
|
||||
#else
|
||||
var resource = Resources.Load<GameObject>(path.Substring("Assets/Resources/".Length).Split('.').First());
|
||||
_paths[resource] = path;
|
||||
return resource;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public class UnityMaterialFormatter : IMessagePackFormatter<Material>
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
private static Dictionary<Material,string> _paths = new Dictionary<Material, string>();
|
||||
#endif
|
||||
|
||||
public void Serialize(ref MessagePackWriter writer, Material value, MessagePackSerializerOptions options)
|
||||
{
|
||||
if(value==null)
|
||||
writer.WriteNil();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
writer.Write(AssetDatabase.GetAssetPath(value));
|
||||
#else
|
||||
string path;
|
||||
if (!_paths.TryGetValue(value, out path))
|
||||
path = "RUNTIME_SERIALIZER_UNKNOWN_RESOURCE";
|
||||
writer.Write(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
public Material Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
|
||||
{
|
||||
var path = reader.ReadString();
|
||||
if (string.IsNullOrEmpty(path)) return null;
|
||||
#if UNITY_EDITOR
|
||||
return AssetDatabase.LoadAssetAtPath<Material>(path);
|
||||
#else
|
||||
var resource = Resources.Load<Material>(path.Substring("Assets/Resources/".Length).Split('.').First());
|
||||
_paths[resource] = path;
|
||||
return resource;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public class UnitySpriteFormatter : IMessagePackFormatter<Sprite>
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
private static Dictionary<Sprite,string> _paths = new Dictionary<Sprite, string>();
|
||||
#endif
|
||||
|
||||
public void Serialize(ref MessagePackWriter writer, Sprite value, MessagePackSerializerOptions options)
|
||||
{
|
||||
if(value==null)
|
||||
writer.WriteNil();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
writer.Write(AssetDatabase.GetAssetPath(value));
|
||||
#else
|
||||
string path;
|
||||
if (!_paths.TryGetValue(value, out path))
|
||||
path = "RUNTIME_SERIALIZER_UNKNOWN_RESOURCE";
|
||||
writer.Write(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
public Sprite Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
|
||||
{
|
||||
var path = reader.ReadString();
|
||||
if (string.IsNullOrEmpty(path)) return null;
|
||||
#if UNITY_EDITOR
|
||||
return AssetDatabase.LoadAssetAtPath<Sprite>(path);
|
||||
#else
|
||||
var resource = Resources.Load<Sprite>(path.Substring("Assets/Resources/".Length).Split('.').First());
|
||||
_paths[resource] = path;
|
||||
return resource;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public class UnityTexture2DFormatter : IMessagePackFormatter<Texture2D>
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
private static Dictionary<Texture2D,string> _paths = new Dictionary<Texture2D, string>();
|
||||
#endif
|
||||
|
||||
public void Serialize(ref MessagePackWriter writer, Texture2D value, MessagePackSerializerOptions options)
|
||||
{
|
||||
if(value==null)
|
||||
writer.WriteNil();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
writer.Write(AssetDatabase.GetAssetPath(value));
|
||||
#else
|
||||
string path;
|
||||
if (!_paths.TryGetValue(value, out path))
|
||||
path = "RUNTIME_SERIALIZER_UNKNOWN_RESOURCE";
|
||||
writer.Write(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
public Texture2D Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
|
||||
{
|
||||
var path = reader.ReadString();
|
||||
if (string.IsNullOrEmpty(path)) return null;
|
||||
#if UNITY_EDITOR
|
||||
return AssetDatabase.LoadAssetAtPath<Texture2D>(path);
|
||||
#else
|
||||
var resource = Resources.Load<Texture2D>(path.Substring("Assets/Resources/".Length).Split('.').First());
|
||||
_paths[resource] = path;
|
||||
return resource;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,10 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
- Shared domain state is still partly built around `DatabaseEntry`, GUID
|
||||
identity, MessagePack attributes, and static cache references. Newtonsoft,
|
||||
JsonKnownTypes, RethinkDB, LiteNetLib client transport, and the broken
|
||||
`Economy.Shared` wrapper have been removed from live source.
|
||||
`Economy.Shared` wrapper have been removed from live source. The stale
|
||||
`StrategyGameManager.csbak` backup file and unused Unity asset MessagePack
|
||||
formatter classes have also been deleted, so the remaining direct
|
||||
`MessagePackSerializer` calls are the two legacy catalog deserializers.
|
||||
- Local legacy catalog data remains in `GameData/AetherDB.msgpack` and
|
||||
`GameData/NameFile/*.msgpack` as migration/catalog inputs. The old
|
||||
`PlayerSettings.msgpack`, `.loadout`, `.zone`, and
|
||||
|
|
@ -87,8 +90,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
- MessagePack is no longer used as a runtime object-cloning shortcut for
|
||||
`EntitySettings`, and UI/player-settings startup no longer registers the old
|
||||
MessagePack resolver. Resolver registration is confined to legacy catalog
|
||||
deserialization. The slime compute settings path no longer serializes its
|
||||
local parameter struct for change detection.
|
||||
deserialization. Unused Unity asset formatters for GameObject, Material,
|
||||
Sprite, and Texture2D are deleted. The slime compute settings path no longer
|
||||
serializes its local parameter struct for change detection.
|
||||
- The dead story compiled-JSON cache sketch and its SHA helper are deleted;
|
||||
story compilation currently reads Ink source directly until a typed Verse
|
||||
story/cache document exists.
|
||||
|
|
@ -266,6 +270,8 @@ First Aetheria surfaces to publish:
|
|||
their source backing store.
|
||||
- Done: delete legacy catalog backing-store write/realtime APIs.
|
||||
- Done: delete public legacy catalog cache mutation APIs.
|
||||
- Done: delete the stale `StrategyGameManager.csbak` backup source and
|
||||
unused Unity asset MessagePack formatters.
|
||||
- Remaining: delete or quarantine old cache abstractions that no longer
|
||||
protect an invariant once catalog migration has a typed reader.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue