|
|
@@ -12,49 +12,6 @@ namespace ET
|
|
|
{
|
|
|
public static class MongoHelper
|
|
|
{
|
|
|
- static MongoHelper()
|
|
|
- {
|
|
|
- // 自动注册IgnoreExtraElements
|
|
|
-
|
|
|
- ConventionPack conventionPack = new ConventionPack { new IgnoreExtraElementsConvention(true) };
|
|
|
-
|
|
|
- ConventionRegistry.Register("IgnoreExtraElements", conventionPack, type => true);
|
|
|
-
|
|
|
-#if SERVER
|
|
|
- BsonSerializer.RegisterSerializer(typeof(Vector3), new StructBsonSerialize<Vector3>());
|
|
|
- BsonSerializer.RegisterSerializer(typeof(Vector4), new StructBsonSerialize<Vector4>());
|
|
|
- BsonSerializer.RegisterSerializer(typeof(Quaternion), new StructBsonSerialize<Quaternion>());
|
|
|
-#elif ROBOT
|
|
|
- BsonSerializer.RegisterSerializer(typeof(Quaternion), new StructBsonSerialize<Quaternion>());
|
|
|
- BsonSerializer.RegisterSerializer(typeof(Vector3), new StructBsonSerialize<Vector3>());
|
|
|
- BsonSerializer.RegisterSerializer(typeof(Vector4), new StructBsonSerialize<Vector4>());
|
|
|
-#else
|
|
|
- BsonSerializer.RegisterSerializer(typeof (Vector4), new StructBsonSerialize<Vector4>());
|
|
|
- BsonSerializer.RegisterSerializer(typeof (Vector3), new StructBsonSerialize<Vector3>());
|
|
|
-#endif
|
|
|
-
|
|
|
- var types = Game.EventSystem.GetTypes();
|
|
|
-
|
|
|
- foreach (Type type in types)
|
|
|
- {
|
|
|
- if (!type.IsSubclassOf(typeof (Object)))
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- if (type.IsGenericType)
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- BsonClassMap.LookupClassMap(type);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static void Init()
|
|
|
- {
|
|
|
- }
|
|
|
-
|
|
|
public static string ToJson(object obj)
|
|
|
{
|
|
|
return obj.ToJson();
|