上传YomovSDK
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
namespace Newtonsoft.Json.UnityConverters.Configuration
|
||||
{
|
||||
public enum ConfigType
|
||||
{
|
||||
Boolean,
|
||||
Integer,
|
||||
Number,
|
||||
Text,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ce9e326b060ce44aa786589489ee7a5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Newtonsoft.Json.UnityConverters.Configuration
|
||||
{
|
||||
#pragma warning disable CA2235 // Mark all non-serializable fields
|
||||
[Serializable]
|
||||
[System.Diagnostics.DebuggerDisplay("{converterName}, enabled={enabled}")]
|
||||
public struct ConverterConfig : IEquatable<ConverterConfig>
|
||||
{
|
||||
public bool enabled;
|
||||
|
||||
public string converterName;
|
||||
|
||||
public string converterAssembly;
|
||||
|
||||
public List<KeyedConfig> settings;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{{enabled={enabled}, converterName={converterName}, assembly={converterAssembly}, settings=[{settings?.Count ?? 0}]}}";
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is ConverterConfig config && Equals(config);
|
||||
}
|
||||
|
||||
public bool Equals(ConverterConfig other)
|
||||
{
|
||||
return enabled == other.enabled &&
|
||||
converterName == other.converterName &&
|
||||
converterAssembly == other.converterAssembly &&
|
||||
EqualityComparer<List<KeyedConfig>>.Default.Equals(settings, other.settings);
|
||||
}
|
||||
|
||||
#pragma warning disable S2328 // "GetHashCode" should not reference mutable fields
|
||||
public override int GetHashCode()
|
||||
#pragma warning restore S2328 // "GetHashCode" should not reference mutable fields
|
||||
{
|
||||
int hashCode = 913629501;
|
||||
hashCode = hashCode * -1521134295 + enabled.GetHashCode();
|
||||
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(converterName);
|
||||
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(converterAssembly);
|
||||
hashCode = hashCode * -1521134295 + EqualityComparer<List<KeyedConfig>>.Default.GetHashCode(settings);
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
public static bool operator ==(ConverterConfig left, ConverterConfig right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(ConverterConfig left, ConverterConfig right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
}
|
||||
#pragma warning restore CA2235 // Mark all non-serializable fields
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 350f8e6a924e9204093fe7f43a7d3d52
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Newtonsoft.Json.UnityConverters.Configuration
|
||||
{
|
||||
#pragma warning disable CA2235 // Mark all non-serializable fields
|
||||
[Serializable]
|
||||
public struct KeyedConfig : IEquatable<KeyedConfig>
|
||||
{
|
||||
public string key;
|
||||
|
||||
public ConfigType type;
|
||||
|
||||
public bool boolean;
|
||||
|
||||
public int integer;
|
||||
|
||||
public float number;
|
||||
|
||||
public string text;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is KeyedConfig config && Equals(config);
|
||||
}
|
||||
|
||||
public bool Equals(KeyedConfig other)
|
||||
{
|
||||
if (type != other.type)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case ConfigType.Boolean:
|
||||
return boolean == other.boolean;
|
||||
case ConfigType.Integer:
|
||||
return integer == other.integer;
|
||||
case ConfigType.Number:
|
||||
return Mathf.Approximately(number, other.number);
|
||||
case ConfigType.Text:
|
||||
return text == other.text;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable S2328 // "GetHashCode" should not reference mutable fields
|
||||
public override int GetHashCode()
|
||||
#pragma warning restore S2328 // "GetHashCode" should not reference mutable fields
|
||||
{
|
||||
int hashCode = 910641971;
|
||||
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(key);
|
||||
hashCode = hashCode * -1521134295 + type.GetHashCode();
|
||||
hashCode = hashCode * -1521134295 + boolean.GetHashCode();
|
||||
hashCode = hashCode * -1521134295 + integer.GetHashCode();
|
||||
hashCode = hashCode * -1521134295 + number.GetHashCode();
|
||||
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(text);
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
public static bool operator ==(KeyedConfig left, KeyedConfig right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(KeyedConfig left, KeyedConfig right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
}
|
||||
#pragma warning restore CA2235 // Mark all non-serializable fields
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b1b9bbba08d40c46a4e29422663b731
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Newtonsoft.Json.UnityConverters.Configuration
|
||||
{
|
||||
|
||||
#pragma warning disable CA2235 // Mark all non-serializable fields
|
||||
[Serializable]
|
||||
public sealed class UnityConvertersConfig : ScriptableObject
|
||||
{
|
||||
internal const string PATH = "Assets/Resources/Newtonsoft.Json-for-Unity.Converters.asset";
|
||||
internal const string PATH_FOR_RESOURCES_LOAD = "Newtonsoft.Json-for-Unity.Converters";
|
||||
|
||||
public bool useUnityContractResolver = true;
|
||||
|
||||
public bool useAllOutsideConverters = true;
|
||||
|
||||
public List<ConverterConfig> outsideConverters = new List<ConverterConfig>();
|
||||
|
||||
public bool useAllUnityConverters = true;
|
||||
|
||||
public List<ConverterConfig> unityConverters = new List<ConverterConfig>();
|
||||
|
||||
public bool useAllJsonNetConverters;
|
||||
|
||||
public List<ConverterConfig> jsonNetConverters = new List<ConverterConfig> {
|
||||
new ConverterConfig { converterName = typeof(StringEnumConverter).FullName, enabled = true },
|
||||
new ConverterConfig { converterName = typeof(VersionConverter).FullName, enabled = true },
|
||||
};
|
||||
|
||||
public bool autoSyncConverters = true;
|
||||
}
|
||||
#pragma warning restore CA2235 // Mark all non-serializable fields
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce56e4dbb13e1644aa983b6dd170e4a7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user