mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-01-06 20:27:40 +00:00
Remove unused custom type resolver.
This commit is contained in:
parent
36d7de5692
commit
2383fdfade
|
@ -961,10 +961,7 @@ class Save
|
||||||
*/
|
*/
|
||||||
static function loadFromSlot(slot:Int):Save
|
static function loadFromSlot(slot:Int):Save
|
||||||
{
|
{
|
||||||
trace("[SAVE] Loading save from slot " + slot + "...");
|
trace('[SAVE] Loading save from slot $slot...');
|
||||||
|
|
||||||
// Prevent crashes if the save data is corrupted.
|
|
||||||
SerializerUtil.initSerializer();
|
|
||||||
|
|
||||||
FlxG.save.bind('$SAVE_NAME${slot}', SAVE_PATH);
|
FlxG.save.bind('$SAVE_NAME${slot}', SAVE_PATH);
|
||||||
|
|
||||||
|
|
|
@ -63,31 +63,6 @@ class SerializerUtil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function initSerializer():Void
|
|
||||||
{
|
|
||||||
haxe.Unserializer.DEFAULT_RESOLVER = new FunkinTypeResolver();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serialize a Haxe object using the built-in Serializer.
|
|
||||||
* @param input The object to serialize
|
|
||||||
* @return The serialized object as a string
|
|
||||||
*/
|
|
||||||
public static function fromHaxeObject(input:Dynamic):String
|
|
||||||
{
|
|
||||||
return haxe.Serializer.run(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a serialized Haxe object back into a Haxe object.
|
|
||||||
* @param input The serialized object as a string
|
|
||||||
* @return The deserialized object
|
|
||||||
*/
|
|
||||||
public static function toHaxeObject(input:String):Dynamic
|
|
||||||
{
|
|
||||||
return haxe.Unserializer.run(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customize how certain types are serialized when converting to JSON.
|
* Customize how certain types are serialized when converting to JSON.
|
||||||
*/
|
*/
|
||||||
|
@ -115,26 +90,3 @@ class SerializerUtil
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class FunkinTypeResolver
|
|
||||||
{
|
|
||||||
public function new()
|
|
||||||
{
|
|
||||||
// Blank constructor.
|
|
||||||
}
|
|
||||||
|
|
||||||
public function resolveClass(name:String):Class<Dynamic>
|
|
||||||
{
|
|
||||||
if (name == 'Dynamic')
|
|
||||||
{
|
|
||||||
FlxG.log.warn('Found invalid class type in save data, indicates partial save corruption.');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return Type.resolveClass(name);
|
|
||||||
};
|
|
||||||
|
|
||||||
public function resolveEnum(name:String):Enum<Dynamic>
|
|
||||||
{
|
|
||||||
return Type.resolveEnum(name);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue