diff --git a/Assets/Plugins/Editor/Vexe/Drawers/API/Core/MethodDrawer.cs b/Assets/Plugins/Editor/Vexe/Drawers/API/Core/MethodDrawer.cs index 2db39b3..2d3a094 100644 --- a/Assets/Plugins/Editor/Vexe/Drawers/API/Core/MethodDrawer.cs +++ b/Assets/Plugins/Editor/Vexe/Drawers/API/Core/MethodDrawer.cs @@ -1,8 +1,8 @@ //#define DBG using System; -using System.Reflection; using System.Collections; +using System.Reflection; using UnityEngine; using Vexe.Editor.GUIs; using Vexe.Editor.Types; @@ -11,9 +11,8 @@ using Vexe.Runtime.Types; using UnityObject = UnityEngine.Object; -namespace Vexe.Editor.Drawers -{ - public class MethodDrawer +namespace Vexe.Editor.Drawers { + public class MethodDrawer { private EditorMember[] argMembers; private MethodCaller invoke; @@ -51,7 +50,7 @@ public void Initialize(MethodInfo method, object rawTarget, UnityObject unityTar isCoroutine = method.ReturnType == typeof(IEnumerator); - var commentAttr = method.GetCustomAttribute(); + var commentAttr = MemberInfoExtensions.GetCustomAttribute(method); if (commentAttr != null) comment = commentAttr.comment; diff --git a/Assets/Plugins/Editor/Vexe/Drawers/API/Core/RecursiveDrawer.cs b/Assets/Plugins/Editor/Vexe/Drawers/API/Core/RecursiveDrawer.cs index 9bd7983..f850f1d 100644 --- a/Assets/Plugins/Editor/Vexe/Drawers/API/Core/RecursiveDrawer.cs +++ b/Assets/Plugins/Editor/Vexe/Drawers/API/Core/RecursiveDrawer.cs @@ -23,11 +23,11 @@ public class RecursiveDrawer : ObjectDrawer private bool _isToStringImpl; private Type _polymorphicType; private string _nullString; - private Tab[] _tabs; + private Vexe.Editor.Windows.Tab[] _tabs; private Predicate _isDropAccepted; private Func _getDraggedObject; - private Func, Action, string, Tab> _newTypeTab; - private Func, string, Tab> _newUnityTab; + private Func, Action, string, Vexe.Editor.Windows.Tab> _newTypeTab; + private Func, string, Vexe.Editor.Windows.Tab> _newUnityTab; private bool _disablePicker, _autoAlloc; protected override void Initialize() @@ -69,7 +69,7 @@ protected override void Initialize() _isDropAccepted = objs => _getDraggedObject(objs) != null; _newTypeTab = (getValues, create, title) => - new Tab( + new Vexe.Editor.Windows.Tab( @getValues: getValues, @getCurrent: () => { var x = memberValue; return x == null ? null : x.GetType(); }, @setTarget: newType => { if (newType == null) memberValue = memberType.GetDefaultValueEmptyIfString(); else create(newType); }, @@ -78,7 +78,7 @@ protected override void Initialize() ); _newUnityTab = (getValues, title) => - new Tab( + new Vexe.Editor.Windows.Tab( @getValues: getValues, @getCurrent: member.As, @setTarget: member.Set, @@ -89,7 +89,7 @@ protected override void Initialize() int idx = 0; if (memberType.IsInterface) { - _tabs = new Tab[4]; + _tabs = new Vexe.Editor.Windows.Tab[4]; _tabs[idx++] = _newUnityTab(() => UnityObject.FindObjectsOfType() .OfType(memberType) @@ -102,7 +102,7 @@ protected override void Initialize() .Where(t => t.IsA() && !t.IsAbstract) .ToArray(), TryCreateInstanceInGO, "New Behaviour"); } - else _tabs = new Tab[1]; + else _tabs = new Vexe.Editor.Windows.Tab[1]; var systemTypes = ReflectionHelper.GetAllUserTypesOf(memberType) .Where(t => !t.IsA() && !t.IsAbstract) diff --git a/Assets/Plugins/Editor/Vexe/Editors/Internal/CategoryDefinitionResolver.cs b/Assets/Plugins/Editor/Vexe/Editors/Internal/CategoryDefinitionResolver.cs index caa6f69..2d369eb 100644 --- a/Assets/Plugins/Editor/Vexe/Editors/Internal/CategoryDefinitionResolver.cs +++ b/Assets/Plugins/Editor/Vexe/Editors/Internal/CategoryDefinitionResolver.cs @@ -7,8 +7,7 @@ using Vexe.Runtime.Types; using MembersList = System.Collections.Generic.List; -namespace Vexe.Editor.Internal -{ +namespace Vexe.Editor.Internal { /// /// Responsible for the resolution of a category definition (what members are categorized in that cateogry) /// and determining how the members are combined in that category (united or intersected) @@ -29,10 +28,10 @@ public CategoryDefinitionResolver() var output = new MembersList(); output.AddRange(input.Where(m => { - var caetgory = m.GetCustomAttribute(); + var caetgory = MemberInfoExtensions.GetCustomAttribute(m); if (caetgory != null && caetgory.name == def.FullPath) return true; - var show = m.GetCustomAttribute(); + var show = MemberInfoExtensions.GetCustomAttribute(m); return show != null && show.Category == def.FullPath; })); return output; diff --git a/Assets/Plugins/Editor/Vexe/Editors/Internal/ConditionalVisibility.cs b/Assets/Plugins/Editor/Vexe/Editors/Internal/ConditionalVisibility.cs index b0acb44..30785fb 100644 --- a/Assets/Plugins/Editor/Vexe/Editors/Internal/ConditionalVisibility.cs +++ b/Assets/Plugins/Editor/Vexe/Editors/Internal/ConditionalVisibility.cs @@ -18,7 +18,7 @@ public static bool IsVisible(MemberInfo member, object target) { //Debug.Log("Building delegate for conditionally visible member: " + member.Name); - var attr = member.GetCustomAttribute(); + var attr = MemberInfoExtensions.GetCustomAttribute(member); if (attr == null) { _isVisibleCache[member] = AlwaysVisible; diff --git a/Assets/Plugins/Editor/Vexe/Visibility/VisibilityLogic.cs b/Assets/Plugins/Editor/Vexe/Visibility/VisibilityLogic.cs index 6207151..ca5702e 100644 --- a/Assets/Plugins/Editor/Vexe/Visibility/VisibilityLogic.cs +++ b/Assets/Plugins/Editor/Vexe/Visibility/VisibilityLogic.cs @@ -8,8 +8,7 @@ using Vexe.Runtime.Types; using UnityObject = UnityEngine.Object; -namespace Vexe.Editor.Visibility -{ +namespace Vexe.Editor.Visibility { public static class VisibilityLogic { public static readonly VisibilityAttributes Attributes; @@ -36,7 +35,7 @@ static VisibilityLogic() public static float GetMemberDisplayOrder(MemberInfo member) { - var attribute = member.GetCustomAttribute(); + var attribute = MemberInfoExtensions.GetCustomAttribute(member); if (attribute != null && attribute.DisplayOrder.HasValue) return attribute.Order; @@ -60,15 +59,15 @@ public static float GetMemberDisplayOrder(MemberInfo member) public static bool IsVisibleMember(MemberInfo member) { if (member is MethodInfo) - return Attributes.Show.Any(member.IsDefined); + return Attributes.Show.Any((t) => MemberInfoExtensions.IsDefined(member, t)); var field = member as FieldInfo; if (field != null) { - if (Attributes.Hide.Any(field.IsDefined)) + if (Attributes.Hide.Any((t) => MemberInfoExtensions.IsDefined(field, t))) return false; - if (Attributes.Show.Any(field.IsDefined)) + if (Attributes.Show.Any((t) => MemberInfoExtensions.IsDefined(field, t))) return true; if (field.IsDefined()) @@ -78,7 +77,7 @@ public static bool IsVisibleMember(MemberInfo member) } var property = member as PropertyInfo; - if (property == null || Attributes.Hide.Any(property.IsDefined)) + if (property == null || Attributes.Hide.Any((t) => MemberInfoExtensions.IsDefined(property, t))) return false; // accept properties such as transform.position, rigidbody.mass, etc @@ -90,7 +89,7 @@ public static bool IsVisibleMember(MemberInfo member) if (unityProp) return true; - if (Attributes.Show.Any(property.IsDefined)) + if (Attributes.Show.Any((t) => MemberInfoExtensions.IsDefined(property, t))) return true; return false; @@ -103,7 +102,7 @@ public static bool IsVisibleMember(MemberInfo member) public static bool IsSerializableType(Type type) { - if (type.IsPrimitive || type.IsEnum || type == typeof(string) + if (type.GetTypeInfo().IsPrimitive || type.GetTypeInfo().IsEnum || type == typeof(string) || type.IsA() || IsUnityStructType(type)) return true; diff --git a/Assets/Plugins/Vexe/Runtime/FastSave.meta b/Assets/Plugins/Vexe/Runtime/FastSave.meta deleted file mode 100644 index 466c73c..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 04dab809484f7804a85bcfae63c9bdaf -folderAsset: yes -timeCreated: 1434700880 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Core.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Core.meta deleted file mode 100644 index d769462..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Core.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b2b4d9dca5782024a802a69da84ff4f0 -folderAsset: yes -timeCreated: 1436620737 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Core/FSCommon.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Core/FSCommon.cs deleted file mode 100644 index 617a86e..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Core/FSCommon.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using BX20Serializer; -using UnityEngine; -using Vexe.FastSave.Serializers; - -namespace Vexe.FastSave -{ - public static class FSCommon - { - public static readonly BinaryX20 Serializer; - - static FSCommon() - { - BinaryX20.Log = Debug.Log; - - X20Logic.SerializeMemberAttributes = new Type[] { typeof(SaveAttribute) }; - X20Logic.DontSerializeMemberAttributes = new Type[] { typeof(DontSaveAttribute) }; - - Serializer = new BinaryX20(); - - var ecs = new ExplicitComponentSerializer(); - ecs.Add("position", "eulerAngles", "localScale") - .Add("mass", "drag", "isKinematic", "useGravity", "angularDrag", "constraints", "interpolation", "collisionDetectionMode") - .Add("sharedMesh") - .Add("shadowCastingMode", "receiveShadows", "sharedMaterials", "useLightProbes", "reflectionProbeUsage", "probeAnchor") - .Add("shadowCastingMode", "receiveShadows", "sharedMaterials", "useLightProbes", "reflectionProbeUsage", "probeAnchor", "rootBone", "quality", "localBounds", "sharedMesh", "updateWhenOffscreen") - .Add("shadowCastingMode", "receiveShadows", "sharedMaterials", "useLightProbes", "reflectionProbeUsage", "probeAnchor", "time", "startWidth", "endWidth", "autodestruct") - .Add("shadowCastingMode", "receiveShadows", "sharedMaterials", "useLightProbes", "reflectionProbeUsage", "probeAnchor", "cameraVelocityScale", "particleRenderMode", "lengthScale", "velocityScale", "maxParticleSize", "uvAnimationCycles", "uvAnimationXTile", "uvAnimationYTile", "uvTiles") - .Add("doesAnimateColor", "colorAnimation", "worldRotationAxis", "localRotationAxis", "rndForce", "force", "sizeGrow", "damping", "autodestruct") - .Add("fieldOfView", "orthographicSize", "orthographic", "nearClipPlane", "farClipPlane", "backgroundColor", "clearFlags", "rect", "depth", "renderingPath", "hdr", "targetTexture") - .Add("stepOffset", "radius", "height", "center") - .Add("clip", "volume", "pitch", "time", "mute", "playOnAwake", "loop") - .Add("runtimeAnimatorController", "applyRootMotion") - .Add("isTrigger", "center", "size", "sharedMaterial") - .Add("isTrigger", "center", "radius", "height", "direction", "sharedMaterial") - .Add("isTrigger", "convex", "sharedMaterial", "sharedMesh") - .Add("isTrigger", "radius", "center", "sharedMaterial") - .Add("isTrigger", "sharedMaterial", "usedByEffector", "offset", "size") - .Add("isTrigger", "sharedMaterial", "usedByEffector", "offset", "radius") - .Add("isTrigger", "sharedMaterial", "usedByEffector", "offset", "points", "pathCount") - .Add("isTrigger", "sharedMaterial", "usedByEffector", "offset", "points") - .Add("mass", "drag", "angularDrag", "angularVelocity", "gravityScale", "fixedAngle", "isKinematic", "interpolation", "sleepMode", "collisionDetectionMode") - .Add("force", "relativeForce", "torque") - .Add("colliderMask", "forceDirection", "forceMagnitude", "forceVariation", "drag", "angularDrag", "forceTarget") - .Add("colliderMask", "oneWay", "sideFriction", "sideBounce", "sideAngleVariance") - .Add("colliderMask", "forceMagnitude", "forceVariation", "distanceScale", "drag", "angularDrag", "forceSource", "forceTarget", "forceMode") - .Add("colliderMask", "speed", "speedVariation") - .Add("collideConnected", "connectedBody", "connectedAnchor", "anchor", "distance", "maxDistanceOnly") - .Add("collideConnected", "connectedBody", "connectedAnchor", "anchor", "useMotor", "motor", "useLimits", "limits") - .Add("collideConnected", "connectedBody", "connectedAnchor", "anchor", "angle", "useMotor", "motor", "useLimits", "limits") - .Add("collideConnected", "connectedBody", "connectedAnchor", "anchor", "distance", "dampingRatio", "frequency") - .Add("collideConnected", "connectedBody", "connectedAnchor", "anchor", "suspension", "useMotor", "motor"); - - Serializer.AddSerializer(new AssetReferenceSerializer()) - .AddSerializer(new ReflectiveComponentSerializer()) - .AddSerializer(ecs); - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Core/FSCommon.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Core/FSCommon.cs.meta deleted file mode 100644 index 62c89f8..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Core/FSCommon.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 350593525f1638b4bbcc385223e01ecb -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Core/Load.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Core/Load.cs deleted file mode 100644 index ba9538c..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Core/Load.cs +++ /dev/null @@ -1,232 +0,0 @@ -//#define PROFILE -//#define DBG - -using System; -using System.Collections.Generic; -using System.IO; -using BX20Serializer; -using UnityEngine; -using Vexe.FastSave.Serializers; -using Vexe.Runtime.Extensions; -using Vexe.Runtime.Helpers; -using Vexe.Runtime.Types; -using UnityObject = UnityEngine.Object; -using UnityEngine.Assertions; - -namespace Vexe.FastSave -{ - public static class Load - { - public static event Action> OnBeganLoadingMarked; - - public static event Action> OnFinishedLoadingMarked; - - // Stream - #region - public static bool MarkedFromStream(Stream stream) - { -#if DBG - string status = "Began"; -#endif - - try - { - if (stream.Length == 0) - { -#if DBG - Log("Save stream is empty"); -#endif - return false; - } - - var data = Load.ObjectFromStream>(stream); -#if DBG - status = "Loaded marked from stream"; -#endif - var markers = UnityObject.FindObjectsOfType(); - - if (OnBeganLoadingMarked != null) - OnBeganLoadingMarked(data); - - for (int i = 0; i < markers.Length; i++) - { - var marked = markers[i]; - int id = marked.GetPersistentId(); - string serializedState; - if (!data.TryGetValue(id, out serializedState)) - continue; -#if DBG - status = "Loading " + marked.name; -#endif - var bytes = serializedState.GetBytes(); - using (var memory = new MemoryStream(bytes)) - Load.GameObjectFromStream(memory, marked.gameObject); - } - - if (OnFinishedLoadingMarked != null) - OnFinishedLoadingMarked(data); - - return true; - } - catch (Exception e) - { -#if DBG - Log(string.Format("Error ({0}) {1}", status, e.Message)); -#else - Log("Error loading: " + e.Message); -#endif - return false; - } - } - - public static void GameObjectFromStream(Stream stream, GameObject into) - { - GameObjectSerializer.Read(stream, into); - - int numSavedComponents = stream.ReadInt(); - for (int i = 0; i < numSavedComponents; i++) - { - var type = TypeSerializer.Read(stream); - var component = into.GetOrAddComponent(type); - ComponentFromStream(stream, type, component); - } - } - - public static void HierarchyFromStream(Stream stream, GameObject root) - { - var numSavedChildren = stream.ReadInt(); - var children = root.GetComponentsInChildren(); - var newHierarchy = numSavedChildren != children.Length; - - var list = new List>(numSavedChildren); - - if (newHierarchy) - { - GameObjectFromStream(stream, root); - list.Add(ItemTuple.Create(root, 0)); - for (int i = 0; i < numSavedChildren - 1; i++) - { - var depth = stream.ReadInt(); - var go = new GameObject(); - GameObjectFromStream(stream, go); - list.Add(ItemTuple.Create(go, depth)); - } - } - else - { - GameObjectFromStream(stream, root); - list.Add(ItemTuple.Create(root, 0)); - for (int i = 0; i < numSavedChildren - 1; i++) - { - var depth = stream.ReadInt(); - var go = children[i + 1].gameObject; - GameObjectFromStream(stream, go); - list.Add(ItemTuple.Create(go, depth)); - } - } - - // traverse forward - for (int i = 0; i < list.Count; i++) - { - // foreach item going forward, we traverse backwards - // to find the first parent item - var forward = list[i]; - for (int j = i - 1; j >= 0; j--) - { - var backward = list[j]; - if (forward.Item2 == backward.Item2 + 1) - { - //Debug.Log("parenting: " + forward.Item1 + " to: " + backward.Item1); - forward.Item1.transform.SetParent(backward.Item1.transform, true); - break; - } - } - } - } - - public static void ComponentFromStream(Stream stream, Component into) - { - ComponentFromStream(stream, into.GetType(), into); - } - - public static void ComponentFromStream(Stream stream, Type type, Component into) - { - FSCommon.Serializer.Deserialize(stream, type, ref into); - } - - public static T ObjectFromStream(Stream stream) - { - T instance = default(T); - FSCommon.Serializer.Deserialize(stream, typeof(T), ref instance); - return instance; - } - #endregion - - // File - #region - public static bool MarkedFromFile(string path) - { - using (var file = File.OpenRead(path)) - return MarkedFromStream(file); - } - - public static void GameObjectFromFile(string path, GameObject into) - { - using (var file = File.OpenRead(path)) - GameObjectFromStream(file, into); - } - - public static void ComponentFromFile(string path, Component into) - { - using (var file = File.OpenRead(path)) - ComponentFromStream(file, into); - } - - public static void HierarchyFromFile(string path, GameObject root) - { - using (var file = File.OpenRead(path)) - HierarchyFromStream(file, root); - } - #endregion - - // Memory - #region - public static bool MarkedFromMemory(byte[] bytes) - { - using (var memory = new MemoryStream(bytes)) - return MarkedFromStream(memory); - } - - public static void GameObjectFromMemory(byte[] bytes, GameObject into) - { - using (var ms = new MemoryStream(bytes)) - GameObjectFromStream(ms, into); - } - - public static void HierarchyFromMemory(byte[] bytes, GameObject into) - { - using (var ms = new MemoryStream(bytes)) - HierarchyFromStream(ms, into); - } - - public static void ComponentFromMemory(byte[] bytes, Component into) - { - using (var ms = new MemoryStream(bytes)) - ComponentFromStream(ms, into); - } - - public static T ObjectFromMemory(byte[] bytes) - { - using (var ms = new MemoryStream(bytes)) - return ObjectFromStream(ms); - } - #endregion - - static void Log(string msg) - { -#if DBG - Debug.Log(msg); -#endif - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Core/Load.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Core/Load.cs.meta deleted file mode 100644 index e1055ac..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Core/Load.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bde646ba56e4ded46aa1202969c83af8 -timeCreated: 1436621125 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Core/Save.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Core/Save.cs deleted file mode 100644 index 9fbed52..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Core/Save.cs +++ /dev/null @@ -1,242 +0,0 @@ -//#define PROFILE -//#define DBG - -using System; -using System.Collections.Generic; -using System.IO; -using BX20Serializer; -using UnityEngine; -using Vexe.FastSave.Serializers; -using Vexe.Runtime.Extensions; -using UnityObject = UnityEngine.Object; - -namespace Vexe.FastSave -{ - public static class Save - { - public static event Action> OnBeganSavingMarked; - - public static event Action> OnFinishedSavingMarked; - - // Stream - #region - public static bool MarkedToStream(Stream stream) - { -#if DBG - string status = "Began saving"; -#endif - try - { - var markers = UnityObject.FindObjectsOfType(); - var data = new Dictionary(markers.Length); - - if (OnBeganSavingMarked != null) - OnBeganSavingMarked(data); - - using (var memory = new MemoryStream()) - { - for (int i = 0; i < markers.Length; i++) - { - var marker = markers[i]; -#if DBG - status = "Saving " + marker.name; -#endif - Save.GameObjectToStream(memory, marker.gameObject, marker); - - string serializedState = memory.ToArray().GetString(); - int id = marker.GetPersistentId(); - data[id] = serializedState; - - memory.Reset(); - } - } -#if DBG - status = "Saving to stream (" + stream.GetType() + ")"; -#endif - Save.ObjectToStream(stream, data); - - if (OnFinishedSavingMarked != null) - OnFinishedSavingMarked(data); - - return true; - } - catch (Exception e) - { -#if DBG - Log(string.Format("Error ({0}): {1}", status, e.Message)); -#else - Log("Error saving: " + e.Message); -#endif - return false; - } - } - - public static void GameObjectToStream(Stream stream, GameObject value, FSMarker marker) - { - GameObjectSerializer.Write(stream, value); - - var marked = marker.ComponentsToSave; - stream.WriteInt(marked.Count); - for (int i = 0; i < marked.Count; i++) - { - var type = marked[i]; - var component = marker.GetComponent(type); - TypeSerializer.Write(stream, component.GetType()); - ComponentToStream(stream, type, component); - } - } - - public static void GameObjectToStream(Stream stream, GameObject value) - { - var marker = value.GetComponent(); - if (marker != null) - { - GameObjectToStream(stream, value, marker); - } - else - { - GameObjectSerializer.Write(stream, value); - - var components = value.GetAllComponents(); - stream.WriteInt(components.Length); - for (int i = 0; i < components.Length; i++) - { - var component = components[i]; - var type = component.GetType(); - TypeSerializer.Write(stream, type); - ComponentToStream(stream, type, component); - } - } - } - - public static void HierarchyToStream(Stream stream, GameObject root) - { - var children = root.GetComponentsInChildren(); - stream.WriteInt(children.Length); - GameObjectToStream(stream, root); - RecurseHierarchy(stream, root, children, 0); - } - - private static void RecurseHierarchy(Stream stream, GameObject root, Transform[] children, int rootDepth) - { - var rootTransform = root.transform; - for (int i = 0; i < children.Length; i++) - { - var child = children[i]; - if (child.parent == rootTransform) - { - var go = child.gameObject; - var currentDepth = rootDepth + 1; - Log(go + ": " + currentDepth); - stream.WriteInt(currentDepth); - GameObjectToStream(stream, go); - RecurseHierarchy(stream, go, go.GetComponentsInChildren(), currentDepth); - } - } - } - - public static void ComponentToStream(Stream stream, Component value) - { - ComponentToStream(stream, value.GetType(), value); - } - - public static void ComponentToStream(Stream stream, Type type, Component value) - { - FSCommon.Serializer.Serialize(stream, type, value); - } - - public static void ObjectToStream(Stream stream, T value) - { - FSCommon.Serializer.Serialize(stream, value.GetType(), value); - } - #endregion - - // File - #region - public static bool MarkedToFile(string path) - { - using(var file = File.OpenWrite(path)) - return MarkedToStream(file); - } - - public static void ComponentToFile(string path, Component value) - { - using (var file = File.OpenWrite(path)) - ComponentToStream(file, value); - } - - public static void GameObjectToFile(string path, GameObject value) - { - using (var file = File.OpenWrite(path)) - GameObjectToStream(file, value); - } - - public static void HierarchyToFile(string path, GameObject root) - { - using (var file = File.OpenWrite(path)) - HierarchyToStream(file, root); - } - #endregion - - // Memory - #region - public static byte[] ComponentToMemory(Component value) - { - using (var ms = new MemoryStream()) - { - ComponentToStream(ms, value); - return ms.ToArray(); - } - } - - public static byte[] HierarchyToMemory(GameObject root) - { - using (var ms = new MemoryStream()) - { - HierarchyToStream(ms, root); - return ms.ToArray(); - } - } - - public static byte[] GameObjectToMemory(GameObject value) - { - using (var ms = new MemoryStream()) - { - GameObjectToStream(ms, value); - return ms.ToArray(); - } - } - - public static byte[] ObjectToMemory(T value) - { - using (var ms = new MemoryStream()) - { - ObjectToStream(ms, value); - return ms.ToArray(); - } - } - - public static byte[] MarkedToMemory() - { - bool success; - return MarkedToMemory(out success); - } - - public static byte[] MarkedToMemory(out bool success) - { - using(var memory = new MemoryStream()) - { - success = MarkedToStream(memory); - return memory.ToArray(); - } - } - #endregion - - static void Log(string msg) - { -#if DBG - Debug.Log(msg); -#endif - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Core/Save.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Core/Save.cs.meta deleted file mode 100644 index eb9d9e0..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Core/Save.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 60e74e746c690e24e8d1f5328b11034a -timeCreated: 1436621125 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Other.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Other.meta deleted file mode 100644 index 0135859..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Other.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 8282fb442f755764bb5e432da5ce54c7 -folderAsset: yes -timeCreated: 1427900059 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSAttributes.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSAttributes.cs deleted file mode 100644 index 0e94bc8..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSAttributes.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using UnityEngine; - -namespace Vexe.FastSave -{ - /// - /// Annotate a member (field/auto-property) to mark it for saving - /// - public class SaveAttribute : Attribute { } - - /// - /// Annotate a member (field/auto-property) to ignore saving it - /// - public class DontSaveAttribute : Attribute { } -} \ No newline at end of file diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSAttributes.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSAttributes.cs.meta deleted file mode 100644 index 925120c..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSAttributes.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0f62492be51df9a49a0a7befc5f8ee8a -timeCreated: 1427791016 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSExtensions.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSExtensions.cs deleted file mode 100644 index 1827760..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSExtensions.cs +++ /dev/null @@ -1,53 +0,0 @@ -using UnityEngine; -using System.IO; - -namespace Vexe.FastSave -{ - public static class FSExtensions - { - public static void SaveHierarchyToStream(this GameObject root, Stream stream) - { - Save.HierarchyToStream(stream, root); - } - - public static byte[] SaveHierarchyToMemory(this GameObject root) - { - return Save.HierarchyToMemory(root); - } - - public static void LoadHierarchyFromStream(this GameObject into, Stream stream) - { - Load.HierarchyFromStream(stream, into); - } - - public static void SaveToStream(this GameObject value, Stream stream) - { - Save.GameObjectToStream(stream, value); - } - - public static byte[] SaveToMemory(this GameObject value) - { - return Save.GameObjectToMemory(value); - } - - public static void LoadFromMemory(this GameObject into, byte[] bytes) - { - Load.GameObjectFromMemory(bytes, into); - } - - public static void LoadFromStream(this GameObject into, Stream stream) - { - Load.GameObjectFromStream(stream, into); - } - - public static byte[] SaveToMemory(this Component value) - { - return Save.ComponentToMemory(value); - } - - public static void LoadFromMemory(this Component into, byte[] bytes) - { - Load.ComponentFromMemory(bytes, into); - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSExtensions.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSExtensions.cs.meta deleted file mode 100644 index 8c27246..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSExtensions.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9f39395ef16fee346b7be678fabd28cd -timeCreated: 1436699600 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSMarker.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSMarker.cs deleted file mode 100644 index d3821c6..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSMarker.cs +++ /dev/null @@ -1,224 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using Vexe.Runtime.Extensions; -using Vexe.Runtime.Types; - -#if UNITY_EDITOR -using UnityEditor; -using System.Linq; -#endif - -namespace Vexe.FastSave -{ - /// - /// Attach this script to gameObjects that you want to save. - /// You can then explictly specify which components within a gameObject. - /// By default all components are saved. - /// You can use the methods visible in the inspector to mark/unmark children, - /// or apply the current saved components to children. - /// You can also press Alt-Shift-M to quickly add a marker to a selection of gameObjects (Alt-Shift-u) to remove - /// - [ExecuteInEditMode, DisallowMultipleComponent, DefineCategory("Editor", Order = 1)] - public class FSMarker : BaseBehaviour, ISerializationCallbackReceiver - { - [Display(Seq.PerItemRemove | Seq.UniqueItems), - PerItem("ShowType"), ShowType(typeof(Component), FromThisGo = true)] - public List ComponentsToSave - { - set { _TypeList = value; } - get - { - if (_TypeList == null) - { - _TypeList = new List(); -#if UNITY_EDITOR - MarkAllComponentsForSave(); -#endif - } - return _TypeList; - } - } - - [SerializeField, Hide] List _SerializedList = new List(); - [NonSerialized] List _TypeList; - - public void OnBeforeSerialize() - { - _SerializedList.Clear(); - for (int i = 0; i < ComponentsToSave.Count; ) - { - var type = ComponentsToSave[i]; - if (type == null) - { - ComponentsToSave.RemoveAt(i); - continue; - } - _SerializedList.Add(type.AssemblyQualifiedName); - i++; - } - } - - public void OnAfterDeserialize() - { - _TypeList = new List(); - for (int i = 0; i < _SerializedList.Count; i++) - { - string serialized = _SerializedList[i]; - Type type = Type.GetType(serialized); - _TypeList.Add(type); - } - } - - void OnEnable() - { - // Since we're executing in Edit mode, we want to - // make sure our id is assigned so we do a ping - GetPersistentId(); - } - -#if UNITY_EDITOR - const string kMarkSelectionKey = "&#m"; // Alt-Shift-m - const string kUnmarkSelectionKey = "&#u"; // Alt-Shift-u - - /// - /// Marks all the components on this gameObject to be saved - /// - [Show("Editor")] void MarkAllComponentsForSave() - { - ComponentsToSave.Clear(); - ComponentsToSave.AddRange(gameObject.GetAllComponents() - .Where(x => x != null) - .Select(x => x.GetType())); - } - - /// - /// Recursively adds a marker to children - /// - [Show("Editor")] void MarkChildren() - { - var children = gameObject.GetComponentsInChildren(); - for (int i = 0; i < children.Length; i++) - children[i].gameObject.GetOrAddComponent(); - } - - /// - /// Recurisvely removes marker from children - /// - [Show("Editor")] void UnmarkChildren() - { - var children = gameObject.GetComponentsInChildren(); - for (int i = 0; i < children.Length; i++) - { - var child = children[i]; - if (child == transform) continue; - var marker = child.GetComponent(); - if (marker != null) - marker.Destroy(); - } - } - - /// - /// Recurisvely removes marker from this gameObject and children - /// - [Show("Editor")] void UnmarkThisAndChildren() - { - UnmarkChildren(); - EditorApplication.delayCall += this.Destroy; - } - - /// - /// Recurisvely adds a marker to this gameObject's children - /// applying the same ComponentToSave types that are already defined in this marker - /// - [Show("Editor")] void ApplyToChildren() - { - var children = gameObject.GetComponentsInChildren(); - for (int i = 0; i < children.Length; i++) - { - var child = children[i]; - if (child == transform) continue; - var marker = child.gameObject.GetOrAddComponent(); - marker.ComponentsToSave.Clear(); - for (int j = 0; j < ComponentsToSave.Count; j++) - { - var toSave = ComponentsToSave[j]; - if (child.HasComponent(toSave)) - { - marker.ComponentsToSave.Add(toSave); - } - } - } - } - - [MenuItem("Tools/Vexe/FastSave/MarkSelection " + kMarkSelectionKey)] - public static void MarkSelection() - { - var selection = Selection.gameObjects; - - bool markChildren = selection.Any(x => x.transform.childCount > 0) && - EditorUtility.DisplayDialog("Mark children", "Do you want to mark the selected object(s) children as well?", "Yes", "No"); - - foreach (var go in selection) - { - go.GetOrAddComponent(); - if (markChildren) - { - var children = go.GetComponentsInChildren(); - for (int i = 0; i < children.Length; i++) - children[i].GetOrAddComponent(); - } - } - } - - [MenuItem("Tools/Vexe/FastSave/UnmarkSelection " + kUnmarkSelectionKey)] - public static void UnmarkSelection() - { - var selection = Selection.gameObjects; - bool unmarkChildren = selection.Any(x => x.transform.childCount > 0) && - EditorUtility.DisplayDialog("Unmark children", "Do you want to unmark the selected object(s) children as well?", "Yes", "No"); - - foreach (var go in selection) - { - var marker = go.GetComponent(); - if (marker != null) - marker.Destroy(); - - if (unmarkChildren) - { - var children = go.GetComponentsInChildren(); - for (int i = 0; i < children.Length; i++) - children[i].Destroy(); - } - } - } - - static FSMarker() - { - EditorApplication.hierarchyWindowItemOnGUI += OnMarkerGUI; - } - - static void OnMarkerGUI(int id, Rect rect) - { - var go = EditorUtility.InstanceIDToObject(id) as GameObject; - if (go == null) - return; - - var marker = go.GetComponent(); - if (marker == null) - return; - - var color = Color.green; - color.a *= 0.2f; - - rect.x = 0f; - rect.width = EditorGUIUtility.currentViewWidth; - - var prev = GUI.contentColor; - GUI.color = color; - GUI.Box(rect, GUIContent.none); - GUI.color = prev; - } -#endif - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSMarker.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSMarker.cs.meta deleted file mode 100644 index 03b5d34..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSMarker.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 100e8ebedf872b54b93bc241c4dae51d -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSReference.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSReference.cs deleted file mode 100644 index 8674f91..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSReference.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using UnityEngine; -using Vexe.Runtime.Types; - -namespace Vexe.FastSave -{ - [ExecuteInEditMode] - public class FSReference : BaseBehaviour - { - [Display(Dict.HorizontalPairs | Dict.Readonly)] - static readonly ReferenceLookup Lookup = new ReferenceLookup(); - - void OnEnable() - { - Lookup[GetPersistentId()] = gameObject; - } - - void OnDestroy() - { - Lookup.Remove(GetPersistentId()); - } - - public static GameObject Get(int id) - { - return Lookup.ValueOrDefault(id); - } - - public static T Get(int id) where T : Component - { - var go = Get(id); - if (go == null) - return null; - return go.GetComponent(); - } - - [Serializable] - public class ReferenceLookup : SerializableDictionary { } - -#if UNITY_EDITOR - [Show] int Id { get { return GetPersistentId(); } } - - [Show] void Populate() - { - Lookup.Clear(); - var refs = FindObjectsOfType(); - for(int i = 0; i < refs.Length; i++) - Lookup[refs[i].GetPersistentId()] = refs[i].gameObject; - } -#endif - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSReference.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSReference.cs.meta deleted file mode 100644 index e8cae16..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Other/FSReference.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5db7c82b72f30a44081b8ed7827d1c46 -timeCreated: 1436623795 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/README.txt b/Assets/Plugins/Vexe/Runtime/FastSave/README.txt deleted file mode 100644 index e7ab9be..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/README.txt +++ /dev/null @@ -1,186 +0,0 @@ -_________________ -*** Fast.Save *** ------------------ - -* What is it? -- It's a simple and fast runtime saving/loading (80%) solution for Unity Components, GameObjects and other System.Objects as well. -- You could write/read to/from any Stream (File, Memory, etc) -- Could be used to build other systems (persist changes in playmode, clone Components at runtime etc) -- It has a dependency on VFW (runtime extensions/helpers and editor codes) -- Should work on AOT platforms, not tested though - -* What is it NOT? -- A 100% solution -- A generic saving/loading soultion that works *out of the box* for *any game* -- A tool to help artists - -* License? -- MIT - -* Components support? -- Transform, -- Rigidbody, Rigidbody2D, -- MeshFilter, -- Renderers (MeshRenderer, SkinnedMeshRenderer, TrailRenderer, ParticleRenderer) -- Animator, ParticleAnimator, -- Camera, -- CharacterController, -- AudioSource, -- 3D Colliders (BoxCollider, CapsuleCollider, MeshCollider, SphereCollider) -- 2D Colliders (BoxCollider2D, CircleCollider2D, PolygonCollider2D, EdgeCollider2D) -- 2D Effectors (AreaEffector2D, PlatformEffector2D, PointEffector2D, SurfaceEffector2D) -- 2D Joints (DistanceJoint2D, HingeJoint2D, SliderJoint2D, SpringJoint2D, WheelJoint2D) -- ConstantForce2D -- Support to other components is as easy as typing what fields to serialize (by name) in that component. - -* Assets? -- Mesh, AudioClip, Material, PhysicMaterial, PhysicsMaterial2D, Flare, -- GUIStyle, Texture, RuntimeAnimatorController, AnimationClip, -- and pretty much any other type of Asset (TextAsset etc) - -* System.Objects? -- Arrays (1D), Lists, Stacks, Queues, Dictionaries are supported. - -* Polymorphic serialization, Cycle support, serialize by reference, string caching? -- The serializer has two modes: Standard (1) and Minimal (0). By default it's set to 1. - Which means all of these features are enabled. Set the mode to 0 and you'd only get string caching. -- Polymorphic component serialization is supported by default. - To disable: ReflectiveComponentSerializer.SetRTI(false); // don't store runtime type info - -* What's the underlying serializer? -- A home-cooked reflection-based binary serializer: BinaryX 2.0 -- Uses Fast.Reflection (dynamic IL emission to generate getters/setters for fields/properties) - for standalone builds and regular reflection otherwise. - -* Why a home-cooked serializer? -- Excellent learning experience (this is my second serializer :p) -- I like to have total control over my toys. Know all the ins and outs. If there's ever a bug - I can fix it my self, if I ever wanted a new feature I can implement it myself instead of having - to wait for somebody else's reply/permission. -- Most existing serializers don't meet my requirements: Speed, Simplicity and high Customizability. - Take BinaryFormatter for example, it's slow, stores tons of metadata and not customizable (requires Serializable attribute on types) - Take protobuf-net, it's fast but has some limitations I don't like. e.g. serializing nested - generic lists. Not very customizable, requires you to clutter your code with annotations - everywhere, you can't change what attributes to annotate with. You can't change the serializer logic etc. - Other serializers (JSON, etc) are just painfully slow. - -* 2.0? what happened to 1.0? -- That's the genius part, we skip it. Who needs 1.0 if there's 2.0? - -* Usage? -- The public API is split into a 'Save' and 'Load' classes -- You can Save/Load GameObjects, Components, Hierarchy or Marked (a bit on that later) - to/from Stream, Memory and File. So you can say: - Save.[GameObject|Component|Hierarchy|Marked]To[Stream|Memory|File] and - Load.[GameObject|Component|Hierarchy|Marked]From[Stream|Memory|File] - -- When saving, you provide an instance to save, when loading you provide an instance to load 'into' -- Example: - byte[] bytes = Save.GameObjectToMemory(target); - string str = bytes.GetString(); - PlayerPrefs.SetString("Target", str); - // ... - string str = PlayerPrefs.GetString("Target"); - byte[] bytes = str.GetBytes(); - Load.GameObjectFromStream(bytes, target); // load/deserialize 'into' target - - Notes: - 1- GetString and GetBytes are extension methods in System - 2- You can also use the extension methods in FSExtensions.cs so you can say: - byte[] bytes = myGo.SaveToMemory(memoryStream); - 3- You can also save/load system objects, via: Save.ObjectToX and Load.ObjectFromX - -(FSMarker) -- You can selectively mark GameObjects to save/load by adding a FSMarker to them. --- From the marker, you choose what components to save/load within those GameObjects. --- Then you can: - // finds all marked GameObject and save whatever marked components in them - byte[] bytes = Save.MarkedToMemory(); - // loads the saved data into the same marked objects. - // If one of the previously saved marked objects is destroyed, - // its data gets ignored when loading - Load.MarkedFromMemory(bytes); --- There's callbacks for when saving/loading marked objects begins/finishes. - Save.OnBeganSavingMarked, Save.OnFinishedSavingMarked, - Load.OnBeganLoadingMarked and Load.OnFinishedLoadingMarked. - -[Save], [DontSave] -- You can customize the saving/loading of your script fields: --- Public fields/auto-properties in scripts are saved by default. --- Non-public ones are saved only if marked with [Save] --- You can explicitly marked a member not to be saved via [DontSave] --- The reason that we request non-public fields to be marked with [Save], - is because there are instances where you have a field that you care about - saving, but not necessarily 'serialize' for persistency (via SerializeField) - Think of a bomb timer, the timer starts, you save the game in the middle of the timer, - when loading you want the timer to resume where it left off. - In this case you might not be interested in persisting the timer via [SerializeField], - but only in Saving it via [Save] - -(FSReference) -- If you have a script that references an in-scene Component or GameObject - and you want to save that reference, you have to attach a FSReference - to the GameObject your referenced component is attached to - or to the GameObject you're referencing. e.g. - - public class MyScript : MonoBehaviour - { - public GameObject someGo; - public BoxCollider someCollider; - } - - If you wanted to save those references, an FSReference component has to be attached to - the GameObject 'someGo' is referencing, and another on the GameObject 'someCollider' - is attached to. - - Note: You don't have to explicitly add it yourself. When the serializer serializes - a reference that is not a prefab or a component attached to a prefab, - it will automatically add a FSReference if it's not already there. - -(PrefabStorage) -- If you have a script that references a prefab (or a Component that's attached to a prefab) - and you want to save that reference, you have to create a PrefabStorage asset under a Resources - folder and populate it with your prefabs. When you import Fast.Save there should already be - a PrefabStorage under FastSave/Resources. To populate it just click the "Populate" button. - This will look for all the prefabs in your project and add them to the store. - - Now when the serializer comes across a prefab reference, it just looks up its id (index) - from the store and serializes it. When loading, we read the id and get the prefab from - the store at that id number. - -(AssetStorage) -- The point of this system is to let you save/load your game in the most effecient and fastest way - regardless of how it's done. For that reason, Assets (textures, meshes, audio clips etc) are not - serialized in the sense that we get their bytes data. I figured they're already living in the project, - we already have them, so why bother getting their bytes? why not just reference them? - This is that idea of AssetStorage. Similar to PrefabStorage, it stores references to assets. - You don't need to do anything for it to work. Just make sure there's a AssetStorage asset under - a Resources folder. There's already one created for you under FastSave/Resources. - - Notes: - 1- Your store *MUST* be populated before you build your game. Otherwise when you play your bulid - assets not included in the store won't be loaded properly. - To populate the store with the assets you want to save, you just simply play and save the game - from the editor. - 2- The system curretnly uses a single storage for all assets. This is not a problem unless you're - saving *huge* amounts of assets. You probably don't want assets from the first level of your game - to be still loaded at the last one. You can simply work around that by using multiple storages, - maybe each storage stores assets referenced in a single scene, when you're done with that scene, - you clear out its storage. - Multiple-storage solution is not included out of the box in the system as of yet. - Because the most common things to save are position of things, AI states, player data etc. - Even if you had a giant game with tons of assets, do you really want to save all of them? - -* Current limitations: -- Assets (textures, audio clips etc) referenced by components you're saving *must* have unique names -- Components you're saving in GameObjects (via Save.GameObjectToX or Save.MarkedToX or Save.HierarchyToX) - *must* be of unique types i.e. you can't have 2 Rigidbodies on a GameObject you want to save, - or say, X and Y, where both X and Y 'is a' (inherits) Z. -- No interface with other serializers (JSON etc). Just a home-cooked Binary serializer for now. -- No way to extend the system/add support for new component types without modifying existing code -- No versioning/backward type compatibility from the serializer -- No error/status codes returned from the saving/loading methods (will eventually be added but not - sure if it's really necessary for all methods and if it is what is the right approach for it) - -Hope you find it useful! Cheers! -- vexe diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/README.txt.meta b/Assets/Plugins/Vexe/Runtime/FastSave/README.txt.meta deleted file mode 100644 index 1365238..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/README.txt.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 28a28c3b5afcbbc4d86229a2aee6313b -timeCreated: 1436634949 -licenseType: Free -TextScriptImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Resources.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Resources.meta deleted file mode 100644 index 7ac611b..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Resources.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 9397fcbe0e2f06c4899e26f7256fdcd3 -folderAsset: yes -timeCreated: 1427847050 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Resources/AssetStorage.asset b/Assets/Plugins/Vexe/Runtime/FastSave/Resources/AssetStorage.asset deleted file mode 100644 index 44326ad..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Resources/AssetStorage.asset +++ /dev/null @@ -1,39 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 428e6e31139d86442996a24b17eb5f61, type: 3} - m_Name: AssetStorage - m_EditorClassIdentifier: - _id: 7786 - dbg: 0 - Assets: - _Buckets: 06000000050000000100000003000000ffffffffffffffffffffffff - _HashCodes: ed53fd1355382000714001004e12430d7aa41f00e3de1d049450a11d - _Next: ffffffff00000000ffffffffffffffff02000000ffffffff04000000 - _Count: 7 - _Version: 3957 - _FreeList: -1 - _FreeCount: 0 - _Keys: - - Sphere - - Cube - - Red - - Orange - - Blue - - Green - - Yellow - _Values: - - {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} - - {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} - - {fileID: 2100000, guid: 9b9a2a4b9a0d3594f97402a7264ff75a, type: 2} - - {fileID: 2100000, guid: a47bda0e0b731924dbe772fb96d2e08c, type: 2} - - {fileID: 2100000, guid: ba76a0dc5e56cad468e9b2d125d2c1e8, type: 2} - - {fileID: 2100000, guid: 99893584a5be0344da3dff2efd729859, type: 2} - - {fileID: 2100000, guid: 0ccb97ee808ca0c42adab6236b01ccce, type: 2} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Resources/AssetStorage.asset.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Resources/AssetStorage.asset.meta deleted file mode 100644 index a40b5b2..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Resources/AssetStorage.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7e3ac4ca70cc1ec46bf2194c002bae85 -timeCreated: 1435220050 -licenseType: Free -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Resources/PrefabStorage.asset b/Assets/Plugins/Vexe/Runtime/FastSave/Resources/PrefabStorage.asset deleted file mode 100644 index 7041835..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Resources/PrefabStorage.asset +++ /dev/null @@ -1,17 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 51ff9abeff58b4c46968a7987aaa5ca4, type: 3} - m_Name: PrefabStorage - m_EditorClassIdentifier: - _id: -513682 - dbg: 0 - Prefabs: - - {fileID: 106520, guid: 66fbf79b06b9dfe4d953ef8e6884a68e, type: 2} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Resources/PrefabStorage.asset.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Resources/PrefabStorage.asset.meta deleted file mode 100644 index ffc2dcc..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Resources/PrefabStorage.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 27821c709906fc9408990c2935d3e227 -timeCreated: 1436618199 -licenseType: Free -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer.meta deleted file mode 100644 index 8462331..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5778b47557f26f145a77a24289fee77a -folderAsset: yes -timeCreated: 1433513905 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BasicSerializer.dll b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BasicSerializer.dll deleted file mode 100644 index c20198a..0000000 Binary files a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BasicSerializer.dll and /dev/null differ diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BasicSerializer.dll.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BasicSerializer.dll.meta deleted file mode 100644 index 5420ed5..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BasicSerializer.dll.meta +++ /dev/null @@ -1,24 +0,0 @@ -fileFormatVersion: 2 -guid: b22dbea6d3530bb43bf80d12b6e84056 -timeCreated: 1434725567 -licenseType: Free -PluginImporter: - serializedVersion: 1 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - platformData: - Any: - enabled: 1 - settings: {} - Editor: - enabled: 0 - settings: - DefaultValueInitialized: true - WindowsStoreApps: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20.meta deleted file mode 100644 index 1670499..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 14970d99ed7af094b980aac9141d8424 -folderAsset: yes -timeCreated: 1433563718 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/BinaryX20.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/BinaryX20.cs deleted file mode 100644 index a91bd8c..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/BinaryX20.cs +++ /dev/null @@ -1,628 +0,0 @@ -//#define PROFILE -//#define DBG - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; - -/* -* New serializer idea: -- FLEXIBLE (not rigid - can easily adapt to new types) -- EASY TO DEBUG -- uses reflection (the fast one) -- no more IL (except for reflection, that's fine...) -- binary, no parsing -- fast, robust, simple -- customizable (custom serialization logic/attributes etc) -- optional runtimetypeinfo/cycle handling -*/ - -namespace BX20Serializer -{ - public delegate void StrongReader(Stream stream, ref T value); - public delegate void StrongWriter(Stream stream, T value); - - public delegate bool FieldPredicate(FieldInfo field); - public delegate bool PropertyPredicate(PropertyInfo property); - - public class BinaryX20 - { - public static Action Log = delegate { }; - - delegate void SerializeFunction(Stream stream, Type type, object value); - delegate void DeserializeFunction(Stream stream, Type type, ref object instance); - - readonly List _Serializers; - readonly Dictionary _CachedSerializers; - readonly SerializationContext _Ctx; - readonly ReferenceMarker _Marker; - - private SerializeFunction _Serialize; - private DeserializeFunction _Deserialize; - - private int _CurrentRefId; - - /// - /// 1: runtime type info (polymorphic serialization), cycle/serialize by reference, string cache - /// 0: string cache - /// - public void SetMode(int value) - { - if (value == 0) - { - _Serialize = Serialize_Minimal; - _Deserialize = Deserialize_Minimal; - } - else - { - _Serialize = Serialize_Standard; - _Deserialize = Deserialize_Standard; - } - } - - public BinaryX20() - { - _Serializers = new List() - { - PrimitiveSerializer.Instance, - new V2Serializer(), - new V3Serializer(), - new V4Serializer(), - new BoundsSerializer(), - new LayerMaskSerializer(), - new RectSerializer(), - new ArraySerializer(), - new DictionarySerializer(), - new EnumSerializer(), - new CollectionSerializer(), - new TypeSerializer(), - new ReflectiveSerializer(), - }; - - _Ctx = new SerializationContext(this); - _Marker = new ReferenceMarker(); - _CachedSerializers = new Dictionary(); - - SetMode(1); - } - - public BinaryX20 AddSerializer(BaseSerializer serializer) - { - _Serializers.Insert(0, serializer); - return this; - } - - public BinaryX20 AddStrongReflective(string member0, StrongWriter writer, StrongReader reader) - { - _Serializers.Insert(0, new StrongReflectiveSerializer(member0, writer, reader)); - return this; - } - - public BinaryX20 AddStrongArray(StrongWriter write, StrongReader read) - { - _Serializers.Insert(0, new ArraySerializer(write, read)); - return this; - } - - public BinaryX20 AddStrongList(StrongWriter write, StrongReader read) - { - _Serializers.Insert(0, new ListSerializer(write, read)); - return this; - } - - public BinaryX20 AddStrongDictionary(StrongWriter keyWriter, StrongReader keyReader, StrongWriter valueWriter, StrongReader valueReader) - { - _Serializers.Insert(0, new DictionarySerializer(keyWriter, keyReader, valueWriter, valueReader)); - return this; - } - - public void ClearSerializersCache() - { - _CachedSerializers.Clear(); - } - - private BaseSerializer GetSerializer(Type type) - { - BaseSerializer result; - if (!_CachedSerializers.TryGetValue(type, out result)) - { - for (int i = 0; i < _Serializers.Count; i++) - { - var serializer = _Serializers[i]; - if (serializer.Handles(type)) - { - _CachedSerializers[type] = serializer; -#if DBG - Log("Cached serializer for type: " + type.Name + " is: " + serializer.GetType().Name); -#endif - result = serializer; - result.ctx = _Ctx; - break; - } - } - } - return result; - } - - public void Serialize(Stream stream, Type type, object value) - { - Serialize(stream, type, value, null); - } - - public void Serialize(Stream stream, Type type, object value, object ctx) - { - _Ctx.Context = ctx; - { -#if PROFILE - Profiler.BeginSample("Binary: Serializing " + type.Name); -#endif - Serialize_Main(stream, type, value); -#if PROFILE - Profiler.EndSample(); -#endif - } - _Marker.Clear(); - Basic.ClearMarkedStrings(); - } - - public void Serialize_Main(Stream stream, Type type, object value) - { - _Serialize(stream, type, value); - } - - private void Serialize_Minimal(Stream stream, Type type, object value) - { - if (type.IsValueType) - { - // Primitives - { - if (type.IsPrimitive || type == typeof(DateTime)) - { -#if DBG - Log("Writing primitive: " + value + " (" + type.Name + ")"); -#endif - PrimitiveSerializer.Instance.Serialize(stream, type, value); - return; - } - } - - // Structs - { -#if DBG - Log("Writing struct: " + value + " (" + type.Name + ")"); -#endif - var serializer = GetSerializer(type); - serializer.Serialize(stream, type, value); - return; - } - } - - // Reference-types - { -#if DBG - Log("Writing reference type: " + type.Name); -#endif - - if (type == typeof(string)) - { -#if DBG - Log("Writing string: " + value); -#endif - Basic.WriteString(stream, value as string); - return; - } - - if (value == null) - { - // set null flag -#if DBG - Log("Setting null flag"); -#endif - Basic.WriteByte(stream, 1); - return; - } - -#if DBG - Log("Clearing null flag"); -#endif - Basic.WriteByte(stream, 0); // clear null flag - - var serializer = GetSerializer(type); - serializer.Serialize(stream, type, value); - } - } - - private void Serialize_Standard(Stream stream, Type type, object value) - { - if (type.IsValueType) - { - // Primitives - { - if (type.IsPrimitive || type == typeof(DateTime)) - { -#if DBG - Log("Writing primitive: " + type.Name); -#endif - PrimitiveSerializer.Instance.Serialize(stream, type, value); - return; - } - } - - // Structs - { -#if DBG - Log("Writing struct: " + type.Name); -#endif - var serializer = GetSerializer(type); - serializer.Serialize(stream, type, value); - return; - } - } - - if (type == typeof(string)) - { -#if DBG - Log("Writing string: " + value); -#endif - Basic.WriteString(stream, value as string); - return; - } - - // Reference-types - { -#if DBG - Log("Writing refernece type: " + type.Name); -#endif - if (value == null) - { -#if DBG - Log("Setting null flag"); -#endif - // set null flag - Basic.WriteByte(stream, 1); - return; - } -#if DBG - Log("Clearing null flag"); -#endif - Basic.WriteByte(stream, 0); // clear null flag - - int id = _Marker.GetRefId(value); -#if DBG - Log("Writing reference id"); -#endif - Basic.WriteInt(stream, id); - if (_Marker.IsReference(id)) - { - // set isref flag -#if DBG - Log("Setting isref flag"); -#endif - Basic.WriteByte(stream, 1); - return; - } -#if DBG - Log("Clearing isref flag"); -#endif - Basic.WriteByte(stream, 0); // clear isref flag - - _Marker.Mark(value, id); - - var runtimeType = value.GetType(); - if (runtimeType != type) - { - // set rti flag -#if DBG - Log("Setting rti flag. And writing runtime type: " + runtimeType); -#endif - Basic.WriteByte(stream, 1); - TypeSerializer.Write(stream, runtimeType); - } - else // clear rti flag - { -#if DBG - Log("Clearing rti flag"); -#endif - Basic.WriteByte(stream, 0); - } - - var serializer = GetSerializer(runtimeType); -#if DBG - Log("Serializing with: " + serializer.GetType().Name); -#endif - serializer.Serialize(stream, runtimeType, value); - } - } - - public void Deserialize(Stream stream, Type type, ref T instance) - { - object obj = instance; - Deserialize(stream, type, ref obj); - instance = (T)obj; - } - - public T Deserialize(Stream stream) - { - T obj = default(T); - Deserialize(stream, typeof(T), ref obj); - return obj; - } - - public void Deserialize(Stream stream, Type type, ref object instance) - { - Deserialize(stream, type, ref instance, null); - } - - public void Deserialize(Stream stream, Type type, ref object instance, object ctx) - { - _Ctx.Context = ctx; - { - Deserialize_Main(stream, type, ref instance); - } - _Marker.Clear(); - Basic.ClearMarkedStrings(); - } - - public void Deserialize_Main(Stream stream, Type type, ref object instance) - { - _Deserialize(stream, type, ref instance); - } - - private void Deserialize_Minimal(Stream stream, Type type, ref object instance) - { - if (type.IsValueType) - { - // Primitives - { - if (type.IsPrimitive || type == typeof(DateTime)) - { - PrimitiveSerializer.Instance.Deserialize(stream, type, ref instance); -#if DBG - Log("Read primitive: " + instance); -#endif - return; - } - } - // Structs - { - var serializer = GetSerializer(type); - if (instance == null) - instance = serializer.GetInstance(stream, type); - serializer.Deserialize(stream, type, ref instance); -#if DBG - Log("Read struct: " + instance); -#endif - return; - } - } - - // Reference-types - { - if (type == typeof(string)) - { - instance = stream.ReadString(); -#if DBG - Log("Read string: " + instance); -#endif - return; - } - - bool nullFlag = stream.ReadBool(); -#if DBG - Log("Read null flag: " + nullFlag); -#endif - if (nullFlag) - { - instance = null; - return; - } - - var serializer = GetSerializer(type); - if (instance == null) - instance = serializer.GetInstance(stream, type); - serializer.Deserialize(stream, type, ref instance); - } - } - - private void Deserialize_Standard(Stream stream, Type type, ref object instance) - { - if (type.IsValueType) - { - // Primitives - { - if (type.IsPrimitive || type == typeof(DateTime)) - { - PrimitiveSerializer.Instance.Deserialize(stream, type, ref instance); -#if DBG - Log("Read primitive: " + instance + " (" + type.Name + ")"); -#endif - return; - } - } - // Structs - { - var serializer = GetSerializer(type); - if (instance == null) - instance = serializer.GetInstance(stream, type); -#if DBG - Log("Reading struct: " + type.Name + " with: " + serializer.GetType().Name); -#endif - serializer.Deserialize(stream, type, ref instance); -#if DBG - Log("struct value: " + instance); -#endif - return; - } - } - - if (type == typeof(string)) - { - instance = stream.ReadString(); -#if DBG - Log("Read string: " + instance); -#endif - return; - } - - // Reference-types - { -#if DBG - Log("Reading reference type: " + type.Name); -#endif - - bool nullFlag = stream.ReadBool(); -#if DBG - Log("Read null flag: " + nullFlag); -#endif - if (nullFlag) - { - instance = null; - return; - } - - int id = stream.ReadInt(); -#if DBG - Log("Read ref id (int): " + id); -#endif - bool refFlag = stream.ReadBool(); -#if DBG - Log("Read ref flag (bool/byte): " + refFlag); -#endif - if (refFlag) - { - instance = _Marker.GetRef(id); - return; - } - - Type runtimeType; - bool typeInfoFlag = stream.ReadBool(); -#if DBG - Log("Read rti flag: " + typeInfoFlag); -#endif - if (typeInfoFlag) - runtimeType = TypeSerializer.Read(stream); - else - runtimeType = type; - - var serializer = GetSerializer(runtimeType); - - if (instance == null) - { -#if DBG - Log("instance == null - Creating new instance (" + runtimeType + ")"); -#endif - instance = serializer.GetInstance(stream, runtimeType); - } -#if DBG - Log("Marked instance: " + instance + " with id: " + id); -#endif - _Marker.Mark(instance, id); - - _CurrentRefId = id; - - serializer.Deserialize(stream, runtimeType, ref instance); - } - } - - internal void ReMark(object instance) - { - _Marker.Mark(instance, _CurrentRefId); - } - - public string SerializeToString(object value) - { - using (var ms = new MemoryStream()) - { - Serialize(ms, value.GetType(), value, null); - var bytes = ms.ToArray(); - var result = Convert.ToBase64String(bytes); - return result; - } - } - - public T DeserializeFromString(string serializedState) - { - var bytes = Convert.FromBase64String(serializedState); - using (var ms = new MemoryStream(bytes)) - { - T instance = default(T); - Deserialize(ms, typeof(T), ref instance); - return instance; - } - } - - private class ReferenceMarker - { - private int _NextRefId; - - readonly Dictionary _Marked = new Dictionary(); - readonly Dictionary _Ids = new Dictionary(RefComparer.Instance); - - public object GetRef(int id) - { - return _Marked[id]; - } - - public bool IsReference(int objId) - { - return _Marked.ContainsKey(objId); - } - - public void Mark(object obj, int id) - { - _Marked[id] = obj; - } - - public int GetRefId(object obj) - { - int id; - if (!_Ids.TryGetValue(obj, out id)) - { - id = _NextRefId++; - _Ids[obj] = id; - } - return id; - } - - public void Clear() - { - _Marked.Clear(); - _Ids.Clear(); - _NextRefId = 0; - } - - private class RefComparer : IEqualityComparer - { - public static readonly RefComparer Instance = new RefComparer(); - - private RefComparer() - { - } - - new public bool Equals(object x, object y) - { - return x == y; - } - - public int GetHashCode(object obj) - { - return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(obj); - } - } - } - - public class SerializationContext - { - public readonly BinaryX20 Serializer; - - public object Context; - - public SerializationContext(BinaryX20 serializer) - { - this.Serializer = serializer; - } - } - - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/BinaryX20.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/BinaryX20.cs.meta deleted file mode 100644 index db10ac8..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/BinaryX20.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: cc05bf0252c63464496f17b04d7d7581 -timeCreated: 1433651632 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal.meta deleted file mode 100644 index ff72e37..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 3688bebbaf12d774fac3fa513b50d6b0 -folderAsset: yes -timeCreated: 1433563718 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Logic.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Logic.cs deleted file mode 100644 index ebeac9d..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Logic.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System; -using System.Linq; -using System.Reflection; -using UnityEngine; -using UnityObject = UnityEngine.Object; - -namespace BX20Serializer -{ - public static class X20Logic - { - public static Type[] SerializeMemberAttributes; - public static Type[] DontSerializeMemberAttributes; - - public static FieldPredicate IsSerializableFieldPredicate; - public static PropertyPredicate IsSerializablePropertyPredicate; - - public static readonly Func CachedGetSerializableMembers; - - public static bool IsSerializableMember(MemberInfo member) - { - if (member.MemberType == MemberTypes.Method) - return false; - - var field = member as FieldInfo; - if (field != null) - { - if (IsSerializableFieldPredicate != null) - return IsSerializableFieldPredicate(field); - - return DefaultIsSerializableField(field); - } - - var property = member as PropertyInfo; - if (property != null) - { - if (IsSerializablePropertyPredicate != null) - return IsSerializablePropertyPredicate(property); - - return DefaultIsSerializableProperty(property); - } - - return false; - } - - public static Type[] GetSerializableMembersTypes(Type forType) - { - var members = CachedGetSerializableMembers(forType); - var result = X20Reflection.GetMembersTypes(members); - return result; - } - - - static X20Logic() - { - SerializeMemberAttributes = new Type[] { typeof(SerializeField) }; - DontSerializeMemberAttributes = new Type[] { typeof(NonSerializedAttribute) }; - - CachedGetSerializableMembers = new Func(type => - { - var members = X20Reflection.CachedGetMembers(type); - var serializableMembers = members.Where(IsSerializableMember).ToArray(); - return serializableMembers; - }).Memoize(); - } - - - public static bool IsSerializableType(Type type) - { - if (type.IsPrimitive || type.IsEnum || type == typeof(string) - || typeof(UnityObject).IsAssignableFrom(type) - || IsUnityType(type)) - return true; - - if (type.IsArray) - return type.GetArrayRank() == 1 && IsSerializableType(type.GetElementType()); - - if (type.IsInterface) - return true; - - if (NotSupportedTypes.Any(type.IsA)) - return false; - - if (SupportedTypes.Any(type.IsA)) - return true; - - if (type.IsGenericType) - return type.GetGenericArguments().All(IsSerializableType); - - return true; - } - - public static bool DefaultIsSerializableField(FieldInfo field) - { - if (DontSerializeMemberAttributes.Any(field.IsDefined)) - return false; - - if (field.IsLiteral) - return false; - - if (!(field.IsPublic || SerializeMemberAttributes.Any(field.IsDefined))) - return false; - - bool serializable = IsSerializableType(field.FieldType); - return serializable; - } - - public static bool DefaultIsSerializableProperty(PropertyInfo property) - { - if (DontSerializeMemberAttributes.Any(property.IsDefined)) - return false; - - if (!property.IsAutoProperty()) - return false; - - if (!(property.GetGetMethod(true).IsPublic || - property.GetSetMethod(true).IsPublic || - SerializeMemberAttributes.Any(property.IsDefined))) - return false; - - bool serializable = IsSerializableType(property.PropertyType); - return serializable; - } - - public static bool IsUnityType(Type type) - { - for (int i = 0; i < UnityTypes.Length; i++) - if (type == UnityTypes[i]) - return true; - return false; - } - - public static readonly Type[] UnityTypes = - { - typeof(Vector3), - typeof(Vector2), - typeof(Vector4), - typeof(Rect), - typeof(Quaternion), - typeof(Matrix4x4), - typeof(Color), - typeof(Color32), - typeof(LayerMask), - typeof(Bounds) - }; - - public static readonly Type[] NotSupportedTypes = - { - typeof(Delegate) - }; - - public static readonly Type[] SupportedTypes = - { - typeof(Type) - }; - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Logic.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Logic.cs.meta deleted file mode 100644 index b2d69b5..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Logic.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 89b675671a75647449d79a20a9045e33 -timeCreated: 1436615594 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Member.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Member.cs deleted file mode 100644 index 7221ff5..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Member.cs +++ /dev/null @@ -1,247 +0,0 @@ -#if UNITY_EDITOR || UNITY_STANDALONE -#define FAST_REFLECTION -#endif - -using System; -using System.Collections.Generic; -using System.Reflection; -using UnityEngine; -using Vexe.Runtime.Extensions; - -namespace BX20Serializer -{ - public class X20Member - { -#if FAST_REFLECTION - private MemberSetter _setter; - private MemberGetter _getter; -#else - private Action _setter; - private Func _getter; -#endif - public object Target; - - /// - /// The name of the wrapped member - /// - public readonly string Name; - - /// - /// The type of the wrapped member (FieldInfo.FieldType in case of a field, or PropertyInfo.PropertyType in case of a property) - /// - public readonly Type Type; - - /// - /// A reference to the MemberInfo reference of the wrapped member - /// - public readonly MemberInfo Info; - - /// - /// The current value of the member in the current target object - /// - public object Value - { - get - { - return _getter(Target); - } - set - { - try - { -#if FAST_REFLECTION - _setter(ref Target, value); -#else - _setter(Target, value); -#endif - } - catch(InvalidCastException) - { - throw new InvalidCastException("Failed casting: " + value + " to type: " + Type); - } - } - } - - private X20Member(MemberInfo memberInfo, Type memberType, object memberTarget) - { - Info = memberInfo; - Type = memberType; - Target = memberTarget; - Name = memberInfo.Name; - } - - /// - /// Returns false if the field was constant (literal) while setting 'result' to null. - /// Otherwise true while setting result to a new RuntimeMember wrapping the specified field - /// using the appropriate method of building the [s|g]etters (delegates in case of editor/standalone, reflection otherwise) - /// - public static bool TryWrapField(FieldInfo field, object target, out X20Member result) - { - if (field.IsLiteral) - { - result = null; - return false; - } - - result = new X20Member(field, field.FieldType, target); - -#if FAST_REFLECTION - result._setter = field.DelegateForSet(); - result._getter = field.DelegateForGet(); -#else - result._setter = field.SetValue; - result._getter = field.GetValue; -#endif - return true; - } - - /// - /// Returns false if the property isn't readable or if it's an indexer, setting 'result' to null in the process. - /// Otherwise true while setting result to a new RuntimeMember wrapping the specified property - /// using the appropriate method of building the [s|g]etters (delegates in case of editor/standalone, reflection otherwise) - /// Note that readonly properties (getter only) are fine, as the setter will just be an empty delegate doing nothing. - /// - public static bool TryWrapProperty(PropertyInfo property, object target, out X20Member result) - { - if (!property.CanRead || property.IsIndexer()) - { - result = null; - return false; - } - - result = new X20Member(property, property.PropertyType, target); - - if (property.CanWrite) - { -#if FAST_REFLECTION - result._setter = property.DelegateForSet(); -#else - result._setter = (x, y) => property.SetValue(x, y, null); -#endif - } -#if FAST_REFLECTION - else result._setter = delegate(ref object obj, object value) { }; -#else - else result._setter = (x, y) => { }; -#endif - -#if FAST_REFLECTION - result._getter = property.DelegateForGet(); -#else - result._getter = x => property.GetValue(x, null); -#endif - return true; - } - - /// - /// Returns a list of RuntimeMember wrapping whatever is valid from the input members IEnumerable in the specified target - /// - public static List WrapMembers(IEnumerable members, object target) - { - var result = new List(); - foreach (var member in members) - { - var wrapped = WrapMember(member, target); - if (wrapped != null) - result.Add(wrapped); - } - return result; - } - - /// - /// Tries to wrap the specified member. - /// Returns the wrapped result if it succeeds (valid field/property) - /// otherwise null - /// - public static X20Member WrapMember(MemberInfo member, object target) - { - var field = member as FieldInfo; - if (field != null) - { - X20Member wrappedField; - if (X20Member.TryWrapField(field, target, out wrappedField)) - return wrappedField; - } - else - { - var property = member as PropertyInfo; - if (property == null) - return null; - - X20Member wrappedProperty; - if (X20Member.TryWrapProperty(property, target, out wrappedProperty)) - return wrappedProperty; - } - - return null; - } - - /// - /// Allocates a new array wrapping the specified members (not cached) - /// - public static X20Member[] WrapMembers(Type type, params string[] memberNames) - { - //@Todo memoize, somehow... - var result = new X20Member[memberNames.Length]; - int added = 0; - for (int i = 0; i < memberNames.Length; i++) - { - var name = memberNames[i]; - var flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public; - var member = type.GetMemberFromAll(name, flags); - if (member == null) - { - Debug.Log("Couldn't find member: " + name + " inside: " + type.Name); - continue; - } - - var wrapped = WrapMember(member, null); - if (wrapped == null) - { - Debug.Log("Couldn't wrap member: " + name); - continue; - } - - result[added++] = wrapped; - } - - if (added != memberNames.Length) - Array.Resize(ref result, added); - - return result; - } - - private static Func> _cachedWrapMembers; - /// - /// A cached overload of WrapMembers that returns a list of RuntimeMembers with no target specified (null) - /// wrapping whatever valid members there are in the specified type argument - /// (uses cached reflection to get the members) - /// - public static List CachedWrapMembers(Type type) - { - if (_cachedWrapMembers == null) - _cachedWrapMembers = new Func>(x => - { - var members = X20Reflection.CachedGetMembers(x); - return X20Member.WrapMembers(members, null); - }).Memoize(); - return _cachedWrapMembers(type); - } - - public override string ToString() - { - return Type.Name + " " + Name; - } - - public override int GetHashCode() - { - return Info.GetHashCode(); - } - - public override bool Equals(object obj) - { - var member = obj as X20Member; - return member != null && this.Info == member.Info; - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Member.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Member.cs.meta deleted file mode 100644 index 6d31aca..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Member.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ca880b5ba27ec774b9f11b53d2d0629b -timeCreated: 1433651632 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Reflection.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Reflection.cs deleted file mode 100644 index ba3598e..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Reflection.cs +++ /dev/null @@ -1,212 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using UnityEngine; - -namespace BX20Serializer -{ - public static class X20Reflection - { - public static readonly Func CachedGetMembers; - - static X20Reflection() - { - CachedGetMembers = new Func(type => - GetAllMembers(type).ToArray()).Memoize(); - } - - public static MemberInfo GetMemberFromAll(this Type type, string memberName, Type peak, BindingFlags flags) - { - var result = GetAllMembers(type, peak, flags).FirstOrDefault(x => x.Name == memberName); - return result; - } - - public static MemberInfo GetMemberFromAll(this Type type, string memberName, BindingFlags flags) - { - var peak = type.IsA() ? typeof(MonoBehaviour) - : type.IsA() ? typeof(ScriptableObject) - : typeof(object); - - return GetMemberFromAll(type, memberName, peak, flags); - } - - public static IEnumerable GetAllMembers(this Type type, Type peak, BindingFlags flags) - { - if (type == null || type == peak) - return Enumerable.Empty(); - - return type.GetMembers(flags).Concat(GetAllMembers(type.BaseType, peak, flags)); - } - - public static IEnumerable GetAllMembers(this Type type, Type peak) - { - var flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Static; - return GetAllMembers(type, peak, flags); - } - - public static IEnumerable GetAllMembers(this Type type) - { - return GetAllMembers(type, typeof(object)); - } - - public static bool IsIndexer(this PropertyInfo property) - { - return property.GetIndexParameters().Length > 0; - } - - public static Type[] GetGenericArgsInRawParentInterface(this Type type, Type rawParent) - { - if (!rawParent.IsGenericTypeDefinition) - return Type.EmptyTypes; - - var interfaces = type.GetInterfaces(); - var parentInterface = interfaces.FirstOrDefault(x => x.IsGenericType && x.GetGenericTypeDefinition() == rawParent); - if (parentInterface == null) - return Type.EmptyTypes; - - return parentInterface.GetGenericArguments(); - } - - public static Type[] GetGenericArgsInRawParentClass(this Type type, Type rawParent) - { - if (!rawParent.IsGenericTypeDefinition) - return Type.EmptyTypes; - - if (type.IsGenericType && type.GetGenericTypeDefinition() == rawParent) - return type.GetGenericArguments(); - - Type baseType = type.BaseType; - - while (baseType != typeof(object) && baseType.GetGenericTypeDefinition() != rawParent) - baseType = baseType.BaseType; - - return baseType == typeof(object) ? Type.EmptyTypes : baseType.GetGenericArguments(); - } - - public static bool HasConstructor(this Type type) - { - return type.GetConstructor(new Type[] { typeof(T) }) != null; - } - - public static ConstructorInfo GetEmptyConstructor(this Type type) - { - return GetEmptyConstructor(type, "No public empty ctor in type: " + type); - } - - public static ConstructorInfo GetEmptyConstructor(this Type type, string msg) - { - var ctor = type.GetConstructor(Type.EmptyTypes); - if (ctor == null) - throw new Exception(msg); - return ctor; - } - - public static bool IsSubclassOfRawGeneric(this Type toCheck, Type baseType) - { - while (toCheck != typeof(object) && toCheck != null) - { - Type current = toCheck.IsGenericType ? toCheck.GetGenericTypeDefinition() : toCheck; - if (current == baseType) - return true; - toCheck = toCheck.BaseType; - } - return false; - } - - public static bool IsImplementerOfRawGeneric(this Type type, Type baseType) - { - return type.GetInterfaces().Any(interfaceType => - { - var current = interfaceType.IsGenericType ? interfaceType.GetGenericTypeDefinition() : interfaceType; - return current == baseType; - }); - } - - public static Type[] GetMembersTypes(MemberInfo[] members) - { - return members.Select(GetMemberType).ToArray(); - } - - public static MethodInfo GetMethodMarkedWith(this Type type, Type attribute) - { - var methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - var result = methods.FirstOrDefault(x => x.IsDefined(attribute)); - return result; - } - - public static Type GetMemberType(this MemberInfo member) - { - if (member == null) - throw new ArgumentNullException("member"); - - var field = member as FieldInfo; - if (field != null) - return field.FieldType; - - var property = member as PropertyInfo; - if (property != null) - return property.PropertyType; - - throw new NotSupportedException("Unsupported member: " + member.Name); - } - - public static bool IsA(this Type type) - { - return typeof(T).IsAssignableFrom(type); - } - - public static bool IsA(this Type type, Type other) - { - return other.IsAssignableFrom(type); - } - - public static bool IsDefined(this MemberInfo member, Type type) - { - return member.IsDefined(type, false); - } - - public static bool IsAutoProperty(this PropertyInfo property) - { - if (!(property.CanWrite && property.CanWrite)) - return false; - - var flags = BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static; - string compilerGeneratedName = "<" + property.Name + ">"; - return property.DeclaringType.GetFields(flags).Any(f => f.Name.Contains(compilerGeneratedName)); - } - - public static Func Memoize(this Func fn) - { - var dic = new Dictionary(); - return _in => - { - TOut _out; - if (!dic.TryGetValue(_in, out _out)) - { - _out = fn(_in); - dic.Add(_in, _out); - } - return _out; - }; - } - - public static MemberInfo[] GetMembersFromNames(Type type, string[] names) - { - var members = new MemberInfo[names.Length]; - for (int i = 0; i < names.Length; i++) - { - var name = names[i]; - var all = type.GetMember(name); - if (all.Length == 0) - { - Debug.LogError("No member " + name + " found in type " + type.Name); - continue; - } - members[i] = all[0]; - } - return members; - } - - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Reflection.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Reflection.cs.meta deleted file mode 100644 index 4d3852e..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Internal/X20Reflection.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 85c8d5dde46010947869d97d745509e5 -timeCreated: 1433651632 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers.meta deleted file mode 100644 index af26e2b..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 7e4ac6aa3eeda504fa19795d92945ed6 -folderAsset: yes -timeCreated: 1433563718 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ArraySerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ArraySerializer.cs deleted file mode 100644 index 42bc622..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ArraySerializer.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections; -using System.IO; - -namespace BX20Serializer -{ - public class ArraySerializer : BaseSerializer - { - public override bool Handles(Type type) - { - return type.IsArray && type.GetArrayRank() == 1; - } - - public override void Serialize(Stream stream, Type type, object value) - { - var array = value as Array; - var elementType = type.GetElementType(); - stream.WriteInt(array.Length); - for (int i = 0; i < array.Length; i++) - ctx.Serializer.Serialize_Main(stream, elementType, array.GetValue(i)); - } - - public override void Deserialize(Stream stream, Type type, ref object instance) - { - int count = stream.ReadInt(); - if (instance == null || ((Array)instance).Length != count) - { - instance = Array.CreateInstance(type.GetElementType(), count); - ctx.Serializer.ReMark(instance); - } - - var array = instance as IList; - var elementType = type.GetElementType(); - for (int i = 0; i < count; i++) - { - object element = null; - ctx.Serializer.Deserialize_Main(stream, elementType, ref element); - array[i] = element; - } - } - } - - public class ArraySerializer : StrongSerializer - { - public readonly StrongWriter WriteElement; - public readonly StrongReader ReadElement; - - public ArraySerializer(StrongWriter write, StrongReader read) - { - this.WriteElement = write; - this.ReadElement = read; - } - - public override bool Handles(Type type) - { - return type.IsArray && type.GetArrayRank() == 1 && type.GetElementType() == typeof(T); - } - - public override void StrongSerialize(Stream stream, T[] value) - { - stream.WriteInt(value.Length); - for (int i = 0; i < value.Length; i++) - WriteElement(stream, value[i]); - } - - public override void StrongDeserialize(Stream stream, ref T[] instance) - { - int count = stream.ReadInt(); - if (instance == null || instance.Length != count) - { - instance = new T[count]; - ctx.Serializer.ReMark(instance); - } - - for (int i = 0; i < instance.Length; i++) - { - T element = default(T); - ReadElement(stream, ref element); - instance[i] = element; - } - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ArraySerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ArraySerializer.cs.meta deleted file mode 100644 index 5b00622..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ArraySerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4c6945bc6fb964d4c897c2c8ff308648 -timeCreated: 1433651632 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/BaseSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/BaseSerializer.cs deleted file mode 100644 index e90f256..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/BaseSerializer.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.IO; - -namespace BX20Serializer -{ - public abstract class BaseSerializer - { - public BinaryX20.SerializationContext ctx; - - public abstract bool Handles(Type type); - - public abstract void Serialize(Stream stream, Type type, object value); - - public abstract void Deserialize(Stream stream, Type type, ref object instance); - - public virtual object GetInstance(Stream stream, Type type) - { - return null; - } - - public static void Write(Stream stream, int value) - { - Basic.WriteInt(stream, value); - } - - public static void Write(Stream stream, string value) - { - Basic.WriteString(stream, value); - } - - public static void Write(Stream stream, float value) - { - Basic.WriteFloat(stream, value); - } - - public static void Write(Stream stream, bool value) - { - Basic.WriteBool(stream, value); - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/BaseSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/BaseSerializer.cs.meta deleted file mode 100644 index 6e6cccf..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/BaseSerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: aa26299fcd50b30489da37fccf86d1a2 -timeCreated: 1433651632 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/CollectionSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/CollectionSerializer.cs deleted file mode 100644 index 94194e0..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/CollectionSerializer.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using Vexe.Runtime.Extensions; -using Vexe.Runtime.Helpers; - -namespace BX20Serializer -{ - /// - /// Intended mainly for generic: List, Stack, Queue - /// - public class CollectionSerializer : BaseSerializer - { - public override bool Handles(Type type) - { - return type.IsA() && GetAddMethod(type, GetElementType(type)) != null; - } - - public override void Serialize(Stream stream, Type type, object value) - { - var collection = (ICollection)value; - Type elementType = GetElementType(type); - stream.WriteInt(collection.Count); - - foreach (var item in collection) - ctx.Serializer.Serialize_Main(stream, elementType, item); - } - - static object[] addArgs = new object[1]; - - public override void Deserialize(Stream stream, Type type, ref object value) - { - var elementType = GetElementType(type); - var add = GetAddMethod(type, elementType).DelegateForCall(); - var clear = GetClearMethod(type); - clear.Invoke(value); - - int count = stream.ReadInt(); - for (int i = 0; i < count; i++) - { - object item = null; - ctx.Serializer.Deserialize_Main(stream, elementType, ref item); - addArgs[0] = item; - add.Invoke(value, addArgs); - } - } - - public override object GetInstance(Stream stream, Type type) - { - return type.DelegateForCtor().Invoke(null); - } - - static Type GetElementType(Type objectType) - { - if (objectType.HasElementType) - return objectType.GetElementType(); - - Type[] args = objectType.GetGenericArgsInRawParentInterface(typeof(ICollection<>)); - if (args != Type.EmptyTypes) - return args[0]; - - return typeof(object); - } - - static Dictionary _ClearMethods = - new Dictionary(); - - static Dictionary _AddMethods = - new Dictionary(); - - static MethodInfo GetAddMethod(Type collection, Type element) - { - MethodInfo result; - if (!_AddMethods.TryGetValue(collection, out result)) - { - result = - GetAddMethod(collection, element, "Add") ?? - GetAddMethod(collection, element, "Push") ?? - GetAddMethod(collection, element, "Enqueue"); - _AddMethods[collection] = result; - } - - if (result == null) - ErrorHelper.MemberNotFound(collection, "Add/Push/Enqueue"); - - return result; - } - - static MethodInfo GetClearMethod(Type collection) - { - MethodInfo result; - if (!_ClearMethods.TryGetValue(collection, out result)) - _ClearMethods[collection] = result = collection.GetMethod("Clear"); - - if (result == null) - ErrorHelper.MemberNotFound(collection, "Clear"); - - return result; - } - - static MethodInfo GetAddMethod(Type collection, Type element, string methodName) - { - var methods = collection.GetMember(methodName); - for (int i = 0; i < methods.Length; i++) - { - var method = methods[i] as MethodInfo; - if (method == null) - continue; - var prams = method.GetParameters(); - if (prams.Length != 1) - continue; - if (prams[0].ParameterType == element) - return method; - } - return null; - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/CollectionSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/CollectionSerializer.cs.meta deleted file mode 100644 index 967e08c..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/CollectionSerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1bc0f93395952a24c855978801a18b2a -timeCreated: 1433651632 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/DictionarySerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/DictionarySerializer.cs deleted file mode 100644 index 7936484..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/DictionarySerializer.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using Vexe.Runtime.Extensions; - -namespace BX20Serializer -{ - public class DictionarySerializer : BaseSerializer - { - public override bool Handles(Type type) - { - return typeof(IDictionary).IsAssignableFrom(type); - } - - void GetKVTypes(Type type, out Type keyType, out Type valueType) - { - var args = type.GetGenericArgsInRawParentInterface(typeof(IDictionary<,>)); - if (args == Type.EmptyTypes) - keyType = valueType = typeof(object); - else - { - keyType = args[0]; - valueType = args[1]; - } - } - - public override void Serialize(Stream stream, Type type, object value) - { - Type keyType, valueType; - GetKVTypes(type, out keyType, out valueType); - - var dictionary = value as IDictionary; - Basic.WriteInt(stream, dictionary.Count); - var iter = dictionary.GetEnumerator(); - while(iter.MoveNext()) - { - ctx.Serializer.Serialize_Main(stream, keyType, iter.Key); - ctx.Serializer.Serialize_Main(stream, valueType, iter.Value); - } - } - - public override void Deserialize(Stream stream, Type type, ref object instance) - { - Type keyType, valueType; - GetKVTypes(type, out keyType, out valueType); - - int count = Basic.ReadInt(stream); - var dictionary = instance as IDictionary; - dictionary.Clear(); - for (int i = 0; i < count; i++) - { - object key = null; - ctx.Serializer.Deserialize_Main(stream, keyType, ref key); - object value = null; - ctx.Serializer.Deserialize_Main(stream, valueType, ref value); - dictionary.Add(key, value); - } - } - - public override object GetInstance(Stream stream, Type type) - { - var ctor = type.DelegateForCtor(); - return ctor(null); - } - } - - public class DictionarySerializer : StrongSerializer> - { - private readonly StrongWriter WriteKey; - private readonly StrongWriter WriteValue; - private readonly StrongReader ReadKey; - private readonly StrongReader ReadValue; - - public DictionarySerializer(StrongWriter keyWriter, StrongReader keyReader, StrongWriter valueWriter, StrongReader valueReader) - { - this.WriteValue = valueWriter; - this.ReadValue = valueReader; - this.WriteKey = keyWriter; - this.ReadKey = keyReader; - } - - public override bool Handles(Type type) - { - return typeof(IDictionary).IsAssignableFrom(type); - } - - public override void StrongSerialize(Stream stream, IDictionary value) - { - Basic.WriteInt(stream, value.Count); - var iter = value.GetEnumerator(); - while(iter.MoveNext()) - { - var current = iter.Current; - WriteKey(stream, current.Key); - WriteValue(stream, current.Value); - } - } - - public override void StrongDeserialize(Stream stream, ref IDictionary instance) - { - instance.Clear(); - int count = Basic.ReadInt(stream); - for (int i = 0; i < count; i++) - { - TK key = default(TK); - ReadKey(stream, ref key); - TV value = default(TV); - ReadValue(stream, ref value); - instance.Add(key, value); - } - } - - public override object GetInstance(Stream stream, Type type) - { - var ctor = type.DelegateForCtor(); - return ctor(null); - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/DictionarySerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/DictionarySerializer.cs.meta deleted file mode 100644 index d8199fe..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/DictionarySerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 96361edc7c89559458e979f64077ed14 -timeCreated: 1433651632 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/EnumSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/EnumSerializer.cs deleted file mode 100644 index c1cf9e9..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/EnumSerializer.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.IO; - -namespace BX20Serializer -{ - public class EnumSerializer : BaseSerializer - { - public override bool Handles(Type type) - { - return type.IsEnum; - } - - public override void Serialize(Stream stream, Type type, object value) - { - var underlyingType = Enum.GetUnderlyingType(type); - PrimitiveSerializer.Write(stream, underlyingType, value); - } - - public override void Deserialize(Stream stream, Type type, ref object value) - { - var underlyingType = Enum.GetUnderlyingType(type); - PrimitiveSerializer.Read(stream, underlyingType, ref value); - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/EnumSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/EnumSerializer.cs.meta deleted file mode 100644 index 152cd5e..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/EnumSerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6df4b5d5c52dfd2468862a40a24a3c57 -timeCreated: 1433651632 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ListSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ListSerializer.cs deleted file mode 100644 index 420a39a..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ListSerializer.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace BX20Serializer -{ - public class ListSerializer : StrongSerializer> - { - public readonly StrongWriter WriteElement; - public readonly StrongReader ReadElement; - - public ListSerializer(StrongWriter write, StrongReader read) - { - this.WriteElement = write; - this.ReadElement = read; - } - - public override bool Handles(Type type) - { - return type == typeof(List); - } - - public override void StrongSerialize(Stream stream, List value) - { - int count = value.Count; - stream.WriteInt(count); - for(int i = 0; i < count; i++) - { - T element = value[i]; - WriteElement(stream, element); - } - } - - public override void StrongDeserialize(Stream stream, ref List instance) - { - int count = stream.ReadInt(); - if (instance == null) - { - instance = new List(count); - ctx.Serializer.ReMark(instance); - } - else - instance.Clear(); - - for(int i = 0; i < count; i++) - { - T element = default(T); - ReadElement(stream, ref element); - instance[i] = element; - } - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ListSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ListSerializer.cs.meta deleted file mode 100644 index cf83967..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ListSerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0c9d7199efb572a428a5122dd43f1438 -timeCreated: 1433651632 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/PrimitiveSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/PrimitiveSerializer.cs deleted file mode 100644 index c7b5109..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/PrimitiveSerializer.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace BX20Serializer -{ - public class PrimitiveSerializer : BaseSerializer - { - public static readonly PrimitiveSerializer Instance = new PrimitiveSerializer(); - - public static readonly Type[] SupportedTypes = new Type[] - { - typeof(byte), - typeof(sbyte), - typeof(bool), - typeof(int), - typeof(uint), - typeof(short), - typeof(ushort), - typeof(long), - typeof(ulong), - typeof(float), - typeof(double), - typeof(char), - typeof(DateTime), - }; - - static readonly Dictionary> _WriteLookup = - new Dictionary>(); - - static readonly Dictionary> _ReadLookup = - new Dictionary>(); - - static PrimitiveSerializer() - { - _WriteLookup[typeof(byte)] = (stream, value) => stream.WriteByte((byte)value); - _WriteLookup[typeof(sbyte)] = (stream, value) => stream.WriteSByte((sbyte)value); - _WriteLookup[typeof(bool)] = (stream, value) => stream.WriteBool((bool)value); - _WriteLookup[typeof(int)] = (stream, value) => stream.WriteInt((int)value); - _WriteLookup[typeof(uint)] = (stream, value) => stream.WriteUInt((uint)value); - _WriteLookup[typeof(short)] = (stream, value) => stream.WriteShort((short)value); - _WriteLookup[typeof(ushort)] = (stream, value) => stream.WriteUShort((ushort)value); - _WriteLookup[typeof(long)] = (stream, value) => stream.WriteLong((long)value); - _WriteLookup[typeof(ulong)] = (stream, value) => stream.WriteULong((ulong)value); - _WriteLookup[typeof(float)] = (stream, value) => stream.WriteFloat((float)value); - _WriteLookup[typeof(double)] = (stream, value) => stream.WriteDouble((double)value); - _WriteLookup[typeof(char)] = (stream, value) => stream.WriteChar((char)value); - _WriteLookup[typeof(DateTime)] = (stream, value) => stream.WriteDateTime((DateTime)value); - - _ReadLookup[typeof(byte)] = stream => stream.ReadByte(); - _ReadLookup[typeof(sbyte)] = stream => stream.ReadSByte(); - _ReadLookup[typeof(bool)] = stream => stream.ReadBool(); - _ReadLookup[typeof(int)] = stream => stream.ReadInt(); - _ReadLookup[typeof(uint)] = stream => stream.ReadUInt(); - _ReadLookup[typeof(short)] = stream => stream.ReadShort(); - _ReadLookup[typeof(ushort)] = stream => stream.ReadUShort(); - _ReadLookup[typeof(long)] = stream => stream.ReadLong(); - _ReadLookup[typeof(ulong)] = stream => stream.ReadULong(); - _ReadLookup[typeof(float)] = stream => stream.ReadFloat(); - _ReadLookup[typeof(double)] = stream => stream.ReadDouble(); - _ReadLookup[typeof(char)] = stream => stream.ReadChar(); - _ReadLookup[typeof(DateTime)] = stream => stream.ReadDateTime(); - } - - public override bool Handles(Type type) - { - for (int i = 0; i < SupportedTypes.Length; i++) - if (SupportedTypes[i] == type) - return true; - return false; - } - - public override void Serialize(Stream stream, Type type, object value) - { - _WriteLookup[type](stream, value); - } - - public override void Deserialize(Stream stream, Type type, ref object value) - { - value = _ReadLookup[type](stream); - } - - public static void Write(Stream stream, Type type, object value) - { - _WriteLookup[type](stream, value); - } - - public static void Read(Stream stream, Type type, ref object value) - { - value = _ReadLookup[type](stream); - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/PrimitiveSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/PrimitiveSerializer.cs.meta deleted file mode 100644 index af48e68..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/PrimitiveSerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c34af9eec4f64c6438923071edee5873 -timeCreated: 1433651632 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ReflectiveSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ReflectiveSerializer.cs deleted file mode 100644 index 97471b3..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ReflectiveSerializer.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.IO; -using System.Reflection; -using Vexe.Runtime.Extensions; - -namespace BX20Serializer -{ - public class ReflectiveSerializer : BaseSerializer - { - public override bool Handles(Type type) - { - return true; - } - - public override object GetInstance(Stream stream, Type type) - { - var ctor = type.DelegateForCtor(Type.EmptyTypes); - return ctor(null); - } - - public override void Serialize(Stream stream, Type type, object value) - { - var members = GetMembers(type); - for (int i = 0; i < members.Length; i++) - { - var member = X20Member.WrapMember(members[i], value); - ctx.Serializer.Serialize_Main(stream, member.Type, member.Value); - } - } - - public override void Deserialize(Stream stream, Type type, ref object value) - { - var members = GetMembers(type); - for (int i = 0; i < members.Length; i++) - { - var member = X20Member.WrapMember(members[i], value); - var memberValue = member.Value; - ctx.Serializer.Deserialize_Main(stream, member.Type, ref memberValue); - member.Value = memberValue; - value = member.Target; // this bit is needed for structs! - } - } - - public virtual MemberInfo[] GetMembers(Type type) - { - return X20Logic.CachedGetSerializableMembers(type); - } - } - - /// - /// The idea is that we specify at compile time a target type, member(s) type(s) and their writers/readers. - /// Should give at least a x2 performance boost over the regular reflective stuff. - /// Makes sense to use if you have a class with a lot of value-types and you want it to written/read fast. - /// This class only supports a single member just to test the waters, obviously you'll have more than that. - /// - public class StrongReflectiveSerializer : ReflectiveSerializer - { - private readonly MemberSetter _setter0; - private readonly MemberGetter _getter0; - private readonly StrongReader _reader0; - private readonly StrongWriter _writer0; - - public StrongReflectiveSerializer(string member0, StrongWriter writer0, StrongReader reader0) - { - var flags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static; - var member = typeof(TTarget).GetMemberFromAll(member0, flags); - _setter0 = DelegateForSet(member); - _getter0 = DelegateForGet(member); - _writer0 = writer0; - _reader0 = reader0; - } - - public override bool Handles(Type type) - { - return type == typeof(TTarget); - } - - public override void Serialize(Stream stream, Type type, object value) - { - SerializeMember0(stream, value); - } - - public override void Deserialize(Stream stream, Type type, ref object value) - { - DeserializeMember0(stream, ref value); - } - - protected void SerializeMember0(Stream stream, object value) - { - _writer0(stream, _getter0((TTarget)value)); - } - - protected void DeserializeMember0(Stream stream, ref object value) - { - TMember0 result = _getter0((TTarget)value); - _reader0(stream, ref result); - var target = (TTarget)value; - _setter0(ref target, result); - value = target; - } - - protected static MemberGetter DelegateForGet(MemberInfo member) - { - var field = member as FieldInfo; - if (field != null) - return field.DelegateForGet(); - var property = member as PropertyInfo; - if (property == null) - throw new NotSupportedException(member.Name); - return property.DelegateForGet(); - } - - protected static MemberSetter DelegateForSet(MemberInfo member) - { - var field = member as FieldInfo; - if (field != null) - return field.DelegateForSet(); - var property = member as PropertyInfo; - if (property == null) - throw new NotSupportedException(member.Name); - return property.DelegateForSet(); - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ReflectiveSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ReflectiveSerializer.cs.meta deleted file mode 100644 index 6ffeac9..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/ReflectiveSerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 480738666e233b2489115c1af249fadc -timeCreated: 1433651632 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/StrongSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/StrongSerializer.cs deleted file mode 100644 index 5e2d97b..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/StrongSerializer.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.IO; - -namespace BX20Serializer -{ - public abstract class StrongSerializer : BaseSerializer - { - public override void Serialize(Stream stream, Type type, object value) - { - StrongSerialize(stream, (T)value); - } - - public override void Deserialize(Stream stream, Type type, ref object instance) - { - T result; - if (instance == null) - result = default(T); - else - result = (T)instance; - StrongDeserialize(stream, ref result); - instance = result; - } - - public override bool Handles(Type type) - { - return type == typeof(T); - } - - public abstract void StrongSerialize(Stream stream, T value); - public abstract void StrongDeserialize(Stream stream, ref T instance); - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/StrongSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/StrongSerializer.cs.meta deleted file mode 100644 index 3081494..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/StrongSerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bc67e1bcd3ba6b74e8e9e9e4ebb229d5 -timeCreated: 1433651632 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/TypeSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/TypeSerializer.cs deleted file mode 100644 index 6d15bd4..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/TypeSerializer.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.IO; - -namespace BX20Serializer -{ - public class TypeSerializer : StrongSerializer - { - public override bool Handles(Type type) - { - return typeof(Type).IsAssignableFrom(type); - } - - public override void StrongSerialize(Stream stream, Type type) - { - Write(stream, type); - } - - public override void StrongDeserialize(Stream stream, ref Type value) - { - value = Read(stream); - } - - public static void Write(Stream stream, Type type) - { - var name = type.AssemblyQualifiedName; - Basic.WriteString(stream, name); - } - - public static Type Read(Stream stream) - { - string name = Basic.ReadString(stream); - return Type.GetType(name); - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/TypeSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/TypeSerializer.cs.meta deleted file mode 100644 index ba6c7a8..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/TypeSerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 29c5d91c42e256e41a86515291465f11 -timeCreated: 1433651632 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/UnityStructs.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/UnityStructs.cs deleted file mode 100644 index a6c79f9..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/UnityStructs.cs +++ /dev/null @@ -1,159 +0,0 @@ -using System.IO; -using UnityEngine; - -namespace BX20Serializer -{ - public class ColorSerializer : StrongSerializer - { - public override void StrongSerialize(Stream stream, Color value) - { - Write(stream, value); - } - - public override void StrongDeserialize(Stream stream, ref Color instance) - { - instance = Read(stream); - } - - public static void Write(Stream stream, Color value) - { - stream.WriteFloat(value.r); - stream.WriteFloat(value.g); - stream.WriteFloat(value.b); - stream.WriteFloat(value.a); - } - - public static Color Read(Stream stream) - { - return new Color() - { - r = stream.ReadFloat(), - g = stream.ReadFloat(), - b = stream.ReadFloat(), - a = stream.ReadFloat(), - }; - } - } - - public class V2Serializer : StrongSerializer - { - public override void StrongSerialize(Stream stream, Vector2 value) - { - stream.WriteFloat(value.x); - stream.WriteFloat(value.y); - } - - public override void StrongDeserialize(Stream stream, ref Vector2 instance) - { - instance = new Vector2() - { - x = stream.ReadFloat(), - y = stream.ReadFloat(), - }; - } - } - - public class V3Serializer : StrongSerializer - { - public override void StrongSerialize(Stream stream, Vector3 value) - { - Write(stream, value); - } - - public override void StrongDeserialize(Stream stream, ref Vector3 instance) - { - instance = Read(stream); - } - - public static void Write(Stream stream, Vector3 value) - { - stream.WriteFloat(value.x); - stream.WriteFloat(value.y); - stream.WriteFloat(value.z); - } - - public static Vector3 Read(Stream stream) - { - return new Vector3() - { - x = stream.ReadFloat(), - y = stream.ReadFloat(), - z = stream.ReadFloat(), - }; - } - } - - public class V4Serializer : StrongSerializer - { - public override void StrongSerialize(Stream stream, Vector4 value) - { - stream.WriteFloat(value.x); - stream.WriteFloat(value.y); - stream.WriteFloat(value.z); - stream.WriteFloat(value.w); - } - - public override void StrongDeserialize(Stream stream, ref Vector4 instance) - { - instance = new Vector4() - { - x = stream.ReadFloat(), - y = stream.ReadFloat(), - z = stream.ReadFloat(), - w = stream.ReadFloat(), - }; - } - } - - public class BoundsSerializer : StrongSerializer - { - public override void StrongSerialize(Stream stream, Bounds value) - { - V3Serializer.Write(stream, value.center); - V3Serializer.Write(stream, value.size); - } - - public override void StrongDeserialize(Stream stream, ref Bounds instance) - { - instance = new Bounds() - { - center = V3Serializer.Read(stream), - size = V3Serializer.Read(stream) - }; - } - } - - public class LayerMaskSerializer : StrongSerializer - { - public override void StrongSerialize(Stream stream, LayerMask layer) - { - Write(stream, layer.value); - } - - public override void StrongDeserialize(Stream stream, ref LayerMask layer) - { - layer = stream.ReadInt(); - } - } - - public class RectSerializer : StrongSerializer - { - public override void StrongSerialize(Stream stream, Rect rect) - { - Write(stream, rect.xMin); - Write(stream, rect.xMax); - Write(stream, rect.yMin); - Write(stream, rect.yMax); - } - - public override void StrongDeserialize(Stream stream, ref Rect rect) - { - rect = new Rect(); - rect.xMin = stream.ReadFloat(); - rect.xMax = stream.ReadFloat(); - rect.yMin = stream.ReadFloat(); - rect.yMax = stream.ReadFloat(); - } - } - -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/UnityStructs.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/UnityStructs.cs.meta deleted file mode 100644 index 658c4a3..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializer/BinaryX20/Serializers/UnityStructs.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bed869e138b42e9428b1907f019c6f84 -timeCreated: 1434630857 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializers.meta deleted file mode 100644 index 5367b1c..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 958544ed2686e7a44b685cc615207d31 -folderAsset: yes -timeCreated: 1427899585 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/AnimationSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/AnimationSerializer.cs deleted file mode 100644 index ac1c331..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/AnimationSerializer.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.IO; -using BX20Serializer; -using UnityEngine; - -namespace Vexe.FastSave.Serializers -{ - public class AnimationSerializer : StrongSerializer - { - public override void StrongSerialize(Stream stream, Animation value) - { - Write(stream, value.playAutomatically); - Write(stream, (int)value.wrapMode); - - var clipCount = value.GetClipCount(); - Write(stream, clipCount); - - foreach(AnimationState anim in value) - AssetReferenceSerializer.Write(stream, anim.clip); - } - - public override void StrongDeserialize(Stream stream, ref Animation instance) - { - instance.playAutomatically = stream.ReadBool(); - instance.wrapMode = (WrapMode)stream.ReadInt(); - - int clipCount = stream.ReadInt(); - - for (int i = 0; i < clipCount; i++) - { - var clip = AssetReferenceSerializer.Read(stream) as AnimationClip; - if (instance.GetClip(clip.name) == null) - instance.AddClip(clip, clip.name); - } - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/AnimationSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/AnimationSerializer.cs.meta deleted file mode 100644 index ca70fd9..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/AnimationSerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 34312bcd92fbd9447814bb2706ce6e25 -timeCreated: 1427998442 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/AssetReferenceSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/AssetReferenceSerializer.cs deleted file mode 100644 index f202c23..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/AssetReferenceSerializer.cs +++ /dev/null @@ -1,68 +0,0 @@ -//#define DBG - -using System; -using System.IO; -using System.Linq; -using BX20Serializer; -using UnityEngine; -using UnityObject = UnityEngine.Object; - -namespace Vexe.FastSave.Serializers -{ - /// - /// The FullSerializer converter to use to serialize/deserialize asset references (Textures, Meshes, Materials, AudioClips, AnimationClips, etc) - /// Instead of serializing the actual bytes of meshes, audio etc we just save thsoe references into a store object live in the scene. - /// When loading, we just ask the store to give us the item. - /// Note the use of the name of the assets meaning assets you want to save *must* have unique names - /// - public class AssetReferenceSerializer : StrongSerializer - { - public override bool Handles(Type type) - { - var types = AssetStorage.SupportedTypes; - for (int i = 0; i < types.Count; i++) - { - var supportedType = types[i]; - if (type == supportedType || type.IsA(supportedType)) - return true; - } - return false; - } - - public override void StrongSerialize(Stream stream, UnityObject value) - { - Write(stream, value); - } - - public override void StrongDeserialize(Stream stream, ref UnityObject instance) - { - instance = Read(stream); - } - - public static void Write(Stream stream, UnityObject asset) - { - if (asset == null) - { - Write(stream, string.Empty); - return; - } - - var name = AssetStorage.Current.Store(asset); - Write(stream, name); - -#if DBG - Debug.Log("Wrote asset: " + asset); -#endif - } - - public static UnityObject Read(Stream stream) - { - var name = stream.ReadString(); - var asset = AssetStorage.Current.Get(name); -#if DBG - Debug.Log("Read asset: " + asset); -#endif - return asset; - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/AssetReferenceSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/AssetReferenceSerializer.cs.meta deleted file mode 100644 index 73a72b1..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/AssetReferenceSerializer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8b553a3da413aac4d9c7d53e6270f68c -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/ExplicitComponentSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/ExplicitComponentSerializer.cs deleted file mode 100644 index d1e8cf9..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/ExplicitComponentSerializer.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using BX20Serializer; - -namespace Vexe.FastSave.Serializers -{ - public class ExplicitComponentSerializer : ReflectiveComponentSerializer - { - public readonly Dictionary SupportedComponentTypes = new Dictionary(); - - readonly Dictionary _CachedMembers = new Dictionary(); - - public ExplicitComponentSerializer Add(Type type, params string[] members) - { - SupportedComponentTypes.Add(type, members); - return this; - } - - public ExplicitComponentSerializer Add(params string[] members) - { - return Add(typeof(T), members); - } - - public override MemberInfo[] GetMembers(Type type) - { - MemberInfo[] members; - if (!_CachedMembers.TryGetValue(type, out members)) - { - var names = SupportedComponentTypes[type]; - members = X20Reflection.GetMembersFromNames(type, names); - _CachedMembers[type] = members; - } - return members; - } - - public override bool Handles(Type type) - { - return SupportedComponentTypes.ContainsKey(type); - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/ExplicitComponentSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/ExplicitComponentSerializer.cs.meta deleted file mode 100644 index 8c08d52..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/ExplicitComponentSerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7db3cfafd23d1b440a729d8b9074d837 -timeCreated: 1430772623 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/GameObjectSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/GameObjectSerializer.cs deleted file mode 100644 index 966f78e..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/GameObjectSerializer.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.IO; -using BX20Serializer; -using UnityEngine; - -namespace Vexe.FastSave.Serializers -{ - public static class GameObjectSerializer - { - public static void Write(Stream stream, GameObject instance) - { - stream.WriteString(instance.name); - stream.WriteString(instance.tag); - stream.WriteInt(instance.layer); - stream.WriteBool(instance.isStatic); - stream.WriteBool(instance.activeSelf); - } - - public static void Read(Stream stream, GameObject instance) - { - instance.name = stream.ReadString(); - instance.tag = stream.ReadString(); - instance.layer = stream.ReadInt(); - instance.isStatic = stream.ReadBool(); - instance.SetActive(stream.ReadBool()); - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/GameObjectSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/GameObjectSerializer.cs.meta deleted file mode 100644 index 1b33602..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/GameObjectSerializer.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6597a3a63a8e1804ea51007dc525a0a3 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/LightSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/LightSerializer.cs deleted file mode 100644 index a342a7a..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/LightSerializer.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System.IO; -using BX20Serializer; -using UnityEngine; - -namespace Vexe.FastSave.Serializers -{ - public class LightSerializer : StrongSerializer - { - public override void StrongSerialize(Stream stream, Light value) - { - LightType type = value.type; - Write(stream, (int)type); - - switch(type) - { - case LightType.Point: - Write(stream, value.range); - break; - case LightType.Directional: - Write(stream, value.cookieSize); - Write(stream, value.shadowStrength); - Write(stream, value.shadowBias); - break; - case LightType.Spot: - Write(stream, value.spotAngle); - Write(stream, value.range); - break; - } - - ColorSerializer.Write(stream, value.color); - Write(stream, value.intensity); - - if (type != LightType.Area) - { - AssetReferenceSerializer.Write(stream, value.cookie); - AssetReferenceSerializer.Write(stream, value.flare); - Write(stream, value.cullingMask); - Write(stream, (int)value.renderMode); - } - } - - public override void StrongDeserialize(Stream stream, ref Light instance) - { - var type = (LightType)stream.ReadInt(); - - switch (type) - { - case LightType.Point: - instance.range = stream.ReadFloat(); - break; - case LightType.Directional: - instance.cookieSize = stream.ReadFloat(); - instance.shadowStrength = stream.ReadFloat(); - instance.shadowBias = stream.ReadFloat(); - break; - case LightType.Spot: - instance.spotAngle = stream.ReadFloat(); - instance.range = stream.ReadFloat(); - break; - } - - instance.color = ColorSerializer.Read(stream); - instance.intensity = stream.ReadFloat(); - - if (type != LightType.Area) - { - instance.cookie = AssetReferenceSerializer.Read(stream) as Texture; - instance.flare = AssetReferenceSerializer.Read(stream) as Flare; - instance.cullingMask = stream.ReadInt(); - instance.renderMode = (LightRenderMode)stream.ReadInt(); - } - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/LightSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/LightSerializer.cs.meta deleted file mode 100644 index b781d4a..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/LightSerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 078ee0ba1b9cbeb4c8e59265ae67f99c -timeCreated: 1427998442 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/ReflectiveComponentSerializer.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/ReflectiveComponentSerializer.cs deleted file mode 100644 index dea134d..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/ReflectiveComponentSerializer.cs +++ /dev/null @@ -1,154 +0,0 @@ -//#define DBG - -using System; -using System.IO; -using BX20Serializer; -using UnityEngine; -using Vexe.Runtime.Extensions; - -namespace Vexe.FastSave.Serializers -{ - public class ReflectiveComponentSerializer : ReflectiveSerializer - { - public override bool Handles(Type type) - { - return typeof(Component).IsAssignableFrom(type); - } - - public override void Serialize(Stream stream, Type type, object value) - { - var members = GetMembers(type); - for (int i = 0; i < members.Length; i++) - { - var member = X20Member.WrapMember(members[i], value); - -#if DBG - Debug.Log("Serializing: " + member.Name); -#endif - - if (typeof(Component).IsAssignableFrom(member.Type)) - { - SerializeComponentReference(stream, member.Value as Component); - } - else if (member.Type == typeof(GameObject)) - { - SerializeGameObjectReference(stream, member.Value as GameObject); - } - else - { - ctx.Serializer.Serialize_Main(stream, member.Type, member.Value); - } - } - } - - public override void Deserialize(Stream stream, Type type, ref object instance) - { - var members = GetMembers(type); - for (int i = 0; i < members.Length; i++) - { - var member = X20Member.WrapMember(members[i], instance); - -#if DBG - Debug.Log("Deserializing: " + member.Name); -#endif - - if (typeof(Component).IsAssignableFrom(member.Type)) - { - member.Value = DeserializeComponentReference(stream, member.Type); - } - else if (member.Type == typeof(GameObject)) - { - member.Value = DeserializeGameObjectReference(stream); - } - else - { - var memberValue = member.Value; - ctx.Serializer.Deserialize_Main(stream, member.Type, ref memberValue); - member.Value = memberValue; - } - } - } - - static void SerializeComponentReference(Stream stream, Component value) - { - if (value == null) - { - Basic.WriteByte(stream, 0); - return; - } - - var prefabId = PrefabStorage.Current.GetIndex(value.gameObject); - if (prefabId != -1) - { - Basic.WriteByte(stream, 1); - Write(stream, prefabId); - } - else - { - Basic.WriteByte(stream, 2); - int refId = value.GetOrAddComponent().GetPersistentId(); - Write(stream, refId); - } - } - - static Component DeserializeComponentReference(Stream stream, Type type) - { - byte b = Basic.ReadByte(stream); - if (b == 0) - return null; - - if (b == 1) - { - var prefabId = stream.ReadInt(); - var go = PrefabStorage.Current.Get(prefabId); - return go.GetComponent(type); - } - else - { - var refId = stream.ReadInt(); - var go = FSReference.Get(refId); - return go.GetComponent(type); - } - } - - public static void SerializeGameObjectReference(Stream stream, GameObject value) - { - if (value == null) - { - Basic.WriteByte(stream, 0); - return; - } - - var prefabId = PrefabStorage.Current.GetIndex(value); - if (prefabId != -1) - { - Basic.WriteByte(stream, 1); - Write(stream, prefabId); - } - else - { - Basic.WriteByte(stream, 2); - int refId = value.GetOrAddComponent().GetPersistentId(); - Write(stream, refId); - } - } - - public static GameObject DeserializeGameObjectReference(Stream stream) - { - var b = Basic.ReadByte(stream); - if (b == 0) - return null; - - if (b == 1) - { - var prefabId = stream.ReadInt(); - return PrefabStorage.Current.Get(prefabId); - } - else - { - var refId = stream.ReadInt(); - return FSReference.Get(refId); - } - } - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/ReflectiveComponentSerializer.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/ReflectiveComponentSerializer.cs.meta deleted file mode 100644 index 92706c7..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Serializers/ReflectiveComponentSerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4028a28ab5b0be44bad16cbdd5cc0f4e -timeCreated: 1427791017 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Storage.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Storage.meta deleted file mode 100644 index 4c244a9..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Storage.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: 23de2bc837c54f041b241e8e8f064fa1 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Storage/AssetStorage.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Storage/AssetStorage.cs deleted file mode 100644 index 64a5f85..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Storage/AssetStorage.cs +++ /dev/null @@ -1,111 +0,0 @@ -//#define DBG - -using System; -using System.Collections.Generic; -using System.IO; -using UnityEngine; -using Vexe.Runtime.Types; -using UnityObject = UnityEngine.Object; - -#if UNITY_EDITOR -using UnityEditor; -using System.Linq; -#endif - -namespace Vexe.FastSave -{ - public class AssetStorage : BaseScriptableObject - { - [Display(Dict.HorizontalPairs)] - public AssetLookup Assets = new AssetLookup(); - - [Hide] public static readonly List SupportedTypes = new List() - { - typeof(Mesh), - typeof(AudioClip), - typeof(Material), - typeof(PhysicMaterial), - typeof(PhysicsMaterial2D), - typeof(Flare), - typeof(GUIStyle), - typeof(Texture), - typeof(RuntimeAnimatorController), - typeof(AnimationClip), - typeof(UnityObject), // for text assets etc - }; - - static AssetStorage _Current; - public static AssetStorage Current - { - get - { - if (_Current == null) - _Current = GetStore(); - return _Current; - } - } - - public string Store(UnityObject asset) - { - var name = asset.name; - Assets[name] = asset; - return name; - } - - public UnityObject Get(string key) - { - UnityObject result; - if (!Assets.TryGetValue(key, out result)) - return null; - return result; - } - -#if UNITY_EDITOR - [Show] void FilterNulls() - { - var cleaned = new AssetLookup(); - var iter = Assets.GetEnumerator(); - while(iter.MoveNext()) - { - var current = iter.Current; - - var value = current.Value; - if (value == null) - return; - - cleaned.Add(current.Key, value); - } - Assets = cleaned; - } -#endif - - static AssetStorage GetStore() - { - AssetStorage store = null; -#if UNITY_EDITOR && !UNITY_WEBPLAYER - var storeName = typeof(AssetStorage).Name + ".asset"; - var directory = Directory.GetDirectories("Assets", "FastSave", SearchOption.AllDirectories).FirstOrDefault(); - if (directory == null) - Debug.LogError("Couldn't find FastSave directory!"); - else - { - var storePath = directory + "/Resources/" + storeName; - store = AssetDatabase.LoadAssetAtPath(storePath); - if (store == null) - { - store = ScriptableObject.CreateInstance(); - AssetDatabase.CreateAsset(store, storePath); - AssetDatabase.ImportAsset(storePath, ImportAssetOptions.ForceUpdate); - AssetDatabase.Refresh(); - } - } -#endif - if (store == null) - store = Resources.Load(typeof(AssetStorage).Name); - return store; - } - } - - [Serializable] - public class AssetLookup : SerializableDictionary { } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Storage/AssetStorage.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Storage/AssetStorage.cs.meta deleted file mode 100644 index 0ea2497..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Storage/AssetStorage.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 428e6e31139d86442996a24b17eb5f61 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Storage/PrefabStorage.cs b/Assets/Plugins/Vexe/Runtime/FastSave/Storage/PrefabStorage.cs deleted file mode 100644 index a7cc7d3..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Storage/PrefabStorage.cs +++ /dev/null @@ -1,64 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; -using Vexe.Runtime.Types; - -#if UNITY_EDITOR -using UnityEditor; -using System.IO; -#endif - -namespace Vexe.FastSave -{ - [CreateAssetMenu(menuName = "Vexe/PrefabStorage")] - public class PrefabStorage : BaseScriptableObject - { - public List Prefabs = new List(); - - public GameObject Get(int id) - { - return Prefabs[id]; - } - - public bool IsPrefab(GameObject go) - { - return GetIndex(go) != -1; - } - - public int GetIndex(GameObject prefab) - { - return Prefabs.IndexOf(prefab); - } - - static PrefabStorage _Current; - public static PrefabStorage Current - { - get - { - if (_Current == null) - { - _Current = Resources.Load(typeof(PrefabStorage).Name); - if (_Current == null) - { - Debug.LogError("No prefab storage was found! Please create one under Resources/Storage"); - return null; - } - } - return _Current; - } - } - -#if UNITY_EDITOR && !UNITY_WEBPLAYER - [Show] void Populate() - { - Prefabs.Clear(); - var prefabFiles = Directory.GetFiles("Assets", "*.prefab", SearchOption.AllDirectories); - for (int i = 0; i < prefabFiles.Length; i++) - { - var path = prefabFiles[i]; - var prefab = AssetDatabase.LoadAssetAtPath(path); - Prefabs.Add(prefab); - } - } -#endif - } -} diff --git a/Assets/Plugins/Vexe/Runtime/FastSave/Storage/PrefabStorage.cs.meta b/Assets/Plugins/Vexe/Runtime/FastSave/Storage/PrefabStorage.cs.meta deleted file mode 100644 index 0a6f5f7..0000000 --- a/Assets/Plugins/Vexe/Runtime/FastSave/Storage/PrefabStorage.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 51ff9abeff58b4c46968a7987aaa5ca4 -timeCreated: 1427845688 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/FastReflection.cs b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/FastReflection.cs index 165267c..6318af9 100644 --- a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/FastReflection.cs +++ b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/FastReflection.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Reflection; using System.Reflection.Emit; +using UnityEngine; namespace Vexe.Runtime.Extensions { @@ -34,6 +35,10 @@ public static class FastReflection /// public static CtorInvoker DelegateForCtor(this Type type, params Type[] paramTypes) { +#if NETFX_CORE + Debug.Assert(false, "do not reach"); + return null; +#else int key = kCtorInvokerName.GetHashCode() ^ type.GetHashCode(); for (int i = 0; i < paramTypes.Length; i++) key ^= paramTypes[i].GetHashCode(); @@ -51,6 +56,7 @@ public static CtorInvoker DelegateForCtor(this Type type, params Type[] pa result = dynMethod.CreateDelegate(typeof(CtorInvoker)); cache[key] = result; return (CtorInvoker)result; +#endif } /// @@ -231,6 +237,9 @@ public static void GenDebugAssembly(string name, FieldInfo field, PropertyInfo p /// public static void GenDebugAssembly(string name, FieldInfo field, PropertyInfo property, MethodInfo method, Type targetType, Type[] ctorParamTypes) { +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); +#else var asmName = new AssemblyName("Asm"); var asmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(asmName, AssemblyBuilderAccess.RunAndSave); var modBuilder = asmBuilder.DefineDynamicModule("Mod", name); @@ -280,6 +289,7 @@ public static void GenDebugAssembly(string name, FieldInfo field, Prope typeBuilder.CreateType(); asmBuilder.Save(name); +#endif } static int GetKey(MemberInfo member, string dynMethodName) @@ -292,6 +302,10 @@ static TDelegate GenDelegateForMember(TMember member, int ke where TMember : MemberInfo where TDelegate : class { +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); + return null; +#else var dynMethod = new DynamicMethod(dynMethodName, returnType, paramTypes, true); emit.il = dynMethod.GetILGenerator(); @@ -300,10 +314,14 @@ static TDelegate GenDelegateForMember(TMember member, int ke var result = dynMethod.CreateDelegate(typeof(TDelegate)); cache[key] = result; return (TDelegate)(object)result; +#endif } static void GenCtor(Type type, Type[] paramTypes) { +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); +#else // arg0: object[] arguments // goal: return new T(arguments) Type targetType = typeof(T) == typeof(object) ? type : typeof(T); @@ -340,10 +358,14 @@ static void GenCtor(Type type, Type[] paramTypes) emit.box(targetType); emit.ret(); +#endif } static void GenMethodInvocation(MethodInfo method) { +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); +#else var weaklyTyped = typeof(TTarget) == typeof(object); // push target if not static (instance-method. in that case first arg is always 'this') @@ -405,25 +427,37 @@ static void GenMethodInvocation(MethodInfo method) emit.ifvaluetype_box(method.ReturnType); emit.ret(); +#endif } static void GenFieldGetter(FieldInfo field) { +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); +#else GenMemberGetter(field, field.FieldType, field.IsStatic, (e, f) => e.lodfld((FieldInfo)f) ); +#endif } static void GenPropertyGetter(PropertyInfo property) { +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); +#else GenMemberGetter(property, property.PropertyType, property.GetGetMethod(true).IsStatic, (e, p) => e.callorvirt(((PropertyInfo)p).GetGetMethod(true)) ); +#endif } static void GenMemberGetter(MemberInfo member, Type memberType, bool isStatic, Action get) { +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); +#else if (typeof(TTarget) == typeof(object)) // weakly-typed? { // if we're static immediately load member and return value @@ -446,25 +480,37 @@ static void GenMemberGetter(MemberInfo member, Type memberType, bool is } emit.ret(); +#endif } static void GenFieldSetter(FieldInfo field) { +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); +#else GenMemberSetter(field, field.FieldType, field.IsStatic, (e, f) => e.setfld((FieldInfo)f) ); +#endif } static void GenPropertySetter(PropertyInfo property) { +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); +#else GenMemberSetter(property, property.PropertyType, property.GetSetMethod(true).IsStatic, (e, p) => e.callorvirt(((PropertyInfo)p).GetSetMethod(true)) ); +#endif } static void GenMemberSetter(MemberInfo member, Type memberType, bool isStatic, Action set) { +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); +#else var targetType = typeof(TTarget); var stronglyTyped = targetType != typeof(object); @@ -529,10 +575,12 @@ static void GenMemberSetter(MemberInfo member, Type memberType, bool is .box(targetType) .stind_ref() .ret(); +#endif } private class ILEmitter { +#if !NETFX_CORE public ILGenerator il; public ILEmitter ret() { il.Emit(OpCodes.Ret); return this; } @@ -598,6 +646,7 @@ private class ILEmitter public ILEmitter ifclass_ldloc_else_ldloca(int idx, Type type) { if (type.IsValueType) emit.ldloca(idx); else emit.ldloc(idx); return this; } public ILEmitter perform(Action action, MemberInfo member) { action(this, member); return this; } public ILEmitter ifbyref_ldloca_else_ldloc(LocalBuilder local, Type type) { if (type.IsByRef) ldloca(local); else ldloc(local); return this; } +#endif } } } \ No newline at end of file diff --git a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/Flags.cs b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/Flags.cs index a4c5b99..c6f8c31 100644 --- a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/Flags.cs +++ b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/Flags.cs @@ -25,7 +25,8 @@ static Flags() { foreach (BindingFlags flag in Enum.GetValues(typeof(BindingFlags))) { - if (flag != BindingFlags.Default) + //if (flag != BindingFlags.Default) + if (flag != 0) { flagNames[new Flags((long)flag)] = flag.ToString(); } @@ -41,7 +42,8 @@ static Flags() /// /// This value corresponds to the value. /// - public static readonly Flags None = new Flags((long)BindingFlags.Default); + //public static readonly Flags None = new Flags((long)BindingFlags.Default); + public static readonly Flags None = new Flags((long)0); /// /// This value corresponds to the value. @@ -57,7 +59,8 @@ static Flags() /// This value corresponds to the value. /// Note that this value is respected even in cases where normal Reflection calls would ignore it. /// - public static readonly Flags ExactBinding = new Flags((long)BindingFlags.ExactBinding); + //public static readonly Flags ExactBinding = new Flags((long)BindingFlags.ExactBinding); + public static readonly Flags ExactBinding = new Flags((long)65536); /// /// This value corresponds to the value. diff --git a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/GenericEnumerableExtensions.cs b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/GenericEnumerableExtensions.cs index 1ef0c8d..1062750 100644 --- a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/GenericEnumerableExtensions.cs +++ b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/GenericEnumerableExtensions.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; +using System.Reflection; namespace Vexe.Runtime.Extensions { @@ -48,7 +49,7 @@ public static IEnumerable OfType(this IEnumerable items, Type ofType) { foreach(var item in items) { - if (item != null && ofType.IsAssignableFrom(item.GetType())) + if (item != null && ofType.GetTypeInfo().IsAssignableFrom(item.GetType().GetTypeInfo())) { yield return item; } diff --git a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/MemberInfoExtensions.cs b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/MemberInfoExtensions.cs index 711e6b5..24a8526 100644 --- a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/MemberInfoExtensions.cs +++ b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/MemberInfoExtensions.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using Debug = UnityEngine.Debug; namespace Vexe.Runtime.Extensions { @@ -118,11 +119,15 @@ public static bool IsStatic(this MemberInfo member) if (method != null) return method.IsStatic; +#if NETFX_CORE + Debug.Assert(false, "not implemented"); + throw new NotSupportedException("not implemented"); +#else string message = string.Format("Unable to determine IsStatic for member {0}.{1}" + "MemberType was {2} but only fields, properties and methods are supported.", member.Name, member.MemberType, Environment.NewLine); - throw new NotSupportedException(message); +#endif } } } \ No newline at end of file diff --git a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/MethodInfoExtensions.cs b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/MethodInfoExtensions.cs index b0ca0bc..55bcadc 100644 --- a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/MethodInfoExtensions.cs +++ b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/MethodInfoExtensions.cs @@ -3,6 +3,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Text; +using Debug = UnityEngine.Debug; namespace Vexe.Runtime.Extensions { @@ -70,8 +71,13 @@ public static string GetFullName(this MethodInfo method) // http://stackoverflow.com/questions/4168489/methodinfo-equality-for-declaring-type public static bool AreMethodsEqualForDeclaringType(this MethodInfo first, MethodInfo second) { +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); + return false; +#else first = first.ReflectedType == first.DeclaringType ? first : first.DeclaringType.GetMethod(first.Name, first.GetParameters().Select(p => p.ParameterType).ToArray()); second = second.ReflectedType == second.DeclaringType ? second : second.DeclaringType.GetMethod(second.Name, second.GetParameters().Select(p => p.ParameterType).ToArray()); +#endif return first == second; } @@ -83,8 +89,8 @@ public static bool IsDeclaredIn(this MethodInfo method, Type type) public static bool IsExtensionMethod(this MethodInfo method) { var mType = method.DeclaringType; - return mType.IsSealed && - !mType.IsGenericType && + return mType.GetTypeInfo().IsSealed && + !mType.GetTypeInfo().IsGenericType && !mType.IsNested && method.IsDefined(typeof(ExtensionAttribute), false); } diff --git a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/StringExtensions.cs b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/StringExtensions.cs index 4617397..bd8e668 100644 --- a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/StringExtensions.cs +++ b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/StringExtensions.cs @@ -1,6 +1,7 @@ using System; using System.Text; using System.Text.RegularExpressions; +using UnityEngine; namespace Vexe.Runtime.Extensions { @@ -149,10 +150,15 @@ public static bool Contains(this string source, string toCheck, StringComparison /// public static string ToProperCase(this string text) { - System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture; +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); + return ""; +#else + System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture; System.Globalization.TextInfo textInfo = cultureInfo.TextInfo; return textInfo.ToTitleCase(text); - } +#endif + } /// /// Ex: "thisIsCamelCase" -> "this Is Camel Case" diff --git a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/SystemObjectExtensions.cs b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/SystemObjectExtensions.cs index df1ca37..2668535 100644 --- a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/SystemObjectExtensions.cs +++ b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/SystemObjectExtensions.cs @@ -1,10 +1,12 @@ -namespace Vexe.Runtime.Extensions +using System.Reflection; + +namespace Vexe.Runtime.Extensions { public static class SystemObjectExtensions { public static bool GenericEquals(this T x, T y) { - if (typeof(T).IsValueType) + if (typeof(T).GetTypeInfo().IsValueType) return x.Equals(y); else { diff --git a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/TypeExtensions.cs b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/TypeExtensions.cs index 397d3a5..fee0757 100644 --- a/Assets/Plugins/Vexe/Runtime/Libs/Extensions/TypeExtensions.cs +++ b/Assets/Plugins/Vexe/Runtime/Libs/Extensions/TypeExtensions.cs @@ -6,6 +6,7 @@ using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Debug = UnityEngine.Debug; namespace Vexe.Runtime.Extensions { @@ -15,7 +16,7 @@ public static bool IsNumeric(this Type type) { if (type == typeof(bool) || type == typeof(char)) return false; - return type.IsPrimitive; + return type.GetTypeInfo().IsPrimitive; } public static bool TryGetSequenceElementType(this Type type, out Type element) @@ -38,7 +39,7 @@ public static bool TryGetSequenceElementType(this Type type, out Type element) public static bool IsStatic(this Type type) { - return type.IsSealed && type.IsAbstract; + return type.GetTypeInfo().IsSealed && type.GetTypeInfo().IsAbstract; } public static object Instance(this Type type) @@ -60,11 +61,15 @@ public static T Instance(this Type type, Type[] paramTypes) public static MethodCaller DelegateForCall(this Type type, string name, BindingFlags flags, params Type[] paramTypes) { - var method = type.GetMethod(name, flags, null, paramTypes, null); +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); + return null; +#else + var method = type.GetTypeInfo().GetMethod(name, flags, null, paramTypes, null); if (method == null) throw new Exception("Method not found " + name); - return method.DelegateForCall(); +#endif } public static MethodCaller DelegateForCall(this Type type, string name, params Type[] paramTypes) @@ -106,7 +111,7 @@ public static IEnumerable GetAllMembers(this Type type, Type peak, B if (type == null || type == peak) return Enumerable.Empty(); - return type.GetMembers(flags).Concat(GetAllMembers(type.BaseType, peak, flags)); + return type.GetMembers(flags).Concat(GetAllMembers(type.GetTypeInfo().BaseType, peak, flags)); } public static IEnumerable GetAllMembers(this Type type, Type peak) @@ -147,7 +152,7 @@ public static Attribute[] GetAttributes(this Type type) public static bool IsConstructedGenType(this Type type) { - return !(string.IsNullOrEmpty(type.FullName) && !type.IsGenericTypeDefinition && type.ContainsGenericParameters); + return !(string.IsNullOrEmpty(type.FullName) && !type.GetTypeInfo().IsGenericTypeDefinition && type.GetTypeInfo().ContainsGenericParameters); } /// @@ -156,7 +161,7 @@ public static bool IsConstructedGenType(this Type type) public static Type[] GetParentGenericArguments(this Type type, Type parentDefinition) { return type.GetBaseClasses() - .First(c => c.IsGenericType && c.GetGenericTypeDefinition() == parentDefinition) + .First(c => c.GetTypeInfo().IsGenericType && c.GetTypeInfo().GetGenericTypeDefinition() == parentDefinition) .GetGenericArguments(); } @@ -173,7 +178,7 @@ public static bool IsCollection(this Type type) /// public static Type[] FirstBaseGenArgs(this Type type) { - var genBase = GetBaseClasses(type).FirstOrDefault(t => t.IsGenericType); + var genBase = GetBaseClasses(type).FirstOrDefault(t => t.GetTypeInfo().IsGenericType); return genBase == null ? Type.EmptyTypes : genBase.GetGenericArguments(); } @@ -190,14 +195,14 @@ public static IEnumerable GetBaseTypes(this Type type) /// public static IEnumerable GetBaseClasses(this Type type) { - if (type == null || type.BaseType == null) + if (type == null || type.GetTypeInfo().BaseType == null) yield break; - var current = type.BaseType; + var current = type.GetTypeInfo().BaseType; while (current != null) { yield return current; - current = current.BaseType; + current = current.GetTypeInfo().BaseType; } } @@ -206,7 +211,7 @@ public static IEnumerable GetBaseClasses(this Type type) /// public static bool IsAbstractNotInterface(this Type type) { - return type.IsAbstract && !type.IsInterface; + return type.GetTypeInfo().IsAbstract && !type.GetTypeInfo().IsInterface; } public static readonly Dictionary TypeNameAlternatives = new Dictionary() @@ -256,13 +261,17 @@ private static Func getNiceName if (type.IsSubclassOfRawGeneric(typeof(Nullable<>))) return type.GetGenericArguments()[0].GetNiceName() + "?"; - if (type.IsGenericParameter || !type.IsGenericType) + if (type.IsGenericParameter || !type.GetTypeInfo().IsGenericType) return TypeNameGauntlet(type); var builder = new StringBuilder(); var name = type.Name; var index = name.IndexOf("`"); - builder.Append(name.Substring(0, index)); + if (index >= 0) { + builder.Append(name.Substring(0, index)); + } else { + builder.Append(name); + } builder.Append('<'); var args = type.GetGenericArguments(); for (int i = 0; i < args.Length; i++) @@ -294,7 +303,7 @@ public static string GetNiceName(this Type type) /// public static bool IsStruct(this Type type) { - return type.IsValueType && !type.IsEnum && !type.IsPrimitive; + return type.GetTypeInfo().IsValueType && !type.GetTypeInfo().IsEnum && !type.GetTypeInfo().IsPrimitive; } /// @@ -310,7 +319,7 @@ public static ConstructorInfo GetEmptyConstructor(this Type type) /// public static bool IsSubclassOf(this Type type) { - return type.IsSubclassOf(typeof(T)); + return type.GetTypeInfo().IsSubclassOf(typeof(T)); } /// @@ -338,7 +347,7 @@ public static IEnumerable GetMembersBeneath(this Type type, bool /// public static IEnumerable GetMembersBeneath(this Type type, Type other, BindingFlags flags, bool includeGenArgMembers = false) { - return type.GetMembers(flags).Where(m => includeGenArgMembers ? m.DeclaringType.IsA(other) : m.DeclaringType.IsSubclassOf(other)); + return type.GetMembers(flags).Where(m => includeGenArgMembers ? m.DeclaringType.IsA(other) : m.DeclaringType.GetTypeInfo().IsSubclassOf(other)); } /// @@ -395,7 +404,7 @@ public static IEnumerable GetCustomAttributes(this Type type) where T : At public static IEnumerable GetCustomAttributes(this Type type, bool inherit) where T : Attribute { - return type.GetCustomAttributes(typeof(T), inherit).Cast(); + return type.GetTypeInfo().GetCustomAttributes(typeof(T), inherit).Cast(); } /// @@ -403,7 +412,7 @@ public static IEnumerable GetCustomAttributes(this Type type, bool inherit /// public static bool IsDefined(this Type type) where T : Attribute { - return type.IsDefined(typeof(T)); + return type.GetTypeInfo().IsDefined(typeof(T)); } /// @@ -417,10 +426,10 @@ public static bool IsSubclassOfRawGeneric(this Type toCheck, Type baseType) { while (toCheck != typeof(object) && toCheck != null) { - Type current = toCheck.IsGenericType ? toCheck.GetGenericTypeDefinition() : toCheck; + Type current = toCheck.GetTypeInfo().IsGenericType ? toCheck.GetTypeInfo().GetGenericTypeDefinition() : toCheck; if (current == baseType) return true; - toCheck = toCheck.BaseType; + toCheck = toCheck.GetTypeInfo().BaseType; } return false; } @@ -433,7 +442,7 @@ public static bool IsImplementerOfRawGeneric(this Type type, Type baseType) { return type.GetInterfaces().Any(interfaceType => { - var current = interfaceType.IsGenericType ? interfaceType.GetGenericTypeDefinition() : interfaceType; + var current = interfaceType.GetTypeInfo().IsGenericType ? interfaceType.GetTypeInfo().GetGenericTypeDefinition() : interfaceType; return current == baseType; }); } @@ -449,7 +458,7 @@ public static bool IsSubclassOrImplementerOfRawGeneric(this Type type, Type base // http://stackoverflow.com/questions/2490244/default-value-of-a-type-at-runtime public static object GetDefaultValue(this Type t) { - return t.IsValueType ? Activator.CreateInstance(t) : null; + return t.GetTypeInfo().IsValueType ? Activator.CreateInstance(t) : null; } public static object GetDefaultValueEmptyIfString(this Type t) @@ -464,8 +473,8 @@ public static bool IsIList(this Type type) public static Type[] GetGenericArgsInThisOrAbove(this Type type) { - while (!type.IsGenericType && type != typeof(object)) - type = type.BaseType; + while (!type.GetTypeInfo().IsGenericType && type != typeof(object)) + type = type.GetTypeInfo().BaseType; if (type == typeof(object)) return Type.EmptyTypes; @@ -474,20 +483,25 @@ public static Type[] GetGenericArgsInThisOrAbove(this Type type) public static Type[] GetGenericArgsInRawParents(this Type source, Type rawParentType) { - if (!rawParentType.IsGenericTypeDefinition) + if (!rawParentType.GetTypeInfo().IsGenericTypeDefinition) return Type.EmptyTypes; - Type baseType = source.BaseType; + Type baseType = source.GetTypeInfo().BaseType; while (baseType.GetGenericTypeDefinition() != rawParentType && baseType != typeof(object)) - baseType = baseType.BaseType; + baseType = baseType.GetTypeInfo().BaseType; return baseType == typeof(object) ? Type.EmptyTypes : baseType.GetGenericArguments(); } public static MethodInfo GetMethod(this Type source, string methodName, Type[] paramTypes, BindingFlags flags) { - return source.GetMethod(methodName, flags, null, paramTypes, null); +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); + return null; +#else + return source.GetTypeInfo().GetMethod(methodName, flags, null, paramTypes, null); +#endif } public static IEnumerable GetExtensionMethods( @@ -507,7 +521,7 @@ public static IEnumerable GetExtensionMethods( BindingFlags modifiers, bool exactBinding) { return asm.GetTypes() - .Where(t => t.IsSealed && !t.IsGenericType && !t.IsNested) + .Where(t => t.GetTypeInfo().IsSealed && !t.GetTypeInfo().IsGenericType && !t.IsNested) .SelectMany(t => t.GetMethods(BindingFlags.Static | modifiers)) .Where(m => m.IsDefined(typeof(ExtensionAttribute), false)) .Where(m => m.ReturnType == returnType) @@ -570,7 +584,7 @@ public static bool IsAssignableFrom(this Type[] to, Type[] from) /// public static IEnumerable GetChildren(this Type type, Assembly from, bool directlyUnder = false) { - return from.GetTypes().Where(t => t.IsA(type) && (!directlyUnder || t.BaseType == type)).Disinclude(type); + return from.GetTypes().Where(t => t.IsA(type) && (!directlyUnder || t.GetTypeInfo().BaseType == type)).Disinclude(type); } /// @@ -579,7 +593,7 @@ public static IEnumerable GetChildren(this Type type, Assembly from, bool /// public static IEnumerable GetChildren(this Type type, bool directlyUnder = false) { - return GetChildren(type, type.Assembly, directlyUnder); + return GetChildren(type, type.GetTypeInfo().Assembly, directlyUnder); } /// @@ -588,7 +602,7 @@ public static IEnumerable GetChildren(this Type type, bool directlyUnder = /// public static IEnumerable GetConcreteChildren(this Type type, Assembly from, bool directlyUnder = false) { - return GetChildren(type, from, directlyUnder).Where(c => !c.IsAbstract); + return GetChildren(type, from, directlyUnder).Where(c => !c.GetTypeInfo().IsAbstract); } /// @@ -597,7 +611,7 @@ public static IEnumerable GetConcreteChildren(this Type type, Assembly fro /// public static IEnumerable GetConcreteChildren(this Type type, bool directlyUnder = false) { - return GetConcreteChildren(type, type.Assembly, directlyUnder); + return GetConcreteChildren(type, type.GetTypeInfo().Assembly, directlyUnder); } public static Type[] GetConcreteChildren(this Type type, string[] dlls) @@ -605,11 +619,15 @@ public static Type[] GetConcreteChildren(this Type type, string[] dlls) List allTypes = new List(); foreach (var dll in dlls) { +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); +#else var types = type.GetConcreteChildren(Assembly.LoadFile(dll)); foreach (var t in types) { allTypes.Add(t); } +#endif } return allTypes.ToArray(); } diff --git a/Assets/Plugins/Vexe/Runtime/Libs/Helpers/ReflectionHelper.cs b/Assets/Plugins/Vexe/Runtime/Libs/Helpers/ReflectionHelper.cs index 581fc0c..b91be81 100644 --- a/Assets/Plugins/Vexe/Runtime/Libs/Helpers/ReflectionHelper.cs +++ b/Assets/Plugins/Vexe/Runtime/Libs/Helpers/ReflectionHelper.cs @@ -5,6 +5,7 @@ using Vexe.Runtime.Extensions; using Vexe.Runtime.Types; using UnityObject = UnityEngine.Object; +using UnityEngine; namespace Vexe.Runtime.Helpers { @@ -72,6 +73,8 @@ static ReflectionHelper() return members[0]; }).Memoize(); +#if !NETFX_CORE + // app domain 이 없어서 우회 CachedGetRuntimeTypes = new Func(() => { Predicate isIgnoredAssembly = name => @@ -82,6 +85,7 @@ static ReflectionHelper() .SelectMany(x => x.GetTypes()) .ToArray(); }).Memoize(); +#endif } static IEnumerable GetMembers(Type type) @@ -110,7 +114,7 @@ public static Type[] GetMembersTypes(MemberInfo[] members) /// public static Assembly GetUnityEngineAssembly() { - return typeof(UnityObject).Assembly; + return typeof(UnityObject).GetTypeInfo().Assembly; } /// @@ -174,7 +178,12 @@ public static Type[] GetAllTypesOf(Type wantedType) /// public static IEnumerable GetAllTypes() { +#if NETFX_CORE + Debug.Assert(false, "not implemeted yet"); + return null; +#else return AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()); +#endif } } } \ No newline at end of file diff --git a/Assets/Plugins/Vexe/Runtime/Libs/Helpers/RuntimeHelper.cs b/Assets/Plugins/Vexe/Runtime/Libs/Helpers/RuntimeHelper.cs index 6a3bee5..02da0fb 100644 --- a/Assets/Plugins/Vexe/Runtime/Libs/Helpers/RuntimeHelper.cs +++ b/Assets/Plugins/Vexe/Runtime/Libs/Helpers/RuntimeHelper.cs @@ -8,6 +8,7 @@ using Vexe.Runtime.Extensions; using Vexe.Runtime.Types; using UnityObject = UnityEngine.Object; +using Debug = UnityEngine.Debug; namespace Vexe.Runtime.Helpers { @@ -73,6 +74,10 @@ public static string GetCallStack() public static string GetCallStack(bool verbose) { +#if NETFX_CORE + Debug.Assert(false, "not implemented yet"); + return ""; +#else if (verbose) { return string.Join(" -> \r\n", new StackTrace() @@ -91,6 +96,7 @@ public static string GetCallStack(bool verbose) .GetFrames() .Select(x => x.GetMethod().Name) .ToArray()); +#endif } public static void Swap(ref T value0, ref T value1) diff --git a/Assets/Plugins/Vexe/Runtime/Types/Attributes/User/ResourcePathAttribute.cs b/Assets/Plugins/Vexe/Runtime/Types/Attributes/User/ResourcePathAttribute.cs index 187bcea..6471b9b 100644 --- a/Assets/Plugins/Vexe/Runtime/Types/Attributes/User/ResourcePathAttribute.cs +++ b/Assets/Plugins/Vexe/Runtime/Types/Attributes/User/ResourcePathAttribute.cs @@ -1,5 +1,6 @@ using System; using UnityObject = UnityEngine.Object; +using System.Reflection; namespace Vexe.Runtime.Types { @@ -12,7 +13,7 @@ public class ResourcePathAttribute : DrawnAttribute public ResourcePathAttribute(Type objectType = null) { - if (objectType == null || !typeof(UnityObject).IsAssignableFrom(objectType)) + if (objectType == null || !typeof(UnityObject).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo())) ResourceType = typeof(UnityObject); else ResourceType = objectType; diff --git a/Assets/VFW Deprecated.meta b/Assets/VFW Deprecated.meta deleted file mode 100644 index 34df644..0000000 --- a/Assets/VFW Deprecated.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: fdc93fe1f7fb12243a98d1d05b0875c9 -folderAsset: yes -timeCreated: 1457152084 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Editor.meta b/Assets/VFW Deprecated/Editor.meta deleted file mode 100644 index 87674a4..0000000 --- a/Assets/VFW Deprecated/Editor.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 1e8f8e33a2aa6b34aad3cfa0e8cc6224 -folderAsset: yes -timeCreated: 1457155683 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Editor/Drawers.meta b/Assets/VFW Deprecated/Editor/Drawers.meta deleted file mode 100644 index cf393f9..0000000 --- a/Assets/VFW Deprecated/Editor/Drawers.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: f97512753f99a32498a2bc25bd44a22c -folderAsset: yes -timeCreated: 1457155695 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Editor/Drawers/DelegateDrawer.cs b/Assets/VFW Deprecated/Editor/Drawers/DelegateDrawer.cs deleted file mode 100644 index 66480d9..0000000 --- a/Assets/VFW Deprecated/Editor/Drawers/DelegateDrawer.cs +++ /dev/null @@ -1,588 +0,0 @@ -//#define DBG - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using UnityEditor; -using UnityEngine; -using Vexe.Editor.Types; -using Vexe.Runtime.Extensions; -using Vexe.Runtime.Helpers; -using Vexe.Runtime.Types; -using UnityObject = UnityEngine.Object; - -namespace Vexe.Editor.Drawers -{ - public class DelegateDrawer : ObjectDrawer - { - private AddingData adding; - private EditorMember[] argMembers; - private object[] argValues; - private int kAdvanced, kAdd, kInvoke; - private string kHeaderStr; - - protected override void Initialize() - { - adding = new AddingData(); - kAdvanced = RuntimeHelper.CombineHashCodes(id, "advanced"); - kAdd = RuntimeHelper.CombineHashCodes(id, "add"); - kInvoke = RuntimeHelper.CombineHashCodes(id, "invoke"); - kHeaderStr = string.Format("{0} ({1})", displayText, memberTypeName); - - if (memberValue == null) - memberValue = memberType.Instance(); - - int len = memberValue.ParamTypes.Length; - argValues = new object[len]; - argMembers = new EditorMember[len]; - - for (int iLoop = 0; iLoop < len; iLoop++) - { - int i = iLoop; - var paramType = memberValue.ParamTypes[i]; - - argValues[i] = paramType.GetDefaultValueEmptyIfString(); - - var argMember = EditorMember.WrapGetSet( - @get: () => argValues[i], - @set: x => argValues[i] = x, - @rawTarget: argValues, - @unityTarget: unityTarget, - @name: string.Format("({0})", paramType.GetNiceName()), - @attributes: null, - @id: RuntimeHelper.CombineHashCodes(id, i), - @dataType: paramType - ); - - argMember.RawTarget = rawTarget; - argMembers[i] = argMember; - } - -#if DBG - Log("Delegate drawer init. " + niceName); -#endif - } - - public override void OnGUI() - { - foldout = gui.Foldout(kHeaderStr, foldout, Layout.Auto); - if (!foldout) return; - - if (memberValue == null) - { -#if DBG - Log("Creating instance " + niceName); -#endif - memberValue = memberType.Instance(); - } - - // read - var handlers = memberValue.handlers; - - using (gui.Vertical(GUI.skin.box)) - { - if (handlers.Count == 0) - { - gui.HelpBox("There are no handlers for this delegate"); - goto FOOTER; - } - - // header - { - gui.Space(1.5f); - using (gui.Horizontal()) - { - gui.BoldLabel("Target :: Handler"); - using (gui.State(foldout)) - prefs[kAdvanced] = gui.CheckButton(prefs[kAdvanced], "advanced mode", MiniButtonStyle.Right); - } - } - - gui.Splitter(); - - // body - { - // target : handler - for (int iLoop = 0; iLoop < handlers.Count; ) - { - var i = iLoop; - var handler = handlers[i]; - var target = handler.target; - var removed = false; - - if (handler.method == null) - { - Debug.Log("One of the handlers' method was null! This shouldn't happen under normal circumstances. " + - "Removing that handler from the handlers list. " + - "If you keep getting this message please report it"); - - handlers.RemoveAt(i); - continue; - } - - using (gui.Horizontal()) - { - var obj = target as UnityObject; - if (obj != null) - gui.Object(obj); - else - { - string str; - if (target == null) - str = "null"; - else str = target.ToString(); - gui.Text(str); - } - - gui.Text(handler.method.Name); - - if (prefs[kAdvanced]) - { - if (gui.MoveDownButton()) - handlers.MoveElementDown(i); - if (gui.MoveUpButton()) - handlers.MoveElementUp(i); - if (gui.RemoveButton("handler", MiniButtonStyle.ModRight)) - { - handlers.RemoveAt(i); - removed = true; - } - } - } - - if (!removed) iLoop++; - } - } - - FOOTER: - gui.Space(3f); - gui.Splitter(); - { - // add> source :: invoke> - using (gui.Horizontal()) - { - using (gui.State(prefs[kAdd] && adding.source != null && adding.target != null && adding.method != null)) - { - if (gui.Button("Add", "Add new handler", EditorStyles.miniButton, Layout.sWidth(40f))) - { - handlers.Add(new IBaseDelegate.Handler - { - target = adding.target, - method = adding.method - }); - } - } - - gui.Space(10f); - - // add foldout - if (adding.source != null) - prefs[kAdd] = gui.Foldout(prefs[kAdd]); - - // source - var obj = gui.Object(adding.source); - { - if (adding.source != obj) - { - adding.source = obj; - prefs[kAdd] = true; - } - } - - bool paramless = argMembers.IsEmpty(); - using (gui.State(handlers.Count > 0 && (prefs[kInvoke] || paramless))) - { - if (gui.Button("Invoke", EditorStyles.miniButtonRight, Layout.sWidth(50f))) - { - for (int i = 0; i < handlers.Count; i++) - { - var handler = handlers[i]; - var method = handler.method; - method.Invoke(handler.target, argValues); - } - } - } - - if (!paramless && handlers.Count > 0) - { - gui.Space(8f); - prefs[kInvoke] = gui.Foldout(prefs[kInvoke]); - } - } - - - // adding area: target -- method - if (prefs[kAdd] && adding.source != null) - { - gui.Space(5f); - gui.Label("Add handler:"); - using (gui.Indent(GUI.skin.textArea)) - { - // target - var gameObject = adding.gameObject; - if (gameObject == null) - { - gui.Popup("Target", 0, new string[] { adding.source.GetType().Name }); - { - adding.target = adding.source; - } - } - else - { - if (adding.source is Component) - adding.target = adding.source; - - var components = gameObject.GetAllComponentsIncludingSelf(); - int targetIdx = components.IndexOfZeroIfNotFound(adding.target); - var uniqueNames = components.Select(c => c.GetType().Name).ToList().Uniqify(); - var targetSelection = gui.Popup("Target", targetIdx, uniqueNames.ToArray()); - { - if (targetIdx != targetSelection || adding.target as Component != components[targetSelection]) - adding.target = components[targetSelection]; - } - } - - // method - if (adding.target != null) - { - var methods = adding.target.GetType() - .GetMethods(memberValue.ReturnType, memberValue.ParamTypes, Flags.InstancePublic, false) - .Where(m => !m.IsDefined()) - .Where(m => !DelegateSettings.IgnoredMethods.Contains(m.Name)) - .ToList(); - int mIndex = methods.IndexOfZeroIfNotFound(adding.method); - int methodSelection = gui.Popup("Handler", mIndex, methods.Select(m => m.GetFullName()).ToArray()); - { - if (!methods.IsEmpty() && (mIndex != methodSelection || adding.method != methods[methodSelection])) - adding.method = methods[methodSelection]; - } - } - } - } - - // invocation args - if (prefs[kInvoke]) - { - gui.Label("Invoke with arguments:"); - using (gui.Indent()) - { - for (int i = 0; i < argMembers.Length; i++) - gui.Member(argMembers[i], false); - } - } - } - } - - // write - memberValue.handlers = handlers; - } - - private class AddingData - { - public object target; - public UnityObject source; - public MethodInfo method; - - public GameObject gameObject - { - get - { - var component = source as Component; - return component == null ? source as GameObject : component.gameObject; - } - } - } - } - - // Ugly as hell, I know... - public class uDelegateDrawer : ObjectDrawer - { - private AddingData adding; - private List argValuesList - { - get { return memberValue.arguments; } - set { memberValue.arguments = value; } - } - private List argMembersList; - private int kAdvanced, kAdd; - private string kHeaderStr; - - protected override void Initialize() - { - adding = new AddingData(); - - kAdvanced = RuntimeHelper.CombineHashCodes(id, "advanced"); - kAdd = RuntimeHelper.CombineHashCodes(id, "add"); - kHeaderStr = string.Format("{0} ({1})", displayText, memberTypeName); - - if (memberValue == null) - memberValue = new uDelegate(); - - if (argValuesList == null) - argValuesList = new List(); - - argMembersList = new List(); -#if DBG - Log("Delegate drawer init. " + niceName); -#endif - } - - public override void OnGUI() - { - foldout = gui.Foldout(kHeaderStr, foldout, Layout.Auto); - if (!foldout) return; - - if (memberValue == null) - memberValue = new uDelegate(); - - // read - var handlers = memberValue.handlers; - - using (gui.Vertical(GUI.skin.box)) - { - if (handlers.Count == 0) - { - gui.HelpBox("There are no handlers for this delegate"); - goto FOOTER; - } - - // header - { - gui.Space(1.5f); - using (gui.Horizontal()) - { - gui.BoldLabel("Target :: Handler"); - using (gui.State(foldout)) - { - prefs[kAdvanced] = gui.CheckButton(prefs[kAdvanced], "advanced mode", MiniButtonStyle.Right); - } - } - } - - gui.Splitter(); - - // body - { - // target : handler - for (int iLoop = 0; iLoop < handlers.Count; ) - { - var i = iLoop; - var handler = handlers[i]; - var target = handler.target; - var removed = false; - var key = RuntimeHelper.CombineHashCodes(id, "udel", i); - - using (gui.Horizontal()) - { - var obj = target as UnityObject; - if (obj != null) - gui.Object(obj); - else - { - string str; - if (target == null) - str = "null"; - else str = target.ToString(); - gui.Text(str); - } - - gui.Text(handler.method.Name); - - gui.Space(10f); - prefs[key] = gui.Foldout(prefs[key]); - gui.Space(-5f); - - if (prefs[kAdvanced]) - { - if (gui.MoveDownButton()) - handlers.MoveElementDown(i); - if (gui.MoveUpButton()) - handlers.MoveElementUp(i); - if (gui.RemoveButton("handler", MiniButtonStyle.ModRight)) - { - handlers.RemoveAt(i); - argMembersList.RemoveAt(i); - argValuesList.RemoveAt(i); - removed = true; - } - } - } - - if (prefs[key] && !removed) - { - var method = handler.method; - Type[] paramTypes = method.GetParameters().Select(x => x.ParameterType).ToArray(); - - SetupMembers(i, paramTypes); - - using (gui.Indent()) - { - gui.Label("Invocation args"); - using (gui.Indent()) - { - var argMembers = argMembersList[i]; - for (int j = 0; j < argMembers.Length; j++) - gui.Member(argMembers[j], true); - } - } - } - - if (!removed) iLoop++; - } - } - - FOOTER: - gui.Space(3f); - gui.Splitter(); - { - // add> source :: invoke> - using (gui.Horizontal()) - { - using (gui.State(prefs[kAdd] && adding.source != null && adding.target != null && adding.method != null)) - { - if (gui.Button("Add", "Add new handler", EditorStyles.miniButton, Layout.sWidth(40f))) - { - handlers.Add(new IBaseDelegate.Handler - { - target = adding.target, - method = adding.method - }); - - var method = adding.method; - var paramTypes = method.GetParameters().Select(x => x.ParameterType).ToArray(); - int len = paramTypes.Length; - var argValues = new object[len]; - argValuesList.Add(argValues); - for (int x = 0; x < argValues.Length; x++) - argValues[x] = paramTypes[x].GetDefaultValueEmptyIfString(); - } - } - - gui.Space(10f); - - // add foldout - if (adding.source != null) - prefs[kAdd] = gui.Foldout(prefs[kAdd]); - - // source - var obj = gui.Object(adding.source); - { - if (adding.source != obj) - { - adding.source = obj; - prefs[kAdd] = true; - } - } - - using (gui.State(handlers.Count > 0)) - { - if (gui.Button("Invoke", EditorStyles.miniButtonRight, Layout.sWidth(50f))) - memberValue.Invoke(); - } - } - - // adding area: target -- method - if (prefs[kAdd] && adding.source != null) - { - gui.Space(5f); - gui.Label("Add handler:"); - using (gui.Indent(GUI.skin.textArea)) - { - // target - var gameObject = adding.gameObject; - if (gameObject == null) - { - gui.Popup("Target", 0, new string[] { adding.source.GetType().Name }); - { - adding.target = adding.source; - } - } - else - { - if (adding.source is Component) - adding.target = adding.source; - - var components = gameObject.GetAllComponentsIncludingSelf(); - int cIndex = components.IndexOfZeroIfNotFound(adding.target); - var uniqueNames = components.Select(c => c.GetType().Name).ToList().Uniqify(); - var targetSelection = gui.Popup("Target", cIndex, uniqueNames.ToArray()); - { - if (cIndex != targetSelection || adding.target as Component != components[targetSelection]) - adding.target = components[targetSelection]; - } - } - - // method - if (adding.target != null) - { - var methods = adding.target.GetType() - .GetMethods(memberValue.ReturnType, memberValue.ParamTypes, Flags.InstancePublic, false) - .Where(m => !m.IsDefined()) - .Where(m => !DelegateSettings.IgnoredMethods.Contains(m.Name)) - .ToList(); - int mIndex = methods.IndexOfZeroIfNotFound(adding.method); - int methodSelection = gui.Popup("Handler", mIndex, methods.Select(m => m.GetFullName()).ToArray()); - { - if (!methods.IsEmpty() && (mIndex != methodSelection || adding.method != methods[methodSelection])) - adding.method = methods[methodSelection]; - } - } - } - } - } - } - - // write - memberValue.handlers = handlers; - } - - private void SetupMembers(int idx, Type[] paramTypes) - { - if (idx < argMembersList.Count) - return; - - int len = paramTypes.Length; - - var argMembers = new EditorMember[len]; - var argValues = argValuesList[idx]; - - argMembersList.Add(argMembers); - - for (int iLoop = 0; iLoop < len; iLoop++) - { - int i = iLoop; - var paramType = paramTypes[i]; - - var argMember = EditorMember.WrapGetSet( - get: () => argValues[i], - set: x => argValues[i] = x, - rawTarget: argValues, - @unityTarget: unityTarget, - @name: string.Format("({0})", paramType.GetNiceName()), - @id: id + i, - @dataType: paramType, - @attributes: null - ); - - argMembers[i] = argMember; - } - } - - private class AddingData - { - public UnityObject source; - public UnityObject target; - public MethodInfo method; - - public GameObject gameObject - { - get - { - var component = source as Component; - return component == null ? source as GameObject : component.gameObject; - } - } - } - } -} diff --git a/Assets/VFW Deprecated/Editor/Drawers/DelegateDrawer.cs.meta b/Assets/VFW Deprecated/Editor/Drawers/DelegateDrawer.cs.meta deleted file mode 100644 index 938826e..0000000 --- a/Assets/VFW Deprecated/Editor/Drawers/DelegateDrawer.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 8f01e764189d5a4419e799d1302529c7 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Editor/Drawers/RequirementDrawers.cs b/Assets/VFW Deprecated/Editor/Drawers/RequirementDrawers.cs deleted file mode 100644 index 405b985..0000000 --- a/Assets/VFW Deprecated/Editor/Drawers/RequirementDrawers.cs +++ /dev/null @@ -1,60 +0,0 @@ -using UnityEditor; -using Vexe.Editor.Types; -using Vexe.Runtime.Types; -using UnityObject = UnityEngine.Object; - -namespace Vexe.Editor.Drawers -{ - public abstract class BaseRequirementDrawer : CompositeDrawer where T : RequiredAttribute - { - protected abstract string GetHelpMsg(); - - public override void OnUpperGUI() - { - if (member.IsNull()) - { - gui.HelpBox(GetHelpMsg(), MessageType.Warning); - } - } - } - - public class RequiredFromThisDrawer : BaseRequirementDrawer - { - protected override string GetHelpMsg() - { - return "Couldn't resolve member from this gameObject"; - } - } - - public class RequiredSingleDrawer : BaseRequirementDrawer - { - protected override string GetHelpMsg() - { - return "Couldn't find a single object in the scene to assign to member"; - } - } - - public class RequiredDrawer : BaseRequirementDrawer - { - protected override string GetHelpMsg() - { - return "Member assignment is required"; - } - } - - public class RequiredFromChildrenDrawer : BaseRequirementDrawer - { - protected override string GetHelpMsg() - { - return "Couldn't resolve member from children"; - } - } - - public class RequiredFromParentsDrawer : BaseRequirementDrawer - { - protected override string GetHelpMsg() - { - return "Couldn't resolve member from parents"; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Editor/Drawers/RequirementDrawers.cs.meta b/Assets/VFW Deprecated/Editor/Drawers/RequirementDrawers.cs.meta deleted file mode 100644 index e05643b..0000000 --- a/Assets/VFW Deprecated/Editor/Drawers/RequirementDrawers.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: cc51149708fda0a47b97a8cbed10c6f4 -timeCreated: 1457156395 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Editor/Drawers/SelectObjDrawer.cs b/Assets/VFW Deprecated/Editor/Drawers/SelectObjDrawer.cs deleted file mode 100644 index 491a89e..0000000 --- a/Assets/VFW Deprecated/Editor/Drawers/SelectObjDrawer.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Linq; -using UnityEngine; -using Vexe.Editor.Helpers; -using Vexe.Editor.Windows; -using Vexe.Editor.Types; -using Vexe.Runtime.Extensions; -using Vexe.Runtime.Types; -using UnityObject = UnityEngine.Object; - -namespace Vexe.Editor.Drawers -{ - public class SelectObjDrawer : AttributeDrawer - { - public override void OnGUI() - { - using (gui.Horizontal()) - { - bool isNull = member.IsNull(); - bool isObjectField = prefs[id]; - - gui.Text(displayText, isNull ? "null" : memberValue.name + " (" + memberTypeName + ")"); - - var fieldRect = gui.LastRect; - { - GUIHelper.PingField(fieldRect, memberValue, !isNull && isObjectField); - } - - if (gui.SelectionButton("object")) - { - Func newTab = (values, title) => - new Tab( - @getValues : () => values, - @getCurrent : member.As, - @setTarget : member.Set, - @getValueName : obj => obj.name, - @title : title - ); - - bool isGo = memberType == typeof(GameObject); - SelectionWindow.Show("Select a " + memberTypeName, - newTab(UnityObject.FindObjectsOfType(memberType), "All"), - newTab(isGo ? (UnityObject[])gameObject.GetChildren() : - gameObject.GetComponentsInChildren(memberType), "Children"), - newTab(isGo ? (UnityObject[])gameObject.GetParents() : - gameObject.GetComponentsInParent(memberType), "Parents"), - newTab(isGo ? PrefabHelper.GetGameObjectPrefabs().ToArray() : - PrefabHelper.GetComponentPrefabs(memberType).Cast().ToArray(), "Prefabs") - ); - } - } - - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Editor/Drawers/SelectObjDrawer.cs.meta b/Assets/VFW Deprecated/Editor/Drawers/SelectObjDrawer.cs.meta deleted file mode 100644 index 196af4c..0000000 --- a/Assets/VFW Deprecated/Editor/Drawers/SelectObjDrawer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f89ec6c9b6503994abab469e0dffa4a1 -timeCreated: 1457156395 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Editor/RegisterDeprecatedDrawers.cs b/Assets/VFW Deprecated/Editor/RegisterDeprecatedDrawers.cs deleted file mode 100644 index 28e2247..0000000 --- a/Assets/VFW Deprecated/Editor/RegisterDeprecatedDrawers.cs +++ /dev/null @@ -1,16 +0,0 @@ -using UnityEditor; -using Vexe.Runtime.Types; - -namespace Vexe.Editor.Drawers -{ - [InitializeOnLoad] - public static class RegisterDeprecatedDrawers - { - static RegisterDeprecatedDrawers() - { - MemberDrawersHandler.Mapper.Insert(true) - .Insert() - .Insert(); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Editor/RegisterDeprecatedDrawers.cs.meta b/Assets/VFW Deprecated/Editor/RegisterDeprecatedDrawers.cs.meta deleted file mode 100644 index fdff335..0000000 --- a/Assets/VFW Deprecated/Editor/RegisterDeprecatedDrawers.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2f2b52c3e56c67b4696ef27e898219c5 -timeCreated: 1457155796 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime.meta b/Assets/VFW Deprecated/Runtime.meta deleted file mode 100644 index e57a275..0000000 --- a/Assets/VFW Deprecated/Runtime.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 02df604eb78c38a48a8bcf7b4f72f65c -folderAsset: yes -timeCreated: 1457152340 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization.meta b/Assets/VFW Deprecated/Runtime/Serialization.meta deleted file mode 100644 index 8623fe3..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 82af438451fe0614c84a3789a2556c3c -folderAsset: yes -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/SerializationAttributes.cs b/Assets/VFW Deprecated/Runtime/Serialization/SerializationAttributes.cs deleted file mode 100644 index ba3ba0f..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/SerializationAttributes.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace Vexe.Runtime.Types -{ - [Obsolete("Please stick to Unity's seiralization")] - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public class SerializeAttribute : Attribute - { - } - - [Obsolete("Please stick to Unity's seiralization")] - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public class DontSerializeAttribute : Attribute - { - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/SerializationAttributes.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/SerializationAttributes.cs.meta deleted file mode 100644 index 4648cb4..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/SerializationAttributes.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 1616120942e05414490fa7263a7df06f -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/SerializationData.cs b/Assets/VFW Deprecated/Runtime/Serialization/SerializationData.cs deleted file mode 100644 index f06393a..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/SerializationData.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using Vexe.Runtime.Types; -using UnityObject = UnityEngine.Object; - -namespace Vexe.Runtime.Serialization -{ - /// - /// A serializable (by Unity) class that holds the serialization data for a BetterBehaviour/BetterScriptableObject - /// - [Serializable] - public class SerializationData - { - /// We let Unity handle the serialization of its own types so whenever we come across a Unity object we store it - /// in the 'serializedObjects' list and serialize the index of where that storage took place. - [Display(Seq.Readonly)] - public List serializedObjects = new List(); - - /// A serializable key-value pair list data structure that holds the serialized values of members - /// in a BetterBehaviour/BetterScriptableObject. Let's say we had a int field called 'x' = 10, - /// then we'd have an entry with "int x" as key and '10' as value. - [Display(Dict.Readonly)] - public StrStrDict serializedStrings = new StrStrDict(); - - public void Clear() - { - serializedObjects.Clear(); - serializedStrings.Clear(); - } - - public override string ToString() - { - return "Runtime Serialization Data"; - } - } - - [Serializable] - public class StrStrDict : KVPList - { - } -} diff --git a/Assets/VFW Deprecated/Runtime/Serialization/SerializationData.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/SerializationData.cs.meta deleted file mode 100644 index 727c198..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/SerializationData.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 07e3576e587930347851c8c969a728ef -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/SerializationLogic.cs b/Assets/VFW Deprecated/Runtime/Serialization/SerializationLogic.cs deleted file mode 100644 index 62ec7b8..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/SerializationLogic.cs +++ /dev/null @@ -1,202 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using UnityEngine; -using Vexe.Runtime.Extensions; -using Vexe.Runtime.Helpers; -using Vexe.Runtime.Types; -using UnityObject = UnityEngine.Object; - -namespace Vexe.Runtime.Serialization -{ - /// - /// Defines a serialization logic interface that specifies whether a field, property or type is serializable or not - /// - public abstract class ISerializationLogic - { - public abstract bool IsSerializableField(FieldInfo field); - public abstract bool IsSerializableProperty(PropertyInfo property); - public abstract bool IsSerializableType(Type type); - - /// - /// Returns a list of RuntimeMember wrapping all the serializable members in the specified type. - /// Caches the result so that we only do the query once for a certain type. - /// - public readonly Func CachedGetSerializableMembers; - - public ISerializationLogic() - { - CachedGetSerializableMembers = new Func(type => - GetSerializableMembers(type, null).ToArray()).Memoize(); - } - - /// - /// Returns a list of RuntimeMember wrapping all the serializable members in the specified type. - /// - private List GetSerializableMembers(Type type, object target) - { - var members = ReflectionHelper.CachedGetMembers(type); - var serializableMembers = members.Where(IsSerializableMember); - var result = RuntimeMember.WrapMembers(serializableMembers, target); - return result; - } - - /// - /// returns IsSerializableField if the member is a field, - /// returns IsSerializableProperty if the member is a property, - /// otherwise false - /// - public bool IsSerializableMember(MemberInfo member) - { - var field = member as FieldInfo; - if (field != null) - return IsSerializableField(field); - - var property = member as PropertyInfo; - if (property != null) - return IsSerializableProperty(property); - - return false; - } - } - - /// - /// The default serialization logic in VFW. - /// - public class VFWSerializationLogic : ISerializationLogic - { - public readonly Type[] SerializeMember; - - public readonly Type[] DontSerializeMember; - - /// - /// The default serialization logic used in VFW - /// - [Serialize] and to tell that a field/property must be serialized - /// - [DontSerialize] to tell that a field/property should not be serialized - /// - no attributes required for a type to be serializable - /// - public static readonly VFWSerializationLogic Instance = new VFWSerializationLogic( - new Type[] { typeof(SerializeAttribute), typeof(SerializeField) }, - new Type[] { typeof(DontSerializeAttribute), typeof(NonSerializedAttribute) }); - - public VFWSerializationLogic(Type[] serializeMemberAttributes, Type[] dontSerializeMemberAttributes) - { - this.SerializeMember = serializeMemberAttributes; - this.DontSerializeMember = dontSerializeMemberAttributes; - } - - /// - /// Types don't need to be annotated with any special attributes for them to be serialized - /// A type is serialized if: - /// - it's a primitive, enum or string - /// - or a UnityEngine.Object - /// - or a Unity struct - /// - or a single-dimensional array and the element type is serializable - /// - or an interface - /// - or included in the 'SupportedTypes' array - /// - it's not included in the 'NotSupportedTypes' array - /// - it's generic and all its generic type arguments are serializable as well - /// - public override bool IsSerializableType(Type type) - { - if (type.IsPrimitive || type.IsEnum || type == typeof(string) - || type.IsA() - || UnityStructs.ContainsValue(type)) - return true; - - if (type.IsArray) - return type.GetArrayRank() == 1 && IsSerializableType(type.GetElementType()); - - if (type.IsInterface) - return true; - - if (NotSupportedTypes.Any(type.IsA)) - return false; - - if (SupportedTypes.Any(type.IsA)) - return true; - - if (type.IsGenericType) - return type.GetGenericArguments().All(IsSerializableType); - - return true; - } - - /// - /// A field is serializable if: - /// - it's not marked with any of the 'DontSerializeMember' attributes - /// - nor literal (const) - /// - it's public otherwise annotated with one of the attributes in the 'SerializeMember' array - /// - its type is serializable - /// - readonly fields that meet the previous requirements are serialized in Better[Behaviour|ScriptableObject] - /// and System.Objects as long as the used serializer supports it (FullSerializer does) - /// - static fields that meet the previous requirements are always serialized in Better[Behaviour|ScriptableObject], - /// and in System.Objects if the serializer of use supports it (FullSerialier doesn't) - /// - public override bool IsSerializableField(FieldInfo field) - { - if (DontSerializeMember.Any(field.IsDefined)) - return false; - - if (field.IsLiteral) - return false; - - if (!(field.IsPublic || SerializeMember.Any(field.IsDefined))) - return false; - - bool serializable = IsSerializableType(field.FieldType); - return serializable; - } - - /// - /// A property is serializable if: - /// - it's not marked with any of the 'DontSerializeMember' attributes - /// - it's an auto-property - /// - has a public getter or setter, otherwise must be annotated with any of the 'SerializeMember' attributes - /// - its type is serializable - /// - static properties that meet the previous requirements are always serialized in Better[Behaviour|ScriptableObject], - /// and in System.Objects if the serializer of use supports it (FullSerialier doesn't) - /// - public override bool IsSerializableProperty(PropertyInfo property) - { - if (DontSerializeMember.Any(property.IsDefined)) - return false; - - if (!property.IsAutoProperty()) - return false; - - if (!(property.GetGetMethod(true).IsPublic || - property.GetSetMethod(true).IsPublic || - SerializeMember.Any(property.IsDefined))) - return false; - - bool serializable = IsSerializableType(property.PropertyType); - return serializable; - } - - public static readonly Type[] UnityStructs = - { - typeof(Vector3), - typeof(Vector2), - typeof(Vector4), - typeof(Rect), - typeof(Quaternion), - typeof(Matrix4x4), - typeof(Color), - typeof(Color32), - typeof(LayerMask), - typeof(Bounds) - }; - - public static readonly Type[] NotSupportedTypes = - { - typeof(Delegate) - }; - - public static readonly Type[] SupportedTypes = - { - typeof(Type) - }; - } -} diff --git a/Assets/VFW Deprecated/Runtime/Serialization/SerializationLogic.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/SerializationLogic.cs.meta deleted file mode 100644 index 4f55fdf..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/SerializationLogic.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: de861aea39d11a6489b0df6252e05785 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers.meta deleted file mode 100644 index 21d01ee..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 3d5b54d3de6f9dc479163904b2a019eb -folderAsset: yes -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer.meta deleted file mode 100644 index 5fcaab0..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 17202e6f88969f040b4299caec6f65d0 -folderAsset: yes -timeCreated: 1428457244 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/FullSerializerBackend.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/FullSerializerBackend.cs deleted file mode 100644 index 114c8ef..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/FullSerializerBackend.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using FullSerializer; -using UnityObject = UnityEngine.Object; - -namespace Vexe.Runtime.Serialization -{ - /// - /// An adaptor/proxy to add support for the JSON serializer FullSerializer - /// - public class FullSerializerBackend : SerializerBackend - { - public static readonly fsSerializer Serializer; - - public FullSerializerBackend() - { - Logic = VFWSerializationLogic.Instance; - } - - static FullSerializerBackend() - { - Serializer = new fsSerializer(); - Serializer.AddConverter(new UnityObjectConverter()); - Serializer.AddConverter(new MethodInfoConverter()); - - fsConfig.SerializeAttributes = VFWSerializationLogic.Instance.SerializeMember; - fsConfig.IgnoreSerializeAttributes = VFWSerializationLogic.Instance.DontSerializeMember; - } - - public override string Serialize(Type type, object value, object context) - { - Serializer.Context.Set(context as List); - - fsData data; - var fail = Serializer.TrySerialize(type, value, out data); - if (fail.Failed) throw new Exception(fail.FormattedMessages); - - return fsJsonPrinter.CompressedJson(data); - } - - public override object Deserialize(Type type, string serializedState, object context) - { - fsData data; - fsResult status = fsJsonParser.Parse(serializedState, out data); - if (status.Failed) throw new Exception(status.FormattedMessages); - - Serializer.Context.Set(context as List); - - object deserialized = null; - status = Serializer.TryDeserialize(data, type, ref deserialized); - if (status.Failed) throw new Exception(status.FormattedMessages); - return deserialized; - } - } -} diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/FullSerializerBackend.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/FullSerializerBackend.cs.meta deleted file mode 100644 index b0c9410..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/FullSerializerBackend.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 68a974526db73fa41a6852a17ff753a5 -timeCreated: 1426181015 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/MethodInfoConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/MethodInfoConverter.cs deleted file mode 100644 index 8a5c526..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/MethodInfoConverter.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Reflection; -using FullSerializer; - -namespace Vexe.Runtime.Serialization -{ - public class MethodInfoConverter : fsConverter - { - public override bool RequestCycleSupport(Type storageType) - { - return false; - } - - public override bool CanProcess(Type type) - { - return typeof(MethodInfo).IsAssignableFrom(type); - } - - public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) - { - var method = instance as MethodInfo; - serialized = fsData.CreateList(); - var list = serialized.AsList; - - fsData declTypeData; - Serializer.TrySerialize(method.DeclaringType, out declTypeData); - - list.Add(declTypeData); - list.Add(new fsData(method.Name)); - - var args = method.GetParameters(); - list.Add(new fsData(args.Length)); - - for(int i = 0; i < args.Length; i++) - { - fsData argData; - Serializer.TrySerialize(args[i].ParameterType, out argData); - list.Add(argData); - } - - return fsResult.Success; - } - - public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) - { - var list = data.AsList; - - Type declaringType = null; - Serializer.TryDeserialize(list[0], ref declaringType); - - string methodName = list[1].AsString; - int argCount = (int)list[2].AsInt64; - var argTypes = new Type[argCount]; - for(int i = 0; i < argCount; i++) - { - var argData = list[i + 3]; - Serializer.TryDeserialize(argData, ref argTypes[i]); - } - - var flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; - instance = declaringType.GetMethod(methodName, flags, null, argTypes, null); - return fsResult.Success; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/MethodInfoConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/MethodInfoConverter.cs.meta deleted file mode 100644 index 52030a0..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/MethodInfoConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e45da1087e27f0d41b3a9fc4056861ae -timeCreated: 1428470683 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source.meta deleted file mode 100644 index ca242b7..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: f441b0a0efabf0745bcdf252f3fcd935 -folderAsset: yes -timeCreated: 1428466633 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters.meta deleted file mode 100644 index 131a8bb..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 8ecb479571ff05a44a804a8f33e1f5c9 -folderAsset: yes -timeCreated: 1428466633 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity.meta deleted file mode 100644 index ee01375..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c43aacb4d98819b49a32e38cea14a239 -folderAsset: yes -timeCreated: 1428466633 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/AnimationCurve_DirectConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/AnimationCurve_DirectConverter.cs deleted file mode 100644 index 574a5ab..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/AnimationCurve_DirectConverter.cs +++ /dev/null @@ -1,47 +0,0 @@ -#if !NO_UNITY -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace FullSerializer { - partial class fsConverterRegistrar { - public static Internal.DirectConverters.AnimationCurve_DirectConverter Register_AnimationCurve_DirectConverter; - } -} - -namespace FullSerializer.Internal.DirectConverters { - public class AnimationCurve_DirectConverter : fsDirectConverter { - protected override fsResult DoSerialize(AnimationCurve model, Dictionary serialized) { - var result = fsResult.Success; - - result += SerializeMember(serialized, "keys", model.keys); - result += SerializeMember(serialized, "preWrapMode", model.preWrapMode); - result += SerializeMember(serialized, "postWrapMode", model.postWrapMode); - - return result; - } - - protected override fsResult DoDeserialize(Dictionary data, ref AnimationCurve model) { - var result = fsResult.Success; - - var t0 = model.keys; - result += DeserializeMember(data, "keys", out t0); - model.keys = t0; - - var t1 = model.preWrapMode; - result += DeserializeMember(data, "preWrapMode", out t1); - model.preWrapMode = t1; - - var t2 = model.postWrapMode; - result += DeserializeMember(data, "postWrapMode", out t2); - model.postWrapMode = t2; - - return result; - } - - public override object CreateInstance(fsData data, Type storageType) { - return new AnimationCurve(); - } - } -} -#endif \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/AnimationCurve_DirectConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/AnimationCurve_DirectConverter.cs.meta deleted file mode 100644 index 78df4ff..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/AnimationCurve_DirectConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 25e9fa07f92db7244afe261c3bbf2b0a -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Bounds_DirectConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Bounds_DirectConverter.cs deleted file mode 100644 index 1f6733c..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Bounds_DirectConverter.cs +++ /dev/null @@ -1,42 +0,0 @@ -#if !NO_UNITY -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace FullSerializer { - partial class fsConverterRegistrar { - public static Internal.DirectConverters.Bounds_DirectConverter Register_Bounds_DirectConverter; - } -} - -namespace FullSerializer.Internal.DirectConverters { - public class Bounds_DirectConverter : fsDirectConverter { - protected override fsResult DoSerialize(Bounds model, Dictionary serialized) { - var result = fsResult.Success; - - result += SerializeMember(serialized, "center", model.center); - result += SerializeMember(serialized, "size", model.size); - - return result; - } - - protected override fsResult DoDeserialize(Dictionary data, ref Bounds model) { - var result = fsResult.Success; - - var t0 = model.center; - result += DeserializeMember(data, "center", out t0); - model.center = t0; - - var t1 = model.size; - result += DeserializeMember(data, "size", out t1); - model.size = t1; - - return result; - } - - public override object CreateInstance(fsData data, Type storageType) { - return new Bounds(); - } - } -} -#endif \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Bounds_DirectConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Bounds_DirectConverter.cs.meta deleted file mode 100644 index 745923a..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Bounds_DirectConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 67581cbc9dcc87849b2b883efb53a4cd -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Gradient_DirectConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Gradient_DirectConverter.cs deleted file mode 100644 index 67e0db1..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Gradient_DirectConverter.cs +++ /dev/null @@ -1,42 +0,0 @@ -#if !NO_UNITY -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace FullSerializer { - partial class fsConverterRegistrar { - public static Internal.DirectConverters.Gradient_DirectConverter Register_Gradient_DirectConverter; - } -} - -namespace FullSerializer.Internal.DirectConverters { - public class Gradient_DirectConverter : fsDirectConverter { - protected override fsResult DoSerialize(Gradient model, Dictionary serialized) { - var result = fsResult.Success; - - result += SerializeMember(serialized, "alphaKeys", model.alphaKeys); - result += SerializeMember(serialized, "colorKeys", model.colorKeys); - - return result; - } - - protected override fsResult DoDeserialize(Dictionary data, ref Gradient model) { - var result = fsResult.Success; - - var t0 = model.alphaKeys; - result += DeserializeMember(data, "alphaKeys", out t0); - model.alphaKeys = t0; - - var t1 = model.colorKeys; - result += DeserializeMember(data, "colorKeys", out t1); - model.colorKeys = t1; - - return result; - } - - public override object CreateInstance(fsData data, Type storageType) { - return new Gradient(); - } - } -} -#endif \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Gradient_DirectConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Gradient_DirectConverter.cs.meta deleted file mode 100644 index bcab0b7..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Gradient_DirectConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a6cace10f6d7d7a4cbc2001b104eb3ea -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Keyframe_DirectConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Keyframe_DirectConverter.cs deleted file mode 100644 index 0665303..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Keyframe_DirectConverter.cs +++ /dev/null @@ -1,57 +0,0 @@ -#if !NO_UNITY -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace FullSerializer { - partial class fsConverterRegistrar { - public static Internal.DirectConverters.Keyframe_DirectConverter Register_Keyframe_DirectConverter; - } -} - -namespace FullSerializer.Internal.DirectConverters { - public class Keyframe_DirectConverter : fsDirectConverter { - protected override fsResult DoSerialize(Keyframe model, Dictionary serialized) { - var result = fsResult.Success; - - result += SerializeMember(serialized, "time", model.time); - result += SerializeMember(serialized, "value", model.value); - result += SerializeMember(serialized, "tangentMode", model.tangentMode); - result += SerializeMember(serialized, "inTangent", model.inTangent); - result += SerializeMember(serialized, "outTangent", model.outTangent); - - return result; - } - - protected override fsResult DoDeserialize(Dictionary data, ref Keyframe model) { - var result = fsResult.Success; - - var t0 = model.time; - result += DeserializeMember(data, "time", out t0); - model.time = t0; - - var t1 = model.value; - result += DeserializeMember(data, "value", out t1); - model.value = t1; - - var t2 = model.tangentMode; - result += DeserializeMember(data, "tangentMode", out t2); - model.tangentMode = t2; - - var t3 = model.inTangent; - result += DeserializeMember(data, "inTangent", out t3); - model.inTangent = t3; - - var t4 = model.outTangent; - result += DeserializeMember(data, "outTangent", out t4); - model.outTangent = t4; - - return result; - } - - public override object CreateInstance(fsData data, Type storageType) { - return new Keyframe(); - } - } -} -#endif \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Keyframe_DirectConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Keyframe_DirectConverter.cs.meta deleted file mode 100644 index 9e3b717..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Keyframe_DirectConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 541f199986bdbd44a9bd24149bdbe790 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/LayerMask_DirectConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/LayerMask_DirectConverter.cs deleted file mode 100644 index 13c05d6..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/LayerMask_DirectConverter.cs +++ /dev/null @@ -1,37 +0,0 @@ -#if !NO_UNITY -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace FullSerializer { - partial class fsConverterRegistrar { - public static Internal.DirectConverters.LayerMask_DirectConverter Register_LayerMask_DirectConverter; - } -} - -namespace FullSerializer.Internal.DirectConverters { - public class LayerMask_DirectConverter : fsDirectConverter { - protected override fsResult DoSerialize(LayerMask model, Dictionary serialized) { - var result = fsResult.Success; - - result += SerializeMember(serialized, "value", model.value); - - return result; - } - - protected override fsResult DoDeserialize(Dictionary data, ref LayerMask model) { - var result = fsResult.Success; - - var t0 = model.value; - result += DeserializeMember(data, "value", out t0); - model.value = t0; - - return result; - } - - public override object CreateInstance(fsData data, Type storageType) { - return new LayerMask(); - } - } -} -#endif \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/LayerMask_DirectConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/LayerMask_DirectConverter.cs.meta deleted file mode 100644 index 626f1a6..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/LayerMask_DirectConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7ad142c0d7eba2547a76e5675b94c392 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Rect_DirectConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Rect_DirectConverter.cs deleted file mode 100644 index 508b659..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Rect_DirectConverter.cs +++ /dev/null @@ -1,52 +0,0 @@ -#if !NO_UNITY -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace FullSerializer { - partial class fsConverterRegistrar { - public static Internal.DirectConverters.Rect_DirectConverter Register_Rect_DirectConverter; - } -} - -namespace FullSerializer.Internal.DirectConverters { - public class Rect_DirectConverter : fsDirectConverter { - protected override fsResult DoSerialize(Rect model, Dictionary serialized) { - var result = fsResult.Success; - - result += SerializeMember(serialized, "xMin", model.xMin); - result += SerializeMember(serialized, "yMin", model.yMin); - result += SerializeMember(serialized, "xMax", model.xMax); - result += SerializeMember(serialized, "yMax", model.yMax); - - return result; - } - - protected override fsResult DoDeserialize(Dictionary data, ref Rect model) { - var result = fsResult.Success; - - var t0 = model.xMin; - result += DeserializeMember(data, "xMin", out t0); - model.xMin = t0; - - var t1 = model.yMin; - result += DeserializeMember(data, "yMin", out t1); - model.yMin = t1; - - var t2 = model.xMax; - result += DeserializeMember(data, "xMax", out t2); - model.xMax = t2; - - var t3 = model.yMax; - result += DeserializeMember(data, "yMax", out t3); - model.yMax = t3; - - return result; - } - - public override object CreateInstance(fsData data, Type storageType) { - return new Rect(); - } - } -} -#endif \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Rect_DirectConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Rect_DirectConverter.cs.meta deleted file mode 100644 index 2600ec8..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/Unity/Rect_DirectConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d799c1fefad9169469b7b57f6adcf025 -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsArrayConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsArrayConverter.cs deleted file mode 100644 index 7ad8c2a..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsArrayConverter.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections; - -namespace FullSerializer.Internal { - public class fsArrayConverter : fsConverter { - public override bool CanProcess(Type type) { - return type.IsArray; - } - - public override bool RequestCycleSupport(Type storageType) { - return false; - } - - public override bool RequestInheritanceSupport(Type storageType) { - return false; - } - - public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) { - // note: IList[index] is **significantly** faster than Array.Get, so make sure we use - // that instead. - - IList arr = (Array)instance; - Type elementType = storageType.GetElementType(); - - var result = fsResult.Success; - - serialized = fsData.CreateList(arr.Count); - var serializedList = serialized.AsList; - - for (int i = 0; i < arr.Count; ++i) { - object item = arr[i]; - - fsData serializedItem; - - var itemResult = Serializer.TrySerialize(elementType, item, out serializedItem); - result.AddMessages(itemResult); - if (itemResult.Failed) continue; - - serializedList.Add(serializedItem); - } - - return result; - } - - public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { - var result = fsResult.Success; - - // Verify that we actually have an List - if ((result += CheckType(data, fsDataType.Array)).Failed) { - return result; - } - - Type elementType = storageType.GetElementType(); - - var serializedList = data.AsList; - var list = new ArrayList(serializedList.Count); - - for (int i = 0; i < serializedList.Count; ++i) { - var serializedItem = serializedList[i]; - object deserialized = null; - - var itemResult = Serializer.TryDeserialize(serializedItem, elementType, ref deserialized); - result.AddMessages(itemResult); - if (itemResult.Failed) continue; - - list.Add(deserialized); - } - - instance = list.ToArray(elementType); - return result; - } - - public override object CreateInstance(fsData data, Type storageType) { - return fsMetaType.Get(storageType).CreateInstance(); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsArrayConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsArrayConverter.cs.meta deleted file mode 100644 index 7668856..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsArrayConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9a874a979a9ab8945a70bd5ec1d22f1a -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsDateConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsDateConverter.cs deleted file mode 100644 index 9884b08..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsDateConverter.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Globalization; - -namespace FullSerializer.Internal { - /// - /// Supports serialization for DateTime, DateTimeOffset, and TimeSpan. - /// - public class fsDateConverter : fsConverter { - // The format strings that we use when serializing DateTime and DateTimeOffset types. - private const string DateTimeFormatString = @"o"; - private const string DateTimeOffsetFormatString = @"o"; - - public override bool CanProcess(Type type) { - return - type == typeof(DateTime) || - type == typeof(DateTimeOffset) || - type == typeof(TimeSpan); - } - - public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) { - if (instance is DateTime) { - var dateTime = (DateTime)instance; - serialized = new fsData(dateTime.ToString(DateTimeFormatString)); - return fsResult.Success; - } - - if (instance is DateTimeOffset) { - var dateTimeOffset = (DateTimeOffset)instance; - serialized = new fsData(dateTimeOffset.ToString(DateTimeOffsetFormatString)); - return fsResult.Success; - } - - if (instance is TimeSpan) { - var timeSpan = (TimeSpan)instance; - serialized = new fsData(timeSpan.ToString()); - return fsResult.Success; - } - - throw new InvalidOperationException("FullSerializer Internal Error -- Unexpected serialization type"); - } - - public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { - if (data.IsString == false) { - return fsResult.Fail("Date deserialization requires a string, not " + data.Type); - } - - if (storageType == typeof(DateTime)) { - DateTime result; - if (DateTime.TryParse(data.AsString, null, DateTimeStyles.RoundtripKind, out result)) { - instance = result; - return fsResult.Success; - } - - return fsResult.Fail("Unable to parse " + data.AsString + " into a DateTime"); - } - - if (storageType == typeof(DateTimeOffset)) { - DateTimeOffset result; - if (DateTimeOffset.TryParse(data.AsString, null, DateTimeStyles.RoundtripKind, out result)) { - instance = result; - return fsResult.Success; - } - - return fsResult.Fail("Unable to parse " + data.AsString + " into a DateTimeOffset"); - } - - if (storageType == typeof(TimeSpan)) { - TimeSpan result; - if (TimeSpan.TryParse(data.AsString, out result)) { - instance = result; - return fsResult.Success; - } - - return fsResult.Fail("Unable to parse " + data.AsString + " into a TimeSpan"); - } - - throw new InvalidOperationException("FullSerializer Internal Error -- Unexpected deserialization type"); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsDateConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsDateConverter.cs.meta deleted file mode 100644 index 5e5cb14..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsDateConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f48636835461c4e439e80a9966404361 -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsDictionaryConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsDictionaryConverter.cs deleted file mode 100644 index af1616b..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsDictionaryConverter.cs +++ /dev/null @@ -1,169 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; - -namespace FullSerializer.Internal { - // While the generic IEnumerable converter can handle dictionaries, we process them separately here because - // we support a few more advanced use-cases with dictionaries, such as inline strings. Further, dictionary - // processing in general is a bit more advanced because a few of the collection implementations are buggy. - public class fsDictionaryConverter : fsConverter { - public override bool CanProcess(Type type) { - return typeof(IDictionary).IsAssignableFrom(type); - } - - public override object CreateInstance(fsData data, Type storageType) { - return fsMetaType.Get(storageType).CreateInstance(); - } - - public override fsResult TryDeserialize(fsData data, ref object instance_, Type storageType) { - var instance = (IDictionary)instance_; - var result = fsResult.Success; - - Type keyStorageType, valueStorageType; - GetKeyValueTypes(instance.GetType(), out keyStorageType, out valueStorageType); - - if (data.IsList) { - var list = data.AsList; - for (int i = 0; i < list.Count; ++i) { - var item = list[i]; - - fsData keyData, valueData; - if ((result += CheckType(item, fsDataType.Object)).Failed) return result; - if ((result += CheckKey(item, "Key", out keyData)).Failed) return result; - if ((result += CheckKey(item, "Value", out valueData)).Failed) return result; - - object keyInstance = null, valueInstance = null; - if ((result += Serializer.TryDeserialize(keyData, keyStorageType, ref keyInstance)).Failed) return result; - if ((result += Serializer.TryDeserialize(valueData, valueStorageType, ref valueInstance)).Failed) return result; - - AddItemToDictionary(instance, keyInstance, valueInstance); - } - } - else if (data.IsDictionary) { - foreach (var entry in data.AsDictionary) { - if (fsSerializer.IsReservedKeyword(entry.Key)) continue; - - fsData keyData = new fsData(entry.Key), valueData = entry.Value; - object keyInstance = null, valueInstance = null; - - if ((result += Serializer.TryDeserialize(keyData, keyStorageType, ref keyInstance)).Failed) return result; - if ((result += Serializer.TryDeserialize(valueData, valueStorageType, ref valueInstance)).Failed) return result; - - AddItemToDictionary(instance, keyInstance, valueInstance); - } - } - else { - return FailExpectedType(data, fsDataType.Array, fsDataType.Object); - } - - return result; - } - - public override fsResult TrySerialize(object instance_, out fsData serialized, Type storageType) { - serialized = fsData.Null; - - var result = fsResult.Success; - - var instance = (IDictionary)instance_; - - Type keyStorageType, valueStorageType; - GetKeyValueTypes(instance.GetType(), out keyStorageType, out valueStorageType); - - // No other way to iterate dictionaries and still have access to the key/value info - IDictionaryEnumerator enumerator = instance.GetEnumerator(); - - bool allStringKeys = true; - var serializedKeys = new List(instance.Count); - var serializedValues = new List(instance.Count); - while (enumerator.MoveNext()) { - fsData keyData, valueData; - if ((result += Serializer.TrySerialize(keyStorageType, enumerator.Key, out keyData)).Failed) return result; - if ((result += Serializer.TrySerialize(valueStorageType, enumerator.Value, out valueData)).Failed) return result; - - serializedKeys.Add(keyData); - serializedValues.Add(valueData); - - allStringKeys &= keyData.IsString; - } - - if (allStringKeys) { - serialized = fsData.CreateDictionary(); - var serializedDictionary = serialized.AsDictionary; - - for (int i = 0; i < serializedKeys.Count; ++i) { - fsData key = serializedKeys[i]; - fsData value = serializedValues[i]; - serializedDictionary[key.AsString] = value; - } - } - else { - serialized = fsData.CreateList(serializedKeys.Count); - var serializedList = serialized.AsList; - - for (int i = 0; i < serializedKeys.Count; ++i) { - fsData key = serializedKeys[i]; - fsData value = serializedValues[i]; - - var container = new Dictionary(); - container["Key"] = key; - container["Value"] = value; - serializedList.Add(new fsData(container)); - } - } - - return result; - } - - private fsResult AddItemToDictionary(IDictionary dictionary, object key, object value) { - // Because we're operating through the IDictionary interface by default (and not the - // generic one), we normally send items through IDictionary.Add(object, object). This - // works fine in the general case, except that the add method verifies that it's - // parameter types are proper types. However, mono is buggy and these type checks do - // not consider null a subtype of the parameter types, and exceptions get thrown. So, - // we have to special case adding null items via the generic functions (which do not - // do the null check), which is slow and messy. - // - // An example of a collection that fails deserialization without this method is - // `new SortedList { { 0, null } }`. (SortedDictionary is fine because - // it properly handles null values). - if (key == null || value == null) { - // Life would be much easier if we had MakeGenericType available, but we don't. So - // we're going to find the correct generic KeyValuePair type via a bit of trickery. - // All dictionaries extend ICollection>, so we just - // fetch the ICollection<> type with the proper generic arguments, and then we take - // the KeyValuePair<> generic argument, and whola! we have our proper generic type. - - var collectionType = fsReflectionUtility.GetInterface(dictionary.GetType(), typeof(ICollection<>)); - if (collectionType == null) { - return fsResult.Warn(dictionary.GetType() + " does not extend ICollection"); - } - - var keyValuePairType = collectionType.GetGenericArguments()[0]; - object keyValueInstance = Activator.CreateInstance(keyValuePairType, key, value); - MethodInfo add = collectionType.GetFlattenedMethod("Add"); - add.Invoke(dictionary, new object[] { keyValueInstance }); - return fsResult.Success; - } - - dictionary.Add(key, value); - return fsResult.Success; - } - - private static void GetKeyValueTypes(Type dictionaryType, out Type keyStorageType, out Type valueStorageType) { - // All dictionaries extend IDictionary, so we just fetch the generic arguments from it - var interfaceType = fsReflectionUtility.GetInterface(dictionaryType, typeof(IDictionary<,>)); - if (interfaceType != null) { - var genericArgs = interfaceType.GetGenericArguments(); - keyStorageType = genericArgs[0]; - valueStorageType = genericArgs[1]; - } - - else { - // Fetching IDictionary<,> failed... we have to encode full type information :( - keyStorageType = typeof(object); - valueStorageType = typeof(object); - } - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsDictionaryConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsDictionaryConverter.cs.meta deleted file mode 100644 index 008b459..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsDictionaryConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ac051473100c2914da3e018843d5c792 -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsEnumConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsEnumConverter.cs deleted file mode 100644 index 4d0166a..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsEnumConverter.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace FullSerializer.Internal { - /// - /// Serializes and deserializes enums by their current name. - /// - public class fsEnumConverter : fsConverter { - public override bool CanProcess(Type type) { - return type.Resolve().IsEnum; - } - - public override bool RequestCycleSupport(Type storageType) { - return false; - } - - public override bool RequestInheritanceSupport(Type storageType) { - return false; - } - - public override object CreateInstance(fsData data, Type storageType) { - // In .NET compact, Enum.ToObject(Type, Object) is defined but the overloads like - // Enum.ToObject(Type, int) are not -- so we get around this by boxing the value. - return Enum.ToObject(storageType, (object)0); - } - - public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) { - if (fsPortableReflection.GetAttribute(storageType) != null) { - long instanceValue = Convert.ToInt64(instance); - var result = new StringBuilder(); - - bool first = true; - foreach (var value in Enum.GetValues(storageType)) { - int integralValue = (int)value; - bool isSet = (instanceValue & integralValue) != 0; - - if (isSet) { - if (first == false) result.Append(","); - first = false; - result.Append(value.ToString()); - } - } - - serialized = new fsData(result.ToString()); - } - else { - serialized = new fsData(Enum.GetName(storageType, instance)); - } - return fsResult.Success; - } - - public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { - if (data.IsString) { - string[] enumValues = data.AsString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - - long instanceValue = 0; - for (int i = 0; i < enumValues.Length; ++i) { - string enumValue = enumValues[i]; - - // Verify that the enum name exists; Enum.TryParse is only available in .NET 4.0 - // and above :(. - if (ArrayContains(Enum.GetNames(storageType), enumValue) == false) { - return fsResult.Fail("Cannot find enum name " + enumValue + " on type " + storageType); - } - - long flagValue = (long)Convert.ChangeType(Enum.Parse(storageType, enumValue), typeof(long)); - instanceValue |= flagValue; - } - - instance = Enum.ToObject(storageType, (object)instanceValue); - return fsResult.Success; - } - - else if (data.IsInt64) { - int enumValue = (int)data.AsInt64; - - // In .NET compact, Enum.ToObject(Type, Object) is defined but the overloads like - // Enum.ToObject(Type, int) are not -- so we get around this by boxing the value. - instance = Enum.ToObject(storageType, (object)enumValue); - - return fsResult.Success; - } - - return fsResult.Fail("EnumConverter encountered an unknown JSON data type"); - } - - /// - /// Returns true if the given value is contained within the specified array. - /// - private static bool ArrayContains(T[] values, T value) { - // note: We don't use LINQ because this function will *not* allocate - for (int i = 0; i < values.Length; ++i) { - if (EqualityComparer.Default.Equals(values[i], value)) { - return true; - } - } - - return false; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsEnumConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsEnumConverter.cs.meta deleted file mode 100644 index 9bb8f0e..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsEnumConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ff4504a059530d24c9db798d4835b68a -timeCreated: 1428466647 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsGuidConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsGuidConverter.cs deleted file mode 100644 index 01d0b80..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsGuidConverter.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; - -namespace FullSerializer.Internal { - /// - /// Serializes and deserializes guids. - /// - public class fsGuidConverter : fsConverter { - public override bool CanProcess(Type type) { - return type == typeof(Guid); - } - - public override bool RequestCycleSupport(Type storageType) { - return false; - } - - public override bool RequestInheritanceSupport(Type storageType) { - return false; - } - - public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) { - var guid = (Guid)instance; - serialized = new fsData(guid.ToString()); - return fsResult.Success; - } - - public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { - if (data.IsString) { - instance = new Guid(data.AsString); - return fsResult.Success; - } - - return fsResult.Fail("fsGuidConverter encountered an unknown JSON data type"); - } - - public override object CreateInstance(fsData data, Type storageType) { - return new Guid(); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsGuidConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsGuidConverter.cs.meta deleted file mode 100644 index 2af2120..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsGuidConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3284eaafbefac0e4d9452871cdd3eccc -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsIEnumerableConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsIEnumerableConverter.cs deleted file mode 100644 index c917f04..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsIEnumerableConverter.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; - -namespace FullSerializer.Internal { - /// - /// Provides serialization support for anything which extends from `IEnumerable` and has an `Add` method. - /// - public class fsIEnumerableConverter : fsConverter { - public override bool CanProcess(Type type) { - if (typeof(IEnumerable).IsAssignableFrom(type) == false) return false; - return GetAddMethod(type) != null; - } - - public override object CreateInstance(fsData data, Type storageType) { - return fsMetaType.Get(storageType).CreateInstance(); - } - - public override fsResult TrySerialize(object instance_, out fsData serialized, Type storageType) { - var instance = (IEnumerable)instance_; - var result = fsResult.Success; - - Type elementType = GetElementType(storageType); - - serialized = fsData.CreateList(HintSize(instance)); - var serializedList = serialized.AsList; - - foreach (object item in instance) { - fsData itemData; - - // note: We don't fail the entire deserialization even if the item failed - var itemResult = Serializer.TrySerialize(elementType, item, out itemData); - result.AddMessages(itemResult); - if (itemResult.Failed) continue; - - serializedList.Add(itemData); - } - - return result; - } - - public override fsResult TryDeserialize(fsData data, ref object instance_, Type storageType) { - var instance = (IEnumerable)instance_; - var result = fsResult.Success; - - if ((result += CheckType(data, fsDataType.Array)).Failed) return result; - - var elementStorageType = GetElementType(storageType); - var addMethod = GetAddMethod(storageType); - - var serializedList = data.AsList; - for (int i = 0; i < serializedList.Count; ++i) { - var itemData = serializedList[i]; - object itemInstance = null; - - // note: We don't fail the entire deserialization even if the item failed - var itemResult = Serializer.TryDeserialize(itemData, elementStorageType, ref itemInstance); - result.AddMessages(itemResult); - if (itemResult.Failed) continue; - - addMethod.Invoke(instance, new object[] { itemInstance }); - } - - return result; - } - - private static int HintSize(IEnumerable collection) { - if (collection is ICollection) { - return ((ICollection)collection).Count; - } - return 0; - } - - /// - /// Fetches the element type for objects inside of the collection. - /// - private static Type GetElementType(Type objectType) { - if (objectType.HasElementType) return objectType.GetElementType(); - - Type enumerableList = fsReflectionUtility.GetInterface(objectType, typeof(IEnumerable<>)); - if (enumerableList != null) return enumerableList.GetGenericArguments()[0]; - - return typeof(object); - } - - private static MethodInfo GetAddMethod(Type type) { - // There is a really good chance the type will extend ICollection{}, which will contain - // the add method we want. Just doing type.GetFlattenedMethod() may return the incorrect one -- - // for example, with dictionaries, it'll return Add(TKey, TValue), and we want - // Add(KeyValuePair). - Type collectionInterface = fsReflectionUtility.GetInterface(type, typeof(ICollection<>)); - if (collectionInterface != null) { - MethodInfo add = collectionInterface.GetDeclaredMethod("Add"); - if (add != null) return add; - } - - // Otherwise try and look up a general Add method. - return - type.GetFlattenedMethod("Add") ?? - type.GetFlattenedMethod("Push") ?? - type.GetFlattenedMethod("Enqueue"); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsIEnumerableConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsIEnumerableConverter.cs.meta deleted file mode 100644 index d7db1fe..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsIEnumerableConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e10e66c9da2082d4aab291c7e0f22544 -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsKeyValuePairConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsKeyValuePairConverter.cs deleted file mode 100644 index 2082d0e..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsKeyValuePairConverter.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; - -namespace FullSerializer.Internal { - public class fsKeyValuePairConverter : fsConverter { - public override bool CanProcess(Type type) { - return - type.Resolve().IsGenericType && - type.GetGenericTypeDefinition() == typeof(KeyValuePair<,>); - } - - public override bool RequestCycleSupport(Type storageType) { - return false; - } - - public override bool RequestInheritanceSupport(Type storageType) { - return false; - } - - public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { - var result = fsResult.Success; - - fsData keyData, valueData; - if ((result += CheckKey(data, "Key", out keyData)).Failed) return result; - if ((result += CheckKey(data, "Value", out valueData)).Failed) return result; - - var genericArguments = storageType.GetGenericArguments(); - Type keyType = genericArguments[0], valueType = genericArguments[1]; - - object keyObject = null, valueObject = null; - result.AddMessages(Serializer.TryDeserialize(keyData, keyType, ref keyObject)); - result.AddMessages(Serializer.TryDeserialize(valueData, valueType, ref valueObject)); - - instance = Activator.CreateInstance(storageType, keyObject, valueObject); - return result; - } - - public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) { - PropertyInfo keyProperty = storageType.GetDeclaredProperty("Key"); - PropertyInfo valueProperty = storageType.GetDeclaredProperty("Value"); - - object keyObject = keyProperty.GetValue(instance, null); - object valueObject = valueProperty.GetValue(instance, null); - - var genericArguments = storageType.GetGenericArguments(); - Type keyType = genericArguments[0], valueType = genericArguments[1]; - - var result = fsResult.Success; - - fsData keyData, valueData; - result.AddMessages(Serializer.TrySerialize(keyType, keyObject, out keyData)); - result.AddMessages(Serializer.TrySerialize(valueType, valueObject, out valueData)); - - serialized = fsData.CreateDictionary(); - if (keyData != null) serialized.AsDictionary["Key"] = keyData; - if (valueData != null) serialized.AsDictionary["Value"] = valueData; - - return result; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsKeyValuePairConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsKeyValuePairConverter.cs.meta deleted file mode 100644 index cda5907..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsKeyValuePairConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 703a8eeea08220e40a0c89ada77bc1b3 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsNullableConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsNullableConverter.cs deleted file mode 100644 index 09c1223..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsNullableConverter.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; - -namespace FullSerializer.Internal { - /// - /// The reflected converter will properly serialize nullable types. However, we do it here - /// instead as we can emit less serialization data. - /// - public class fsNullableConverter : fsConverter { - public override bool CanProcess(Type type) { - return - type.Resolve().IsGenericType && - type.GetGenericTypeDefinition() == typeof(Nullable<>); - } - - public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) { - // null is automatically serialized - return Serializer.TrySerialize(Nullable.GetUnderlyingType(storageType), instance, out serialized); - } - - public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { - // null is automatically deserialized - return Serializer.TryDeserialize(data, Nullable.GetUnderlyingType(storageType), ref instance); - } - - public override object CreateInstance(fsData data, Type storageType) { - return storageType; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsNullableConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsNullableConverter.cs.meta deleted file mode 100644 index 222ece6..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsNullableConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 173f37eeb076eb744aea740f2b4101b7 -timeCreated: 1428466633 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsPrimitiveConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsPrimitiveConverter.cs deleted file mode 100644 index 8ed8de0..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsPrimitiveConverter.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; - -namespace FullSerializer.Internal { - public class fsPrimitiveConverter : fsConverter { - public override bool CanProcess(Type type) { - return - type.Resolve().IsPrimitive || - type == typeof(string) || - type == typeof(decimal); - } - - public override bool RequestCycleSupport(Type storageType) { - return false; - } - - public override bool RequestInheritanceSupport(Type storageType) { - return false; - } - - private static bool UseBool(Type type) { - return type == typeof(bool); - } - - private static bool UseInt64(Type type) { - return type == typeof(sbyte) || type == typeof(byte) || - type == typeof(Int16) || type == typeof(UInt16) || - type == typeof(Int32) || type == typeof(UInt32) || - type == typeof(Int64) || type == typeof(UInt64); - } - - private static bool UseDouble(Type type) { - return type == typeof(float) || - type == typeof(double) || - type == typeof(decimal); - } - - private static bool UseString(Type type) { - return type == typeof(string) || - type == typeof(char); - } - - public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) { - var instanceType = instance.GetType(); - - if (UseBool(instanceType)) { - serialized = new fsData((bool)instance); - return fsResult.Success; - } - - if (UseInt64(instanceType)) { - serialized = new fsData((Int64)Convert.ChangeType(instance, typeof(Int64))); - return fsResult.Success; - } - - if (UseDouble(instanceType)) { - serialized = new fsData((double)Convert.ChangeType(instance, typeof(double))); - return fsResult.Success; - } - - if (UseString(instanceType)) { - serialized = new fsData((string)Convert.ChangeType(instance, typeof(string))); - return fsResult.Success; - } - - serialized = null; - return fsResult.Fail("Unhandled primitive type " + instance.GetType()); - } - - public override fsResult TryDeserialize(fsData storage, ref object instance, Type storageType) { - var result = fsResult.Success; - - if (UseBool(storageType)) { - if ((result += CheckType(storage, fsDataType.Boolean)).Succeeded) { - instance = storage.AsBool; - } - return result; - } - - if (UseDouble(storageType) || UseInt64(storageType)) { - if (storage.IsDouble) { - instance = Convert.ChangeType(storage.AsDouble, storageType); - } - else if (storage.IsInt64) { - instance = Convert.ChangeType(storage.AsInt64, storageType); - } - else { - return fsResult.Fail(GetType().Name + " expected number but got " + storage.Type + " in " + storage); - } - return fsResult.Success; - } - - if (UseString(storageType)) { - if ((result += CheckType(storage, fsDataType.String)).Succeeded) { - instance = storage.AsString; - } - return result; - } - - return fsResult.Fail(GetType().Name + ": Bad data; expected bool, number, string, but got " + storage); - } - } -} - diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsPrimitiveConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsPrimitiveConverter.cs.meta deleted file mode 100644 index 82c95b6..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsPrimitiveConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7a3d5fc45e87ffd48b5b4dc6b385e155 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsReflectedConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsReflectedConverter.cs deleted file mode 100644 index a5234b7..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsReflectedConverter.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Collections; - -namespace FullSerializer.Internal { - public class fsReflectedConverter : fsConverter { - public override bool CanProcess(Type type) { - if (type.Resolve().IsArray || - typeof(ICollection).IsAssignableFrom(type)) { - - return false; - } - - return true; - } - - public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) { - serialized = fsData.CreateDictionary(); - var result = fsResult.Success; - - fsMetaType metaType = fsMetaType.Get(instance.GetType()); - metaType.EmitAotData(); - - for (int i = 0; i < metaType.Properties.Length; ++i) { - fsMetaProperty property = metaType.Properties[i]; - if (property.CanRead == false) continue; - - fsData serializedData; - - var itemResult = Serializer.TrySerialize(property.StorageType, property.Read(instance), out serializedData); - result.AddMessages(itemResult); - if (itemResult.Failed) { - continue; - } - - serialized.AsDictionary[property.JsonName] = serializedData; - } - - return result; - } - - public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { - var result = fsResult.Success; - - // Verify that we actually have an Object - if ((result += CheckType(data, fsDataType.Object)).Failed) { - return result; - } - - fsMetaType metaType = fsMetaType.Get(storageType); - metaType.EmitAotData(); - - for (int i = 0; i < metaType.Properties.Length; ++i) { - fsMetaProperty property = metaType.Properties[i]; - if (property.CanWrite == false) continue; - - fsData propertyData; - if (data.AsDictionary.TryGetValue(property.JsonName, out propertyData)) { - object deserializedValue = null; - - var itemResult = Serializer.TryDeserialize(propertyData, property.StorageType, ref deserializedValue); - result.AddMessages(itemResult); - if (itemResult.Failed) continue; - - property.Write(instance, deserializedValue); - } - } - - return result; - } - - public override object CreateInstance(fsData data, Type storageType) { - fsMetaType metaType = fsMetaType.Get(storageType); - return metaType.CreateInstance(); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsReflectedConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsReflectedConverter.cs.meta deleted file mode 100644 index 79edce3..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsReflectedConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 507a50b23da6036419fa586a04c0590f -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsTypeConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsTypeConverter.cs deleted file mode 100644 index 55c84e4..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsTypeConverter.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; - -namespace FullSerializer.Internal { - public class fsTypeConverter : fsConverter { - public override bool CanProcess(Type type) { - return typeof(Type).IsAssignableFrom(type); - } - - public override bool RequestCycleSupport(Type type) { - return false; - } - - public override bool RequestInheritanceSupport(Type type) { - return false; - } - - public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) { - var type = (Type)instance; - serialized = new fsData(type.FullName); - return fsResult.Success; - } - - public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { - if (data.IsString == false) { - return fsResult.Fail("Type converter requires a string"); - } - - instance = fsTypeLookup.GetType(data.AsString); - if (instance == null) { - return fsResult.Fail("Unable to find type " + data.AsString); - } - return fsResult.Success; - } - - public override object CreateInstance(fsData data, Type storageType) { - return storageType; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsTypeConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsTypeConverter.cs.meta deleted file mode 100644 index 8fad3c7..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsTypeConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 418156fce73b47b4f8a63482e56ce03f -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsWeakReferenceConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsWeakReferenceConverter.cs deleted file mode 100644 index a7ceadd..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsWeakReferenceConverter.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; - -namespace FullSerializer.Internal { - /// - /// Serializes and deserializes WeakReferences. - /// - public class fsWeakReferenceConverter : fsConverter { - public override bool CanProcess(Type type) { - return type == typeof(WeakReference); - } - - public override bool RequestCycleSupport(Type storageType) { - return false; - } - - public override bool RequestInheritanceSupport(Type storageType) { - return false; - } - - public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) { - var weakRef = (WeakReference)instance; - - var result = fsResult.Success; - serialized = fsData.CreateDictionary(); - - if (weakRef.IsAlive) { - fsData data; - if ((result += Serializer.TrySerialize(weakRef.Target, out data)).Failed) { - return result; - } - - serialized.AsDictionary["Target"] = data; - serialized.AsDictionary["TrackResurrection"] = new fsData(weakRef.TrackResurrection); - } - - return result; - } - - public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { - var result = fsResult.Success; - - if ((result += CheckType(data, fsDataType.Object)).Failed) return result; - - if (data.AsDictionary.ContainsKey("Target")) { - var targetData = data.AsDictionary["Target"]; - object targetInstance = null; - - if ((result += Serializer.TryDeserialize(targetData, typeof(object), ref targetInstance)).Failed) return result; - - bool trackResurrection = false; - if (data.AsDictionary.ContainsKey("TrackResurrection") && data.AsDictionary["TrackResurrection"].IsBool) { - trackResurrection = data.AsDictionary["TrackResurrection"].AsBool; - } - - instance = new WeakReference(targetInstance, trackResurrection); - } - - return result; - } - - public override object CreateInstance(fsData data, Type storageType) { - return new WeakReference(null); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsWeakReferenceConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsWeakReferenceConverter.cs.meta deleted file mode 100644 index 2fcea8e..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Converters/fsWeakReferenceConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7d2a2bc664058734ea726803b08c4aef -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal.meta deleted file mode 100644 index 2cc0e70..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: fe1e081dbb4520546983aeed5e2dfb45 -folderAsset: yes -timeCreated: 1428466633 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsCyclicReferenceManager.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsCyclicReferenceManager.cs deleted file mode 100644 index e422dd2..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsCyclicReferenceManager.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; - -namespace FullSerializer.Internal { - public class fsCyclicReferenceManager { - // We use the default ReferenceEquals when comparing two objects because - // custom objects may override equals methods. These overriden equals may - // treat equals differently; we want to serialize/deserialize the object - // graph *identically* to how it currently exists. - class ObjectReferenceEqualityComparator : IEqualityComparer { - bool IEqualityComparer.Equals(object x, object y) { - return ReferenceEquals(x, y); - } - - int IEqualityComparer.GetHashCode(object obj) { - return RuntimeHelpers.GetHashCode(obj); - } - - public static readonly IEqualityComparer Instance = new ObjectReferenceEqualityComparator(); - } - - private Dictionary _objectIds = new Dictionary(ObjectReferenceEqualityComparator.Instance); - private int _nextId; - - private Dictionary _marked = new Dictionary(); - private int _depth; - - public void Enter() { - _depth++; - } - - public bool Exit() { - _depth--; - - if (_depth == 0) { - _objectIds = new Dictionary(ObjectReferenceEqualityComparator.Instance); - _nextId = 0; - _marked = new Dictionary(); - } - - if (_depth < 0) { - _depth = 0; - throw new InvalidOperationException("Internal Error - Mismatched Enter/Exit"); - } - - return _depth == 0; - } - - public object GetReferenceObject(int id) { - if (_marked.ContainsKey(id) == false) { - throw new InvalidOperationException("Internal Deserialization Error - Object " + - "definition has not been encountered for object with id=" + id + - "; have you reordered or modified the serialized data? If this is an issue " + - "with an unmodified Full Json implementation and unmodified serialization " + - "data, please report an issue with an included test case."); - } - - return _marked[id]; - } - - public void AddReferenceWithId(int id, object reference) { - _marked[id] = reference; - } - - public int GetReferenceId(object item) { - int id; - if (_objectIds.TryGetValue(item, out id) == false) { - id = _nextId++; - _objectIds[item] = id; - } - return id; - } - - public bool IsReference(object item) { - return _marked.ContainsKey(GetReferenceId(item)); - } - - public void MarkSerialized(object item) { - int referenceId = GetReferenceId(item); - - if (_marked.ContainsKey(referenceId)) { - throw new InvalidOperationException("Internal Error - " + item + - " has already been marked as serialized"); - } - - _marked[referenceId] = item; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsCyclicReferenceManager.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsCyclicReferenceManager.cs.meta deleted file mode 100644 index f5bc559..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsCyclicReferenceManager.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8770fa44545caa948a1558f50e337d80 -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsOption.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsOption.cs deleted file mode 100644 index 02459e3..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsOption.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; - -namespace FullSerializer.Internal { - /// - /// Simple option type. This is akin to nullable types. - /// - public struct fsOption { - private bool _hasValue; - private T _value; - - public bool HasValue { - get { return _hasValue; } - } - public bool IsEmpty { - get { return _hasValue == false; } - } - public T Value { - get { - if (IsEmpty) throw new InvalidOperationException("fsOption is empty"); - return _value; - } - } - - public fsOption(T value) { - _hasValue = true; - _value = value; - } - - public static fsOption Empty; - } - - public static class fsOption { - public static fsOption Just(T value) { - return new fsOption(value); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsOption.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsOption.cs.meta deleted file mode 100644 index a018be2..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsOption.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 16df672dbb8d6214d84e9927ec8ad1d1 -timeCreated: 1428466633 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsPortableReflection.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsPortableReflection.cs deleted file mode 100644 index a28848e..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsPortableReflection.cs +++ /dev/null @@ -1,374 +0,0 @@ -#if !UNITY_EDITOR && UNITY_METRO -#define USE_TYPEINFO -#endif - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -#if USE_TYPEINFO -namespace System { - public static class AssemblyExtensions { - public static Type[] GetTypes(this Assembly assembly) { - TypeInfo[] infos = assembly.DefinedTypes.ToArray(); - Type[] types = new Type[infos.Length]; - for (int i = 0; i < infos.Length; ++i) { - types[i] = infos[i].AsType(); - } - return types; - } - - public static Type GetType(this Assembly assembly, string name, bool throwOnError) { - var types = assembly.GetTypes(); - for (int i = 0; i < types.Length; ++i) { - if (types[i].Name == name) { - return types[i]; - } - } - - if (throwOnError) throw new Exception("Type " + name + " was not found"); - return null; - } - } -} -#endif - -namespace FullSerializer.Internal { - /// - /// This wraps reflection types so that it is portable across different Unity runtimes. - /// - public static class fsPortableReflection { - public static Type[] EmptyTypes = { }; - - #region Attribute Queries -#if USE_TYPEINFO - public static TAttribute GetAttribute(Type type) - where TAttribute : Attribute { - - return GetAttribute(type.GetTypeInfo()); - } - - public static Attribute GetAttribute(Type type, Type attributeType) { - return GetAttribute(type.GetTypeInfo(), attributeType); - } - - public static bool HasAttribute(Type type, Type attributeType) { - return GetAttribute(type, attributeType) != null; - } -#endif - - /// - /// Returns true if the given attribute is defined on the given element. - /// - public static bool HasAttribute(MemberInfo element, Type attributeType) { - return GetAttribute(element, attributeType) != null; - } - - /// - /// Returns true if the given attribute is defined on the given element. - /// - public static bool HasAttribute(MemberInfo element) { - return HasAttribute(element, typeof(TAttribute)); - } - - /// - /// Fetches the given attribute from the given MemberInfo. This method applies caching - /// and is allocation free (after caching has been performed). - /// - /// The MemberInfo the get the attribute from. - /// The type of attribute to fetch. - /// The attribute or null. - public static Attribute GetAttribute(MemberInfo element, Type attributeType) { - var query = new AttributeQuery { - MemberInfo = element, - AttributeType = attributeType - }; - - Attribute attribute; - if (_cachedAttributeQueries.TryGetValue(query, out attribute) == false) { - var attributes = element.GetCustomAttributes(attributeType, /*inherit:*/ true); - attribute = (Attribute)attributes.FirstOrDefault(); - _cachedAttributeQueries[query] = attribute; - } - - return attribute; - } - - /// - /// Fetches the given attribute from the given MemberInfo. - /// - /// The type of attribute to fetch. - /// The MemberInfo to get the attribute from. - /// The attribute or null. - public static TAttribute GetAttribute(MemberInfo element) - where TAttribute : Attribute { - - return (TAttribute)GetAttribute(element, typeof(TAttribute)); - } - private struct AttributeQuery { - public MemberInfo MemberInfo; - public Type AttributeType; - } - private static IDictionary _cachedAttributeQueries = - new Dictionary(new AttributeQueryComparator()); - private class AttributeQueryComparator : IEqualityComparer { - public bool Equals(AttributeQuery x, AttributeQuery y) { - return - x.MemberInfo == y.MemberInfo && - x.AttributeType == y.AttributeType; - } - - public int GetHashCode(AttributeQuery obj) { - return - obj.MemberInfo.GetHashCode() + - (17 * obj.AttributeType.GetHashCode()); - } - } - #endregion - -#if !USE_TYPEINFO - private static BindingFlags DeclaredFlags = - BindingFlags.NonPublic | - BindingFlags.Public | - BindingFlags.Instance | - BindingFlags.Static | - BindingFlags.DeclaredOnly; -#endif - - public static PropertyInfo GetDeclaredProperty(this Type type, string propertyName) { - var props = GetDeclaredProperties(type); - - for (int i = 0; i < props.Length; ++i) { - if (props[i].Name == propertyName) { - return props[i]; - } - } - - return null; - } - - public static MethodInfo GetDeclaredMethod(this Type type, string methodName) { - var methods = GetDeclaredMethods(type); - - for (int i = 0; i < methods.Length; ++i) { - if (methods[i].Name == methodName) { - return methods[i]; - } - } - - return null; - } - - - public static ConstructorInfo GetDeclaredConstructor(this Type type, Type[] parameters) { - var ctors = GetDeclaredConstructors(type); - - for (int i = 0; i < ctors.Length; ++i) { - var ctor = ctors[i]; - var ctorParams = ctor.GetParameters(); - - if (parameters.Length != ctorParams.Length) continue; - - for (int j = 0; j < ctorParams.Length; ++j) { - // require an exact match - if (ctorParams[j].ParameterType != parameters[j]) continue; - } - - return ctor; - } - - return null; - } - - public static ConstructorInfo[] GetDeclaredConstructors(this Type type) { -#if USE_TYPEINFO - return type.GetTypeInfo().DeclaredConstructors.ToArray(); -#else - return type.GetConstructors(DeclaredFlags); -#endif - } - - public static MemberInfo[] GetFlattenedMember(this Type type, string memberName) { - var result = new List(); - - while (type != null) { - var members = GetDeclaredMembers(type); - - for (int i = 0; i < members.Length; ++i) { - if (members[i].Name == memberName) { - result.Add(members[i]); - } - } - - type = type.Resolve().BaseType; - } - - return result.ToArray(); - } - - public static MethodInfo GetFlattenedMethod(this Type type, string methodName) { - while (type != null) { - var methods = GetDeclaredMethods(type); - - for (int i = 0; i < methods.Length; ++i) { - if (methods[i].Name == methodName) { - return methods[i]; - } - } - - type = type.Resolve().BaseType; - } - - return null; - } - - public static IEnumerable GetFlattenedMethods(this Type type, string methodName) { - while (type != null) { - var methods = GetDeclaredMethods(type); - - for (int i = 0; i < methods.Length; ++i) { - if (methods[i].Name == methodName) { - yield return methods[i]; - } - } - - type = type.Resolve().BaseType; - } - } - - public static PropertyInfo GetFlattenedProperty(this Type type, string propertyName) { - while (type != null) { - var properties = GetDeclaredProperties(type); - - for (int i = 0; i < properties.Length; ++i) { - if (properties[i].Name == propertyName) { - return properties[i]; - } - } - - type = type.Resolve().BaseType; - } - - return null; - } - - public static MemberInfo GetDeclaredMember(this Type type, string memberName) { - var members = GetDeclaredMembers(type); - - for (int i = 0; i < members.Length; ++i) { - if (members[i].Name == memberName) { - return members[i]; - } - } - - return null; - } - - public static MethodInfo[] GetDeclaredMethods(this Type type) { -#if USE_TYPEINFO - return type.GetTypeInfo().DeclaredMethods.ToArray(); -#else - return type.GetMethods(DeclaredFlags); -#endif - } - - public static PropertyInfo[] GetDeclaredProperties(this Type type) { -#if USE_TYPEINFO - return type.GetTypeInfo().DeclaredProperties.ToArray(); -#else - return type.GetProperties(DeclaredFlags); -#endif - } - - public static FieldInfo[] GetDeclaredFields(this Type type) { -#if USE_TYPEINFO - return type.GetTypeInfo().DeclaredFields.ToArray(); -#else - return type.GetFields(DeclaredFlags); -#endif - } - - public static MemberInfo[] GetDeclaredMembers(this Type type) { -#if USE_TYPEINFO - return type.GetTypeInfo().DeclaredMembers.ToArray(); -#else - return type.GetMembers(DeclaredFlags); -#endif - } - - public static MemberInfo AsMemberInfo(Type type) { -#if USE_TYPEINFO - return type.GetTypeInfo(); -#else - return type; -#endif - } - - public static bool IsType(MemberInfo member) { -#if USE_TYPEINFO - return member is TypeInfo; -#else - return member is Type; -#endif - } - - public static Type AsType(MemberInfo member) { -#if USE_TYPEINFO - return ((TypeInfo)member).AsType(); -#else - return (Type)member; -#endif - } - -#if USE_TYPEINFO - public static TypeInfo Resolve(this Type type) { - return type.GetTypeInfo(); - } -#else - public static Type Resolve(this Type type) { - return type; - } -#endif - - - #region Extensions - -#if USE_TYPEINFO - public static bool IsAssignableFrom(this Type parent, Type child) { - return parent.GetTypeInfo().IsAssignableFrom(child.GetTypeInfo()); - } - - public static Type GetElementType(this Type type) { - return type.GetTypeInfo().GetElementType(); - } - - public static MethodInfo GetSetMethod(this PropertyInfo member, bool nonPublic = false) { - // only public requested but the set method is not public - if (nonPublic == false && member.SetMethod != null && member.SetMethod.IsPublic == false) return null; - - return member.SetMethod; - } - - public static MethodInfo GetGetMethod(this PropertyInfo member, bool nonPublic = false) { - // only public requested but the set method is not public - if (nonPublic == false && member.GetMethod != null && member.GetMethod.IsPublic == false) return null; - - return member.GetMethod; - } - - public static MethodInfo GetBaseDefinition(this MethodInfo method) { - return method.GetRuntimeBaseDefinition(); - } - - public static Type[] GetInterfaces(this Type type) { - return type.GetTypeInfo().ImplementedInterfaces.ToArray(); - } - - public static Type[] GetGenericArguments(this Type type) { - return type.GetTypeInfo().GenericTypeArguments.ToArray(); - } -#endif - #endregion - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsPortableReflection.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsPortableReflection.cs.meta deleted file mode 100644 index bc0577b..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsPortableReflection.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2d2850d21e92b6d408c8f8b4553bc210 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsTypeExtensions.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsTypeExtensions.cs deleted file mode 100644 index 3101e07..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsTypeExtensions.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace FullSerializer.Internal { - public static class fsTypeExtensions { - /// - /// Returns a pretty name for the type in the style of one that you'd see in C# without the namespace. - /// - public static string CSharpName(this Type type) { - return CSharpName(type, /*includeNamespace:*/false); - } - - public static string CSharpName(this Type type, bool includeNamespace, bool ensureSafeDeclarationName) { - var name = CSharpName(type, includeNamespace); - if (ensureSafeDeclarationName) name = name.Replace('>', '_').Replace('<', '_').Replace('.', '_'); - return name; - } - - /// - /// Returns a pretty name for the type in the style of one that you'd see in C#. - /// - /// Should the name include namespaces? - public static string CSharpName(this Type type, bool includeNamespace) { - // we special case some of the common type names - if (type == typeof(void)) return "void"; - if (type == typeof(int)) return "int"; - if (type == typeof(float)) return "float"; - if (type == typeof(bool)) return "bool"; - if (type == typeof(double)) return "double"; - if (type == typeof(string)) return "string"; - - // Generic parameter, ie, T in Okay - // We special-case this logic otherwise we will recurse on the T - if (type.IsGenericParameter) { - return type.ToString(); - } - - string name = ""; - - var genericArguments = (IEnumerable)type.GetGenericArguments(); - if (type.IsNested) { - name += type.DeclaringType.CSharpName() + "."; - - // The declaring type generic parameters are considered part of the nested types generic - // parameters so we need to remove them, otherwise it will get included again. - // - // Say we have type `class Parent { class Child {} }` - // If we did not do the removal, then we would output Parent.Child, but we really want - // to output Parent.Child - if (type.DeclaringType.GetGenericArguments().Length > 0) { - genericArguments = genericArguments.Skip(type.DeclaringType.GetGenericArguments().Length); - } - } - - if (genericArguments.Any() == false) { - name += type.Name; - } - else { - name += type.Name.Substring(0, type.Name.IndexOf('`')); - name += "<" + String.Join(",", genericArguments.Select(t => CSharpName(t, includeNamespace)).ToArray()) + ">"; - } - - if (includeNamespace && type.Namespace != null) { - name = type.Namespace + "." + name; - } - - return name; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsTypeExtensions.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsTypeExtensions.cs.meta deleted file mode 100644 index 9e85bd9..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsTypeExtensions.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 20c46c708fff93741a1944a90e708673 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsVersionManager.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsVersionManager.cs deleted file mode 100644 index ac2a618..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsVersionManager.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; - -namespace FullSerializer.Internal { - public static class fsVersionManager { - private static readonly Dictionary> _cache = new Dictionary>(); - - public static fsResult GetVersionImportPath(string currentVersion, fsVersionedType targetVersion, out List path) { - path = new List(); - - if (GetVersionImportPathRecursive(path, currentVersion, targetVersion) == false) { - return fsResult.Fail("There is no migration path from \"" + currentVersion + "\" to \"" + targetVersion.VersionString + "\""); - } - - path.Add(targetVersion); - return fsResult.Success; - } - - private static bool GetVersionImportPathRecursive(List path, string currentVersion, fsVersionedType current) { - for (int i = 0; i < current.Ancestors.Length; ++i) { - fsVersionedType ancestor = current.Ancestors[i]; - - if (ancestor.VersionString == currentVersion || - GetVersionImportPathRecursive(path, currentVersion, ancestor)) { - - path.Add(ancestor); - return true; - } - } - - return false; - } - - public static fsOption GetVersionedType(Type type) { - fsOption optionalVersionedType; - - if (_cache.TryGetValue(type, out optionalVersionedType) == false) { - var attr = fsPortableReflection.GetAttribute(type); - - if (attr != null) { - if (string.IsNullOrEmpty(attr.VersionString) == false || attr.PreviousModels != null) { - // Version string must be provided - if (attr.PreviousModels != null && string.IsNullOrEmpty(attr.VersionString)) { - throw new Exception("fsObject attribute on " + type + " contains a PreviousModels specifier - it must also include a VersionString modifier"); - } - - // Map the ancestor types into versioned types - fsVersionedType[] ancestors = new fsVersionedType[attr.PreviousModels != null ? attr.PreviousModels.Length : 0]; - for (int i = 0; i < ancestors.Length; ++i) { - fsOption ancestorType = GetVersionedType(attr.PreviousModels[i]); - if (ancestorType.IsEmpty) { - throw new Exception("Unable to create versioned type for ancestor " + ancestorType + "; please add an [fsObject(VersionString=\"...\")] attribute"); - } - ancestors[i] = ancestorType.Value; - } - - // construct the actual versioned type instance - fsVersionedType versionedType = new fsVersionedType { - Ancestors = ancestors, - VersionString = attr.VersionString, - ModelType = type - }; - - // finally, verify that the versioned type passes some sanity checks - VerifyUniqueVersionStrings(versionedType); - VerifyConstructors(versionedType); - - optionalVersionedType = fsOption.Just(versionedType); - } - } - - _cache[type] = optionalVersionedType; - } - - return optionalVersionedType; - } - - /// - /// Verifies that the given type has constructors to migrate from all ancestor types. - /// - private static void VerifyConstructors(fsVersionedType type) { - ConstructorInfo[] publicConstructors = type.ModelType.GetDeclaredConstructors(); - - for (int i = 0; i < type.Ancestors.Length; ++i) { - Type requiredConstructorType = type.Ancestors[i].ModelType; - - bool found = false; - for (int j = 0; j < publicConstructors.Length; ++j) { - var parameters = publicConstructors[j].GetParameters(); - if (parameters.Length == 1 && parameters[0].ParameterType == requiredConstructorType) { - found = true; - break; - } - } - - if (found == false) { - throw new fsMissingVersionConstructorException(type.ModelType, requiredConstructorType); - } - } - } - - /// - /// Verifies that the given version graph contains only unique versions. - /// - private static void VerifyUniqueVersionStrings(fsVersionedType type) { - // simple tree traversal - - var found = new Dictionary(); - - var remaining = new Queue(); - remaining.Enqueue(type); - - while (remaining.Count > 0) { - fsVersionedType item = remaining.Dequeue(); - - // Verify we do not already have the version string. Take into account that we're not just - // comparing the same model twice, since we can have a valid import graph that has the same - // model multiple times. - if (found.ContainsKey(item.VersionString) && found[item.VersionString] != item.ModelType) { - throw new fsDuplicateVersionNameException(found[item.VersionString], item.ModelType, item.VersionString); - } - found[item.VersionString] = item.ModelType; - - // scan the ancestors as well - foreach (var ancestor in item.Ancestors) { - remaining.Enqueue(ancestor); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsVersionManager.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsVersionManager.cs.meta deleted file mode 100644 index c40e5a0..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsVersionManager.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a432f43787317c243b39e43d9f33045e -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsVersionedType.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsVersionedType.cs deleted file mode 100644 index 7bda5b7..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsVersionedType.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; - -namespace FullSerializer.Internal { - public struct fsVersionedType { - /// - /// The direct ancestors that this type can import. - /// - public fsVersionedType[] Ancestors; - - /// - /// The identifying string that is unique among all ancestors. - /// - public string VersionString; - - /// - /// The modeling type that this versioned type maps back to. - /// - public Type ModelType; - - /// - /// Migrate from an instance of an ancestor. - /// - public object Migrate(object ancestorInstance) { - return Activator.CreateInstance(ModelType, ancestorInstance); - } - - public override string ToString() { - return "fsVersionedType [ModelType=" + ModelType + ", VersionString=" + VersionString + ", Ancestors.Length=" + Ancestors.Length + "]"; - } - - public static bool operator ==(fsVersionedType a, fsVersionedType b) { - return a.ModelType == b.ModelType; - } - - public static bool operator !=(fsVersionedType a, fsVersionedType b) { - return a.ModelType != b.ModelType; - } - - public override bool Equals(object obj) { - return - obj is fsVersionedType && - ModelType == ((fsVersionedType)obj).ModelType; - } - - public override int GetHashCode() { - return ModelType.GetHashCode(); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsVersionedType.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsVersionedType.cs.meta deleted file mode 100644 index f98225d..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Internal/fsVersionedType.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8f65584db0ae43c4f852788d19048ba6 -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/LICENSE.md b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/LICENSE.md deleted file mode 100644 index e67b092..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Jacob Dufault - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/LICENSE.md.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/LICENSE.md.meta deleted file mode 100644 index 5bc5bf1..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/LICENSE.md.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: da500bebd2553ae4397a290a8ae21a17 -timeCreated: 1428466633 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/LIMITATIONS.md b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/LIMITATIONS.md deleted file mode 100644 index a641c52..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/LIMITATIONS.md +++ /dev/null @@ -1,10 +0,0 @@ -# Limitations -We've tried hard to prevent any serialization restrictions, but some them of are simply unavoidable. -Depending on your export platform, certain features in Full Json may not be available. - -If you know of a way to remove any of these limitations, please make sure to bring it up. - -## WebPlayer - -- All serialized types need to have a default constructor (`FormatterServices.GetUninitializedObject` is not available - -`Activator.CreateInstance` must be used instead). diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/LIMITATIONS.md.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/LIMITATIONS.md.meta deleted file mode 100644 index 3ca0546..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/LIMITATIONS.md.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6ae798d60a2048b46b93bf988d95808c -timeCreated: 1428466633 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/README.md b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/README.md deleted file mode 100644 index 08d2705..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/README.md +++ /dev/null @@ -1,189 +0,0 @@ -# Full Serializer - -Full Serializer is an extremely easy to use serializer for Unity that *just works*. It is as simple as possible but no simpler. It currently ships with a robust JSON parser and printer. - -Full Serializer has been designed to support all Unity export platforms, including tricky ones such as the WebPlayer and iOS. Additionally, it has been designed to support full stripping mode on iOS (Full Serializer does not use exceptions). - -Best of all, Full Serializer is completely free to use and available under the MIT license! - -## Why? - -There were no serializers that just work in Unity that are free and target all export platforms. [Full Inspector](http://forum.unity3d.com/threads/224270-Full-Inspector-Inspector-and-serialization-for-structs-dicts-generics-interfaces) needed one, so here it is. - -## Installation - -Import the `Source` folder into your Unity project! You're good to go! - -# Usage - -## Annotations and Default Behavior - -Usage is identical to Unity's default serialization, *except* that you don't have to mark types as `[Serializable]`. Here's an example: - -```c# -struct SerializedStruct { - public int Field; - - public Dictionary DictionaryAutoProperty { get; set; } - - [SerializeField] - private int PrivateField; -} -``` - -Here are the precise rules: - -- Public fields are serialized by default -- Auto-properties that are at least partially public are serialized by default -- All fields or properties annotated with `[SerializeField]` are serialized -- The default name in serialization data for a field/property is that field/property's name. However, you can override this with `[fsProperty("name")]`. `[fsProperty]` will also cause private fields to be serialized. -- Public fields/public auto-properties are not serialized if annotated with `[NonSerialized]` or `[fsIgnore]`. `[fsIgnore]` can be used on properties (unlike `[NonSerialized]`). - - -Inheritance and cycles are both correctly handled and fully supported by Full Serializer. You don't need to do anything -- they are automatically detected. - -## API - -### Serialization and Deserialization - -Here's a simple example of how to use the Full Serializer API to serialize objects to and from strings. - -```c# -using FullSerializer; - -public static class StringSerializationAPI { - private static fsSerializer _serializer = new fsSerializer(); - - public static string Serialize(Type type, object value) { - // serialize the data - fsData data; - var fail = _serializer.TrySerialize(type, value, out data); - if (fail.Failed) throw new Exception(fail.FailureReason); - - // emit the data via JSON - return fsJsonPrinter.CompressedJson(data); - } - - public static object Deserialize(Type type, string serializedState) { - fsFailure fail; - - // step 1: parse the JSON data - fsData data; - fail = fsJsonParser.Parse(serializedState, out data); - if (fail.Failed) throw new Exception(fail.FailureReason); - - // step 2: deserialize the data - object deserialized = null; - fail = _serializer.TryDeserialize(data, type, ref deserialized); - if (fail.Failed) throw new Exception(fail.FailureReason); - - return deserialized; - } -} -``` - -While the API may look noisy, rest assured that it cleanly separates different library concerns, such as parsing and serialization. If you wanted to add BSON support, you would only have to write a parser and printer -- no need to touch any serialization or deserialization code. - -### Custom Serialization - -You can completely override serialization by registering your own `fsConverter` type, which can override serialization for any type. Inheritance and cycles are properly handled even when you use a custom converter. - -Please see the next few sections for an example of how to define a custom converter. Custom converters should only be necessary in really exceptional cases -- Full Serializer has been designed to *just work* with any object. - -#### Example Definition - -```c# -using FullSerializer; - -public class MyType { - public string Value; -} - -public class MyTypeConverter : fsConverter { - public override bool CanProcess(Type type) { - // CanProcess will be called over every type that Full Serializer - // attempts to serialize. If this converter should be used, return true - // in this function. - return type == typeof(MyType); - } - - public override fsFailure TrySerialize(object instance, - out fsData serialized, Type storageType) { - - // Serialize the data into the serialized parameter. fsData is a - // strongly typed object store that maps directly to a JSON object model. - // It's really easy to use. - - var myType = (MyType)instance; - serialized = new fsData(myType.Value); - return fsFailure.Success; - } - - public override fsFailure TryDeserialize(fsData storage, - ref object instance, Type storageType) { - - // Always make to sure to verify that the deserialized data is the of - // the expected type. Otherwise, on platforms where exceptions are - // disabled bad things can happen (if the data was actually an object - // and you try to access a string, an exception will be thrown). - if (storage.Type != fsDataType.String) { - return fsFailure.Fail("Expected string fsData type but got " + - storage.Type); - } - - // We just want to deserialize into the existing object instance. If - // instance is a value type, then we can assign directly into instance - // to update the value. - - var myType = (MyType)instance; - myType.Value = storage.AsString; - return fsFailure.Success; - } - - // Object instance construction is separated from deserialization so that - // cycles can be correctly handled. If it's not possible to construct an - // instance of the expected type here, then just return any non-null value - // and construct the proper instance in TryDeserialize (though cycles will - // *not* be handled properly). - // - // You do not need to override this method if your converted type is a - // struct. - public override object CreateInstance(fsData data, Type storageType) { - return new MyType(); - } -} -``` - -#### Example Registration - -```c# -var serializer = new fsSerializer(); -serializer.AddConverter(new MyTypeConverter()); -``` - -After registration, use your serializer like normal and when it comes time to serialize or deserialize, your custom `MyTypeConverter` will automatically be invoked to serialize/deserialize `MyType` objects. - -# Limitations - -Full Serializer has minimal limitations, however, there are as follows: - -- The WebPlayer build target requires all deserialized types to have a default constructor -- No multidimensional array support (this can be added with a custom converter, however) -- Delegates are not serialized (how? If you have any ideas, please let me know!) - -# Adding Full Serializer to my project - -Import the `Source` folder into your Unity project! You're good to go! - -## How do I run the tests? - -To run automated tests, please also import [Unity Test Tools](https://www.assetstore.unity3d.com/en/#!/content/13802) into your project. Then you can run the NUnit tests via the standard unit test menu `Unity Test Tools\Unit Tests\Run all unit tests`. - -There are also a set of manual tests; simply add `Testing\RuntimeTests\RuntimeTestObject.prefab` to an empty scene and enter play-mode. - -> note: You need [Full Inspector](http://forum.unity3d.com/threads/224270-Full-Inspector-Inspector-and-serialization-for-structs-dicts-generics-interfaces) to run the manual tests. You can use the trial for in-editor testing, but to actually test on export platforms you need the full version. - - -# License - -Full Serializer is freely available under the MIT license. If you make any improvements, it would be greatly appreciated if you would submit a pull request with them. diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/README.md.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/README.md.meta deleted file mode 100644 index 01b0ead..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/README.md.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b3beb7e1e49ca0d4495c957c63752bc6 -timeCreated: 1428466633 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection.meta deleted file mode 100644 index 9584965..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b7538a46aa74e144c96035dd7912cb2e -folderAsset: yes -timeCreated: 1428466633 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsMetaProperty.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsMetaProperty.cs deleted file mode 100644 index 49e7238..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsMetaProperty.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System; -using System.Reflection; - -namespace FullSerializer.Internal { - /// - /// A property or field on a MetaType. - /// - public class fsMetaProperty { - internal fsMetaProperty(FieldInfo field) { - _memberInfo = field; - StorageType = field.FieldType; - JsonName = GetJsonName(field); - MemberName = field.Name; - IsPublic = field.IsPublic; - CanRead = true; - CanWrite = true; - } - - internal fsMetaProperty(PropertyInfo property) { - _memberInfo = property; - StorageType = property.PropertyType; - JsonName = GetJsonName(property); - MemberName = property.Name; - IsPublic = (property.GetGetMethod() != null && property.GetGetMethod().IsPublic) && (property.GetSetMethod() != null && property.GetSetMethod().IsPublic); - CanRead = property.CanRead; - CanWrite = property.CanWrite; - } - - /// - /// Internal handle to the reflected member. - /// - private MemberInfo _memberInfo; - - /// - /// The type of value that is stored inside of the property. For example, for an int field, - /// StorageType will be typeof(int). - /// - public Type StorageType { - get; - private set; - } - - /// - /// Can this property be read? - /// - public bool CanRead { - get; - private set; - } - - /// - /// Can this property be written to? - /// - public bool CanWrite { - get; - private set; - } - - /// - /// The serialized name of the property, as it should appear in JSON. - /// - public string JsonName { - get; - private set; - } - - /// - /// The name of the actual member. - /// - public string MemberName { - get; - private set; - } - - /// - /// Is this member public? - /// - public bool IsPublic { - get; - private set; - } - - /// - /// Writes a value to the property that this MetaProperty represents, using given object - /// instance as the context. - /// - public void Write(object context, object value) { - FieldInfo field = _memberInfo as FieldInfo; - PropertyInfo property = _memberInfo as PropertyInfo; - - if (field != null) { - field.SetValue(context, value); - } - - else if (property != null) { - MethodInfo setMethod = property.GetSetMethod(/*nonPublic:*/ true); - if (setMethod != null) { - setMethod.Invoke(context, new object[] { value }); - } - } - } - - /// - /// Reads a value from the property that this MetaProperty represents, using the given - /// object instance as the context. - /// - public object Read(object context) { - if (_memberInfo is PropertyInfo) { - return ((PropertyInfo)_memberInfo).GetValue(context, new object[] { }); - } - - else { - return ((FieldInfo)_memberInfo).GetValue(context); - } - } - - /// - /// Returns the name the given member wants to use for JSON serialization. - /// - private static string GetJsonName(MemberInfo member) { - var attr = fsPortableReflection.GetAttribute(member); - if (attr != null && string.IsNullOrEmpty(attr.Name) == false) { - return attr.Name; - } - - return member.Name; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsMetaProperty.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsMetaProperty.cs.meta deleted file mode 100644 index 9477992..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsMetaProperty.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: defa85c2a432ffb4c813547c73801cc7 -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsMetaType.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsMetaType.cs deleted file mode 100644 index 8ab6b4c..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsMetaType.cs +++ /dev/null @@ -1,310 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Runtime.CompilerServices; -using FullSerializer.Internal; - -namespace FullSerializer { - /// - /// MetaType contains metadata about a type. This is used by the reflection serializer. - /// - public class fsMetaType { - private static Dictionary _metaTypes = new Dictionary(); - public static fsMetaType Get(Type type) { - fsMetaType metaType; - if (_metaTypes.TryGetValue(type, out metaType) == false) { - metaType = new fsMetaType(type); - _metaTypes[type] = metaType; - } - - return metaType; - } - - /// - /// Clears out the cached type results. Useful if some prior assumptions become invalid, ie, the default member - /// serialization mode. - /// - public static void ClearCache() { - _metaTypes = new Dictionary(); - } - - private fsMetaType(Type reflectedType) { - ReflectedType = reflectedType; - - List properties = new List(); - CollectProperties(properties, reflectedType); - Properties = properties.ToArray(); - } - - public Type ReflectedType; - - private static void CollectProperties(List properties, Type reflectedType) { - // do we require a [SerializeField] or [fsProperty] attribute? - bool requireOptIn = fsConfig.DefaultMemberSerialization == fsMemberSerialization.OptIn; - bool requireOptOut = fsConfig.DefaultMemberSerialization == fsMemberSerialization.OptOut; - - fsObjectAttribute attr = fsPortableReflection.GetAttribute(reflectedType); - if (attr != null) { - requireOptIn = attr.MemberSerialization == fsMemberSerialization.OptIn; - requireOptOut = attr.MemberSerialization == fsMemberSerialization.OptOut; - } - - MemberInfo[] members = reflectedType.GetDeclaredMembers(); - foreach (var member in members) { - // We don't serialize members annotated with any of the ignore serialize attributes - if (fsConfig.IgnoreSerializeAttributes.Any(t => fsPortableReflection.HasAttribute(member, t))) { - continue; - } - - PropertyInfo property = member as PropertyInfo; - FieldInfo field = member as FieldInfo; - - // If an opt-in annotation is required, then skip the property if it doesn't have one - // of the serialize attributes - if (requireOptIn && - !fsConfig.SerializeAttributes.Any(t => fsPortableReflection.HasAttribute(member, t))) { - - continue; - } - - // If an opt-out annotation is required, then skip the property *only if* it has one of - // the not serialize attributes - if (requireOptOut && - fsConfig.IgnoreSerializeAttributes.Any(t => fsPortableReflection.HasAttribute(member, t))) { - - continue; - } - - if (property != null) { - if (CanSerializeProperty(property, members, requireOptOut)) { - properties.Add(new fsMetaProperty(property)); - } - } - else if (field != null) { - if (CanSerializeField(field, requireOptOut)) { - properties.Add(new fsMetaProperty(field)); - } - } - } - - if (reflectedType.Resolve().BaseType != null) { - CollectProperties(properties, reflectedType.Resolve().BaseType); - } - } - - private static bool IsAutoProperty(PropertyInfo property, MemberInfo[] members) { - if (!property.CanWrite || !property.CanRead) { - return false; - } - - string backingFieldName = "<" + property.Name + ">k__BackingField"; - for (int i = 0; i < members.Length; ++i) { - if (members[i].Name == backingFieldName) { - return true; - } - } - - return false; - } - - /// - /// Returns if the given property should be serialized. - /// - /// Should a property without any annotations be serialized? - private static bool CanSerializeProperty(PropertyInfo property, MemberInfo[] members, bool annotationFreeValue) { - // We don't serialize delegates - if (typeof(Delegate).IsAssignableFrom(property.PropertyType)) { - return false; - } - - var publicGetMethod = property.GetGetMethod(/*nonPublic:*/ false); - var publicSetMethod = property.GetSetMethod(/*nonPublic:*/ false); - - // We do not bother to serialize static fields. - if ((publicGetMethod != null && publicGetMethod.IsStatic) || - (publicSetMethod != null && publicSetMethod.IsStatic)) { - return false; - } - - // If a property is annotated with one of the serializable attributes, then it should - // it should definitely be serialized. - // - // NOTE: We place this override check *after* the static check, because we *never* - // allow statics to be serialized. - if (fsConfig.SerializeAttributes.Any(t => fsPortableReflection.HasAttribute(property, t))) { - return true; - } - - // If the property cannot be both read and written to, we are not going to serialize it - // regardless of the default serialization mode - if (property.CanRead == false || property.CanWrite == false) { - return false; - } - - // If it's an auto-property and it has either a public get or a public set method, - // then we serialize it - if (IsAutoProperty(property, members) && - (publicGetMethod != null || publicSetMethod != null)) { - return true; - } - - - // Otherwise, we don't bother with serialization - return annotationFreeValue; - } - - private static bool CanSerializeField(FieldInfo field, bool annotationFreeValue) { - // We don't serialize delegates - if (typeof(Delegate).IsAssignableFrom(field.FieldType)) { - return false; - } - - // We don't serialize compiler generated fields. - if (field.IsDefined(typeof(CompilerGeneratedAttribute), false)) { - return false; - } - - // We don't serialize static fields - if (field.IsStatic) { - return false; - } - - // We want to serialize any fields annotated with one of the serialize attributes. - // - // NOTE: This occurs *after* the static check, because we *never* want to serialize - // static fields. - if (fsConfig.SerializeAttributes.Any(t => fsPortableReflection.HasAttribute(field, t))) { - return true; - } - - // We use !IsPublic because that also checks for internal, protected, and private. - if (!annotationFreeValue && !field.IsPublic) { - return false; - } - - return true; - } - - /// - /// Attempt to emit an AOT compiled direct converter for this type. - /// - /// True if AOT data was emitted, false otherwise. - public bool EmitAotData() { - if (_hasEmittedAotData == false) { - _hasEmittedAotData = true; - - // NOTE: - // Even if the type has derived types, we can still generate a direct converter for it. - // Direct converters are not used for inherited types, so the reflected converter or something - // similar will be used for the derived type instead of our AOT compiled one. - - for (int i = 0; i < Properties.Length; ++i) { - if (Properties[i].IsPublic == false) return false; // cannot do a speedup - } - - // we need a default ctor - if (HasDefaultConstructor == false) return false; - - fsAotCompilationManager.AddAotCompilation(ReflectedType, Properties, _isDefaultConstructorPublic); - return true; - } - - return false; - } - private bool _hasEmittedAotData; - - public fsMetaProperty[] Properties { - get; - private set; - } - - /// - /// Returns true if the type represented by this metadata contains a default constructor. - /// - public bool HasDefaultConstructor { - get { - if (_hasDefaultConstructorCache.HasValue == false) { - // arrays are considered to have a default constructor - if (ReflectedType.Resolve().IsArray) { - _hasDefaultConstructorCache = true; - _isDefaultConstructorPublic = true; - } - - // value types (ie, structs) always have a default constructor - else if (ReflectedType.Resolve().IsValueType) { - _hasDefaultConstructorCache = true; - _isDefaultConstructorPublic = true; - } - - else { - // consider private constructors as well - var ctor = ReflectedType.GetDeclaredConstructor(fsPortableReflection.EmptyTypes); - _hasDefaultConstructorCache = ctor != null; - _isDefaultConstructorPublic = ctor.IsPublic; - } - } - - return _hasDefaultConstructorCache.Value; - } - } - private bool? _hasDefaultConstructorCache; - private bool _isDefaultConstructorPublic; - - /// - /// Creates a new instance of the type that this metadata points back to. If this type has a - /// default constructor, then Activator.CreateInstance will be used to construct the type - /// (or Array.CreateInstance if it an array). Otherwise, an uninitialized object created via - /// FormatterServices.GetSafeUninitializedObject is used to construct the instance. - /// - public object CreateInstance() { - if (ReflectedType.Resolve().IsInterface || ReflectedType.Resolve().IsAbstract) { - throw new Exception("Cannot create an instance of an interface or abstract type for " + ReflectedType); - } - -#if !NO_UNITY - // Unity requires special construction logic for types that derive from - // ScriptableObject. - if (typeof(UnityEngine.ScriptableObject).IsAssignableFrom(ReflectedType)) { - return UnityEngine.ScriptableObject.CreateInstance(ReflectedType); - } -#endif - - // Strings don't have default constructors but also fail when run through - // FormatterSerivces.GetSafeUninitializedObject - if (typeof(string) == ReflectedType) { - return string.Empty; - } - - if (HasDefaultConstructor == false) { -#if !UNITY_EDITOR && (UNITY_WEBPLAYER || UNITY_WP8 || UNITY_METRO) - throw new InvalidOperationException("The selected Unity platform requires " + - ReflectedType.FullName + " to have a default constructor. Please add one."); -#else - return System.Runtime.Serialization.FormatterServices.GetSafeUninitializedObject(ReflectedType); -#endif - } - - if (ReflectedType.Resolve().IsArray) { - // we have to start with a size zero array otherwise it will have invalid data - // inside of it - return Array.CreateInstance(ReflectedType.GetElementType(), 0); - } - - try { - return Activator.CreateInstance(ReflectedType, /*nonPublic:*/ true); - } -#if (!UNITY_EDITOR && (UNITY_METRO)) == false - catch (MissingMethodException e) { - throw new InvalidOperationException("Unable to create instance of " + ReflectedType + "; there is no default constructor", e); - } -#endif - catch (TargetInvocationException e) { - throw new InvalidOperationException("Constructor of " + ReflectedType + " threw an exception when creating an instance", e); - } - catch (MemberAccessException e) { - throw new InvalidOperationException("Unable to access constructor of " + ReflectedType, e); - } - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsMetaType.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsMetaType.cs.meta deleted file mode 100644 index dc1e204..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsMetaType.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e5b4843309bc35944b8592505fd2976a -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsReflectionUtility.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsReflectionUtility.cs deleted file mode 100644 index 651f42b..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsReflectionUtility.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; - -namespace FullSerializer.Internal { - public static class fsReflectionUtility { - /// - /// Searches for a particular implementation of the given interface type inside of the type. - /// This is particularly useful if the interface type is an open type, ie, typeof(IFace{}), - /// because this method will then return IFace{} but with appropriate type parameters - /// inserted. - /// - /// The base type to search for interface - /// The interface type to search for. Can be an open generic - /// type. - /// The actual interface type that the type contains, or null if there is no - /// implementation of the given interfaceType on type. - public static Type GetInterface(Type type, Type interfaceType) { - if (interfaceType.Resolve().IsGenericType && - interfaceType.Resolve().IsGenericTypeDefinition == false) { - - throw new ArgumentException("GetInterface requires that if the interface " + - "type is generic, then it must be the generic type definition, not a " + - "specific generic type instantiation"); - }; - - while (type != null) { - foreach (var iface in type.GetInterfaces()) { - if (iface.Resolve().IsGenericType) { - if (interfaceType == iface.GetGenericTypeDefinition()) { - return iface; - } - } - - else if (interfaceType == iface) { - return iface; - } - } - - type = type.Resolve().BaseType; - } - - return null; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsReflectionUtility.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsReflectionUtility.cs.meta deleted file mode 100644 index 9983c13..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsReflectionUtility.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: af18e08cb53dfee4bb3c5efcaebe92f4 -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsTypeLookup.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsTypeLookup.cs deleted file mode 100644 index 6414b99..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsTypeLookup.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Reflection; - -namespace FullSerializer.Internal { - /// - /// Provides APIs for looking up types based on their name. - /// - internal static class fsTypeLookup { - /// - /// Attempts to lookup the given type. Returns null if the type lookup fails. - /// - public static Type GetType(string typeName) { - Type type = null; - - // Try a direct type lookup - type = Type.GetType(typeName); - if (type != null) { - return type; - } - -#if (!UNITY_EDITOR && UNITY_METRO) == false // no AppDomain on WinRT - // If we still haven't found the proper type, we can enumerate all of the loaded - // assemblies and see if any of them define the type - foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { - // See if that assembly defines the named type - type = assembly.GetType(typeName); - if (type != null) { - return type; - } - } -#endif - - return null; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsTypeLookup.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsTypeLookup.cs.meta deleted file mode 100644 index 382fb35..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/Reflection/fsTypeLookup.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 96e46a3d6ef61ce4dbc5f7ac2de97a14 -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsAotCompilationManager.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsAotCompilationManager.cs deleted file mode 100644 index 82e0af1..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsAotCompilationManager.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using FullSerializer.Internal; - -namespace FullSerializer { - /// - /// The AOT compilation manager - /// - public class fsAotCompilationManager { - /// - /// Ahead of time compilations that are available. The type maps to the object type the generated converter - /// will serialize/deserialize, and the string is the text content for a converter that will do the serialization. - /// - /// The generated serializer is completely independent and you don't need to do anything. Simply add the file to - /// your project and it'll get used instead of the reflection based one. - /// - public static Dictionary AvailableAotCompilations { - get { - for (int i = 0; i < _uncomputedAotCompilations.Count; ++i) { - var item = _uncomputedAotCompilations[i]; - _computedAotCompilations[item.Type] = GenerateDirectConverterForTypeInCSharp(item.Type, item.Members, item.IsConstructorPublic); - } - _uncomputedAotCompilations.Clear(); - - return _computedAotCompilations; - } - } - private static Dictionary _computedAotCompilations = new Dictionary(); - - private struct AotCompilation { - public Type Type; - public fsMetaProperty[] Members; - public bool IsConstructorPublic; - } - private static List _uncomputedAotCompilations = new List(); - - /// - /// This is a helper method that makes it simple to run an AOT compilation on the given type. - /// - /// The type to perform the AOT compilation on. - /// The AOT class. Add this C# code to your project. - /// True if AOT compilation was successful. - public static bool TryToPerformAotCompilation(Type type, out string aotCompiledClassInCSharp) { - if (fsMetaType.Get(type).EmitAotData()) { - aotCompiledClassInCSharp = AvailableAotCompilations[type]; - return true; - } - - aotCompiledClassInCSharp = default(string); - return false; - } - - /// - /// Adds a new AOT compilation unit. - /// - /// The type of object we are AOT compiling. - /// The members on the object which will be serialized/deserialized. - public static void AddAotCompilation(Type type, fsMetaProperty[] members, bool isConstructorPublic) { - _uncomputedAotCompilations.Add(new AotCompilation { - Type = type, - Members = members, - IsConstructorPublic = isConstructorPublic - }); - } - - /// - /// AOT compiles the object (in C#). - /// - private static string GenerateDirectConverterForTypeInCSharp(Type type, fsMetaProperty[] members, bool isConstructorPublic) { - var sb = new StringBuilder(); - string typeName = type.CSharpName(/*includeNamespace:*/ true); - string typeNameSafeDecl = type.CSharpName(true, true); - - sb.AppendLine("using System;"); - sb.AppendLine("using System.Collections.Generic;"); - sb.AppendLine(); - sb.AppendLine("namespace FullSerializer {"); - sb.AppendLine(" partial class fsConverterRegistrar {"); - sb.AppendLine(" public static Speedup." + typeNameSafeDecl + "_DirectConverter " + "Register_" + typeNameSafeDecl + ";"); - sb.AppendLine(" }"); - sb.AppendLine("}"); - sb.AppendLine(); - sb.AppendLine("namespace FullSerializer.Speedup {"); - sb.AppendLine(" public class " + typeNameSafeDecl + "_DirectConverter : fsDirectConverter<" + typeName + "> {"); - sb.AppendLine(" protected override fsResult DoSerialize(" + typeName + " model, Dictionary serialized) {"); - sb.AppendLine(" var result = fsResult.Success;"); - sb.AppendLine(); - foreach (var member in members) { - sb.AppendLine(" result += SerializeMember(serialized, \"" + member.JsonName + "\", model." + member.MemberName + ");"); - } - sb.AppendLine(); - sb.AppendLine(" return result;"); - sb.AppendLine(" }"); - sb.AppendLine(); - sb.AppendLine(" protected override fsResult DoDeserialize(Dictionary data, ref " + typeName + " model) {"); - sb.AppendLine(" var result = fsResult.Success;"); - sb.AppendLine(); - for (int i = 0; i < members.Length; ++i) { - var member = members[i]; - sb.AppendLine(" var t" + i + " = model." + member.MemberName + ";"); - sb.AppendLine(" result += DeserializeMember(data, \"" + member.JsonName + "\", out t" + i + ");"); - sb.AppendLine(" model." + member.MemberName + " = t" + i + ";"); - sb.AppendLine(); - } - sb.AppendLine(" return result;"); - sb.AppendLine(" }"); - sb.AppendLine(); - sb.AppendLine(" public override object CreateInstance(fsData data, Type storageType) {"); - if (isConstructorPublic) { - sb.AppendLine(" return new " + typeName + "();"); - } - else { - sb.AppendLine(" return Activator.CreateInstance(typeof(" + typeName + "), /*nonPublic:*/true);"); - } - sb.AppendLine(" }"); - sb.AppendLine(" }"); - sb.AppendLine("}"); - - return sb.ToString(); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsAotCompilationManager.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsAotCompilationManager.cs.meta deleted file mode 100644 index ed580e1..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsAotCompilationManager.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 183352ab310d31245b612aedf64342d0 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsBaseConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsBaseConverter.cs deleted file mode 100644 index 2e7186e..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsBaseConverter.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using FullSerializer.Internal; - -namespace FullSerializer { - /// - /// The serialization converter allows for customization of the serialization process. - /// - /// You do not want to derive from this class - there is no way to actually use it within - /// the serializer.. Instead, derive from either fsConverter or fsDirectConverter - public abstract class fsBaseConverter { - /// - /// The serializer that was owns this converter. - /// - public fsSerializer Serializer; - - /// - /// Construct an object instance that will be passed to TryDeserialize. This should **not** - /// deserialize the object. - /// - /// The data the object was serialized with. - /// The field/property type that is storing the instance. - /// An object instance - public virtual object CreateInstance(fsData data, Type storageType) { - if (RequestCycleSupport(storageType)) { - throw new InvalidOperationException("Please override CreateInstance for " + - GetType().FullName + "; the object graph for " + storageType + - " can contain potentially contain cycles, so separated instance creation " + - "is needed"); - } - - return storageType; - } - - /// - /// If true, then the serializer will support cyclic references with the given converted - /// type. - /// - /// The field/property type that is currently storing the object - /// that is being serialized. - public virtual bool RequestCycleSupport(Type storageType) { - if (storageType == typeof(string)) return false; - - return storageType.Resolve().IsClass || storageType.Resolve().IsInterface; - } - - /// - /// If true, then the serializer will include inheritance data for the given converter. - /// - /// The field/property type that is currently storing the object - /// that is being serialized. - public virtual bool RequestInheritanceSupport(Type storageType) { - return storageType.Resolve().IsSealed == false; - } - - /// - /// Serialize the actual object into the given data storage. - /// - /// The object instance to serialize. This will never be null. - /// The serialized state. - /// The field/property type that is storing this instance. - /// If serialization was successful. - public abstract fsResult TrySerialize(object instance, out fsData serialized, Type storageType); - - /// - /// Deserialize data into the object instance. - /// - /// Serialization data to deserialize from. - /// The object instance to deserialize into. - /// The field/property type that is storing the instance. - /// True if serialization was successful, false otherwise. - public abstract fsResult TryDeserialize(fsData data, ref object instance, Type storageType); - - protected fsResult FailExpectedType(fsData data, params fsDataType[] types) { - return fsResult.Fail(GetType().Name + " expected one of " + - string.Join(", ", types.Select(t => t.ToString()).ToArray()) + - " but got " + data.Type + " in " + data); - } - - protected fsResult CheckType(fsData data, fsDataType type) { - if (data.Type != type) { - return fsResult.Fail(GetType().Name + " expected " + type + " but got " + data.Type + " in " + data); - } - return fsResult.Success; - } - - protected fsResult CheckKey(fsData data, string key, out fsData subitem) { - return CheckKey(data.AsDictionary, key, out subitem); - } - - protected fsResult CheckKey(Dictionary data, string key, out fsData subitem) { - if (data.TryGetValue(key, out subitem) == false) { - return fsResult.Fail(GetType().Name + " requires a <" + key + "> key in the data " + data); - } - return fsResult.Success; - } - - protected fsResult SerializeMember(Dictionary data, string name, T value) { - fsData memberData; - var result = Serializer.TrySerialize(typeof(T), value, out memberData); - if (result.Succeeded) data[name] = memberData; - return result; - } - - protected fsResult DeserializeMember(Dictionary data, string name, out T value) { - fsData memberData; - if (data.TryGetValue(name, out memberData) == false) { - value = default(T); - return fsResult.Fail("Unable to find member \"" + name + "\""); - } - - object storage = null; - var result = Serializer.TryDeserialize(memberData, typeof(T), ref storage); - value = (T)storage; - return result; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsBaseConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsBaseConverter.cs.meta deleted file mode 100644 index 98bd441..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsBaseConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6464fb5b0d3f43248a6737022479a085 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConfig.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConfig.cs deleted file mode 100644 index cb672eb..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConfig.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; - -namespace FullSerializer { - /// - /// Enables some top-level customization of Full Serializer. - /// - public static class fsConfig { - /// - /// The attributes that will force a field or property to be serialized. - /// - public static Type[] SerializeAttributes = { -#if !NO_UNITY - typeof(UnityEngine.SerializeField), -#endif - typeof(fsPropertyAttribute) - }; - - /// - /// The attributes that will force a field or property to *not* be serialized. - /// - public static Type[] IgnoreSerializeAttributes = { typeof(NonSerializedAttribute), typeof(fsIgnoreAttribute) }; - - /// - /// The default member serialization. - /// - public static fsMemberSerialization DefaultMemberSerialization { - get { - return _defaultMemberSerialization; - } - set { - _defaultMemberSerialization = value; - fsMetaType.ClearCache(); - } - } - - private static fsMemberSerialization _defaultMemberSerialization = fsMemberSerialization.Default; - - /// - /// Should deserialization be case sensitive? If this is false and the JSON has multiple members with the - /// same keys only separated by case, then this results in undefined behavior. - /// - public static bool IsCaseSensitive = true; - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConfig.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConfig.cs.meta deleted file mode 100644 index f467bec..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConfig.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 00ce26a1fa691bd4c90018ffe336c77a -timeCreated: 1428466633 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsContext.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsContext.cs deleted file mode 100644 index 1392d0c..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsContext.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace FullSerializer { - /// - /// fsContext stores global metadata that can be used to customize how fsConverters operate - /// during serialization. - /// - public sealed class fsContext { - /// - /// All of the context objects. - /// - private readonly Dictionary _contextObjects = new Dictionary(); - - /// - /// Removes all context objects from the context. - /// - public void Reset() { - _contextObjects.Clear(); - } - - /// - /// Sets the context object for the given type with the given value. - /// - public void Set(T obj) { - _contextObjects[typeof(T)] = obj; - } - - /// - /// Returns true if there is a context object for the given type. - /// - public bool Has() { - return _contextObjects.ContainsKey(typeof(T)); - } - - /// - /// Fetches the context object for the given type. - /// - public T Get() { - object val; - if (_contextObjects.TryGetValue(typeof(T), out val)) { - return (T)val; - } - throw new InvalidOperationException("There is no context object of type " + typeof(T)); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsContext.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsContext.cs.meta deleted file mode 100644 index e9302b8..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsContext.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: fbec27c0b190fc848882363d08b9769f -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConverter.cs deleted file mode 100644 index d8cac9e..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConverter.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using FullSerializer.Internal; - -namespace FullSerializer { - /// - /// The serialization converter allows for customization of the serialization process. - /// - public abstract class fsConverter : fsBaseConverter { - /// - /// Can this converter serialize and deserialize the given object type? - /// - /// The given object type. - /// True if the converter can serialize it, false otherwise. - public abstract bool CanProcess(Type type); - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConverter.cs.meta deleted file mode 100644 index 8317fe6..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6401567a07204d648bbca6e0f73338e3 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConverterRegistrar.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConverterRegistrar.cs deleted file mode 100644 index d53ef02..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConverterRegistrar.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using FullSerializer.Internal; - -namespace FullSerializer { - /// - /// This class allows arbitrary code to easily register global converters. To add a converter, - /// simply declare a new field called "Register_*" that stores the type of converter you would - /// like to add. Alternatively, you can do the same with a method called "Register_*"; just add - /// the converter type to the `Converters` list. - /// - public partial class fsConverterRegistrar { - static fsConverterRegistrar() { - Converters = new List(); - - foreach (var field in typeof(fsConverterRegistrar).GetDeclaredFields()) { - if (field.Name.StartsWith("Register_")) Converters.Add(field.FieldType); - } - - foreach (var method in typeof(fsConverterRegistrar).GetDeclaredMethods()) { - if (method.Name.StartsWith("Register_")) method.Invoke(null, null); - } - - } - - public static List Converters; - - // Example field registration: - //public static AnimationCurve_DirectConverter Register_AnimationCurve_DirectConverter; - - // Example method registration: - //public static void Register_AnimationCurve_DirectConverter() { - // Converters.Add(typeof(AnimationCurve_DirectConverter)); - //} - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConverterRegistrar.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConverterRegistrar.cs.meta deleted file mode 100644 index e0b2f63..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsConverterRegistrar.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: eb3e23d38a6b513439165534590c8a26 -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsData.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsData.cs deleted file mode 100644 index a39b07c..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsData.cs +++ /dev/null @@ -1,376 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; - -namespace FullSerializer { - /// - /// The actual type that a JsonData instance can store. - /// - public enum fsDataType { - Array, - Object, - Double, - Int64, - Boolean, - String, - Null - } - - /// - /// A union type that stores a serialized value. The stored type can be one of six different - /// types: null, boolean, double, Int64, string, Dictionary, or List. - /// - public sealed class fsData { - /// - /// The raw value that this serialized data stores. It can be one of six different types; a - /// boolean, a double, Int64, a string, a Dictionary, or a List. - /// - private readonly object _value; - - #region Constructors - /// - /// Creates a fsData instance that holds null. - /// - public fsData() { - _value = null; - } - - /// - /// Creates a fsData instance that holds a boolean. - /// - public fsData(bool boolean) { - _value = boolean; - } - - /// - /// Creates a fsData instance that holds a double. - /// - public fsData(double f) { - _value = f; - } - - /// - /// Creates a new fsData instance that holds an integer. - /// - public fsData(Int64 i) { - _value = i; - } - - /// - /// Creates a fsData instance that holds a string. - /// - public fsData(string str) { - _value = str; - } - - /// - /// Creates a fsData instance that holds a dictionary of values. - /// - public fsData(Dictionary dict) { - _value = dict; - } - - /// - /// Creates a fsData instance that holds a list of values. - /// - public fsData(List list) { - _value = list; - } - - /// - /// Helper method to create a fsData instance that holds a dictionary. - /// - public static fsData CreateDictionary() { - return new fsData(new Dictionary( - fsConfig.IsCaseSensitive ? StringComparer.CurrentCulture : StringComparer.CurrentCultureIgnoreCase)); - } - - /// - /// Helper method to create a fsData instance that holds a list. - /// - public static fsData CreateList() { - return new fsData(new List()); - } - - /// - /// Helper method to create a fsData instance that holds a list with the initial capacity. - /// - public static fsData CreateList(int capacity) { - return new fsData(new List(capacity)); - } - - public readonly static fsData True = new fsData(true); - public readonly static fsData False = new fsData(true); - public readonly static fsData Null = new fsData(); - #endregion - - #region Casting Predicates - public fsDataType Type { - get { - if (_value == null) return fsDataType.Null; - if (_value is double) return fsDataType.Double; - if (_value is Int64) return fsDataType.Int64; - if (_value is bool) return fsDataType.Boolean; - if (_value is string) return fsDataType.String; - if (_value is Dictionary) return fsDataType.Object; - if (_value is List) return fsDataType.Array; - - throw new InvalidOperationException("unknown JSON data type"); - } - } - - /// - /// Returns true if this fsData instance maps back to null. - /// - public bool IsNull { - get { - return _value == null; - } - } - - /// - /// Returns true if this fsData instance maps back to a double. - /// - public bool IsDouble { - get { - return _value is double; - } - } - - /// - /// Returns true if this fsData instance maps back to an Int64. - /// - public bool IsInt64 { - get { - return _value is Int64; - } - } - - /// - /// Returns true if this fsData instance maps back to a boolean. - /// - public bool IsBool { - get { - return _value is bool; - } - } - - /// - /// Returns true if this fsData instance maps back to a string. - /// - public bool IsString { - get { - return _value is string; - } - } - - /// - /// Returns true if this fsData instance maps back to a Dictionary. - /// - public bool IsDictionary { - get { - return _value is Dictionary; - } - } - - /// - /// Returns true if this fsData instance maps back to a List. - /// - public bool IsList { - get { - return _value is List; - } - } - #endregion - - #region Casts - /// - /// Casts this fsData to a double. Throws an exception if it is not a double. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - public double AsDouble { - get { - return Cast(); - } - } - - /// - /// Casts this fsData to an Int64. Throws an exception if it is not an Int64. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - public Int64 AsInt64 { - get { - return Cast(); - } - } - - - /// - /// Casts this fsData to a boolean. Throws an exception if it is not a boolean. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - public bool AsBool { - get { - return Cast(); - } - } - - /// - /// Casts this fsData to a string. Throws an exception if it is not a string. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - public string AsString { - get { - return Cast(); - } - } - - /// - /// Casts this fsData to a Dictionary. Throws an exception if it is not a - /// Dictionary. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - public Dictionary AsDictionary { - get { - return Cast>(); - } - } - - /// - /// Casts this fsData to a List. Throws an exception if it is not a List. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - public List AsList { - get { - return Cast>(); - } - } - - /// - /// Internal helper method to cast the underlying storage to the given type or throw a - /// pretty printed exception on failure. - /// - private T Cast() { - if (_value is T) { - return (T)_value; - } - - throw new InvalidCastException("Unable to cast <" + this + "> (with type = " + - _value.GetType() + ") to type " + typeof(T)); - } - #endregion - - #region ToString Implementation - public override string ToString() { - return fsJsonPrinter.CompressedJson(this); - } - #endregion - - #region Equality Comparisons - /// - /// Determines whether the specified object is equal to the current object. - /// - public override bool Equals(object obj) { - return Equals(obj as fsData); - } - - /// - /// Determines whether the specified object is equal to the current object. - /// - public bool Equals(fsData other) { - if (other == null || Type != other.Type) { - return false; - } - - switch (Type) { - case fsDataType.Null: - return true; - - case fsDataType.Double: - return AsDouble == other.AsDouble || Math.Abs(AsDouble - other.AsDouble) < double.Epsilon; - - case fsDataType.Int64: - return AsInt64 == other.AsInt64; - - case fsDataType.Boolean: - return AsBool == other.AsBool; - - case fsDataType.String: - return AsString == other.AsString; - - case fsDataType.Array: - var thisList = AsList; - var otherList = other.AsList; - - if (thisList.Count != otherList.Count) return false; - - for (int i = 0; i < thisList.Count; ++i) { - if (thisList[i].Equals(otherList[i]) == false) { - return false; - } - } - - return true; - - case fsDataType.Object: - var thisDict = AsDictionary; - var otherDict = other.AsDictionary; - - if (thisDict.Count != otherDict.Count) return false; - - foreach (string key in thisDict.Keys) { - if (otherDict.ContainsKey(key) == false) { - return false; - } - - if (thisDict[key].Equals(otherDict[key]) == false) { - return false; - } - } - - return true; - } - - throw new Exception("Unknown data type"); - } - - /// - /// Returns true iff a == b. - /// - public static bool operator ==(fsData a, fsData b) { - // If both are null, or both are same instance, return true. - if (ReferenceEquals(a, b)) { - return true; - } - - // If one is null, but not both, return false. - if (((object)a == null) || ((object)b == null)) { - return false; - } - - if (a.IsDouble && b.IsDouble) { - return Math.Abs(a.AsDouble - b.AsDouble) < double.Epsilon; - } - - return a.Equals(b); - } - - /// - /// Returns true iff a != b. - /// - public static bool operator !=(fsData a, fsData b) { - return !(a == b); - } - - /// - /// Returns a hash code for this instance. - /// - /// A hash code for this instance, suitable for use in hashing algorithms and data - /// structures like a hash table. - public override int GetHashCode() { - return _value.GetHashCode(); - } - #endregion - } - -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsData.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsData.cs.meta deleted file mode 100644 index c8b92ac..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsData.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 431a40cd7e2b0864291bc9954a9626fb -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsDirectConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsDirectConverter.cs deleted file mode 100644 index 77a8154..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsDirectConverter.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using FullSerializer.Internal; - -namespace FullSerializer { - /// - /// The direct converter is similar to a regular converter, except that it targets specifically only one type. - /// This means that it can be used without performance impact when discovering converters. It is strongly - /// recommended that you derive from fsDirectConverter{TModel}. - /// - /// Due to the way that direct converters operate, inheritance is *not* supported. Direct converters - /// will only be used with the exact ModelType object. - public abstract class fsDirectConverter : fsBaseConverter { - public abstract Type ModelType { get; } - } - - public abstract class fsDirectConverter : fsDirectConverter { - public override Type ModelType { get { return typeof(TModel); } } - - public sealed override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) { - var serializedDictionary = new Dictionary(); - var result = DoSerialize((TModel)instance, serializedDictionary); - serialized = new fsData(serializedDictionary); - return result; - } - - public sealed override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { - var result = fsResult.Success; - if ((result += CheckType(data, fsDataType.Object)).Failed) return result; - - var obj = (TModel)instance; - result += DoDeserialize(data.AsDictionary, ref obj); - instance = obj; - return result; - } - - protected abstract fsResult DoSerialize(TModel model, Dictionary serialized); - protected abstract fsResult DoDeserialize(Dictionary data, ref TModel model); - } -} diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsDirectConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsDirectConverter.cs.meta deleted file mode 100644 index 75ce921..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsDirectConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 69aa96924d7c2264196bc90ee4902f36 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsExceptions.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsExceptions.cs deleted file mode 100644 index 705b834..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsExceptions.cs +++ /dev/null @@ -1,16 +0,0 @@ -// note: This file contains exceptions used by FullSerializer. Exceptions are never used at runtime -// in FullSerializer; they are only used when validating annotations and code-based models. - -using System; - -namespace FullSerializer { - public sealed class fsMissingVersionConstructorException : Exception { - public fsMissingVersionConstructorException(Type versionedType, Type constructorType) : - base(versionedType + " is missing a constructor for previous model type " + constructorType) { } - } - - public sealed class fsDuplicateVersionNameException : Exception { - public fsDuplicateVersionNameException(Type typeA, Type typeB, string version) : - base(typeA + " and " + typeB + " have the same version string (" + version + "); please change one of them.") { } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsExceptions.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsExceptions.cs.meta deleted file mode 100644 index ee4bf22..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsExceptions.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e827f5c0f06546242a8d0069b1d5a026 -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsISerializationCallbacks.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsISerializationCallbacks.cs deleted file mode 100644 index f612ea6..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsISerializationCallbacks.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; - -namespace FullSerializer { - /// - /// Extend this interface on your type to receive notifications about serialization/deserialization events. If you don't - /// have access to the type itself, then you can write an fsObjectProcessor instead. - /// - public interface fsISerializationCallbacks { - /// - /// Called before serialization. - /// - void OnBeforeSerialize(Type storageType); - - /// - /// Called after serialization. - /// - /// The field/property type that is storing the instance. - /// The data that was serialized. - void OnAfterSerialize(Type storageType, ref fsData data); - - /// - /// Called before deserialization. - /// - /// The field/property type that is storing the instance. - /// The data that will be used for deserialization. - void OnBeforeDeserialize(Type storageType, ref fsData data); - - /// - /// Called after deserialization. - /// - /// The field/property type that is storing the instance. - /// The type of the instance. - void OnAfterDeserialize(Type storageType); - } -} - -namespace FullSerializer.Internal { - public class fsSerializationCallbackProcessor : fsObjectProcessor { - public override bool CanProcess(Type type) { - return typeof(fsISerializationCallbacks).IsAssignableFrom(type); - } - - public override void OnBeforeSerialize(Type storageType, object instance) { - ((fsISerializationCallbacks)instance).OnBeforeSerialize(storageType); - } - - public override void OnAfterSerialize(Type storageType, object instance, ref fsData data) { - ((fsISerializationCallbacks)instance).OnAfterSerialize(storageType, ref data); - } - - public override void OnBeforeDeserializeAfterInstanceCreation(Type storageType, object instance, ref fsData data) { - if (instance is fsISerializationCallbacks == false) { - throw new InvalidCastException("Please ensure the converter for " + storageType + " actually returns an instance of it, not an instance of " + instance.GetType()); - } - - ((fsISerializationCallbacks)instance).OnBeforeDeserialize(storageType, ref data); - } - - public override void OnAfterDeserialize(Type storageType, object instance) { - ((fsISerializationCallbacks)instance).OnAfterDeserialize(storageType); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsISerializationCallbacks.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsISerializationCallbacks.cs.meta deleted file mode 100644 index 314f61d..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsISerializationCallbacks.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 674a237ca5c3bec4180c79ebc4478d53 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsIgnoreAttribute.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsIgnoreAttribute.cs deleted file mode 100644 index 3eaea48..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsIgnoreAttribute.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace FullSerializer { - /// - /// The given property or field annotated with [JsonIgnore] will not be serialized. - /// - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public sealed class fsIgnoreAttribute : Attribute { - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsIgnoreAttribute.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsIgnoreAttribute.cs.meta deleted file mode 100644 index 9fe2794..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsIgnoreAttribute.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 72b1235353273194fb5cbeb71b13db6a -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsJsonParser.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsJsonParser.cs deleted file mode 100644 index 460172f..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsJsonParser.cs +++ /dev/null @@ -1,479 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text; - -namespace FullSerializer { - // TODO: properly propagate warnings/etc for fsResult states - - /// - /// A simple recursive descent parser for JSON. - /// - public class fsJsonParser { - private int _start; - private string _input; - - private fsResult MakeFailure(string message) { - int start = Math.Max(0, _start - 20); - int length = Math.Min(50, _input.Length - start); - - string error = "Error while parsing: " + message + "; context = <" + - _input.Substring(start, length) + ">"; - return fsResult.Fail(error); - } - - private bool TryMoveNext() { - if (_start < _input.Length) { - ++_start; - return true; - } - - return false; - } - - private bool HasValue() { - return HasValue(0); - } - - private bool HasValue(int offset) { - return (_start + offset) >= 0 && (_start + offset) < _input.Length; - } - - private char Character() { - return Character(0); - } - - private char Character(int offset) { - return _input[_start + offset]; - } - - /// - /// Skips input such that Character() will return a non-whitespace character - /// - private void SkipSpace() { - while (HasValue()) { - char c = Character(); - - // whitespace; fine to skip - if (char.IsWhiteSpace(c)) { - TryMoveNext(); - continue; - } - - // comment? they begin with // - if (HasValue(1) && - (Character(0) == '/' && Character(1) == '/')) { - - // skip the rest of the line - while (HasValue() && Environment.NewLine.Contains("" + Character()) == false) { - TryMoveNext(); - } - - // we still need to skip whitespace on the next line - continue; - } - - break; - } - } - - #region Escaping - private bool IsHex(char c) { - return ((c >= '0' && c <= '9') || - (c >= 'a' && c <= 'f') || - (c >= 'A' && c <= 'F')); - } - - private uint ParseSingleChar(char c1, uint multipliyer) { - uint p1 = 0; - if (c1 >= '0' && c1 <= '9') - p1 = (uint)(c1 - '0') * multipliyer; - else if (c1 >= 'A' && c1 <= 'F') - p1 = (uint)((c1 - 'A') + 10) * multipliyer; - else if (c1 >= 'a' && c1 <= 'f') - p1 = (uint)((c1 - 'a') + 10) * multipliyer; - return p1; - } - - private uint ParseUnicode(char c1, char c2, char c3, char c4) { - uint p1 = ParseSingleChar(c1, 0x1000); - uint p2 = ParseSingleChar(c2, 0x100); - uint p3 = ParseSingleChar(c3, 0x10); - uint p4 = ParseSingleChar(c4, 0x1); - - return p1 + p2 + p3 + p4; - } - - private fsResult TryUnescapeChar(out char escaped) { - // skip leading backslash '\' - TryMoveNext(); - if (HasValue() == false) { - escaped = ' '; - return MakeFailure("Unexpected end of input after \\"); - } - - switch (Character()) { - case '\\': TryMoveNext(); escaped = '\\'; return fsResult.Success; - case '"': TryMoveNext(); escaped = '\"'; return fsResult.Success; - case 'a': TryMoveNext(); escaped = '\a'; return fsResult.Success; - case 'b': TryMoveNext(); escaped = '\b'; return fsResult.Success; - case 'f': TryMoveNext(); escaped = '\f'; return fsResult.Success; - case 'n': TryMoveNext(); escaped = '\n'; return fsResult.Success; - case 'r': TryMoveNext(); escaped = '\r'; return fsResult.Success; - case 't': TryMoveNext(); escaped = '\t'; return fsResult.Success; - case '0': TryMoveNext(); escaped = '\0'; return fsResult.Success; - case 'u': - TryMoveNext(); - if (IsHex(Character(0)) - && IsHex(Character(1)) - && IsHex(Character(2)) - && IsHex(Character(3))) { - - uint codePoint = ParseUnicode(Character(0), Character(1), Character(2), Character(3)); - - TryMoveNext(); - TryMoveNext(); - TryMoveNext(); - TryMoveNext(); - - escaped = (char)codePoint; - return fsResult.Success; - } - - // invalid escape sequence - escaped = (char)0; - return MakeFailure( - string.Format("invalid escape sequence '\\u{0}{1}{2}{3}'\n", - Character(0), - Character(1), - Character(2), - Character(3))); - default: - escaped = (char)0; - return MakeFailure(string.Format("Invalid escape sequence \\{0}", Character())); - } - } - #endregion - - private fsResult TryParseExact(string content) { - for (int i = 0; i < content.Length; ++i) { - if (Character() != content[i]) { - return MakeFailure("Expected " + content[i]); - } - - if (TryMoveNext() == false) { - return MakeFailure("Unexpected end of content when parsing " + content); - } - } - - return fsResult.Success; - } - - private fsResult TryParseTrue(out fsData data) { - var fail = TryParseExact("true"); - - if (fail.Succeeded) { - data = new fsData(true); - return fsResult.Success; - } - - data = null; - return fail; - } - - private fsResult TryParseFalse(out fsData data) { - var fail = TryParseExact("false"); - - if (fail.Succeeded) { - data = new fsData(false); - return fsResult.Success; - } - - data = null; - return fail; - } - - private fsResult TryParseNull(out fsData data) { - var fail = TryParseExact("null"); - - if (fail.Succeeded) { - data = new fsData(); - return fsResult.Success; - } - - data = null; - return fail; - } - - - private bool IsSeparator(char c) { - return char.IsWhiteSpace(c) || c == ',' || c == '}' || c == ']'; - } - - /// - /// Parses numbers that follow the regular expression [-+](\d+|\d*\.\d*) - /// - private fsResult TryParseNumber(out fsData data) { - int start = _start; - - // read until we get to a separator - while ( - TryMoveNext() && - (HasValue() && IsSeparator(Character()) == false)) { - } - - // try to parse the value - string numberString = _input.Substring(start, _start - start); - - // double -- includes a . - if (numberString.Contains(".") || numberString == "Infinity" || numberString == "-Infinity" || numberString == "NaN") { - double doubleValue; - if (double.TryParse(numberString, NumberStyles.Any, CultureInfo.InvariantCulture, out doubleValue) == false) { - data = null; - return MakeFailure("Bad double format with " + numberString); - } - - data = new fsData(doubleValue); - return fsResult.Success; - } - else { - Int64 intValue; - if (Int64.TryParse(numberString, NumberStyles.Any, CultureInfo.InvariantCulture, out intValue) == false) { - data = null; - return MakeFailure("Bad Int64 format with " + numberString); - } - - data = new fsData(intValue); - return fsResult.Success; - } - } - - private readonly StringBuilder _cachedStringBuilder = new StringBuilder(256); - /// - /// Parses a string - /// - private fsResult TryParseString(out string str) { - _cachedStringBuilder.Length = 0; - - // skip the first " - if (Character() != '"' || TryMoveNext() == false) { - str = string.Empty; - return MakeFailure("Expected initial \" when parsing a string"); - } - - // read until the next " - while (HasValue() && Character() != '\"') { - char c = Character(); - - // escape if necessary - if (c == '\\') { - char unescaped; - var fail = TryUnescapeChar(out unescaped); - if (fail.Failed) { - str = string.Empty; - return fail; - } - - _cachedStringBuilder.Append(unescaped); - } - - // no escaping necessary - else { - _cachedStringBuilder.Append(c); - - // get the next character - if (TryMoveNext() == false) { - str = string.Empty; - return MakeFailure("Unexpected end of input when reading a string"); - } - } - } - - // skip the first " - if (HasValue() == false || Character() != '"' || TryMoveNext() == false) { - str = string.Empty; - return MakeFailure("No closing \" when parsing a string"); - } - - str = _cachedStringBuilder.ToString(); - return fsResult.Success; - } - - /// - /// Parses an array - /// - private fsResult TryParseArray(out fsData arr) { - if (Character() != '[') { - arr = null; - return MakeFailure("Expected initial [ when parsing an array"); - } - - // skip '[' - if (TryMoveNext() == false) { - arr = null; - return MakeFailure("Unexpected end of input when parsing an array"); - } - SkipSpace(); - - var result = new List(); - - while (HasValue() && Character() != ']') { - // parse the element - fsData element; - var fail = RunParse(out element); - if (fail.Failed) { - arr = null; - return fail; - } - - result.Add(element); - - // parse the comma - SkipSpace(); - if (HasValue() && Character() == ',') { - if (TryMoveNext() == false) break; - SkipSpace(); - } - } - - // skip the final ] - if (HasValue() == false || Character() != ']' || TryMoveNext() == false) { - arr = null; - return MakeFailure("No closing ] for array"); - } - - arr = new fsData(result); - return fsResult.Success; - } - - private fsResult TryParseObject(out fsData obj) { - if (Character() != '{') { - obj = null; - return MakeFailure("Expected initial { when parsing an object"); - } - - // skip '{' - if (TryMoveNext() == false) { - obj = null; - return MakeFailure("Unexpected end of input when parsing an object"); - } - SkipSpace(); - - var result = new Dictionary( - fsConfig.IsCaseSensitive ? StringComparer.CurrentCulture : StringComparer.CurrentCultureIgnoreCase); - - while (HasValue() && Character() != '}') { - fsResult failure; - - // parse the key - SkipSpace(); - string key; - failure = TryParseString(out key); - if (failure.Failed) { - obj = null; - return failure; - } - SkipSpace(); - - // parse the ':' after the key - if (HasValue() == false || Character() != ':' || TryMoveNext() == false) { - obj = null; - return MakeFailure("Expected : after key \"" + key + "\""); - } - SkipSpace(); - - // parse the value - fsData value; - failure = RunParse(out value); - if (failure.Failed) { - obj = null; - return failure; - } - - result.Add(key, value); - - // parse the comma - SkipSpace(); - if (HasValue() && Character() == ',') { - if (TryMoveNext() == false) break; - SkipSpace(); - } - } - - // skip the final } - if (HasValue() == false || Character() != '}' || TryMoveNext() == false) { - obj = null; - return MakeFailure("No closing } for object"); - } - - obj = new fsData(result); - return fsResult.Success; - } - - private fsResult RunParse(out fsData data) { - SkipSpace(); - - switch (Character()) { - case 'I': // Infinity - case 'N': // NaN - case '.': - case '+': - case '-': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': return TryParseNumber(out data); - case '"': { - string str; - fsResult fail = TryParseString(out str); - if (fail.Failed) { - data = null; - return fail; - } - data = new fsData(str); - return fsResult.Success; - } - case '[': return TryParseArray(out data); - case '{': return TryParseObject(out data); - case 't': return TryParseTrue(out data); - case 'f': return TryParseFalse(out data); - case 'n': return TryParseNull(out data); - default: - data = null; - return MakeFailure("unable to parse; invalid initial token \"" + Character() + "\""); - } - } - - /// - /// Parses the specified input. Returns a failure state if parsing failed. - /// - /// The input to parse. - /// The parsed data. This is undefined if parsing fails. - /// The parsed input. - public static fsResult Parse(string input, out fsData data) { - var context = new fsJsonParser(input); - return context.RunParse(out data); - } - - /// - /// Helper method for Parse that does not allow the error information - /// to be recovered. - /// - public static fsData Parse(string input) { - fsData data; - Parse(input, out data).AssertSuccess(); - return data; - } - - private fsJsonParser(string input) { - _input = input; - _start = 0; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsJsonParser.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsJsonParser.cs.meta deleted file mode 100644 index 8a2cd39..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsJsonParser.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 414cf0d214fdc3746b7c984e498d6807 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsJsonPrinter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsJsonPrinter.cs deleted file mode 100644 index 35845c0..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsJsonPrinter.cs +++ /dev/null @@ -1,280 +0,0 @@ -using System; -using System.Globalization; -using System.IO; -using System.Text; - -namespace FullSerializer { - public static class fsJsonPrinter { - /// - /// Inserts the given number of indents into the builder. - /// - private static void InsertSpacing(TextWriter stream, int count) { - for (int i = 0; i < count; ++i) { - stream.Write(" "); - } - } - - /// - /// Escapes a string. - /// - private static string EscapeString(string str) { - // Escaping a string is pretty allocation heavy, so we try hard to not do it. - - bool needsEscape = false; - for (int i = 0; i < str.Length; ++i) { - char c = str[i]; - - // unicode code point - int intChar = Convert.ToInt32(c); - if (intChar < 0 || intChar > 127) { - needsEscape = true; - break; - } - - // standard escape character - switch (c) { - case '"': - case '\\': - case '\a': - case '\b': - case '\f': - case '\n': - case '\r': - case '\t': - case '\0': - needsEscape = true; - break; - } - - if (needsEscape) { - break; - } - } - - if (needsEscape == false) { - return str; - } - - - StringBuilder result = new StringBuilder(); - - for (int i = 0; i < str.Length; ++i) { - char c = str[i]; - - // unicode code point - int intChar = Convert.ToInt32(c); - if (intChar < 0 || intChar > 127) { - result.Append(string.Format("\\u{0:x4} ", intChar).Trim()); - continue; - } - - // standard escape character - switch (c) { - case '"': result.Append("\\\""); continue; - case '\\': result.Append(@"\\"); continue; - case '\a': result.Append(@"\a"); continue; - case '\b': result.Append(@"\b"); continue; - case '\f': result.Append(@"\f"); continue; - case '\n': result.Append(@"\n"); continue; - case '\r': result.Append(@"\r"); continue; - case '\t': result.Append(@"\t"); continue; - case '\0': result.Append(@"\0"); continue; - } - - // no escaping needed - result.Append(c); - } - return result.ToString(); - } - - private static void BuildCompressedString(fsData data, TextWriter stream) { - switch (data.Type) { - case fsDataType.Null: - stream.Write("null"); - break; - - case fsDataType.Boolean: - if (data.AsBool) stream.Write("true"); - else stream.Write("false"); - break; - - case fsDataType.Double: - // doubles must *always* include a decimal - stream.Write(ConvertDoubleToString(data.AsDouble)); - break; - - case fsDataType.Int64: - stream.Write(data.AsInt64); - break; - - case fsDataType.String: - stream.Write('"'); - stream.Write(EscapeString(data.AsString)); - stream.Write('"'); - break; - - case fsDataType.Object: { - stream.Write('{'); - bool comma = false; - foreach (var entry in data.AsDictionary) { - if (comma) stream.Write(','); - comma = true; - stream.Write('"'); - stream.Write(entry.Key); - stream.Write('"'); - stream.Write(":"); - BuildCompressedString(entry.Value, stream); - } - stream.Write('}'); - break; - } - - case fsDataType.Array: { - stream.Write('['); - bool comma = false; - foreach (var entry in data.AsList) { - if (comma) stream.Write(','); - comma = true; - BuildCompressedString(entry, stream); - } - stream.Write(']'); - break; - } - } - } - - /// - /// Formats this data into the given builder. - /// - private static void BuildPrettyString(fsData data, TextWriter stream, int depth) { - switch (data.Type) { - case fsDataType.Null: - stream.Write("null"); - break; - - case fsDataType.Boolean: - if (data.AsBool) stream.Write("true"); - else stream.Write("false"); - break; - - case fsDataType.Double: - stream.Write(ConvertDoubleToString(data.AsDouble)); - break; - - case fsDataType.Int64: - stream.Write(data.AsInt64); - break; - - - case fsDataType.String: - stream.Write('"'); - stream.Write(EscapeString(data.AsString)); - stream.Write('"'); - break; - - case fsDataType.Object: { - stream.Write('{'); - stream.WriteLine(); - bool comma = false; - foreach (var entry in data.AsDictionary) { - if (comma) { - stream.Write(','); - stream.WriteLine(); - } - comma = true; - InsertSpacing(stream, depth + 1); - stream.Write('"'); - stream.Write(entry.Key); - stream.Write('"'); - stream.Write(": "); - BuildPrettyString(entry.Value, stream, depth + 1); - } - stream.WriteLine(); - InsertSpacing(stream, depth); - stream.Write('}'); - break; - } - - case fsDataType.Array: - // special case for empty lists; we don't put an empty line between the brackets - if (data.AsList.Count == 0) { - stream.Write("[]"); - } - - else { - bool comma = false; - - stream.Write('['); - stream.WriteLine(); - foreach (var entry in data.AsList) { - if (comma) { - stream.Write(','); - stream.WriteLine(); - } - comma = true; - InsertSpacing(stream, depth + 1); - BuildPrettyString(entry, stream, depth + 1); - } - stream.WriteLine(); - InsertSpacing(stream, depth); - stream.Write(']'); - } - break; - } - } - - /// - /// Writes the pretty JSON output data to the given stream. - /// - /// The data to print. - /// Where to write the printed data. - public static void PrettyJson(fsData data, TextWriter outputStream) { - BuildPrettyString(data, outputStream, 0); - } - - /// - /// Returns the data in a pretty printed JSON format. - /// - public static string PrettyJson(fsData data) { - var sb = new StringBuilder(); - using (var writer = new StringWriter(sb)) { - BuildPrettyString(data, writer, 0); - return sb.ToString(); - } - } - - /// - /// Writes the compressed JSON output data to the given stream. - /// - /// The data to print. - /// Where to write the printed data. - public static void CompressedJson(fsData data, StreamWriter outputStream) { - BuildCompressedString(data, outputStream); - } - - /// - /// Returns the data in a relatively compressed JSON format. - /// - public static string CompressedJson(fsData data) { - var sb = new StringBuilder(); - using (var writer = new StringWriter(sb)) { - BuildCompressedString(data, writer); - return sb.ToString(); - } - } - - /// - /// Utility method that converts a double to a string. - /// - private static string ConvertDoubleToString(double d) { - if (Double.IsInfinity(d) || Double.IsNaN(d)) return d.ToString(CultureInfo.InvariantCulture); - string doubledString = d.ToString(CultureInfo.InvariantCulture); - - // NOTE/HACK: If we don't serialize with a period, then the number will be deserialized as an Int64, not a double. - if (doubledString.Contains(".") == false) doubledString += ".0"; - - return doubledString; - } - - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsJsonPrinter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsJsonPrinter.cs.meta deleted file mode 100644 index e83ffff..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsJsonPrinter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 92877287a3cb40945ba2b66068886873 -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsMemberSerialization.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsMemberSerialization.cs deleted file mode 100644 index de7767b..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsMemberSerialization.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace FullSerializer { - /// - /// Controls how the reflected converter handles member serialization. - /// - public enum fsMemberSerialization { - /// - /// Only members with [SerializeField] or [fsProperty] attributes are serialized. - /// - OptIn, - - /// - /// Only members with [NotSerialized] or [fsIgnore] will not be serialized. - /// - OptOut, - - /// - /// The default member serialization behavior is applied. - /// - Default - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsMemberSerialization.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsMemberSerialization.cs.meta deleted file mode 100644 index 8138f74..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsMemberSerialization.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4cdaa784b61c525488edbf27f309d3b1 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsObjectAttribute.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsObjectAttribute.cs deleted file mode 100644 index bda5579..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsObjectAttribute.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; - -namespace FullSerializer { - /// - /// This attribute controls some serialization behavior for a type. See the comments - /// on each of the fields for more information. - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] - public sealed class fsObjectAttribute : Attribute { - /// - /// The previous model that should be used if an old version of this - /// object is encountered. Using this attribute also requires that the - /// type have a public constructor that takes only one parameter, an object - /// instance of the given type. Use of this parameter *requires* that - /// the VersionString parameter is also set. - /// - public Type[] PreviousModels; - - /// - /// The version string to use for this model. This should be unique among all - /// prior versions of this model that is supported for importation. If PreviousModel - /// is set, then this attribute must also be set. A good valid example for this - /// is "v1", "v2", "v3", ... - /// - public string VersionString; - - /// - /// This controls the behavior for member serialization. - /// The default behavior is fsMemberSerialization.Default. - /// - public fsMemberSerialization MemberSerialization = fsMemberSerialization.Default; - - /// - /// Specify a custom converter to use for serialization. The converter type needs - /// to derive from fsBaseConverter. This defaults to null. - /// - public Type Converter; - - /// - /// Specify a custom processor to use during serialization. The processor type needs - /// to derive from fsObjectProcessor and the call to CanProcess is not invoked. This - /// defaults to null. - /// - public Type Processor; - - public fsObjectAttribute() { } - public fsObjectAttribute(string versionString, params Type[] previousModels) { - VersionString = versionString; - PreviousModels = previousModels; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsObjectAttribute.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsObjectAttribute.cs.meta deleted file mode 100644 index 1eaac3a..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsObjectAttribute.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: fe7006099b5fc7d4b9f3d6248afe1d97 -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsObjectProcessor.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsObjectProcessor.cs deleted file mode 100644 index 1fc7f7a..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsObjectProcessor.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; - -namespace FullSerializer { - /// - /// - /// Enables injecting code before/after an object has been serialized. This is most - /// useful if you want to run the default serialization process but apply a pre/post - /// processing step. - /// - /// - /// Multiple object processors can be active at the same time. When running they are - /// called in a "nested" fashion - if we have processor1 and process2 added to the - /// serializer in that order (p1 then p2), then the execution order will be - /// p1#Before p2#Before /serialization/ p2#After p1#After. - /// - /// - public abstract class fsObjectProcessor { - /// - /// Is the processor interested in objects of the given type? - /// - /// The given type. - /// True if the processor should be applied, false otherwise. - public virtual bool CanProcess(Type type) { throw new NotImplementedException(); } - - /// - /// Called before serialization. - /// - /// The field/property type that is storing the instance. - /// The type of the instance. - public virtual void OnBeforeSerialize(Type storageType, object instance) { } - - /// - /// Called after serialization. - /// - /// The field/property type that is storing the instance. - /// The type of the instance. - /// The data that was serialized. - public virtual void OnAfterSerialize(Type storageType, object instance, ref fsData data) { } - - /// - /// Called before deserialization. - /// - /// The field/property type that is storing the instance. - /// The data that will be used for deserialization. - public virtual void OnBeforeDeserialize(Type storageType, ref fsData data) { } - - /// - /// Called before deserialization has begun but *after* the object instance has been created. This will get - /// invoked even if the user passed in an existing instance. - /// - /// - /// **IMPORTANT**: The actual instance that gets passed here is *not* guaranteed to be an a subtype of storageType, since - /// the value for instance is whatever the active converter returned for CreateInstance() - ie, some converters will return - /// dummy types in CreateInstance() if instance creation cannot be separated from deserialization (ie, KeyValuePair). - /// - /// The field/property type that is storing the instance. - /// The created object instance. No deserialization has been applied to it. - /// The data that will be used for deserialization. - public virtual void OnBeforeDeserializeAfterInstanceCreation(Type storageType, object instance, ref fsData data) { } - - /// - /// Called after deserialization. - /// - /// The field/property type that is storing the instance. - /// The type of the instance. - public virtual void OnAfterDeserialize(Type storageType, object instance) { } - } -} diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsObjectProcessor.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsObjectProcessor.cs.meta deleted file mode 100644 index 189d99e..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsObjectProcessor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 39e889a81d0b255489d855a5ab331b4a -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsPropertyAttribute.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsPropertyAttribute.cs deleted file mode 100644 index 7cf71be..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsPropertyAttribute.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace FullSerializer { - /// - /// Explicitly mark a property to be serialized. This can also be used to give the name that the - /// property should use during serialization. - /// - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public sealed class fsPropertyAttribute : Attribute { - /// - /// The name of that the property will use in JSON serialization. - /// - public string Name; - - public fsPropertyAttribute() - : this(string.Empty) { - } - - public fsPropertyAttribute(string name) { - Name = name; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsPropertyAttribute.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsPropertyAttribute.cs.meta deleted file mode 100644 index 79718ab..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsPropertyAttribute.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 244d4999d2fa93c4397a3d08c057c700 -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsResult.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsResult.cs deleted file mode 100644 index e6a4f5c..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsResult.cs +++ /dev/null @@ -1,177 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace FullSerializer { - /// - /// The result of some sort of operation. A result is either successful or not, but if it - /// is successful then there may be a set of warnings/messages associated with it. These - /// warnings describe the performed error recovery operations. - /// - public struct fsResult { - // We cache the empty string array so we can unify some collections processing code. - private static readonly string[] EmptyStringArray = { }; - - /// - /// Is this result successful? - /// - /// This is intentionally a `success` state so that when the object - /// is default constructed it defaults to a failure state. - private bool _success; - - /// - /// The warning or error messages associated with the result. This may be null if - /// there are no messages. - /// - private List _messages; - - /// - /// Adds a new message to this result. - /// - /// - public void AddMessage(string message) { - if (_messages == null) { - _messages = new List(); - } - - _messages.Add(message); - } - - /// - /// Adds only the messages from the other result into this result, ignoring - /// the success/failure status of the other result. - /// - public void AddMessages(fsResult result) { - if (result._messages == null) { - return; - } - - if (_messages == null) { - _messages = new List(); - } - - _messages.AddRange(result._messages); - } - - /// - /// Merges the other result into this one. If the other result failed, then - /// this one too will have failed. - /// - /// - /// Note that you can use += instead of this method so that you don't bury - /// the actual method call that is generating the other fsResult. - /// - public fsResult Merge(fsResult other) { - // Copy success over - _success = _success && other._success; - - // Copy messages over - if (other._messages != null) { - if (_messages == null) _messages = new List(other._messages); - else _messages.AddRange(other._messages); - } - - return this; - } - - /// - /// A successful result. - /// - public static fsResult Success = new fsResult { - _success = true - }; - - /// - /// Create a result that is successful but contains the given warning message. - /// - public static fsResult Warn(string warning) { - return new fsResult { - _success = true, - _messages = new List { warning } - }; - } - - /// - /// Create a result that failed. - /// - public static fsResult Fail(string warning) { - return new fsResult { - _success = false, - _messages = new List { warning } - }; - } - - // TODO: how to make sure this is only used as +=? - - /// - /// Only use this as +=! - /// - public static fsResult operator +(fsResult a, fsResult b) { - return a.Merge(b); - } - - /// - /// Did this result fail? If so, you can see the reasons why in `RawMessages`. - /// - public bool Failed { - get { - return _success == false; - } - } - - /// - /// Was the result a success? Note that even successful operations may have - /// warning messages (`RawMessages`) associated with them. - /// - public bool Succeeded { - get { - return _success; - } - } - - /// - /// A simply utility method that will assert that this result is successful. If it - /// is not, then an exception is thrown. - /// - public fsResult AssertSuccess() { - if (Failed) throw AsException; - return this; - } - - /// - /// A simple utility method that will assert that this result is successful and that - /// there are no warning messages. This throws an exception if either of those - /// asserts are false. - /// - public fsResult AssertSuccessWithoutWarnings() { - if (Failed || RawMessages.Any()) throw AsException; - return this; - } - - /// - /// Utility method to convert the result to an exception. This method is only defined - /// is `Failed` returns true. - /// - public Exception AsException { - get { - if (!Failed && !RawMessages.Any()) throw new Exception("Only a failed result can be converted to an exception"); - return new Exception(FormattedMessages); - } - } - - public IEnumerable RawMessages { - get { - if (_messages != null) { - return _messages; - } - return EmptyStringArray; - } - } - - public string FormattedMessages { - get { - return string.Join(",\n", RawMessages.ToArray()); - } - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsResult.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsResult.cs.meta deleted file mode 100644 index d850810..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsResult.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4a770c2ece5f952429de59384e45340a -timeCreated: 1428466634 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsSerializer.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsSerializer.cs deleted file mode 100644 index 989803e..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsSerializer.cs +++ /dev/null @@ -1,728 +0,0 @@ -using System; -using System.Collections.Generic; -using FullSerializer.Internal; - -namespace FullSerializer { - public class fsSerializer { - #region Keys - private static HashSet _reservedKeywords; - static fsSerializer() { - _reservedKeywords = new HashSet { - Key_ObjectReference, - Key_ObjectDefinition, - Key_InstanceType, - Key_Version, - Key_Content - }; - } - /// - /// Returns true if the given key is a special keyword that full serializer uses to - /// add additional metadata on top of the emitted JSON. - /// - public static bool IsReservedKeyword(string key) { - return _reservedKeywords.Contains(key); - } - - /// - /// This is an object reference in part of a cyclic graph. - /// - private const string Key_ObjectReference = "$ref"; - - /// - /// This is an object definition, as part of a cyclic graph. - /// - private const string Key_ObjectDefinition = "$id"; - - /// - /// This specifies the actual type of an object (the instance type was different from - /// the field type). - /// - private const string Key_InstanceType = "$type"; - - /// - /// The version string for the serialized data. - /// - private const string Key_Version = "$version"; - - /// - /// If we have to add metadata but the original serialized state was not a dictionary, - /// then this will contain the original data. - /// - private const string Key_Content = "$content"; - - private static bool IsObjectReference(fsData data) { - if (data.IsDictionary == false) return false; - return data.AsDictionary.ContainsKey(Key_ObjectReference); - } - private static bool IsObjectDefinition(fsData data) { - if (data.IsDictionary == false) return false; - return data.AsDictionary.ContainsKey(Key_ObjectDefinition); - } - private static bool IsVersioned(fsData data) { - if (data.IsDictionary == false) return false; - return data.AsDictionary.ContainsKey(Key_Version); - } - private static bool IsTypeSpecified(fsData data) { - if (data.IsDictionary == false) return false; - return data.AsDictionary.ContainsKey(Key_InstanceType); - } - private static bool IsWrappedData(fsData data) { - if (data.IsDictionary == false) return false; - return data.AsDictionary.ContainsKey(Key_Content); - } - - /// - /// Strips all deserialization metadata from the object, like $type and $content fields. - /// - /// After making this call, you will *not* be able to deserialize the same object instance. The metadata is - /// strictly necessary for deserialization! - public static void StripDeserializationMetadata(ref fsData data) { - if (data.IsDictionary && data.AsDictionary.ContainsKey(Key_Content)) { - data = data.AsDictionary[Key_Content]; - } - - if (data.IsDictionary) { - var dict = data.AsDictionary; - dict.Remove(Key_ObjectReference); - dict.Remove(Key_ObjectDefinition); - dict.Remove(Key_InstanceType); - dict.Remove(Key_Version); - } - } - - /// - /// This function converts legacy serialization data into the new format, so that - /// the import process can be unified and ignore the old format. - /// - private static void ConvertLegacyData(ref fsData data) { - if (data.IsDictionary == false) return; - - var dict = data.AsDictionary; - - // fast-exit: metadata never had more than two items - if (dict.Count > 2) return; - - // Key strings used in the legacy system - string referenceIdString = "ReferenceId"; - string sourceIdString = "SourceId"; - string sourceDataString = "Data"; - string typeString = "Type"; - string typeDataString = "Data"; - - // type specifier - if (dict.Count == 2 && dict.ContainsKey(typeString) && dict.ContainsKey(typeDataString)) { - data = dict[typeDataString]; - EnsureDictionary(ref data); - ConvertLegacyData(ref data); - - data.AsDictionary[Key_InstanceType] = dict[typeString]; - } - - // object definition - else if (dict.Count == 2 && dict.ContainsKey(sourceIdString) && dict.ContainsKey(sourceDataString)) { - data = dict[sourceDataString]; - EnsureDictionary(ref data); - ConvertLegacyData(ref data); - - data.AsDictionary[Key_ObjectDefinition] = dict[sourceIdString]; - } - - // object reference - else if (dict.Count == 1 && dict.ContainsKey(referenceIdString)) { - data = fsData.CreateDictionary(); - data.AsDictionary[Key_ObjectReference] = dict[referenceIdString]; - } - } - #endregion - - #region Utility Methods - private static void Invoke_OnBeforeSerialize(List processors, Type storageType, object instance) { - for (int i = 0; i < processors.Count; ++i) { - processors[i].OnBeforeSerialize(storageType, instance); - } - } - private static void Invoke_OnAfterSerialize(List processors, Type storageType, object instance, ref fsData data) { - // We run the after calls in reverse order; this significantly reduces the interaction burden between - // multiple processors - it makes each one much more independent and ignorant of the other ones. - - for (int i = processors.Count - 1; i >= 0; --i) { - processors[i].OnAfterSerialize(storageType, instance, ref data); - } - } - private static void Invoke_OnBeforeDeserialize(List processors, Type storageType, ref fsData data) { - for (int i = 0; i < processors.Count; ++i) { - processors[i].OnBeforeDeserialize(storageType, ref data); - } - } - private static void Invoke_OnBeforeDeserializeAfterInstanceCreation(List processors, Type storageType, object instance, ref fsData data) { - for (int i = 0; i < processors.Count; ++i) { - processors[i].OnBeforeDeserializeAfterInstanceCreation(storageType, instance, ref data); - } - } - private static void Invoke_OnAfterDeserialize(List processors, Type storageType, object instance) { - for (int i = processors.Count - 1; i >= 0; --i) { - processors[i].OnAfterDeserialize(storageType, instance); - } - } - #endregion - - /// - /// Ensures that the data is a dictionary. If it is not, then it is wrapped inside of one. - /// - private static void EnsureDictionary(ref fsData data) { - if (data.IsDictionary == false) { - var dict = fsData.CreateDictionary(); - dict.AsDictionary[Key_Content] = data; - data = dict; - } - } - - /// - /// This manages instance writing so that we do not write unnecessary $id fields. We - /// only need to write out an $id field when there is a corresponding $ref field. This is able - /// to write $id references lazily because the fsData instance is not actually written out to text - /// until we have entirely finished serializing it. - /// - internal class fsLazyCycleDefinitionWriter { - private Dictionary> _definitions = new Dictionary>(); - private HashSet _references = new HashSet(); - - public void WriteDefinition(int id, Dictionary dict) { - if (_references.Contains(id)) { - dict[Key_ObjectDefinition] = new fsData(id.ToString()); - } - - else { - _definitions[id] = dict; - } - } - - public void WriteReference(int id, Dictionary dict) { - // Write the actual definition if necessary - if (_definitions.ContainsKey(id)) { - _definitions[id][Key_ObjectDefinition] = new fsData(id.ToString()); - _definitions.Remove(id); - } - else { - _references.Add(id); - } - - // Write the reference - dict[Key_ObjectReference] = new fsData(id.ToString()); - } - - public void Clear() { - _definitions.Clear(); - } - } - - /// - /// A cache from type to it's converter. - /// - private Dictionary _cachedConverters; - - /// - /// A cache from type to the set of processors that are interested in it. - /// - private Dictionary> _cachedProcessors; - - /// - /// Converters that can be used for type registration. - /// - private readonly List _availableConverters; - - /// - /// Direct converters (optimized _converters). We use these so we don't have to - /// perform a scan through every item in _converters and can instead just do an O(1) - /// lookup. This is potentially important to perf when there are a ton of direct - /// converters. - /// - private readonly Dictionary _availableDirectConverters; - - /// - /// Processors that are available. - /// - private readonly List _processors; - - /// - /// Reference manager for cycle detection. - /// - private readonly fsCyclicReferenceManager _references; - private readonly fsLazyCycleDefinitionWriter _lazyReferenceWriter; - - public fsSerializer() { - _cachedConverters = new Dictionary(); - _cachedProcessors = new Dictionary>(); - - _references = new fsCyclicReferenceManager(); - _lazyReferenceWriter = new fsLazyCycleDefinitionWriter(); - - // note: The order here is important. Items at the beginning of this - // list will be used before converters at the end. Converters - // added via AddConverter() are added to the front of the list. - _availableConverters = new List { - new fsNullableConverter { Serializer = this }, - new fsGuidConverter { Serializer = this }, - new fsTypeConverter { Serializer = this }, - new fsDateConverter { Serializer = this }, - new fsEnumConverter { Serializer = this }, - new fsPrimitiveConverter { Serializer = this }, - new fsArrayConverter { Serializer = this }, - new fsDictionaryConverter { Serializer = this }, - new fsIEnumerableConverter { Serializer = this }, - new fsKeyValuePairConverter { Serializer = this }, - new fsWeakReferenceConverter { Serializer = this }, - new fsReflectedConverter { Serializer = this } - }; - _availableDirectConverters = new Dictionary(); - - _processors = new List() { - new fsSerializationCallbackProcessor() - }; - - Context = new fsContext(); - - // Register the converters from the registrar - foreach (var converterType in fsConverterRegistrar.Converters) { - AddConverter((fsBaseConverter)Activator.CreateInstance(converterType)); - } - } - - /// - /// A context object that fsConverters can use to customize how they operate. - /// - public fsContext Context; - - /// - /// Add a new processor to the serializer. Multiple processors can run at the same time in the - /// same order they were added in. - /// - /// The processor to add. - public void AddProcessor(fsObjectProcessor processor) { - _processors.Add(processor); - - // We need to reset our cached processor set, as it could be invalid with the new - // processor. Ideally, _cachedProcessors should be empty (as the user should fully setup - // the serializer before actually using it), but there is no guarantee. - _cachedProcessors = new Dictionary>(); - } - - /// - /// Fetches all of the processors for the given type. - /// - private List GetProcessors(Type type) { - List processors; - - // Check to see if the user has defined a custom processor for the type. If they - // have, then we don't need to scan through all of the processor to check which - // one can process the type; instead, we directly use the specified processor. - var attr = fsPortableReflection.GetAttribute(type); - if (attr != null && attr.Processor != null) { - var processor = (fsObjectProcessor)Activator.CreateInstance(attr.Processor); - processors = new List(); - processors.Add(processor); - _cachedProcessors[type] = processors; - } - - else if (_cachedProcessors.TryGetValue(type, out processors) == false) { - processors = new List(); - - for (int i = 0; i < _processors.Count; ++i) { - var processor = _processors[i]; - if (processor.CanProcess(type)) { - processors.Add(processor); - } - } - - _cachedProcessors[type] = processors; - } - - return processors; - } - - - /// - /// Adds a new converter that can be used to customize how an object is serialized and - /// deserialized. - /// - public void AddConverter(fsBaseConverter converter) { - if (converter.Serializer != null) { - throw new InvalidOperationException("Cannot add a single converter instance to " + - "multiple fsConverters -- please construct a new instance for " + converter); - } - - // TODO: wrap inside of a ConverterManager so we can control _converters and _cachedConverters lifetime - if (converter is fsDirectConverter) { - var directConverter = (fsDirectConverter)converter; - _availableDirectConverters[directConverter.ModelType] = directConverter; - } - else if (converter is fsConverter) { - _availableConverters.Insert(0, (fsConverter)converter); - } - else { - throw new InvalidOperationException("Unable to add converter " + converter + - "; the type association strategy is unknown. Please use either " + - "fsDirectConverter or fsConverter as your base type."); - } - - converter.Serializer = this; - - // We need to reset our cached converter set, as it could be invalid with the new - // converter. Ideally, _cachedConverters should be empty (as the user should fully setup - // the serializer before actually using it), but there is no guarantee. - _cachedConverters = new Dictionary(); - } - - /// - /// Fetches a converter that can serialize/deserialize the given type. - /// - private fsBaseConverter GetConverter(Type type) { - fsBaseConverter converter; - - // Check to see if the user has defined a custom converter for the type. If they - // have, then we don't need to scan through all of the converters to check which - // one can process the type; instead, we directly use the specified converter. - var attr = fsPortableReflection.GetAttribute(type); - if (attr != null && attr.Converter != null) { - converter = (fsBaseConverter)Activator.CreateInstance(attr.Converter); - converter.Serializer = this; - _cachedConverters[type] = converter; - } - - // There is no specific converter specified; try all of the general ones to see - // which ones matches. - else { - if (_cachedConverters.TryGetValue(type, out converter) == false) { - if (_availableDirectConverters.ContainsKey(type)) { - converter = _availableDirectConverters[type]; - _cachedConverters[type] = converter; - } - else { - for (int i = 0; i < _availableConverters.Count; ++i) { - if (_availableConverters[i].CanProcess(type)) { - converter = _availableConverters[i]; - _cachedConverters[type] = converter; - break; - } - } - } - } - } - - if (converter == null) { - throw new InvalidOperationException("Internal error -- could not find a converter for " + type); - } - return converter; - } - - /// - /// Helper method that simply forwards the call to TrySerialize(typeof(T), instance, out data); - /// - public fsResult TrySerialize(T instance, out fsData data) { - return TrySerialize(typeof(T), instance, out data); - } - - /// - /// Generic wrapper around TryDeserialize that simply forwards the call. - /// - public fsResult TryDeserialize(fsData data, ref T instance) { - object boxed = instance; - var fail = TryDeserialize(data, typeof(T), ref boxed); - if (fail.Succeeded) { - instance = (T)boxed; - } - return fail; - } - - /// - /// Serialize the given value. - /// - /// The type of field/property that stores the object instance. This is - /// important particularly for inheritance, as a field storing an IInterface instance - /// should have type information included. - /// The actual object instance to serialize. - /// The serialized state of the object. - /// If serialization was successful. - public fsResult TrySerialize(Type storageType, object instance, out fsData data) { - var processors = GetProcessors(storageType); - - Invoke_OnBeforeSerialize(processors, storageType, instance); - - // We always serialize null directly as null - if (ReferenceEquals(instance, null)) { - data = new fsData(); - Invoke_OnAfterSerialize(processors, storageType, instance, ref data); - return fsResult.Success; - } - - var result = InternalSerialize_1_ProcessCycles(storageType, instance, out data); - Invoke_OnAfterSerialize(processors, storageType, instance, ref data); - return result; - } - - private fsResult InternalSerialize_1_ProcessCycles(Type storageType, object instance, out fsData data) { - // We have an object definition to serialize. - try { - // Note that we enter the reference group at the beginning of serialization so that we support - // references that are at equal serialization levels, not just nested serialization levels, within - // the given subobject. A prime example is serialization a list of references. - _references.Enter(); - - // This type does not need cycle support. - if (GetConverter(instance.GetType()).RequestCycleSupport(instance.GetType()) == false) { - return InternalSerialize_2_Inheritance(storageType, instance, out data); - } - - // We've already serialized this object instance (or it is pending higher up on the call stack). - // Just serialize a reference to it to escape the cycle. - // - // note: We serialize the int as a string to so that we don't lose any information - // in a conversion to/from double. - if (_references.IsReference(instance)) { - data = fsData.CreateDictionary(); - _lazyReferenceWriter.WriteReference(_references.GetReferenceId(instance), data.AsDictionary); - return fsResult.Success; - } - - // Mark inside the object graph that we've serialized the instance. We do this *before* - // serialization so that if we get back into this function recursively, it'll already - // be marked and we can handle the cycle properly without going into an infinite loop. - _references.MarkSerialized(instance); - - // We've created the cycle metadata, so we can now serialize the actual object. - // InternalSerialize will handle inheritance correctly for us. - var result = InternalSerialize_2_Inheritance(storageType, instance, out data); - if (result.Failed) return result; - - EnsureDictionary(ref data); - _lazyReferenceWriter.WriteDefinition(_references.GetReferenceId(instance), data.AsDictionary); - - return result; - } - finally { - if (_references.Exit()) { - _lazyReferenceWriter.Clear(); - } - } - } - private fsResult InternalSerialize_2_Inheritance(Type storageType, object instance, out fsData data) { - // Serialize the actual object with the field type being the same as the object - // type so that we won't go into an infinite loop. - var serializeResult = InternalSerialize_3_ProcessVersioning(instance, out data); - if (serializeResult.Failed) return serializeResult; - - // Do we need to add type information? If the field type and the instance type are different - // then we will not be able to recover the correct instance type from the field type when - // we deserialize the object. - // - // Note: We allow converters to request that we do *not* add type information. - if (storageType != instance.GetType() && - GetConverter(storageType).RequestInheritanceSupport(storageType)) { - - EnsureDictionary(ref data); - - // Add the inheritance metadata - data.AsDictionary[Key_InstanceType] = new fsData(instance.GetType().FullName); - } - - return serializeResult; - } - - private fsResult InternalSerialize_3_ProcessVersioning(object instance, out fsData data) { - // note: We do not have to take a Type parameter here, since at this point in the serialization - // algorithm inheritance has *always* been handled. If we took a type parameter, it will - // *always* be equal to instance.GetType(), so why bother taking the parameter? - - // Check to see if there is versioning information for this type. If so, then we need to serialize it. - fsOption optionalVersionedType = fsVersionManager.GetVersionedType(instance.GetType()); - if (optionalVersionedType.HasValue) { - fsVersionedType versionedType = optionalVersionedType.Value; - - // Serialize the actual object content; we'll just wrap it with versioning metadata here. - var result = InternalSerialize_4_Converter(instance, out data); - if (result.Failed) return result; - - // Add the versioning information - EnsureDictionary(ref data); - data.AsDictionary[Key_Version] = new fsData(versionedType.VersionString); - - return result; - } - - // This type has no versioning information -- directly serialize it using the selected converter. - return InternalSerialize_4_Converter(instance, out data); - } - private fsResult InternalSerialize_4_Converter(object instance, out fsData data) { - var instanceType = instance.GetType(); - return GetConverter(instanceType).TrySerialize(instance, out data, instanceType); - } - - /// - /// Attempts to deserialize a value from a serialized state. - /// - /// - /// - /// - /// - public fsResult TryDeserialize(fsData data, Type storageType, ref object result) { - var processors = GetProcessors(storageType); - Invoke_OnBeforeDeserialize(processors, storageType, ref data); - - if (data.IsNull) { - result = null; - Invoke_OnAfterDeserialize(processors, storageType, null); - return fsResult.Success; - } - - // Convert legacy data into modern style data - ConvertLegacyData(ref data); - - try { - // We wrap the entire deserialize call in a reference group so that we can properly - // deserialize a "parallel" set of references, ie, a list of objects that are cyclic - // with regards to the list - _references.Enter(); - - return InternalDeserialize_1_CycleReference(data, storageType, ref result, processors); - } - finally { - _references.Exit(); - Invoke_OnAfterDeserialize(processors, storageType, result); - } - } - - private fsResult InternalDeserialize_1_CycleReference(fsData data, Type storageType, ref object result, List processors) { - // We handle object references first because we could be deserializing a cyclic type that is - // inherited. If that is the case, then if we handle references after inheritances we will try - // to create an object instance for an abstract/interface type. - - // While object construction should technically be two-pass, we can do it in - // one pass because of how serialization happens. We traverse the serialization - // graph in the same order during serialization and deserialization, so the first - // time we encounter an object it'll always be the definition. Any times after that - // it will be a reference. Because of this, if we encounter a reference then we - // will have *always* already encountered the definition for it. - if (IsObjectReference(data)) { - int refId = int.Parse(data.AsDictionary[Key_ObjectReference].AsString); - result = _references.GetReferenceObject(refId); - return fsResult.Success; - } - - return InternalDeserialize_2_Version(data, storageType, ref result, processors); - } - - private fsResult InternalDeserialize_2_Version(fsData data, Type storageType, ref object result, List processors) { - if (IsVersioned(data)) { - // data is versioned, but we might not need to do a migration - string version = data.AsDictionary[Key_Version].AsString; - - fsOption versionedType = fsVersionManager.GetVersionedType(storageType); - if (versionedType.HasValue && - versionedType.Value.VersionString != version) { - - // we have to do a migration - var deserializeResult = fsResult.Success; - - List path; - deserializeResult += fsVersionManager.GetVersionImportPath(version, versionedType.Value, out path); - if (deserializeResult.Failed) return deserializeResult; - - // deserialize as the original type - deserializeResult += InternalDeserialize_3_Inheritance(data, path[0].ModelType, ref result, processors); - if (deserializeResult.Failed) return deserializeResult; - - for (int i = 1; i < path.Count; ++i) { - result = path[i].Migrate(result); - } - - return deserializeResult; - } - } - - return InternalDeserialize_3_Inheritance(data, storageType, ref result, processors); - } - - private fsResult InternalDeserialize_3_Inheritance(fsData data, Type storageType, ref object result, List processors) { - var deserializeResult = fsResult.Success; - - Type objectType = storageType; - - // If the serialized state contains type information, then we need to make sure to update our - // objectType and data to the proper values so that when we construct an object instance later - // and run deserialization we run it on the proper type. - if (IsTypeSpecified(data)) { - fsData typeNameData = data.AsDictionary[Key_InstanceType]; - - // we wrap everything in a do while false loop so we can break out it - do { - if (typeNameData.IsString == false) { - deserializeResult.AddMessage(Key_InstanceType + " value must be a string (in " + data + ")"); - break; - } - - string typeName = typeNameData.AsString; - Type type = fsTypeLookup.GetType(typeName); - if (type == null) { - deserializeResult.AddMessage("Unable to locate specified type \"" + typeName + "\""); - break; - } - - if (storageType.IsAssignableFrom(type) == false) { - deserializeResult.AddMessage("Ignoring type specifier; a field/property of type " + storageType + " cannot hold an instance of " + type); - break; - } - - objectType = type; - } while (false); - } - - // Construct an object instance if we don't have one already. We also need to construct - // an instance if the result type is of the wrong type, which may be the case when we - // have a versioned import graph. - if (ReferenceEquals(result, null) || result.GetType() != objectType) { - result = GetConverter(objectType).CreateInstance(data, objectType); - } - - // We call OnBeforeDeserializeAfterInstanceCreation here because we still want to invoke the - // method even if the user passed in an existing instance. - Invoke_OnBeforeDeserializeAfterInstanceCreation(processors, storageType, result, ref data); - - // NOTE: It is critically important that we pass the actual objectType down instead of - // using result.GetType() because it is not guaranteed that result.GetType() - // will equal objectType, especially because some converters are known to - // return dummy values for CreateInstance() (for example, the default behavior - // for structs is to just return the type of the struct). - - return deserializeResult += InternalDeserialize_4_Cycles(data, objectType, ref result); - } - - private fsResult InternalDeserialize_4_Cycles(fsData data, Type resultType, ref object result) { - if (IsObjectDefinition(data)) { - // NOTE: object references are handled at stage 1 - - // If this is a definition, then we have a serialization invariant that this is the - // first time we have encountered the object (TODO: verify in the deserialization logic) - - // Since at this stage in the deserialization process we already have access to the - // object instance, so we just need to sync the object id to the references database - // so that when we encounter the instance we lookup this same object. We want to do - // this before actually deserializing the object because when deserializing the object - // there may be references to itself. - - int sourceId = int.Parse(data.AsDictionary[Key_ObjectDefinition].AsString); - _references.AddReferenceWithId(sourceId, result); - } - - // Nothing special, go through the standard deserialization logic. - return InternalDeserialize_5_Converter(data, resultType, ref result); - } - - private fsResult InternalDeserialize_5_Converter(fsData data, Type resultType, ref object result) { - if (IsWrappedData(data)) { - data = data.AsDictionary[Key_Content]; - } - - return GetConverter(resultType).TryDeserialize(data, ref result, resultType); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsSerializer.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsSerializer.cs.meta deleted file mode 100644 index 206a78c..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/Source/fsSerializer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8fd5fe1599219ec4ea28f14dd1016d4f -timeCreated: 1428466635 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/UnityObjectConverter.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/UnityObjectConverter.cs deleted file mode 100644 index 18019aa..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/UnityObjectConverter.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using FullSerializer; -using UnityObject = UnityEngine.Object; - -namespace Vexe.Runtime.Serialization -{ - /// - /// The hack that's used to persist UnityEngine.Object references - /// Whenever the serializer comes across a Unity object it stores it to a list - /// of Unity objects (which Unity serializes) and serializes the index of where - /// that storage took place. - /// - public class UnityObjectConverter : fsConverter - { - private List serializedObjects - { - get { return Serializer.Context.Get>(); } - } - - public override bool CanProcess(Type type) - { - return typeof(UnityObject).IsAssignableFrom(type); - } - - public override bool RequestCycleSupport(Type storageType) - { - return false; - } - - public override bool RequestInheritanceSupport(Type storageType) - { - return false; - } - - public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType) - { - var obj = instance as UnityObject; - int idx = serializedObjects.IndexOf(obj); - if (idx == -1) - { - Serializer.TrySerialize(serializedObjects.Count, out serialized); - serializedObjects.Add(obj); - } - else - Serializer.TrySerialize(idx, out serialized); - - return fsResult.Success; - } - - public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) - { - int index = -1; - var result = Serializer.TryDeserialize(data, ref index); - if (index == -1) - throw new InvalidOperationException("Error deserializing Unity object of type " + storageType + ". Index shouldn't be -1. Message: " + result.FormattedMessages); - instance = serializedObjects[index]; - return fsResult.Success; - } - - public override object CreateInstance(fsData data, Type storageType) - { - return storageType; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/UnityObjectConverter.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/UnityObjectConverter.cs.meta deleted file mode 100644 index 5851011..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/FullSerializer/UnityObjectConverter.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: df788c07b2e0fb641bb5757d6c08d1e8 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/SerializerBackend.cs b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/SerializerBackend.cs deleted file mode 100644 index 0750d59..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/SerializerBackend.cs +++ /dev/null @@ -1,142 +0,0 @@ -using System; -using UnityEngine; -using Vexe.Runtime.Extensions; -using Vexe.Runtime.Types; -using UnityObject = UnityEngine.Object; - -namespace Vexe.Runtime.Serialization -{ - public abstract class SerializerBackend - { - /// - /// The default serializer backend type to use - /// - public static readonly Type DefaultType = typeof(FullSerializerBackend); - - /// - /// The serialization logic that this serializer use to fetch the serializable members of a given target - /// - public ISerializationLogic Logic; - - /// - /// Serializes the specified target and stores the result in the specified serialization data - /// such that all Unity object references are stored in the data's serializedObjects list, - /// and the serializable members' values in the data's serializedStrings - /// - public void SerializeTargetIntoData(UnityObject target, SerializationData data) - { - data.Clear(); - - var members = VFWSerializationLogic.Instance.CachedGetSerializableMembers(target.GetType()); - for (int i = 0; i < members.Length; i++) - { - var member = members[i]; - member.Target = target; - var value = member.Value; - - try - { - string memberKey = GetMemberKey(member); - string serializedState = Serialize(member.Type, value, data.serializedObjects); - data.serializedStrings[memberKey] = serializedState; - } - catch (Exception e) - { - Debug.LogError( - "Error serializing member `" + member.Name + "` (" + member.Type.Name + ")" + - " in `" + target.GetType().Name + - "` Error message: \"" + e.Message + - "\" Stacktrace: " + e.StackTrace); - } - } - } - - /// - /// Fetches the serialized state of the specified target from the specified serialization data - /// to use it to deserialize/reload the target reassigning all the target's member values - /// - public void DeserializeTargetFromData(UnityObject target, SerializationData data) - { - var members = VFWSerializationLogic.Instance.CachedGetSerializableMembers(target.GetType()); - for(int i = 0; i < members.Length; i++) - { - var member = members[i]; - var memberKey = GetMemberKey(member); - member.Target = target; - - ConvertLegacyKeys(data); - - try - { - string result; - if (data.serializedStrings.TryGetValue(memberKey, out result)) - { - var value = Deserialize(member.Type, result, data.serializedObjects); - member.Value = value; - } - } - catch (Exception e) - { - Debug.LogError( - "Error deserializing member `" + member.Name + "` (" + member.Type.Name + ")" + - " in `" + target.GetType().Name + - "` Error message: \"" + e.Message + - "\" Stacktrace: " + e.StackTrace); - } - } - } - - private static void ConvertLegacyKeys(SerializationData data) - { - var keys = data.serializedStrings.Keys; - for (int i = 0; i < keys.Count; i++) - { - var key = keys[i]; - key = key.Replace("Field: ", string.Empty); - key = key.Replace("Property: ", string.Empty); - keys[i] = key; - } - } - - private static Func cachedGetMemberKey; - - /// - /// Gets the serialization key used to serialize the specified member - /// The key in general is: "TypeNiceName MemberName" - /// Ex: "int someValue", "GameObject go" - /// - public static string GetMemberKey(RuntimeMember member) - { - if (cachedGetMemberKey == null) - cachedGetMemberKey = new Func(x => x.TypeNiceName + " " + x.Name).Memoize(); - return cachedGetMemberKey(member); - } - - public abstract string Serialize(Type type, object value, object context); - - public string Serialize(object value, object context) - { - if (value == null) - return null; - - return Serialize(value.GetType(), value, context); - } - - public string Serialize(object value) - { - return Serialize(value, null); - } - - public abstract object Deserialize(Type type, string serializedState, object context); - - public T Deserialize(string serializedState, object context) - { - return (T)Deserialize(typeof(T), serializedState, context); - } - - public T Deserialize(string serializedState) - { - return Deserialize(serializedState, null); - } - } -} diff --git a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/SerializerBackend.cs.meta b/Assets/VFW Deprecated/Runtime/Serialization/Serializers/SerializerBackend.cs.meta deleted file mode 100644 index 1c2aae3..0000000 --- a/Assets/VFW Deprecated/Runtime/Serialization/Serializers/SerializerBackend.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 5f9e2f7a46da2494b98fe8c772a9acb4 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types.meta b/Assets/VFW Deprecated/Runtime/Types.meta deleted file mode 100644 index 6f77e6c..0000000 --- a/Assets/VFW Deprecated/Runtime/Types.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: f4c3c50cfba52dd49b218c4c9e68e65c -folderAsset: yes -timeCreated: 1457152368 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Attributes.meta b/Assets/VFW Deprecated/Runtime/Types/Attributes.meta deleted file mode 100644 index c4b2271..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Attributes.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: a8eb7de88e99d1b4d8a5f6d68b18a48b -folderAsset: yes -timeCreated: 1457199962 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Attributes/DefaultAttribute.cs b/Assets/VFW Deprecated/Runtime/Types/Attributes/DefaultAttribute.cs deleted file mode 100644 index 4084ff2..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Attributes/DefaultAttribute.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using UnityEngine; -using Vexe.Runtime.Helpers; - -namespace Vexe.Runtime.Types -{ - [Obsolete("Was used previously by BetterBehaviour which is now deprecated. " + - "Attribute is not reliable because there's no reliable place to " + - "initialize the field/property to the default value specified in the attribute")] - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter)] - public class DefaultAttribute : Attribute - { - public readonly int? intValue; - public readonly float? floatValue; - public readonly bool? boolValue; - public readonly Vector3? vector3Value; - public readonly Vector2? vector2Value; - public readonly string stringValue; - public int[] intArray; - public float[] floatArray; - public bool[] boolArray; - public string[] stringArray; - public int Enum { get; set; } - public bool Instantiate { get; set; } - - public DefaultAttribute(bool[] boolArray) - { - this.boolArray = boolArray; - } - - public DefaultAttribute(string[] stringArray) - { - this.stringArray = stringArray; - } - - public DefaultAttribute(float[] floatArray) - { - this.floatArray = floatArray; - } - - public DefaultAttribute(int[] intArray) - { - this.intArray = intArray; - } - - public DefaultAttribute(int intValue) - { - this.intValue = intValue; - } - - public DefaultAttribute(float floatValue) - { - this.floatValue = floatValue; - } - - public DefaultAttribute(string stringValue) - { - this.stringValue = stringValue; - } - - public DefaultAttribute(bool boolValue) - { - this.boolValue = boolValue; - } - - public DefaultAttribute(float x, float y, float z) - { - vector3Value = new Vector3(x, y, z); - } - - public DefaultAttribute(float x, float y) - { - vector2Value = new Vector2(x, y); - } - - public DefaultAttribute() - { - Enum = -1; - } - - public object Value - { - get - { - if (intValue.HasValue) return intValue.Value; - if (floatValue.HasValue) return floatValue.Value; - if (boolValue.HasValue) return boolValue.Value; - if (vector2Value.HasValue) return vector2Value.Value; - if (vector3Value.HasValue) return vector3Value.Value; - if (stringValue != null) return stringValue; - if (intArray != null) return intArray; - if (floatArray != null) return floatArray; - if (boolArray != null) return boolArray; - if (stringArray != null) return stringArray; - if (Enum != -1) return Enum; - if (Instantiate) return null; - throw new NotSupportedException("Value type not supported"); - } - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Types/Attributes/DefaultAttribute.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Attributes/DefaultAttribute.cs.meta deleted file mode 100644 index ee1a2f6..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Attributes/DefaultAttribute.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: a064f839b276947469a1703ed1598237 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Attributes/RequirementAttributes.cs b/Assets/VFW Deprecated/Runtime/Types/Attributes/RequirementAttributes.cs deleted file mode 100644 index cb9cb80..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Attributes/RequirementAttributes.cs +++ /dev/null @@ -1,112 +0,0 @@ -using UnityEngine; -using System; - -namespace Vexe.Runtime.Types -{ - /// - /// Tag a field this attribute to denote that it's required (should be assigned) - /// If the component is not assigned, It will search the scene and try to find a matching component - /// it will assign the first result it finds - /// If it couldn't assign it you'll get a warning message saying that you should assign - /// - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public class RequiredAttribute : CompositeAttribute - { - public RequiredAttribute(int id) : base(id) - { - } - - public RequiredAttribute() : this(-1) - { - } - } - - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public class RequiredSingleAttribute : RequiredAttribute - { - public bool FromResources { get; set; } - - public RequiredSingleAttribute(int id) : base(id) - { - } - - public RequiredSingleAttribute() - { - } - } - - /// - /// Tag a field/property with this attribute to denote that it's required (should be assigned) from this gameObject - /// If it's not assigned you'll get a warning message - /// - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter)] - public class RequiredFromThisAttribute : RequiredAttribute - { - /// - /// Adds the component if it didn't exist - /// - public bool Add { get; set; } - - public RequiredFromThisAttribute(int id, bool add) : base(id) - { - Add = add; - } - - public RequiredFromThisAttribute(bool add) : this(-1, add) - { - } - - public RequiredFromThisAttribute() - { - } - } - - public abstract class RequiredFromRelativeAttribute : RequiredFromThisAttribute - { - /// - /// The relative (child or parent) path to add to (or create and add) if the requirement was not found - /// If you want to specify a nested relative, you could write its full path, ex: - /// "Senses/Hearing" - in general "relative/Grandrelative/GGrelative, etc" - /// - public string Path { get; set; } - - /// - /// True to create any missing relative within the specified relativePath - /// - public bool Create { get; set; } - } - - /// - /// Tag a field/property with this attribute to denote that it's required (should be assigned) from parent gameObjects - /// If it's not assigned you'll get a warning message - /// - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public class RequiredFromParentsAttribute : RequiredFromRelativeAttribute - { - public RequiredFromParentsAttribute() : this(-1) - { - } - - public RequiredFromParentsAttribute(int id) - { - this.id = id; - } - } - - /// - /// Tag a field/property with this attribute to denote that it's required (should be assigned) from children gameObjects - /// If it's not assigned you'll get a warning message - /// - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public class RequiredFromChildrenAttribute : RequiredFromRelativeAttribute - { - public RequiredFromChildrenAttribute() : this(-1) - { - } - - public RequiredFromChildrenAttribute(int id) - { - this.id = id; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Types/Attributes/RequirementAttributes.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Attributes/RequirementAttributes.cs.meta deleted file mode 100644 index e9cecfa..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Attributes/RequirementAttributes.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 63d2cacb00694d14e9d4ce3b9505346b -timeCreated: 1457156575 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Attributes/SelectObjAttribute.cs b/Assets/VFW Deprecated/Runtime/Types/Attributes/SelectObjAttribute.cs deleted file mode 100644 index 54f9d5e..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Attributes/SelectObjAttribute.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace Vexe.Runtime.Types -{ - [Obsolete("Dumb useless attribute")] - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter)] - public class SelectObjAttribute : DrawnAttribute - { - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Types/Attributes/SelectObjAttribute.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Attributes/SelectObjAttribute.cs.meta deleted file mode 100644 index de1ace7..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Attributes/SelectObjAttribute.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8cd94964e2994ab4fa07716e790e376c -timeCreated: 1457156575 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Core.meta b/Assets/VFW Deprecated/Runtime/Types/Core.meta deleted file mode 100644 index 4810cd0..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Core.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 852c49611a5ec5b4e99b86c4c9f274a9 -folderAsset: yes -timeCreated: 1457152376 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Core/BetterBehaviour.cs b/Assets/VFW Deprecated/Runtime/Types/Core/BetterBehaviour.cs deleted file mode 100644 index def3fc1..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Core/BetterBehaviour.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System; -using UnityEngine; -using Vexe.Runtime.Extensions; -using Vexe.Runtime.Helpers; -using Vexe.Runtime.Serialization; -using UnityObject = UnityEngine.Object; - -namespace Vexe.Runtime.Types -{ - [Obsolete("Please use BaseBehaviour instead. Custom serialization hacks in Unity is fundamentally broken and leads to numerous headaches.")] - public abstract class BetterBehaviour : BaseBehaviour, ISerializationCallbackReceiver - { - [SerializeField] - private SerializationData _serializationData; - private SerializationData serializationData - { - get { return _serializationData ?? (_serializationData = new SerializationData()); } - } - - private SerializerBackend _serializer; - public SerializerBackend Serializer - { - get - { - if (_serializer == null) - { - var type = GetSerializerType(); - _serializer = type.ActivatorInstance(); - } - return _serializer; - } - } - - public virtual void OnBeforeSerialize() - { -#if UNITY_EDITOR - if (IsModified(this, Serializer, serializationData)) - { - SerializeObject(); - } -#else - SerializeObject(); -#endif - } - - public virtual void OnAfterDeserialize() - { -#if UNITY_EDITOR - if (_delayDeserialize) - { - _delayDeserialize = false; - return; - } -#endif - DeserializeObject(); - } - - public virtual void Reset() - { - var members = RuntimeMember.CachedWrapMembers(GetType()); - for (int i = 0; i < members.Count; i++) - { - var member = members[i]; - member.Target = this; - var defAttr = member.Info.GetCustomAttribute(); - if (defAttr != null) - { - var value = defAttr.Value; - if (value == null && !member.Type.IsAbstract) // null means to instantiate a new instance - value = member.Type.ActivatorInstance(); - member.Value = value; - } - } - } - - public static bool IsModified(UnityObject target, SerializerBackend serializer, SerializationData data) - { - var members = serializer.Logic.CachedGetSerializableMembers(target.GetType()); - for (int i = 0; i < members.Length; i++) - { - var member = members[i]; - var memberKey = SerializerBackend.GetMemberKey(member); - member.Target = target; - var value = member.Value; - - string prevState; - if (!data.serializedStrings.TryGetValue(memberKey, out prevState)) - return true; - - if (value.IsObjectNull() && prevState == "null") - return true; - - string curState = serializer.Serialize(member.Type, value, data.serializedObjects); - - if (prevState != null && prevState != curState) - return true; - } - - return false; - } - -#if UNITY_EDITOR - // this editor hack is needed to make it possible to let Unity Layout draw things after RabbitGUI. - // For some reason, if I try to let Unity draw things via obj.Update(), PropertyField(...) and obj.ApplyModifiedProperties(), - // it will send deserialization requests which will deserialize the behaviour overriding the new changes made in the property - // which means that the property will not be modified. so we delay deserialization for a single editor frame - private bool _delayDeserialize; - - public void DelayNextDeserialize() - { - _delayDeserialize = true; - } -#endif - - public virtual Type GetSerializerType() - { - return SerializerBackend.DefaultType; - } - - [ContextMenu("Load behaviour state")] - public virtual void DeserializeObject() - { - Serializer.DeserializeTargetFromData(this, serializationData); - } - - [ContextMenu("Save behaviour state")] - public virtual void SerializeObject() - { - Serializer.SerializeTargetIntoData(this, serializationData); - } - } -} diff --git a/Assets/VFW Deprecated/Runtime/Types/Core/BetterBehaviour.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Core/BetterBehaviour.cs.meta deleted file mode 100644 index 3373686..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Core/BetterBehaviour.cs.meta +++ /dev/null @@ -1,14 +0,0 @@ -fileFormatVersion: 2 -guid: 26d1b83de81da7c42a03c3c972803f60 -labels: -- betterbehaviour -- showemall -- vexe -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Core/BetterScriptableObject.cs b/Assets/VFW Deprecated/Runtime/Types/Core/BetterScriptableObject.cs deleted file mode 100644 index d061c78..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Core/BetterScriptableObject.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using UnityEngine; -using Vexe.Runtime.Extensions; -using Vexe.Runtime.Serialization; - -namespace Vexe.Runtime.Types -{ - [Obsolete("Please use BaseScrtiptableObject instead")] - public abstract class BetterScriptableObject : BaseScriptableObject, ISerializationCallbackReceiver - { - [SerializeField] - private SerializationData _serializationData; - private SerializationData serializationData - { - get { return _serializationData ?? (_serializationData = new SerializationData()); } - } - - private SerializerBackend _serializer; - public SerializerBackend Serializer - { - get - { - if (_serializer == null) - { - var type = GetSerializerType(); - _serializer = type.ActivatorInstance(); - } - return _serializer; - } - } - - public virtual void OnBeforeSerialize() - { - SerializeObject(); - } - - public virtual void OnAfterDeserialize() - { - DeserializeObject(); - } - - public virtual Type GetSerializerType() - { - return SerializerBackend.DefaultType; - } - - [ContextMenu("Load behaviour state")] - public virtual void DeserializeObject() - { - Serializer.DeserializeTargetFromData(this, serializationData); - } - - [ContextMenu("Save behaviour state")] - public virtual void SerializeObject() - { - Serializer.SerializeTargetIntoData(this, serializationData); - } - } -} diff --git a/Assets/VFW Deprecated/Runtime/Types/Core/BetterScriptableObject.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Core/BetterScriptableObject.cs.meta deleted file mode 100644 index 8bba7fa..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Core/BetterScriptableObject.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 2308242a34ff1b64c9306fb386994b34 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Delegates.meta b/Assets/VFW Deprecated/Runtime/Types/Delegates.meta deleted file mode 100644 index 7cdf0bb..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Delegates.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: a764522365eb6934daffee9f0010979f -folderAsset: yes -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Delegates/BaseDelegates.cs b/Assets/VFW Deprecated/Runtime/Types/Delegates/BaseDelegates.cs deleted file mode 100644 index dcbfc09..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Delegates/BaseDelegates.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using Vexe.Runtime.Extensions; - -namespace Vexe.Runtime.Types -{ - [Obsolete("Please use the UnityEvent equivalents instead")] - public abstract class IBaseDelegate - { - public List handlers = new List(); - - public abstract Type[] ParamTypes { get; } - public abstract Type ReturnType { get; } - - public class Handler - { - public object target; - public MethodInfo method; - } - } - - public abstract class uBaseDelegate : IBaseDelegate where T : class - { - protected T directValue; - - protected T Value - { - set { directValue = value; } - get - { - if (directValue == null) - Rebuild(); - return directValue; - } - } - - public void Add(T handler) - { - handlers.Add(new Handler - { - target = GetHandlerTarget(handler), - method = GetHandlerMethod(handler) - }); - DirectAdd(handler); - } - - public void Remove(T handler) - { - int index = handlers.IndexOf(t => t.target == GetHandlerTarget(handler)); - if (index == -1) return; - handlers.RemoveAt(index); - DirectRemove(handler); - } - - public bool Contains(T handler) - { - int idx = handlers.FindIndex(t => t.target == GetHandlerTarget(handler) && - t.method == GetHandlerMethod(handler)); - return idx != -1; - } - - public void Clear() - { - directValue = null; - handlers.Clear(); - } - - public void Rebuild() - { - directValue = null; - for (int i = 0; i < handlers.Count; i++) - { - var handler = handlers[i]; - var del = Delegate.CreateDelegate(typeof(T), handler.target, handler.method) as T; - DirectAdd(del); - } - } - - protected abstract MethodInfo GetHandlerMethod(T handler); - protected abstract object GetHandlerTarget(T handler); - protected abstract void DirectAdd(T handler); - protected abstract void DirectRemove(T handler); - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Types/Delegates/BaseDelegates.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Delegates/BaseDelegates.cs.meta deleted file mode 100644 index 2e41ce4..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Delegates/BaseDelegates.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 902358b39101ae14fb5d4c5849e81c70 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Delegates/DelegateSettings.cs b/Assets/VFW Deprecated/Runtime/Types/Delegates/DelegateSettings.cs deleted file mode 100644 index 9795449..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Delegates/DelegateSettings.cs +++ /dev/null @@ -1,17 +0,0 @@ -using UnityEngine; -using System.Collections; - -namespace Vexe.Runtime.Types -{ - public static class DelegateSettings - { - /// - /// Any method name defined in this array will be ignored in the delegates methods popup - /// - public static string[] IgnoredMethods = - { - "CancelInvoke", - "StopAllCoroutines", - }; - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Types/Delegates/DelegateSettings.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Delegates/DelegateSettings.cs.meta deleted file mode 100644 index 9b6adff..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Delegates/DelegateSettings.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 93e3aaeae2f770f4a99925f003a8a0fd -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Delegates/uAction.cs b/Assets/VFW Deprecated/Runtime/Types/Delegates/uAction.cs deleted file mode 100644 index 17e0754..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Delegates/uAction.cs +++ /dev/null @@ -1,197 +0,0 @@ -using System; -using System.Reflection; -using Vexe.Runtime.Extensions; - -namespace Vexe.Runtime.Types -{ - [Obsolete("Please use the UnityEvent equivalents instead")] - public class uAction : uBaseDelegate - { - public override Type[] ParamTypes - { - get { return Type.EmptyTypes; } - } - - public override Type ReturnType - { - get { return typeof(void); } - } - - public void Invoke() - { - Value.SafeInvoke(); - } - - protected override void DirectAdd(Action handler) - { - directValue += handler; - } - - protected override void DirectRemove(Action handler) - { - directValue -= handler; - } - - protected override MethodInfo GetHandlerMethod(Action handler) - { - return handler.Method; - } - - protected override object GetHandlerTarget(Action handler) - { - return handler.Target; - } - } - - public class uAction : uBaseDelegate> - { - public override Type[] ParamTypes - { - get { return new[] { typeof(T0) }; } - } - - public override Type ReturnType - { - get { return typeof(void); } - } - - public void Invoke(T0 arg0) - { - Value.SafeInvoke(arg0); - } - - protected override void DirectAdd(Action handler) - { - directValue += handler; - } - - protected override void DirectRemove(Action handler) - { - directValue -= handler; - } - - protected override MethodInfo GetHandlerMethod(Action handler) - { - return handler.Method; - } - - protected override object GetHandlerTarget(Action handler) - { - return handler.Target; - } - } - - public class uAction : uBaseDelegate> - { - public override Type[] ParamTypes - { - get { return new[] { typeof(T0), typeof(T1) }; } - } - - public override Type ReturnType - { - get { return typeof(void); } - } - - public void Invoke(T0 arg0, T1 arg1) - { - Value.SafeInvoke(arg0, arg1); - } - - protected override void DirectAdd(Action handler) - { - directValue += handler; - } - - protected override void DirectRemove(Action handler) - { - directValue -= handler; - } - - protected override MethodInfo GetHandlerMethod(Action handler) - { - return handler.Method; - } - - protected override object GetHandlerTarget(Action handler) - { - return handler.Target; - } - } - - public class uAction : uBaseDelegate> - { - public override Type[] ParamTypes - { - get { return new[] { typeof(T0), typeof(T1), typeof(T2) }; } - } - - public override Type ReturnType - { - get { return typeof(void); } - } - - public void Invoke(T0 arg0, T1 arg1, T2 arg2) - { - Value.SafeInvoke(arg0, arg1, arg2); - } - - protected override void DirectAdd(Action handler) - { - directValue += handler; - } - - protected override void DirectRemove(Action handler) - { - directValue -= handler; - } - - protected override MethodInfo GetHandlerMethod(Action handler) - { - return handler.Method; - } - - protected override object GetHandlerTarget(Action handler) - { - return handler.Target; - } - } - - public class uAction : uBaseDelegate> - { - public override Type[] ParamTypes - { - get { return new[] { typeof(T0), typeof(T1), typeof(T2), typeof(T3) }; } - } - - public override Type ReturnType - { - get { return typeof(void); } - } - - public void Invoke(T0 arg0, T1 arg1, T2 arg2, T3 arg3) - { - Value.SafeInvoke(arg0, arg1, arg2, arg3); - } - - protected override void DirectAdd(Action handler) - { - directValue += handler; - } - - protected override void DirectRemove(Action handler) - { - directValue -= handler; - } - - protected override MethodInfo GetHandlerMethod(Action handler) - { - return handler.Method; - } - - protected override object GetHandlerTarget(Action handler) - { - return handler.Target; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Types/Delegates/uAction.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Delegates/uAction.cs.meta deleted file mode 100644 index 7d5a92f..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Delegates/uAction.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: f57cd903a488188418f4f54be72ea98e -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Delegates/uDelegate.cs b/Assets/VFW Deprecated/Runtime/Types/Delegates/uDelegate.cs deleted file mode 100644 index 00b4a3f..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Delegates/uDelegate.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Vexe.Runtime.Types -{ - [Obsolete("Please use the UnityEvent equivalents instead")] - public class uDelegate : IBaseDelegate - { - /// - /// Raw argument values for each handler method to be used in invocation (values set in inspector) - /// You could modify it at runtime to change the invocation arguments, but you better know what you're doing - /// - public List arguments = new List(); - - public override Type[] ParamTypes - { - get { return null; } - } - - public override Type ReturnType - { - get { return typeof(void); } - } - - public void Invoke() - { - for (int i = 0; i < handlers.Count; i++) - { - var handler = handlers[i]; - var method = handler.method; - var target = handler.target; - if (target == null || method == null) - continue; - - method.Invoke(target, arguments[i]); - } - } - } -} diff --git a/Assets/VFW Deprecated/Runtime/Types/Delegates/uDelegate.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Delegates/uDelegate.cs.meta deleted file mode 100644 index c2e990b..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Delegates/uDelegate.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 360158730dcf36f4592df4bf08b4f68c -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Delegates/uFunc.cs b/Assets/VFW Deprecated/Runtime/Types/Delegates/uFunc.cs deleted file mode 100644 index 1097065..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Delegates/uFunc.cs +++ /dev/null @@ -1,197 +0,0 @@ -using System; -using System.Reflection; -using Vexe.Runtime.Extensions; - -namespace Vexe.Runtime.Types -{ - [Obsolete("Please use the UnityEvent equivalents instead")] - public class uFunc : uBaseDelegate> - { - public override Type[] ParamTypes - { - get { return Type.EmptyTypes; } - } - - public override Type ReturnType - { - get { return typeof(TReturn); } - } - - public TReturn Invoke() - { - return Value.SafeInvoke(); - } - - protected override void DirectAdd(Func handler) - { - directValue += handler; - } - - protected override void DirectRemove(Func handler) - { - directValue -= handler; - } - - protected override MethodInfo GetHandlerMethod(Func handler) - { - return handler.Method; - } - - protected override object GetHandlerTarget(Func handler) - { - return handler.Target; - } - } - - public class uFunc : uBaseDelegate> - { - public override Type[] ParamTypes - { - get { return new[] { typeof(T0) }; } - } - - public override Type ReturnType - { - get { return typeof(TReturn); } - } - - public TReturn Invoke(T0 arg0) - { - return Value.SafeInvoke(arg0); - } - - protected override void DirectAdd(Func handler) - { - directValue += handler; - } - - protected override void DirectRemove(Func handler) - { - directValue -= handler; - } - - protected override MethodInfo GetHandlerMethod(Func handler) - { - return handler.Method; - } - - protected override object GetHandlerTarget(Func handler) - { - return handler.Target; - } - } - - public class uFunc : uBaseDelegate> - { - public override Type[] ParamTypes - { - get { return new[] { typeof(T0), typeof(T1) }; } - } - - public override Type ReturnType - { - get { return typeof(TReturn); } - } - - public TReturn Invoke(T0 arg0, T1 arg1) - { - return Value.SafeInvoke(arg0, arg1); - } - - protected override void DirectAdd(Func handler) - { - directValue += handler; - } - - protected override void DirectRemove(Func handler) - { - directValue -= handler; - } - - protected override MethodInfo GetHandlerMethod(Func handler) - { - return handler.Method; - } - - protected override object GetHandlerTarget(Func handler) - { - return handler.Target; - } - } - - public class uFunc : uBaseDelegate> - { - public override Type[] ParamTypes - { - get { return new[] { typeof(T0), typeof(T1), typeof(T2) }; } - } - - public override Type ReturnType - { - get { return typeof(TReturn); } - } - - public TReturn Invoke(T0 arg0, T1 arg1, T2 arg2) - { - return Value.SafeInvoke(arg0, arg1, arg2); - } - - protected override void DirectAdd(Func handler) - { - directValue += handler; - } - - protected override void DirectRemove(Func handler) - { - directValue -= handler; - } - - protected override MethodInfo GetHandlerMethod(Func handler) - { - return handler.Method; - } - - protected override object GetHandlerTarget(Func handler) - { - return handler.Target; - } - } - - public class uFunc : uBaseDelegate> - { - public override Type[] ParamTypes - { - get { return new[] { typeof(T0), typeof(T1), typeof(T2), typeof(T3) }; } - } - - public override Type ReturnType - { - get { return typeof(TReturn); } - } - - public TReturn Invoke(T0 arg0, T1 arg1, T2 arg2, T3 arg3) - { - return Value.SafeInvoke(arg0, arg1, arg2, arg3); - } - - protected override void DirectAdd(Func handler) - { - directValue += handler; - } - - protected override void DirectRemove(Func handler) - { - directValue -= handler; - } - - protected override MethodInfo GetHandlerMethod(Func handler) - { - return handler.Method; - } - - protected override object GetHandlerTarget(Func handler) - { - return handler.Target; - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Types/Delegates/uFunc.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Delegates/uFunc.cs.meta deleted file mode 100644 index 5704a2b..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Delegates/uFunc.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 352fc0cd82390ad4ea28a9632660ec41 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Others.meta b/Assets/VFW Deprecated/Runtime/Types/Others.meta deleted file mode 100644 index af063fd..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: f802f837e7ce8c743aec6cfe62a31295 -folderAsset: yes -timeCreated: 1457156626 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/BetterPrefs.cs b/Assets/VFW Deprecated/Runtime/Types/Others/BetterPrefs.cs deleted file mode 100644 index c6267fd..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/BetterPrefs.cs +++ /dev/null @@ -1,89 +0,0 @@ -//using System.Collections.Generic; -//using UnityEngine; -//using System; - -//#if UNITY_EDITOR -//using UnityEditor; -//using System.IO; -//using System.Linq; -//#endif - -//namespace Vexe.Runtime.Types -//{ -// /// -// /// Intended to be a better replacement for PlayerPrefs/EditorPrefs -// /// Better because it gives more storage options (*), offers more flexibility (**) and faster (***) -// /// (*) There's more data types you could store other than int/float/string. -// /// You could also subclass and add support for arrays/lists of those types. -// /// (**) You could serialize the prefs data to stream, say file or memory. -// /// (***) It uses dictionaries so it's faster than writing to registry -// /// -// /// NOTE: You could use ValueOrDefault on the dictionaries -// /// if you're not sure whether or not there's a value registered with a certain key. -// /// There's also an overload that lets you specify the default value to use. -// /// -// [CreateAssetMenu(menuName = "Vexe/BetterPrefs")] -// public class BetterPrefs : BaseScriptableObject -// { -// [Serializable] public class LookupIntInt : SerializableDictionary { } -// [Serializable] public class LookupIntString : SerializableDictionary { } -// [Serializable] public class LookupIntFloat : SerializableDictionary { } -// [Serializable] public class LookupIntBool : SerializableDictionary { } -// [Serializable] public class LookupIntVector3 : SerializableDictionary { } -// [Serializable] public class LookupIntColor : SerializableDictionary { } - -// public LookupIntInt Ints = new LookupIntInt(); -// public LookupIntString Strings = new LookupIntString(); -// public LookupIntFloat Floats = new LookupIntFloat(); -// public LookupIntBool Bools = new LookupIntBool(); -// public LookupIntVector3 Vector3s = new LookupIntVector3(); -// public LookupIntColor Colors = new LookupIntColor(); - -// [Show] void Clear() -// { -// Ints.Clear(); -// Strings.Clear(); -// Floats.Clear(); -// Bools.Clear(); -// Vector3s.Clear(); -// Colors.Clear(); -// } - -//#if UNITY_EDITOR -// static BetterPrefs instance; -// public static BetterPrefs GetEditorInstance() -// { -// if (instance == null || !AssetDatabase.Contains(instance)) -// { -// var dirs = Directory.GetDirectories("Assets", "Vexe", SearchOption.AllDirectories); -// var editorDir = dirs.FirstOrDefault(x => Directory.GetParent(x).Name == "Editor"); -// var prefsDir = Path.Combine(editorDir, "ScriptableAssets"); -// if (editorDir == null || !Directory.Exists(prefsDir)) -// { -// Debug.LogError("Unable to create editor prefs asset at Editor/Vexe/ScriptableAssets (couldn't find folder). Please make sure that path exists 'somewhere' in your project"); -// return instance != null ? instance : instance = CreateInstance(); -// } - -// var path = Path.Combine(prefsDir, "BetterEditorPrefs.asset"); -// instance = AssetDatabase.LoadAssetAtPath(path); -// if (instance == null) -// { -// instance = ScriptableObject.CreateInstance(); -// AssetDatabase.CreateAsset(instance, path); -// AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate); -// AssetDatabase.Refresh(); -// } -// } - -// if (instance.Ints == null) instance.Ints = new LookupIntInt(); -// if (instance.Strings == null) instance.Strings = new LookupIntString(); -// if (instance.Floats == null) instance.Floats = new LookupIntFloat(); -// if (instance.Bools == null) instance.Bools = new LookupIntBool(); -// if (instance.Colors == null) instance.Colors = new LookupIntColor(); -// if (instance.Vector3s == null) instance.Vector3s = new LookupIntVector3(); - -// return instance; -// } -//#endif -// } -//} diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/BetterPrefs.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Others/BetterPrefs.cs.meta deleted file mode 100644 index 2ded158..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/BetterPrefs.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 237650b62cbc97e45b35cd599eca1554 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/CachedBehaviour.cs b/Assets/VFW Deprecated/Runtime/Types/Others/CachedBehaviour.cs deleted file mode 100644 index 1177ba1..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/CachedBehaviour.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using UnityEngine; - -namespace Vexe.Runtime.Types -{ - public class CachedBehaviour : BaseBehaviour - { - [NonSerialized] string cachedName; - new public string name - { - get - { - if (cachedName == null) - cachedName = base.name; - return cachedName; - } - set - { - if (this.name == value) - return; - cachedName = value; - base.name = value; - } - } - - [NonSerialized] Transform cachedTransform; - new public Transform transform - { - get - { - if (!cachedTransform) - cachedTransform = base.transform; - return cachedTransform; - } - } - - public RectTransform rectTransform - { - get { return transform as RectTransform; } - } - - public Transform parent - { - get { return transform.parent; } - } - - public int childCount - { - get { return transform.childCount; } - } - - public Vector3 forward - { - get { return transform.forward; } - set { transform.forward = value; } - } - - public Vector3 right - { - get { return transform.right; } - set { transform.right = value; } - } - - public Vector3 left - { - get { return -right; } - set { right = -value; } - } - - public Vector3 up - { - get { return transform.up; } - set { transform.up = value; } - } - - public Vector3 back - { - get { return -forward; } - set { forward = -value; } - } - - public Vector3 down - { - get { return -up; } - set { up = -value; } - } - - public Vector3 position - { - get { return transform.position; } - set { transform.position = value; } - } - - public Vector3 localPosition - { - get { return transform.localPosition; } - set { transform.localPosition = value; } - } - - public Quaternion rotation - { - get { return transform.rotation; } - set { transform.rotation = value; } - } - - public Quaternion localRotation - { - get { return transform.localRotation; } - set { transform.localRotation = value; } - } - - public Vector3 eulerAngles - { - get { return transform.eulerAngles; } - set { transform.eulerAngles = value; } - } - - public Vector3 localEulerAngles - { - get { return transform.localEulerAngles; } - set { transform.localEulerAngles = value; } - } - - public Vector3 localScale - { - get { return transform.localScale; } - set { transform.localScale = value; } - } - - } -} diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/CachedBehaviour.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Others/CachedBehaviour.cs.meta deleted file mode 100644 index 77691dc..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/CachedBehaviour.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 94f319e198c902840bf119d36f001f28 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/Message.cs b/Assets/VFW Deprecated/Runtime/Types/Others/Message.cs deleted file mode 100644 index 62f86b0..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/Message.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System; - -namespace Vexe.Runtime.Types -{ - /// - /// A global generic event/messaging system based on C#'s delegates - /// Subscribe/Add, Unsubscribe/Remove and Raise/Fire/Post game events/messages - /// Events/messages are objects (classes|structs) that contain information relavent to that event/message (think EventArgs) - /// See MessageExample.cs for sample usage - /// - public class Message - { - public static readonly Message Instance = new Message(); - - /// - /// Lets the specified handler/listener 'h' handle the event/message specified by the generic argument T - /// Note: this will set the delegate directly to the handler so any previous subscribers will be unsubbed - /// so you might want to use this if you want your event/message to be handled by a single handler - /// - public static void Set(Action handler) - { - Instance.set(handler); - } - - /// - /// Subscribes/Adds a handler/listener to the event/message specified by the generic argument `T` - /// - public static void Add(Action handler) - { - Instance.add(handler); - } - - /// - /// Unubscribes/Remove a handler/listener from the event/message specified by the generic argument `T` - /// - public static void Remove(Action handler) - { - Instance.remove(handler); - } - - /// - /// Raises/Fires/Posts the specified event/message - /// - public static void Post(T e) - { - Instance.post(e); - } - - /// - /// Removes all the subscribers/listeners of the event/message specified by the generic argument T - /// - public static void Clear() - { - Instance.clear(); - } - - /// - /// Returns true if the specified handler/listener is subscribed to the event/message specified by the generic argument T - /// - public static bool Contains(Action handler) - { - return Instance.contains(handler); - } - - private Action _delegate = delegate { }; - - public void set(Action handler) - { - _delegate = handler; - } - - public void add(Action handler) - { - _delegate += handler; - } - - public void remove(Action handler) - { - _delegate -= handler; - } - - public void post(T e) - { - _delegate(e); - } - - public void clear() - { - _delegate = null; - } - - public bool contains(Action handler) - { - if (_delegate == null) - return false; - - var list = _delegate.GetInvocationList(); - if (list.Length == 1 && list[0].Target == null) - return false; - - for (int i = 0; i < list.Length; i++) - if ((Action)list[i] == handler) - return true; - return false; - } - } - - /// - /// Exists for pure conveneince. - /// You might be like me and don't like the repetitiveness in Message.Post(new SomeMessage...) - /// So you could just say Message.Post(new SomeMessage...) - /// - public static class Message - { - public static void Post(T e) - { - Message.Post(e); - } - } -} diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/Message.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Others/Message.cs.meta deleted file mode 100644 index 1b2c43a..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/Message.cs.meta +++ /dev/null @@ -1,15 +0,0 @@ -fileFormatVersion: 2 -guid: e96ad3393c682914e8d7f94d3c0e646f -labels: -- eventsystem -- genericeventsystem -- events -- serializedevents -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/MessageExample.cs b/Assets/VFW Deprecated/Runtime/Types/Others/MessageExample.cs deleted file mode 100644 index 0259ca8..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/MessageExample.cs +++ /dev/null @@ -1,113 +0,0 @@ -using UnityEngine; -using Vexe.Runtime.Types; - -namespace VFWExamples -{ - /// - /// An example showing how to use the global event/messaging system - /// The basic pattern is to subscribe/add handlers in OnEnable, - /// unsubscribe/remove them in OnDisable, - /// and raise them where the event/message should take place (when player dies, on item pickup etc) - /// - public class MessageExample : MonoBehaviour - { - // re-using a single event object - private OnPlayerDied onPlayerDied = new OnPlayerDied(); - - void OnEnable() - { - Message.Add(ReportPlayerDeath); - } - - void OnDisable() - { - Message.Remove(ReportPlayerDeath); - } - - void ReportPlayerDeath(OnPlayerDied e) - { - print(string.Format("Player {0} has died because of {1}", e.Player.name, e.CauseOfDeath)); - } - - void RunTest1(OnTest e) - { - print("Test1: Float: " + e.FloatValue + " Int: " + e.IntValue); - } - - void RunTest2(OnTest e) - { - print("Test2: Float: " + e.FloatValue + " Int: " + e.IntValue); - } - - void KillPlayer() - { - Message.Post(onPlayerDied.Set(transform, "JustBecause")); - } - - void OnGUI() - { - if (GUILayout.Button("Kill player")) - KillPlayer(); - - if (GUILayout.Button("Sub ReportPlayerDeath")) - Message.Add(ReportPlayerDeath); - - if (GUILayout.Button("Unsub ReportPlayerDeath")) - Message.Remove(ReportPlayerDeath); - - if (GUILayout.Button("Is ReportPlayerDeath contained?")) - print(Message.Contains(ReportPlayerDeath)); - - if (GUILayout.Button("Clear OnPlayerDied")) - Message.Clear(); - - if (GUILayout.Button("Sub RunTest1")) - Message.Add(RunTest1); - - if (GUILayout.Button("Unsub RunTest1")) - Message.Remove(RunTest1); - - if (GUILayout.Button("Sub RunTest2")) - Message.Add(RunTest2); - - if (GUILayout.Button("Unsub RunTest2")) - Message.Remove(RunTest2); - - if (GUILayout.Button("Run tests")) - Message.Post(new OnTest(10, 1.3f)); - - if (GUILayout.Button("Is RunTest1 contained?")) - print(Message.Contains(RunTest1)); - - if (GUILayout.Button("Clear OnTest")) - Message.Clear(); - } - - // for event objects, you could either use a mutable class and reuse it - public class OnPlayerDied - { - public Transform Player; - public string CauseOfDeath; - - public OnPlayerDied Set(Transform player, string causeOfDeath) - { - this.Player = player; - this.CauseOfDeath = causeOfDeath; - return this; - } - } - - // or an immutable struct (which I would personally recommend using instead) - public struct OnTest - { - public readonly int IntValue; - public readonly float FloatValue; - - public OnTest(int intValue, float floatValue) - { - this.IntValue = intValue; - this.FloatValue = floatValue; - } - } - } -} diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/MessageExample.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Others/MessageExample.cs.meta deleted file mode 100644 index 0212f25..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/MessageExample.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 977cc163a9387c3459ce0f419aab433e -timeCreated: 1457200579 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/Requirements.cs b/Assets/VFW Deprecated/Runtime/Types/Others/Requirements.cs deleted file mode 100644 index 83368b4..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/Requirements.cs +++ /dev/null @@ -1,293 +0,0 @@ -//#define dbg - -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Vexe.Runtime.Extensions; -using Vexe.Runtime.Serialization; -using UnityObject = UnityEngine.Object; - -#if UNITY_EDITOR -using UnityEditor; -using System.Text.RegularExpressions; -#endif - -namespace Vexe.Runtime.Types -{ - [AttributeUsage(AttributeTargets.Class, Inherited = true)] - public class HasRequirementsAttribute : Attribute - { - } - - /// - /// A system that could automatically resolve requirements (dependencies) for your objects using attributes that tell it how to resolve those requirements - /// Annotate your object (System.Object or BetterBehaviour) with [HasRequirements] to let the system know that this object has requirements and needs them resolved - /// The system could be triggered automatically on editor update in a certain interval specified in Startup.ResolveInterval (see below) - defaults to 1 sec - /// or manually (use Tools/Vexe/Requirements to toggle between auto/manual) - /// To resolve requirements manually, you have to collapse the "Script" header foldout of your behavior, and click the resolve button (the button won't appear if your object isn't annotated with HasRequirements) - /// PS: the system picks up serializble members only - /// - public static class Requirements - { - /// - /// Resolves the whole scene by getting all BetterBehaviours that are tagged with HasRequirements - /// - public static void ResolveScene() - { -#if dbg - Debug.Log("resolving scene"); -#endif - var behaviours = UnityObject.FindObjectsOfType(); - for (int i = 0; i < behaviours.Length; i++) - { - var x = behaviours[i]; - if (x.GetType().IsDefined(true)) - Resolve(x, x.gameObject); - } - } - - public static void Resolve(object target, GameObject gameObject) - { -#if dbg - Debug.Log("resovling " + target); -#endif - var members = VFWSerializationLogic.Instance.CachedGetSerializableMembers(target.GetType()); - for (int i = 0; i < members.Length; i++) - { - var member = members[i]; - member.Target = target; - - if (!member.Type.IsA()) - { - if (member.Type.IsDefined(true)) - { -#if dbg - Debug.Log("recursively resolving non-UnityObject " + member.Type.Name + " in " + target); -#endif - if (member.Value != null) - Resolve(member.Value, gameObject); - } - continue; - } - - var req = member.Info.GetCustomAttribute(); - if (req == null) - continue; - - if (!member.Value.IsObjectNull()) - { -#if dbg - Debug.Log("ignoring member " + member.Name + " cause it's not null. no need to resolve"); -#endif - continue; - } - - Func resolver; - if (!resolvers.TryGetValue(req.GetType(), out resolver)) - { -#if dbg - Debug.Log("No requirement resolver found for attribute type: " + req.GetType().Name); -#endif - continue; - } - - member.Value = resolver.Invoke(target, gameObject, member, req); - } - } - - private static readonly Dictionary> resolvers = - new Dictionary>() - { - { typeof(RequiredAttribute), DontResolve }, - { typeof(RequiredSingleAttribute), ResolveSingle }, - { typeof(RequiredFromThisAttribute), ResolveFromTargetGO }, - { typeof(RequiredFromChildrenAttribute), ResolveFromTargetChildren }, - { typeof(RequiredFromParentsAttribute), ResolveFromTargetParents }, - }; - - private static UnityObject DontResolve(object target, GameObject gameObject, RuntimeMember member, RequiredAttribute attribute) - { - return null; - } - - private static UnityObject ResolveSingle(object target, GameObject gameObject, RuntimeMember member, RequiredAttribute attribute) - { - var single = (attribute as RequiredSingleAttribute).FromResources ? - Resources.FindObjectsOfTypeAll(member.Type).FirstOrDefault() : - UnityObject.FindObjectOfType(member.Type); -#if dbg - Debug.Log("found single " + single + " for " + memberType.Name + " in " + target); -#endif - return single; - } - - private static UnityObject ResolveFromTargetGO(object target, GameObject gameObject, RuntimeMember member, RequiredAttribute attribute) - { - if (member.Type == typeof(GameObject)) - { - return gameObject; - } - - var c = gameObject.GetComponent(member.Type); - if (c == null) - { - if ((attribute as RequiredFromThisAttribute).Add) - { -#if dbg - Debug.Log("adding component " + memberType.Name + " to " + gameObject.name); -#endif - c = gameObject.AddComponent(member.Type); - } - } - return c; - } - - private static UnityObject ResolveFromTargetChildren(object target, GameObject gameObject, RuntimeMember member, RequiredAttribute attribute) - { - return ResolveFromTargetRelative(target, gameObject, member, attribute as RequiredFromRelativeAttribute, - gameObject.GetOrAddChildAtPath, gameObject.GetChildAtPath, gameObject.GetComponentInChildren); - } - - private static UnityObject ResolveFromTargetParents(object target, GameObject gameObject, RuntimeMember member, RequiredAttribute attribute) - { - return ResolveFromTargetRelative(target, gameObject, member, attribute as RequiredFromRelativeAttribute, - gameObject.GetOrAddParentAtPath, gameObject.GetParentAtPath, gameObject.GetComponentInParent); - } - - - private static UnityObject ResolveFromTargetRelative(object target, GameObject gameObject, RuntimeMember member, RequiredFromRelativeAttribute attribute, - Func GetOrAddRelativeAtPath, - Func GetRelativeAtPath, - Func GetComponentInRelative) - { - if (member.Type == typeof(GameObject)) - { - var path = ProcessPath(attribute.Path, member.Name); - if (path.IsNullOrEmpty()) - return null; - - if (attribute.Create) - return GetOrAddRelativeAtPath(path); - - try { return GetRelativeAtPath(path); } - catch { return null; } - } - else - { - Component c = null; - var path = attribute.Path; - if (path.IsNullOrEmpty()) - { - c = GetComponentInRelative(member.Type); - } - else - { - path = ProcessPath(attribute.Path, member.Name); - - GameObject relative; - - if (attribute.Create) - relative = GetOrAddRelativeAtPath(path); - else - { - try { relative = GetRelativeAtPath(path); } - catch { relative = null; } - } - - if (relative == null) - return null; - - c = relative.GetComponent(member.Type); - if (c == null && attribute.Add) - { - if (member.Type.IsAbstract) - Debug.Log("Can't add component `" + member.Type.Name + "` because it's abstract"); - else - c = relative.AddComponent(member.Type); - } - } - return c; - } - } - - private static string ProcessPath(string path, string memberName) - { - if (path == "$Name") - { - return memberName.SplitPascalCase().Split(' ')[0]; - } - if (path == "$name") - { - return memberName.SplitCamelCase().Split(' ')[0]; - } - if (path == "$FullName") - { - return memberName.ToUpperAt(0); - } - if (path == "$fullName") - { - return memberName; - } - if (path == "$Full Name") - { - return memberName.SplitPascalCase(); - } - return path; - } - -#if UNITY_EDITOR - [InitializeOnLoad] - public static class Startup - { - public static double ResolveInterval = 1.0; - - static double nextTime; - static string kReqAuto = "Requirements_Auto"; - - static Startup() - { -#if dbg - Debug.Log("Requirements::Startup"); -#endif - EditorApplication.update += ResolveTick; - } - - static void ResolveTick() - { - if (!EditorPrefs.GetBool(kReqAuto, false)) - return; - - if (EditorApplication.timeSinceStartup > nextTime) - { - Requirements.ResolveScene(); - nextTime = EditorApplication.timeSinceStartup + ResolveInterval; - } - } - - public static class MenuItems - { - [MenuItem("Tools/Vexe/Requirements/ResolveScene")] - public static void ResolveSceneRequirments() - { - Profiler.BeginSample("ResolveSceneReq"); - Requirements.ResolveScene(); - Profiler.EndSample(); - } - - [MenuItem("Tools/Vexe/Requirements/Manual")] - public static void Manual() - { - EditorPrefs.SetBool(kReqAuto, false); - } - - [MenuItem("Tools/Vexe/Requirements/Automatic")] - public static void Automatic() - { - EditorPrefs.SetBool(kReqAuto, false); - } - } - } -#endif - } -} diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/Requirements.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Others/Requirements.cs.meta deleted file mode 100644 index fe04c79..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/Requirements.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 4153ab98ca8051d46a888d6d913ff442 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/RuntimeMember.cs b/Assets/VFW Deprecated/Runtime/Types/Others/RuntimeMember.cs deleted file mode 100644 index ce28224..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/RuntimeMember.cs +++ /dev/null @@ -1,263 +0,0 @@ -#if UNITY_EDITOR || UNITY_STANDALONE -#define FAST_REFLECTION -#endif - -using System; -using System.Collections.Generic; -using System.Reflection; -using UnityEngine; -using Vexe.Runtime.Extensions; -using Vexe.Runtime.Helpers; - -namespace Vexe.Runtime.Types -{ - /// - /// A wrapper for metadata members (fields and properties) - /// that's used to conveneitly set/get the member value on a certain target. - /// The way setting/getting of members is done If you're in-editor or targetting standalone - /// is via dynamically generated delegates (which is pretty fast) - /// otherwise via standard reflection (slower) - /// - public class RuntimeMember - { -#if FAST_REFLECTION - private MemberSetter _setter; - private MemberGetter _getter; -#else - private Action _setter; - private Func _getter; -#endif - public object Target; - - /// - /// The name of the wrapped member - /// - public readonly string Name; - - /// - /// If the member name was "_someValue" or "someValue" then the nice name would be "Some Value" - /// - public readonly string NiceName; - - /// - /// Say the member was a dictionary of float and string, the type nice name would be Dictionary - /// instead of System.Collections.Generic.Dictionary - /// - public readonly string TypeNiceName; - - /// - /// The type of the wrapped member (FieldInfo.FieldType in case of a field, or PropertyInfo.PropertyType in case of a property) - /// - public readonly Type Type; - - /// - /// A reference to the MemberInfo reference of the wrapped member - /// - public readonly MemberInfo Info; - - /// - /// The current value of the member in the current target object - /// - public object Value - { - get - { - return _getter(Target); - } - set - { - try - { -#if FAST_REFLECTION - _setter(ref Target, value); -#else - _setter(Target, value); -#endif - } - catch(InvalidCastException) - { - ErrorHelper.InvalidCast(value, TypeNiceName); - } - } - } - - private RuntimeMember(MemberInfo memberInfo, Type memberType, object memberTarget) - { - Info = memberInfo; - Type = memberType; - Target = memberTarget; - Name = memberInfo.Name; - NiceName = Name.Replace("_", "").SplitPascalCase(); - TypeNiceName = memberType.GetNiceName(); - } - - /// - /// Returns false if the field was constant (literal) while setting 'result' to null. - /// Otherwise true while setting result to a new RuntimeMember wrapping the specified field - /// using the appropriate method of building the [s|g]etters (delegates in case of editor/standalone, reflection otherwise) - /// - public static bool TryWrapField(FieldInfo field, object target, out RuntimeMember result) - { - if (field.IsLiteral) - { - result = null; - return false; - } - - result = new RuntimeMember(field, field.FieldType, target); - -#if FAST_REFLECTION - result._setter = field.DelegateForSet(); - result._getter = field.DelegateForGet(); -#else - result._setter = field.SetValue; - result._getter = field.GetValue; -#endif - return true; - } - - /// - /// Returns false if the property isn't readable or if it's an indexer, setting 'result' to null in the process. - /// Otherwise true while setting result to a new RuntimeMember wrapping the specified property - /// using the appropriate method of building the [s|g]etters (delegates in case of editor/standalone, reflection otherwise) - /// Note that readonly properties (getter only) are fine, as the setter will just be an empty delegate doing nothing. - /// - public static bool TryWrapProperty(PropertyInfo property, object target, out RuntimeMember result) - { - if (!property.CanRead || property.IsIndexer()) - { - result = null; - return false; - } - - result = new RuntimeMember(property, property.PropertyType, target); - - if (property.CanWrite) - { -#if FAST_REFLECTION - result._setter = property.DelegateForSet(); -#else - result._setter = (x, y) => property.SetValue(x, y, null); -#endif - } -#if FAST_REFLECTION - else result._setter = delegate(ref object obj, object value) { }; -#else - else result._setter = (x, y) => { }; -#endif - -#if FAST_REFLECTION - result._getter = property.DelegateForGet(); -#else - result._getter = x => property.GetValue(x, null); -#endif - return true; - } - - /// - /// Returns a list of RuntimeMember wrapping whatever is valid from the input members IEnumerable in the specified target - /// - public static List WrapMembers(IEnumerable members, object target) - { - var result = new List(); - foreach (var member in members) - result.AddIfNotNull(WrapMember(member, target)); - return result; - } - - /// - /// Tries to wrap the specified member. - /// Returns the wrapped result if it succeeds (valid field/property) - /// otherwise null - /// - public static RuntimeMember WrapMember(MemberInfo member, object target) - { - var field = member as FieldInfo; - if (field != null) - { - RuntimeMember wrappedField; - if (RuntimeMember.TryWrapField(field, target, out wrappedField)) - return wrappedField; - } - else - { - var property = member as PropertyInfo; - if (property == null) - return null; - - RuntimeMember wrappedProperty; - if (RuntimeMember.TryWrapProperty(property, target, out wrappedProperty)) - return wrappedProperty; - } - - return null; - } - - /// - /// Allocates a new array wrapping the specified members (not cached) - /// - public static RuntimeMember[] WrapMembers(Type type, params string[] memberNames) - { - //@Todo memoize, somehow... - var result = new RuntimeMember[memberNames.Length]; - int added = 0; - for (int i = 0; i < memberNames.Length; i++) - { - var name = memberNames[i]; - var member = type.GetMemberFromAll(name, Flags.StaticInstanceAnyVisibility); - if (member == null) - { - Debug.Log("Couldn't find member: " + name + " inside: " + type.Name); - continue; - } - - var wrapped = WrapMember(member, null); - if (wrapped == null) - { - Debug.Log("Couldn't wrap member: " + name); - continue; - } - - result[added++] = wrapped; - } - - if (added != memberNames.Length) - Array.Resize(ref result, added); - - return result; - } - - private static Func> _cachedWrapMembers; - /// - /// A cached overload of WrapMembers that returns a list of RuntimeMembers with no target specified (null) - /// wrapping whatever valid members there are in the specified type argument - /// (uses cached reflection to get the members) - /// - public static List CachedWrapMembers(Type type) - { - if (_cachedWrapMembers == null) - _cachedWrapMembers = new Func>(x => - { - var members = ReflectionHelper.CachedGetMembers(x); - return RuntimeMember.WrapMembers(members, null); - }).Memoize(); - return _cachedWrapMembers(type); - } - - public override string ToString() - { - return TypeNiceName + " " + Name; - } - - public override int GetHashCode() - { - return Info.GetHashCode(); - } - - public override bool Equals(object obj) - { - var member = obj as RuntimeMember; - return member != null && this.Info == member.Info; - } - } -} diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/RuntimeMember.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Others/RuntimeMember.cs.meta deleted file mode 100644 index 3aa56a0..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/RuntimeMember.cs.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: dd8f3c9ddaf296a49a27e80f106bf455 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/SerializableType.cs b/Assets/VFW Deprecated/Runtime/Types/Others/SerializableType.cs deleted file mode 100644 index a0c4f07..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/SerializableType.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using UnityEngine; - -namespace Vexe.Runtime.Types -{ - /// - /// A wrapper class around System.Type that is serializable by Unity - /// - [Serializable] - public class SerializableType - { - [SerializeField] string _name; - - private Type _value; - - public Type Value - { - get - { - if(_value == null) - { - _value = Type.GetType(_name); - if (_value == null) - Debug.Log("Couldn't load type: " + _name); - } - return _value; - } - set - { - if (_value != value) - { - _name = value.AssemblyQualifiedName; - _value = value; - } - } - } - - public SerializableType(Type type) - { - Value = type; - } - - public bool HasValidName() - { - return !string.IsNullOrEmpty(_name); - } - } -} \ No newline at end of file diff --git a/Assets/VFW Deprecated/Runtime/Types/Others/SerializableType.cs.meta b/Assets/VFW Deprecated/Runtime/Types/Others/SerializableType.cs.meta deleted file mode 100644 index e5f6775..0000000 --- a/Assets/VFW Deprecated/Runtime/Types/Others/SerializableType.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: df90503cae30d744886cca5fc1eac4bb -timeCreated: 1432453042 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Examples/Editor/DrawersInEditorWindowExample.cs b/Assets/VFW Examples/Editor/DrawersInEditorWindowExample.cs index ad7e01f..bf0e53f 100644 --- a/Assets/VFW Examples/Editor/DrawersInEditorWindowExample.cs +++ b/Assets/VFW Examples/Editor/DrawersInEditorWindowExample.cs @@ -5,7 +5,6 @@ using UnityEngine; using Vexe.Editor.GUIs; using Vexe.Editor.Visibility; -using Vexe.Runtime.Serialization; using Vexe.Runtime.Types; namespace VFWExamples diff --git a/Assets/VFW Examples/FastSave Examples.meta b/Assets/VFW Examples/FastSave Examples.meta deleted file mode 100644 index a1bdcaf..0000000 --- a/Assets/VFW Examples/FastSave Examples.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: eb7bee0c3e1d18742ae223a12609d97e -folderAsset: yes -timeCreated: 1436628164 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Examples/FastSave Examples/GO.meta b/Assets/VFW Examples/FastSave Examples/GO.meta deleted file mode 100644 index 560c8f7..0000000 --- a/Assets/VFW Examples/FastSave Examples/GO.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 9e3d56fd59a1711408d3c379a9166805 -folderAsset: yes -timeCreated: 1436630257 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Examples/FastSave Examples/GO/GameObject Test.unity b/Assets/VFW Examples/FastSave Examples/GO/GameObject Test.unity deleted file mode 100644 index 01299cc..0000000 --- a/Assets/VFW Examples/FastSave Examples/GO/GameObject Test.unity +++ /dev/null @@ -1,435 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!29 &1 -SceneSettings: - m_ObjectHideFlags: 0 - m_PVSData: - m_PVSObjectsArray: [] - m_PVSPortalsArray: [] - m_OcclusionBakeSettings: - smallestOccluder: 5 - smallestHole: 0.25 - backfaceThreshold: 100 ---- !u!104 &2 -RenderSettings: - m_ObjectHideFlags: 0 - serializedVersion: 6 - m_Fog: 0 - m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} - m_FogMode: 3 - m_FogDensity: 0.01 - m_LinearFogStart: 0 - m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} - m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} - m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} - m_AmbientIntensity: 1 - m_AmbientMode: 0 - m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} - m_HaloStrength: 0.5 - m_FlareStrength: 1 - m_FlareFadeSpeed: 3 - m_HaloTexture: {fileID: 0} - m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} - m_DefaultReflectionMode: 0 - m_DefaultReflectionResolution: 128 - m_ReflectionBounces: 1 - m_ReflectionIntensity: 1 - m_CustomReflection: {fileID: 0} - m_Sun: {fileID: 0} ---- !u!157 &4 -LightmapSettings: - m_ObjectHideFlags: 0 - serializedVersion: 6 - m_GIWorkflowMode: 0 - m_LightmapsMode: 1 - m_GISettings: - serializedVersion: 2 - m_BounceScale: 1 - m_IndirectOutputScale: 1 - m_AlbedoBoost: 1 - m_TemporalCoherenceThreshold: 1 - m_EnvironmentLightingMode: 0 - m_EnableBakedLightmaps: 1 - m_EnableRealtimeLightmaps: 1 - m_LightmapEditorSettings: - serializedVersion: 3 - m_Resolution: 2 - m_BakeResolution: 40 - m_TextureWidth: 1024 - m_TextureHeight: 1024 - m_AOMaxDistance: 1 - m_Padding: 2 - m_CompAOExponent: 0 - m_LightmapParameters: {fileID: 0} - m_TextureCompression: 1 - m_FinalGather: 0 - m_FinalGatherRayCount: 1024 - m_ReflectionCompression: 2 - m_LightingDataAsset: {fileID: 0} - m_RuntimeCPUUsage: 25 ---- !u!196 &5 -NavMeshSettings: - serializedVersion: 2 - m_ObjectHideFlags: 0 - m_BuildSettings: - serializedVersion: 2 - agentRadius: 0.5 - agentHeight: 2 - agentSlope: 45 - agentClimb: 0.4 - ledgeDropHeight: 0 - maxJumpAcrossDistance: 0 - accuratePlacement: 0 - minRegionArea: 2 - cellSize: 0.16666667 - manualCellSize: 0 - m_NavMeshData: {fileID: 0} ---- !u!1 &1068538704 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1068538705} - - 114: {fileID: 1068538706} - m_Layer: 0 - m_Name: Ref1 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1068538705 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1068538704} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 44.971577, y: 28.48768, z: 4.395482} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 2 ---- !u!114 &1068538706 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1068538704} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5db7c82b72f30a44081b8ed7827d1c46, type: 3} - m_Name: - m_EditorClassIdentifier: - _id: -1079222 - dbg: 0 - Prefs: - _Buckets: ffffffffffffffffffffffffffffffff040000000300000002000000 - _HashCodes: 89d9a6610aa512069291e7472dee9f4c754f6b400000000000000000 - _Next: ffffffffffffffff0000000001000000ffffffff0000000000000000 - _Count: 5 - _Version: 57 - _FreeList: -1 - _FreeCount: 0 - _Keys: 89d9a6610aa512869291e7c72dee9f4c754f6bc00000000000000000 - _Values: - - ValueString: - ValueFloat: 4 - Type: 0 - - ValueString: - ValueFloat: 10 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 2 - - ValueString: - ValueFloat: 0 - Type: 2 - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 ---- !u!1 &1081347494 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1081347495} - - 114: {fileID: 1081347496} - m_Layer: 0 - m_Name: Ref2 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1081347495 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1081347494} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 44.971577, y: 28.48768, z: 4.395482} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 3 ---- !u!114 &1081347496 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1081347494} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5db7c82b72f30a44081b8ed7827d1c46, type: 3} - m_Name: - m_EditorClassIdentifier: - _id: -1079224 - dbg: 0 - Prefs: - _Buckets: 04000000ffffffffffffffffffffffffffffffffffffffff01000000 - _HashCodes: 4bd9a661cca412065491e7476f059f4cf3476b400000000000000000 - _Next: ffffffffffffffff0000000002000000030000000000000000000000 - _Count: 5 - _Version: 29 - _FreeList: -1 - _FreeCount: 0 - _Keys: 4bd9a661cca412865491e7c76f059f4cf3476bc00000000000000000 - _Values: - - ValueString: - ValueFloat: 4 - Type: 0 - - ValueString: - ValueFloat: 10 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 2 - - ValueString: - ValueFloat: 0 - Type: 2 - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 ---- !u!1 &1376626298 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1376626300} - - 114: {fileID: 1376626299} - m_Layer: 0 - m_Name: Test - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1376626299 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1376626298} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 34fefd8a5c450ba4ab312b4ec6d19755, type: 3} - m_Name: - m_EditorClassIdentifier: - _id: -934346 - dbg: 0 - Prefs: - _Buckets: ffffffffffffffffffffffff - _HashCodes: 000000000000000000000000 - _Next: 000000000000000000000000 - _Count: 0 - _Version: 0 - _FreeList: -1 - _FreeCount: 0 - _Keys: 000000000000000000000000 - _Values: - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - target: {fileID: 1403682384} - output: AAAAAAAHAAAABwAAAFNhdmUgTWUBAAAAAAgAAAAIAAAAVW50YWdnZWQAAAAAAAEFAAAAAgAAAABZAAAAWQAAAFVuaXR5RW5naW5lLlRyYW5zZm9ybSwgVW5pdHlFbmdpbmUsIFZlcnNpb249MC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsAAAAAAAAAK5HOEIKTt5BmNQ4QAAAAIAAAAAAAAAAAGPdiUBjwMM/oIMhQAAAAAAAWgAAAFoAAABVbml0eUVuZ2luZS5NZXNoRmlsdGVyLCBVbml0eUVuZ2luZSwgVmVyc2lvbj0wLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwAAAAAAAAAAAEAAAAAAAEAAAAABAAAAAQAAABDdWJlAAAAAABbAAAAWwAAAFVuaXR5RW5naW5lLkJveENvbGxpZGVyLCBVbml0eUVuZ2luZSwgVmVyc2lvbj0wLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgD8AAIA/AACAPwEAAAAAAFwAAABcAAAAVW5pdHlFbmdpbmUuTWVzaFJlbmRlcmVyLCBVbml0eUVuZ2luZSwgVmVyc2lvbj0wLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwAAAAAAAAAAQAAAAEAAQAAAAAAAQAAAAACAAAAAAABAAAAAAQAAAAEAAAAQmx1ZQEBAAAA/////wAAAAAAUAAAAFAAAABTb21lRGF0YSwgQXNzZW1ibHktQ1NoYXJwLCBWZXJzaW9uPTAuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAAAAAAAAAAAAQAAAAAAAgAAAAEAAAAACgAAAAoAAABTb21lIEtleSAx6AMAAAIAAAAACgAAAAoAAABTb21lIEtleSAy6gAAAP////8AAgAAAAAABQAAACIAAACzFQAABgAAAH0NAAAHAwAAAAMAAAAAAAMAAADhOmpDAA0qR57vCEIAAAAASojv/wAAAABIiO//AQAAAAAAAAAA ---- !u!4 &1376626300 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1376626298} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 40.502647, y: 27.11774, z: 1.8959446} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 ---- !u!1 &1403682384 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1403682389} - - 33: {fileID: 1403682388} - - 65: {fileID: 1403682387} - - 23: {fileID: 1403682386} - - 114: {fileID: 1403682385} - m_Layer: 0 - m_Name: Save Me - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1403682385 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1403682384} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e16b5756b5b9274ba0e621e01843cc9, type: 3} - m_Name: - m_EditorClassIdentifier: - _id: -945064 - dbg: 0 - Prefs: - _Buckets: 050000000200000004000000ffffffffffffffffffffffffffffffff - _HashCodes: 3b4fe661bc1a5206440727481c50a92385ece5159c6bd16100000000 - _Next: ffffffffffffffff0000000001000000ffffffff0300000000000000 - _Count: 6 - _Version: 844 - _FreeList: -1 - _FreeCount: 0 - _Keys: 3b4fe661bc1a5286440727c81c50a92385ece5159c6bd1e100000000 - _Values: - - ValueString: - ValueFloat: 4 - Type: 0 - - ValueString: - ValueFloat: 10 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 2 - - ValueString: - ValueFloat: 0 - Type: 2 - - ValueString: - ValueFloat: 0 - Type: 2 - - ValueString: - ValueFloat: 0 - Type: 2 - - ValueString: - ValueFloat: 0 - Type: 0 - container: - _Buckets: 0000000001000000ffffffff - _HashCodes: 84f41c5285f41c5200000000 - _Next: ffffffffffffffff00000000 - _Count: 2 - _Version: 19327 - _FreeList: -1 - _FreeCount: 0 - _Keys: - - Some Key 1 - - Some Key 2 - - - _Values: e8030000ea00000000000000 - stringField: - intArray: 22000000b3150000060000007d0d000007030000 - floatList: - - 234.23 - - 43533 - - 34.234 - testRenderer: {fileID: 0} - testGameObject: {fileID: 1081347494} - testPrefab: {fileID: 106520, guid: 66fbf79b06b9dfe4d953ef8e6884a68e, type: 2} ---- !u!23 &1403682386 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1403682384} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 1 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!65 &1403682387 -BoxCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1403682384} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!33 &1403682388 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1403682384} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &1403682389 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1403682384} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 46.07, y: 27.788105, z: 2.8879757} - m_LocalScale: {x: 4.3082747, y: 1.5293087, z: 2.5236588} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 1 diff --git a/Assets/VFW Examples/FastSave Examples/GO/GameObject Test.unity.meta b/Assets/VFW Examples/FastSave Examples/GO/GameObject Test.unity.meta deleted file mode 100644 index 25a2676..0000000 --- a/Assets/VFW Examples/FastSave Examples/GO/GameObject Test.unity.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: af4664815f1777b42abca6562e595745 -timeCreated: 1436629340 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Examples/FastSave Examples/GO/GameObjectTest.cs b/Assets/VFW Examples/FastSave Examples/GO/GameObjectTest.cs deleted file mode 100644 index 1e1071d..0000000 --- a/Assets/VFW Examples/FastSave Examples/GO/GameObjectTest.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using UnityEngine; -using Vexe.FastSave; -using Vexe.Runtime.Types; - -namespace FSExamples -{ - public class GameObjectTest : BaseBehaviour - { - public GameObject target; - - [HideInInspector] - public string output; - - [Show] void SaveGo() - { - output = Save.GameObjectToMemory(target).GetString(); - } - - [Show] void LoadIntoNewGo() - { - Load.GameObjectFromMemory(output.GetBytes(), new GameObject()); - } - - [Show] void LoadIntoTargetGo() - { - target.LoadFromMemory(output.GetBytes()); - } - } -} diff --git a/Assets/VFW Examples/FastSave Examples/GO/GameObjectTest.cs.meta b/Assets/VFW Examples/FastSave Examples/GO/GameObjectTest.cs.meta deleted file mode 100644 index e7ac006..0000000 --- a/Assets/VFW Examples/FastSave Examples/GO/GameObjectTest.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 34fefd8a5c450ba4ab312b4ec6d19755 -timeCreated: 1436627927 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Examples/FastSave Examples/Hierarchy.meta b/Assets/VFW Examples/FastSave Examples/Hierarchy.meta deleted file mode 100644 index d39ccf6..0000000 --- a/Assets/VFW Examples/FastSave Examples/Hierarchy.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 19b8c0add8b614447a3880eff4b6fb02 -folderAsset: yes -timeCreated: 1436630261 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Examples/FastSave Examples/Hierarchy/Hierarchy Test.unity b/Assets/VFW Examples/FastSave Examples/Hierarchy/Hierarchy Test.unity deleted file mode 100644 index dfd944d..0000000 --- a/Assets/VFW Examples/FastSave Examples/Hierarchy/Hierarchy Test.unity +++ /dev/null @@ -1,680 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!29 &1 -SceneSettings: - m_ObjectHideFlags: 0 - m_PVSData: - m_PVSObjectsArray: [] - m_PVSPortalsArray: [] - m_OcclusionBakeSettings: - smallestOccluder: 5 - smallestHole: 0.25 - backfaceThreshold: 100 ---- !u!104 &2 -RenderSettings: - m_ObjectHideFlags: 0 - serializedVersion: 6 - m_Fog: 0 - m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} - m_FogMode: 3 - m_FogDensity: 0.01 - m_LinearFogStart: 0 - m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} - m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} - m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} - m_AmbientIntensity: 1 - m_AmbientMode: 0 - m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} - m_HaloStrength: 0.5 - m_FlareStrength: 1 - m_FlareFadeSpeed: 3 - m_HaloTexture: {fileID: 0} - m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} - m_DefaultReflectionMode: 0 - m_DefaultReflectionResolution: 128 - m_ReflectionBounces: 1 - m_ReflectionIntensity: 1 - m_CustomReflection: {fileID: 0} - m_Sun: {fileID: 0} ---- !u!157 &4 -LightmapSettings: - m_ObjectHideFlags: 0 - serializedVersion: 6 - m_GIWorkflowMode: 0 - m_LightmapsMode: 1 - m_GISettings: - serializedVersion: 2 - m_BounceScale: 1 - m_IndirectOutputScale: 1 - m_AlbedoBoost: 1 - m_TemporalCoherenceThreshold: 1 - m_EnvironmentLightingMode: 0 - m_EnableBakedLightmaps: 1 - m_EnableRealtimeLightmaps: 1 - m_LightmapEditorSettings: - serializedVersion: 3 - m_Resolution: 2 - m_BakeResolution: 40 - m_TextureWidth: 1024 - m_TextureHeight: 1024 - m_AOMaxDistance: 1 - m_Padding: 2 - m_CompAOExponent: 0 - m_LightmapParameters: {fileID: 0} - m_TextureCompression: 1 - m_FinalGather: 0 - m_FinalGatherRayCount: 1024 - m_ReflectionCompression: 2 - m_LightingDataAsset: {fileID: 0} - m_RuntimeCPUUsage: 25 ---- !u!196 &5 -NavMeshSettings: - serializedVersion: 2 - m_ObjectHideFlags: 0 - m_BuildSettings: - serializedVersion: 2 - agentRadius: 0.5 - agentHeight: 2 - agentSlope: 45 - agentClimb: 0.4 - ledgeDropHeight: 0 - maxJumpAcrossDistance: 0 - accuratePlacement: 0 - minRegionArea: 2 - cellSize: 0.16666667 - manualCellSize: 0 - m_NavMeshData: {fileID: 0} ---- !u!1 &67789679 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 67789680} - - 33: {fileID: 67789683} - - 135: {fileID: 67789682} - - 23: {fileID: 67789681} - m_Layer: 0 - m_Name: Level 3 - Sphere - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &67789680 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 67789679} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.22000122, y: -1.1299973, z: -0.00010108948} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 513653982} - m_RootOrder: 0 ---- !u!23 &67789681 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 67789679} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_Materials: - - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 1 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!135 &67789682 -SphereCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 67789679} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Radius: 0.5 - m_Center: {x: 0, y: 0, z: 0} ---- !u!33 &67789683 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 67789679} - m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &342746517 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 342746518} - - 33: {fileID: 342746521} - - 135: {fileID: 342746520} - - 23: {fileID: 342746519} - m_Layer: 0 - m_Name: Level 2 - Sphere - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &342746518 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 342746517} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.0099983215, y: -1.1100006, z: -0.00010108948} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1559680047} - m_RootOrder: 0 ---- !u!23 &342746519 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 342746517} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_Materials: - - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 1 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!135 &342746520 -SphereCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 342746517} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Radius: 0.5 - m_Center: {x: 0, y: 0, z: 0} ---- !u!33 &342746521 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 342746517} - m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &513653978 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 513653982} - - 33: {fileID: 513653981} - - 65: {fileID: 513653980} - - 23: {fileID: 513653979} - m_Layer: 0 - m_Name: Level 2 - Cube - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!23 &513653979 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 513653978} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_Materials: - - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 1 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!65 &513653980 -BoxCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 513653978} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!33 &513653981 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 513653978} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &513653982 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 513653978} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -1.1599998, y: -1.2200012, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 67789680} - - {fileID: 2119178710} - m_Father: {fileID: 1559680047} - m_RootOrder: 1 ---- !u!1 &1559680046 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1559680047} - - 33: {fileID: 1559680050} - - 65: {fileID: 1559680049} - - 23: {fileID: 1559680048} - m_Layer: 0 - m_Name: Level 1 - Cube - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1559680047 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1559680046} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -1.1599998, y: -1.0900002, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 342746518} - - {fileID: 513653982} - m_Father: {fileID: 1996651066} - m_RootOrder: 0 ---- !u!23 &1559680048 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1559680046} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_Materials: - - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 1 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!65 &1559680049 -BoxCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1559680046} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!33 &1559680050 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1559680046} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &1622364769 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1622364771} - - 114: {fileID: 1622364770} - m_Layer: 0 - m_Name: Test - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1622364770 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1622364769} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: cfb8509ab4d5dc64fbb475e819662b7e, type: 3} - m_Name: - m_EditorClassIdentifier: - _id: -910132 - dbg: 0 - Prefs: - _Buckets: ffffffffffffffffffffffff - _HashCodes: 000000000000000000000000 - _Next: 000000000000000000000000 - _Count: 0 - _Version: 0 - _FreeList: -1 - _FreeCount: 0 - _Keys: 000000000000000000000000 - _Values: - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - target: {fileID: 1996651065} - output: ---- !u!4 &1622364771 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1622364769} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 24.88, y: 32.1565, z: 18.846642} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 1 ---- !u!1 &1893369491 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1893369492} - - 33: {fileID: 1893369495} - - 135: {fileID: 1893369494} - - 23: {fileID: 1893369493} - m_Layer: 0 - m_Name: Level 1 - Sphere - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1893369492 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1893369491} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.09000015, y: -1.3100014, z: -0.00010108948} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1996651066} - m_RootOrder: 1 ---- !u!23 &1893369493 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1893369491} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_Materials: - - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 1 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!135 &1893369494 -SphereCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1893369491} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Radius: 0.5 - m_Center: {x: 0, y: 0, z: 0} ---- !u!33 &1893369495 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1893369491} - m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &1996651065 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1996651066} - - 33: {fileID: 1996651069} - - 65: {fileID: 1996651068} - - 23: {fileID: 1996651067} - m_Layer: 0 - m_Name: Hierarchy - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1996651066 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1996651065} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 36.76, y: 35.75, z: 19.775492} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 1559680047} - - {fileID: 1893369492} - m_Father: {fileID: 0} - m_RootOrder: 0 ---- !u!23 &1996651067 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1996651065} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_Materials: - - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 1 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!65 &1996651068 -BoxCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1996651065} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!33 &1996651069 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1996651065} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &2119178709 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 2119178710} - - 33: {fileID: 2119178713} - - 65: {fileID: 2119178712} - - 23: {fileID: 2119178711} - m_Layer: 0 - m_Name: Level 3 - Cube - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &2119178710 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 2119178709} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.9300003, y: -1.3099976, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 513653982} - m_RootOrder: 1 ---- !u!23 &2119178711 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 2119178709} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_Materials: - - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 1 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!65 &2119178712 -BoxCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 2119178709} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!33 &2119178713 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 2119178709} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} diff --git a/Assets/VFW Examples/FastSave Examples/Hierarchy/Hierarchy Test.unity.meta b/Assets/VFW Examples/FastSave Examples/Hierarchy/Hierarchy Test.unity.meta deleted file mode 100644 index bd207b3..0000000 --- a/Assets/VFW Examples/FastSave Examples/Hierarchy/Hierarchy Test.unity.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ef451949f84afde469e37a657e67e03b -timeCreated: 1436611700 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Examples/FastSave Examples/Hierarchy/HierarchyTest.cs b/Assets/VFW Examples/FastSave Examples/Hierarchy/HierarchyTest.cs deleted file mode 100644 index 2aea55d..0000000 --- a/Assets/VFW Examples/FastSave Examples/Hierarchy/HierarchyTest.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using UnityEngine; -using Vexe.FastSave; -using Vexe.Runtime.Types; - -namespace FSExamples -{ - public class HierarchyTest : BaseBehaviour - { - public GameObject target; - - [HideInInspector] - public string output; - - [Show] void SaveHierarchy() - { - output = target.SaveHierarchyToMemory().GetString(); - } - - [Show] void LoadIntoNewHierarchy() - { - Load.HierarchyFromMemory(output.GetBytes(), new GameObject("ROOT")); - } - - [Show] void LoadIntoTargetHierarchy() - { - Load.HierarchyFromMemory(output.GetBytes(), target); - } - } - -} diff --git a/Assets/VFW Examples/FastSave Examples/Hierarchy/HierarchyTest.cs.meta b/Assets/VFW Examples/FastSave Examples/Hierarchy/HierarchyTest.cs.meta deleted file mode 100644 index 9d730b2..0000000 --- a/Assets/VFW Examples/FastSave Examples/Hierarchy/HierarchyTest.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: cfb8509ab4d5dc64fbb475e819662b7e -timeCreated: 1436627927 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Examples/FastSave Examples/Marked.meta b/Assets/VFW Examples/FastSave Examples/Marked.meta deleted file mode 100644 index 63cff4b..0000000 --- a/Assets/VFW Examples/FastSave Examples/Marked.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e517d2747965dc044b1e183356ff968d -folderAsset: yes -timeCreated: 1436630268 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Examples/FastSave Examples/Marked/Marked Test.unity b/Assets/VFW Examples/FastSave Examples/Marked/Marked Test.unity deleted file mode 100644 index 432b537..0000000 --- a/Assets/VFW Examples/FastSave Examples/Marked/Marked Test.unity +++ /dev/null @@ -1,774 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!29 &1 -SceneSettings: - m_ObjectHideFlags: 0 - m_PVSData: - m_PVSObjectsArray: [] - m_PVSPortalsArray: [] - m_OcclusionBakeSettings: - smallestOccluder: 5 - smallestHole: 0.25 - backfaceThreshold: 100 ---- !u!104 &2 -RenderSettings: - m_ObjectHideFlags: 0 - serializedVersion: 6 - m_Fog: 0 - m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} - m_FogMode: 3 - m_FogDensity: 0.01 - m_LinearFogStart: 0 - m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} - m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} - m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} - m_AmbientIntensity: 1 - m_AmbientMode: 0 - m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} - m_HaloStrength: 0.5 - m_FlareStrength: 1 - m_FlareFadeSpeed: 3 - m_HaloTexture: {fileID: 0} - m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} - m_DefaultReflectionMode: 0 - m_DefaultReflectionResolution: 128 - m_ReflectionBounces: 1 - m_ReflectionIntensity: 1 - m_CustomReflection: {fileID: 0} - m_Sun: {fileID: 0} ---- !u!157 &4 -LightmapSettings: - m_ObjectHideFlags: 0 - serializedVersion: 6 - m_GIWorkflowMode: 0 - m_LightmapsMode: 1 - m_GISettings: - serializedVersion: 2 - m_BounceScale: 1 - m_IndirectOutputScale: 1 - m_AlbedoBoost: 1 - m_TemporalCoherenceThreshold: 1 - m_EnvironmentLightingMode: 0 - m_EnableBakedLightmaps: 1 - m_EnableRealtimeLightmaps: 1 - m_LightmapEditorSettings: - serializedVersion: 3 - m_Resolution: 2 - m_BakeResolution: 40 - m_TextureWidth: 1024 - m_TextureHeight: 1024 - m_AOMaxDistance: 1 - m_Padding: 2 - m_CompAOExponent: 0 - m_LightmapParameters: {fileID: 0} - m_TextureCompression: 1 - m_FinalGather: 0 - m_FinalGatherRayCount: 1024 - m_ReflectionCompression: 2 - m_LightingDataAsset: {fileID: 0} - m_RuntimeCPUUsage: 25 ---- !u!196 &5 -NavMeshSettings: - serializedVersion: 2 - m_ObjectHideFlags: 0 - m_BuildSettings: - serializedVersion: 2 - agentRadius: 0.5 - agentHeight: 2 - agentSlope: 45 - agentClimb: 0.4 - ledgeDropHeight: 0 - maxJumpAcrossDistance: 0 - accuratePlacement: 0 - minRegionArea: 2 - cellSize: 0.16666667 - manualCellSize: 0 - m_NavMeshData: {fileID: 0} ---- !u!1 &588841656 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 588841661} - - 33: {fileID: 588841660} - - 65: {fileID: 588841659} - - 23: {fileID: 588841658} - - 114: {fileID: 588841657} - m_Layer: 0 - m_Name: Marked3 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &588841657 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 588841656} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 100e8ebedf872b54b93bc241c4dae51d, type: 3} - m_Name: - m_EditorClassIdentifier: - _id: -705932 - dbg: 0 - Prefs: - _Buckets: ffffffff0100000002000000 - _HashCodes: 9f6c57622038c306a8249848 - _Next: ffffffffffffffff00000000 - _Count: 3 - _Version: 97 - _FreeList: -1 - _FreeCount: 0 - _Keys: 9f6c57622038c386a82498c8 - _Values: - - ValueString: - ValueFloat: 4 - Type: 0 - - ValueString: - ValueFloat: 10 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 2 - _SerializedList: - - UnityEngine.Transform, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - UnityEngine.MeshFilter, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - UnityEngine.BoxCollider, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - UnityEngine.MeshRenderer, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null ---- !u!23 &588841658 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 588841656} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_Materials: - - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 1 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!65 &588841659 -BoxCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 588841656} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!33 &588841660 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 588841656} - m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &588841661 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 588841656} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 45.12, y: 37.01, z: 0.8299999} - m_LocalScale: {x: 3.626906, y: 3.6269066, z: 3.6269066} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 2 ---- !u!1 &834950434 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 834950439} - - 33: {fileID: 834950438} - - 65: {fileID: 834950437} - - 23: {fileID: 834950436} - - 114: {fileID: 834950440} - - 114: {fileID: 834950435} - m_Layer: 0 - m_Name: Marked2 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &834950435 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 834950434} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 100e8ebedf872b54b93bc241c4dae51d, type: 3} - m_Name: - m_EditorClassIdentifier: - _id: -705934 - dbg: 0 - Prefs: - _Buckets: ffffffffffffffffffffffff - _HashCodes: 000000000000000000000000 - _Next: 000000000000000000000000 - _Count: 0 - _Version: 0 - _FreeList: -1 - _FreeCount: 0 - _Keys: 000000000000000000000000 - _Values: - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - _SerializedList: - - UnityEngine.Transform, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - UnityEngine.MeshFilter, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - UnityEngine.BoxCollider, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - UnityEngine.MeshRenderer, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null ---- !u!23 &834950436 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 834950434} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_Materials: - - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 1 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!65 &834950437 -BoxCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 834950434} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!33 &834950438 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 834950434} - m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &834950439 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 834950434} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 45.16, y: 32.1, z: 0.92} - m_LocalScale: {x: 2.9566913, y: 2.9566905, z: 2.9566905} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 1 ---- !u!114 &834950440 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 834950434} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5db7c82b72f30a44081b8ed7827d1c46, type: 3} - m_Name: - m_EditorClassIdentifier: - _id: -353156 - dbg: 0 - Prefs: - _Buckets: ffffffff0100000000000000 - _HashCodes: 974bfe6218176a0700000000 - _Next: ffffffffffffffff00000000 - _Count: 2 - _Version: 6 - _FreeList: -1 - _FreeCount: 0 - _Keys: 974bfe6218176a8700000000 - _Values: - - ValueString: - ValueFloat: 4 - Type: 0 - - ValueString: - ValueFloat: 10 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 ---- !u!1 &1068538704 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1068538705} - - 114: {fileID: 1068538706} - m_Layer: 0 - m_Name: Ref1 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1068538705 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1068538704} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 44.971577, y: 28.48768, z: 4.395482} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 4 ---- !u!114 &1068538706 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1068538704} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5db7c82b72f30a44081b8ed7827d1c46, type: 3} - m_Name: - m_EditorClassIdentifier: - _id: -1079222 - dbg: 0 - Prefs: - _Buckets: ffffffffffffffffffffffff - _HashCodes: 000000000000000000000000 - _Next: 000000000000000000000000 - _Count: 0 - _Version: 0 - _FreeList: -1 - _FreeCount: 0 - _Keys: 000000000000000000000000 - _Values: - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 ---- !u!1 &1081347494 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1081347495} - - 114: {fileID: 1081347496} - m_Layer: 0 - m_Name: Ref2 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1081347495 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1081347494} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 44.971577, y: 28.48768, z: 4.395482} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 5 ---- !u!114 &1081347496 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1081347494} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5db7c82b72f30a44081b8ed7827d1c46, type: 3} - m_Name: - m_EditorClassIdentifier: - _id: -1079224 - dbg: 0 - Prefs: - _Buckets: ffffffffffffffffffffffff - _HashCodes: 000000000000000000000000 - _Next: 000000000000000000000000 - _Count: 0 - _Version: 0 - _FreeList: -1 - _FreeCount: 0 - _Keys: 000000000000000000000000 - _Values: - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 ---- !u!1 &1376626298 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1376626300} - - 114: {fileID: 1376626299} - m_Layer: 0 - m_Name: Test - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1376626299 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1376626298} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a4c06ddd31990a8459309aa5855dd23e, type: 3} - m_Name: - m_EditorClassIdentifier: - _id: -1202908 - dbg: 0 - Prefs: - _Buckets: ffffffffffffffffffffffff - _HashCodes: 000000000000000000000000 - _Next: 000000000000000000000000 - _Count: 0 - _Version: 0 - _FreeList: -1 - _FreeCount: 0 - _Keys: 000000000000000000000000 - _Values: - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - output: AAAAAAAAAAMAAAByOvX/AAAAAABIAwAASAMAAEFBQUFBQUFIQUFBQUJ3QUFBRTFoY210bFpESUJBQUFBQUFnQUFBQUlBQUFBVlc1MFlXZG5aV1FBQUFBQUFBRUVBQUFBQWdBQUFBQlpBQUFBV1FBQUFGVnVhWFI1Ulc1bmFXNWxMbFJ5WVc1elptOXliU3dnVlc1cGRIbEZibWRwYm1Vc0lGWmxjbk5wYjI0OU1DNHdMakF1TUN3Z1EzVnNkSFZ5WlQxdVpYVjBjbUZzTENCUWRXSnNhV05MWlhsVWIydGxiajF1ZFd4c0FBQUFBQUFBQU5lak5FSm1aZ0JDSDRWclB3QUFBSUFBQUFBQUFBQUFBRzQ2UFVCck9qMUFhem85UUFBQUFBQUFXZ0FBQUZvQUFBQlZibWwwZVVWdVoybHVaUzVOWlhOb1JtbHNkR1Z5TENCVmJtbDBlVVZ1WjJsdVpTd2dWbVZ5YzJsdmJqMHdMakF1TUM0d0xDQkRkV3gwZFhKbFBXNWxkWFJ5WVd3c0lGQjFZbXhwWTB0bGVWUnZhMlZ1UFc1MWJHd0FBQUFBQUFBQUFBRUFBQUFBQUFFQUFBQUFDQUFBQUFnQUFBQkRlV3hwYm1SbGNnQUFBQUFBV3dBQUFGc0FBQUJWYm1sMGVVVnVaMmx1WlM1Q2IzaERiMnhzYVdSbGNpd2dWVzVwZEhsRmJtZHBibVVzSUZabGNuTnBiMjQ5TUM0d0xqQXVNQ3dnUTNWc2RIVnlaVDF1WlhWMGNtRnNMQ0JRZFdKc2FXTkxaWGxVYjJ0bGJqMXVkV3hzQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFJQS9BQUNBUHdBQWdEOEJBQUFBQUFCY0FBQUFYQUFBQUZWdWFYUjVSVzVuYVc1bExrMWxjMmhTWlc1a1pYSmxjaXdnVlc1cGRIbEZibWRwYm1Vc0lGWmxjbk5wYjI0OU1DNHdMakF1TUN3Z1EzVnNkSFZ5WlQxdVpYVjBjbUZzTENCUWRXSnNhV05MWlhsVWIydGxiajF1ZFd4c0FBQUFBQUFBQUFFQUFBQUJBQUVBQUFBQUFBRUFBQUFBQWdBQUFBQUFBUUFBQUFBRkFBQUFCUUFBQUVkeVpXVnVBUUVBQUFBQXQ69f8BAAAAAEQDAABEAwAAQUFBQUFBQUhBQUFBQndBQUFFMWhjbXRsWkRNQkFBQUFBQWdBQUFBSUFBQUFWVzUwWVdkblpXUUFBQUFBQUFFRUFBQUFBZ0FBQUFCWkFBQUFXUUFBQUZWdWFYUjVSVzVuYVc1bExsUnlZVzV6Wm05eWJTd2dWVzVwZEhsRmJtZHBibVVzSUZabGNuTnBiMjQ5TUM0d0xqQXVNQ3dnUTNWc2RIVnlaVDF1WlhWMGNtRnNMQ0JRZFdKc2FXTkxaWGxVYjJ0bGJqMXVkV3hzQUFBQUFBQUFBT0Y2TkVJOUNoUkM0SHBVUHdBQUFJQUFBQUFBQUFBQUFEb2ZhRUE5SDJoQVBSOW9RQUFBQUFBQVdnQUFBRm9BQUFCVmJtbDBlVVZ1WjJsdVpTNU5aWE5vUm1sc2RHVnlMQ0JWYm1sMGVVVnVaMmx1WlN3Z1ZtVnljMmx2Ymowd0xqQXVNQzR3TENCRGRXeDBkWEpsUFc1bGRYUnlZV3dzSUZCMVlteHBZMHRsZVZSdmEyVnVQVzUxYkd3QUFBQUFBQUFBQUFFQUFBQUFBQUVBQUFBQUJnQUFBQVlBQUFCVGNHaGxjbVVBQUFBQUFGc0FBQUJiQUFBQVZXNXBkSGxGYm1kcGJtVXVRbTk0UTI5c2JHbGtaWElzSUZWdWFYUjVSVzVuYVc1bExDQldaWEp6YVc5dVBUQXVNQzR3TGpBc0lFTjFiSFIxY21VOWJtVjFkSEpoYkN3Z1VIVmliR2xqUzJWNVZHOXJaVzQ5Ym5Wc2JBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUNBUHdBQWdEOEFBSUEvQVFBQUFBQUFYQUFBQUZ3QUFBQlZibWwwZVVWdVoybHVaUzVOWlhOb1VtVnVaR1Z5WlhJc0lGVnVhWFI1Ulc1bmFXNWxMQ0JXWlhKemFXOXVQVEF1TUM0d0xqQXNJRU4xYkhSMWNtVTlibVYxZEhKaGJDd2dVSFZpYkdsalMyVjVWRzlyWlc0OWJuVnNiQUFBQUFBQUFBQUJBQUFBQVFBQkFBQUFBQUFCQUFBQUFBSUFBQUFBQUFFQUFBQUFBd0FBQUFNQUFBQlNaV1FCQVFBQUFBQT0K2+r/AgAAAAA8BQAAPAUAAEFBQUFBQUFIQUFBQUJ3QUFBRTFoY210bFpERUJBQUFBQUFnQUFBQUlBQUFBVlc1MFlXZG5aV1FBQUFBQUFBRUdBQUFBQWdBQUFBQlpBQUFBV1FBQUFGVnVhWFI1Ulc1bmFXNWxMbFJ5WVc1elptOXliU3dnVlc1cGRIbEZibWRwYm1Vc0lGWmxjbk5wYjI0OU1DNHdMakF1TUN3Z1EzVnNkSFZ5WlQxdVpYVjBjbUZzTENCUWRXSnNhV05MWlhsVWIydGxiajF1ZFd4c0FBQUFBQUFBQUkvQ05FSm1adHBCVXJoZVB3QUFBSUFBQUFBQUFBQUFBTUpxU2tEQWFrcEF3R3BLUUFBQUFBQUFXZ0FBQUZvQUFBQlZibWwwZVVWdVoybHVaUzVOWlhOb1JtbHNkR1Z5TENCVmJtbDBlVVZ1WjJsdVpTd2dWbVZ5YzJsdmJqMHdMakF1TUM0d0xDQkRkV3gwZFhKbFBXNWxkWFJ5WVd3c0lGQjFZbXhwWTB0bGVWUnZhMlZ1UFc1MWJHd0FBQUFBQUFBQUFBRUFBQUFBQUFFQUFBQUFCQUFBQUFRQUFBQkRkV0psQUFBQUFBQmJBQUFBV3dBQUFGVnVhWFI1Ulc1bmFXNWxMa0p2ZUVOdmJHeHBaR1Z5TENCVmJtbDBlVVZ1WjJsdVpTd2dWbVZ5YzJsdmJqMHdMakF1TUM0d0xDQkRkV3gwZFhKbFBXNWxkWFJ5WVd3c0lGQjFZbXhwWTB0bGVWUnZhMlZ1UFc1MWJHd0FBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBZ0Q4QUFJQS9BQUNBUHdFQUFBQUFBRndBQUFCY0FBQUFWVzVwZEhsRmJtZHBibVV1VFdWemFGSmxibVJsY21WeUxDQlZibWwwZVVWdVoybHVaU3dnVm1WeWMybHZiajB3TGpBdU1DNHdMQ0JEZFd4MGRYSmxQVzVsZFhSeVlXd3NJRkIxWW14cFkwdGxlVlJ2YTJWdVBXNTFiR3dBQUFBQUFBQUFBUUFBQUFFQUFRQUFBQUFBQVFBQUFBQUNBQUFBQUFBQkFBQUFBQVFBQUFBRUFBQUFRbXgxWlFFQkFBQUFBQUFBQUFBQVd3QUFBRnNBQUFCR1UwVjRZVzF3YkdWekxsTnZiV1ZFWVhSaExDQkJjM05sYldKc2VTMURVMmhoY25Bc0lGWmxjbk5wYjI0OU1DNHdMakF1TUN3Z1EzVnNkSFZ5WlQxdVpYVjBjbUZzTENCUWRXSnNhV05MWlhsVWIydGxiajF1ZFd4c0FBQUFBQUFBQUFBQkFBQUFBQUFDQUFBQUFRQUFBQUFLQUFBQUNnQUFBRk52YldVZ1MyVjVJREhvQXdBQUFnQUFBQUFLQUFBQUNnQUFBRk52YldVZ1MyVjVJREx3QUFBQUF3QUFBQUFBQUFBQUFBSUFBQUFBQUFVQUFBRHcvLy8vOVJVQUFCb0FBQUNFRFFBQTVRSUFBQUFEQUFBQUFBQURBQUFBOWlob1F6T1BLRWVlN3doQ0FueWMrdjhDU0lqdi93RUFBQUFBQUFBQUFBQUFhQUFBQUdnQUFBQldaWGhsTGtaaGMzUlRZWFpsTGtaVFRXRnlhMlZ5TENCQmMzTmxiV0pzZVMxRFUyaGhjbkF0Wm1seWMzUndZWE56TENCV1pYSnphVzl1UFRBdU1DNHdMakFzSUVOMWJIUjFjbVU5Ym1WMWRISmhiQ3dnVUhWaWJHbGpTMlY1Vkc5clpXNDliblZzYkFBQUFBQUFBQUFB ---- !u!4 &1376626300 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1376626298} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 40.502647, y: 27.11774, z: 1.8959446} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 3 ---- !u!1 &1403682384 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1403682389} - - 33: {fileID: 1403682388} - - 65: {fileID: 1403682387} - - 23: {fileID: 1403682386} - - 114: {fileID: 1403682385} - - 114: {fileID: 1403682390} - m_Layer: 0 - m_Name: Marked1 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1403682385 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1403682384} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e16b5756b5b9274ba0e621e01843cc9, type: 3} - m_Name: - m_EditorClassIdentifier: - _id: -945064 - dbg: 0 - Prefs: - _Buckets: 00000000ffffffff01000000 - _HashCodes: 3b4fe661bc1a520600000000 - _Next: ffffffffffffffff00000000 - _Count: 2 - _Version: 4 - _FreeList: -1 - _FreeCount: 0 - _Keys: 3b4fe661bc1a528600000000 - _Values: - - ValueString: - ValueFloat: 4 - Type: 0 - - ValueString: - ValueFloat: 10 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - container: - _Buckets: 0000000001000000ffffffff - _HashCodes: 84f41c5285f41c5200000000 - _Next: ffffffffffffffff00000000 - _Count: 2 - _Version: 76939 - _FreeList: -1 - _FreeCount: 0 - _Keys: - - Some Key 1 - - Some Key 2 - - - _Values: e8030000f000000000000000 - stringField: - intArray: f0fffffff51500001a000000840d0000e5020000 - floatList: - - 232.16 - - 43151.2 - - 34.234 - testRenderer: {fileID: 834950436} - testGameObject: {fileID: 1081347494} - testPrefab: {fileID: 106520, guid: 66fbf79b06b9dfe4d953ef8e6884a68e, type: 2} ---- !u!23 &1403682386 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1403682384} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_Materials: - - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 1 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!65 &1403682387 -BoxCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1403682384} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!33 &1403682388 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1403682384} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &1403682389 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1403682384} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 45.19, y: 27.3, z: 0.87} - m_LocalScale: {x: 3.162766, y: 3.1627655, z: 3.1627655} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 ---- !u!114 &1403682390 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1403682384} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 100e8ebedf872b54b93bc241c4dae51d, type: 3} - m_Name: - m_EditorClassIdentifier: - _id: -1385718 - dbg: 0 - Prefs: - _Buckets: ffffffffffffffffffffffff - _HashCodes: 000000000000000000000000 - _Next: 000000000000000000000000 - _Count: 0 - _Version: 0 - _FreeList: -1 - _FreeCount: 0 - _Keys: 000000000000000000000000 - _Values: - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - - ValueString: - ValueFloat: 0 - Type: 0 - _SerializedList: - - UnityEngine.Transform, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - UnityEngine.MeshFilter, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - UnityEngine.BoxCollider, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - UnityEngine.MeshRenderer, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - FSExamples.SomeData, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - Vexe.FastSave.FSMarker, Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, - PublicKeyToken=null ---- !u!1 &1943119758 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1943119762} - - 33: {fileID: 1943119761} - - 136: {fileID: 1943119760} - - 23: {fileID: 1943119759} - m_Layer: 0 - m_Name: Non Marked - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!23 &1943119759 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1943119758} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 1 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!136 &1943119760 -CapsuleCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1943119758} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - m_Radius: 0.5 - m_Height: 2 - m_Direction: 1 - m_Center: {x: 0, y: 0, z: 0} ---- !u!33 &1943119761 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1943119758} - m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &1943119762 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1943119758} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 44.57235, y: 31.451, z: 9.23} - m_LocalScale: {x: 3.5338676, y: 3.5338662, z: 3.5338662} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 6 diff --git a/Assets/VFW Examples/FastSave Examples/Marked/Marked Test.unity.meta b/Assets/VFW Examples/FastSave Examples/Marked/Marked Test.unity.meta deleted file mode 100644 index 0a30ea6..0000000 --- a/Assets/VFW Examples/FastSave Examples/Marked/Marked Test.unity.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8b9cb4c71e932b04b925951a9236d7df -timeCreated: 1436630505 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Examples/FastSave Examples/Marked/MarkedTest.cs b/Assets/VFW Examples/FastSave Examples/Marked/MarkedTest.cs deleted file mode 100644 index 93a9e3d..0000000 --- a/Assets/VFW Examples/FastSave Examples/Marked/MarkedTest.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using UnityEngine; -using Vexe.FastSave; -using Vexe.Runtime.Types; - -namespace FSExamples -{ - public class MarkedTest : BaseBehaviour - { - [HideInInspector] - public string output; - - [Show] void SaveMarked() - { - output = Save.MarkedToMemory().GetString(); - } - - [Show] void LoadMarked() - { - Load.MarkedFromMemory(output.GetBytes()); - } - } -} diff --git a/Assets/VFW Examples/FastSave Examples/Marked/MarkedTest.cs.meta b/Assets/VFW Examples/FastSave Examples/Marked/MarkedTest.cs.meta deleted file mode 100644 index b841b16..0000000 --- a/Assets/VFW Examples/FastSave Examples/Marked/MarkedTest.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a4c06ddd31990a8459309aa5855dd23e -timeCreated: 1436627927 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Examples/FastSave Examples/SomeData.cs b/Assets/VFW Examples/FastSave Examples/SomeData.cs deleted file mode 100644 index fd9ce32..0000000 --- a/Assets/VFW Examples/FastSave Examples/SomeData.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using Vexe.Runtime.Types; - -namespace FSExamples -{ - public class SomeData : BaseBehaviour - { - public Container container; - public string stringField; - public int[] intArray; - public List floatList; - public MeshRenderer testRenderer; - public GameObject testGameObject; - public GameObject testPrefab; - - [Serializable] - public class Container : SerializableDictionary { } - } -} diff --git a/Assets/VFW Examples/FastSave Examples/SomeData.cs.meta b/Assets/VFW Examples/FastSave Examples/SomeData.cs.meta deleted file mode 100644 index cc6c795..0000000 --- a/Assets/VFW Examples/FastSave Examples/SomeData.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4e16b5756b5b9274ba0e621e01843cc9 -timeCreated: 1436628730 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VFW Examples/Scripts/Attributes/InlineExample.cs b/Assets/VFW Examples/Scripts/Attributes/InlineExample.cs index fc81e66..fd6f1ac 100644 --- a/Assets/VFW Examples/Scripts/Attributes/InlineExample.cs +++ b/Assets/VFW Examples/Scripts/Attributes/InlineExample.cs @@ -6,7 +6,7 @@ namespace VFWExamples // only the types in this example are currently supported for inlining. // if you want to add support to more built-in types, have a look at InlineDrawer, // it's very simple to do so... - [HasRequirements] + //[HasRequirements] public class InlineExample : BaseBehaviour { [Inline] public Transform trans;