Skip to content

Instantly share code, notes, and snippets.

@bamboo
Created April 4, 2011 22:06
Show Gist options
  • Save bamboo/902563 to your computer and use it in GitHub Desktop.
Save bamboo/902563 to your computer and use it in GitHub Desktop.
package UnityEngine.Serialization {
class ActionScriptDeserializer {
public static function Deserialize(instance: IDeserializable, buffer: ByteArray, offset: int): int {
var reader = new SerializedStateReader(buffer, offset);
instance.Deserialize(reader);
return reader.offset;
}
}
interface IDeserializable {
function Deserialize(state: SerializedStateReader): void
}
class SerializedStateReader {
public function ReadFloat(): Number {
return ...
}
public function ReadInt(): int {
return ...
}
}
}
class Foo extends MonoBehaviour implements IDeserializable {
public var i : int;
function Deserialize(reader: SerializedStateReader) {
i = reader.ReadInt();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment