|
A* Pathfinding Project
3.6
The A* Pathfinding Project for Unity 3D
|
Handles low level serialization and deserialization of graph settings and data. More...
Handles low level serialization and deserialization of graph settings and data.
Public Member Functions | |
| AstarSerializer (AstarData data) | |
| AstarSerializer (AstarData data, SerializeSettings settings) | |
| void | AddChecksum (byte[] bytes) |
| void | CloseDeserialize () |
| byte[] | CloseSerialize () |
| void | DeserializeEditorSettings (GraphEditorBase[] graphEditors) |
| Deserializes graph editor settings. | |
| void | DeserializeExtraInfo () |
| Deserializes extra graph info. | |
| NavGraph[] | DeserializeGraphs () |
| Deserializes graph settings. | |
| void | DeserializeNodes () |
| Deserializes nodes. | |
| UserConnection[] | DeserializeUserConnections () |
| Deserializes manually created connections. | |
| uint | GetChecksum () |
| bool | OpenDeserialize (byte[] bytes) |
| void | OpenSerialize () |
| void | PostDeserialization () |
| byte[] | Serialize (NavGraph graph) |
| Serializes the graph settings to JSON and returns the data. | |
| void | SerializeEditorSettings (GraphEditorBase[] editors) |
| void | SerializeExtraInfo () |
| void | SerializeGraphs (NavGraph[] _graphs) |
| void | SerializeNodes () |
| void | SerializeUserConnections (UserConnection[] conns) |
Static Public Member Functions | |
| static byte[] | LoadFromFile (string path) |
| static void | SaveToFile (string path, byte[] data) |
Public Attributes | |
| JsonReaderSettings | readerSettings |
| JsonWriterSettings | writerSettings |
Private Member Functions | |
| GraphMeta | DeserializeMeta (ZipEntry entry) |
| void | DeserializeNodeConnections (int index, BinaryReader reader) |
| Deserializes node connections for a specified graph. | |
| void | DeserializeNodes (int index, BinaryReader reader) |
| Deserializes nodes for a specified graph. | |
| string | GetString (ZipEntry entry) |
| byte[] | SerializeMeta () |
| Serialize metadata about alll graphs. | |
| byte[] | SerializeNodeConnections (int index) |
| Serialize node connections for given graph index. | |
| byte[] | SerializeNodes (int index) |
Static Private Member Functions | |
| static System.Text.StringBuilder | GetStringBuilder () |
| Returns a cached StringBuilder. | |
Private Attributes | |
| const string | binaryExt = ".binary" |
| uint | checksum = 0xffffffff |
| AstarData | data |
| System.Text.UTF8Encoding | encoding =new System.Text.UTF8Encoding() |
| NavGraph[] | graphs |
| const string | jsonExt = ".json" |
| GraphMeta | meta |
| SerializeSettings | settings |
| MemoryStream | str |
| ZipFile | zip |
Static Private Attributes | |
| static System.Text.StringBuilder | _stringBuilder = new System.Text.StringBuilder() |
| AstarSerializer | ( | AstarData | data | ) |
| AstarSerializer | ( | AstarData | data, |
| SerializeSettings | settings | ||
| ) |
| void AddChecksum | ( | byte[] | bytes | ) |
| void CloseDeserialize | ( | ) |
| byte [] CloseSerialize | ( | ) |
| void DeserializeEditorSettings | ( | GraphEditorBase[] | graphEditors | ) |
Deserializes graph editor settings.
For future compatibility this method does not assume that the graphEditors array matches the graphs array in order and/or count. It searches for a matching graph (matching if graphEditor.target == graph) for every graph editor. Multiple graph editors should not refer to the same graph.
| void DeserializeExtraInfo | ( | ) |
Deserializes extra graph info.
Extra graph info is specified by the graph types.
| NavGraph [] DeserializeGraphs | ( | ) |
Deserializes graph settings.
|
private |
|
private |
Deserializes node connections for a specified graph.
| void DeserializeNodes | ( | ) |
Deserializes nodes.
Nodes can be saved to enable loading a full scanned graph from memory/file without scanning the graph first.
|
private |
Deserializes nodes for a specified graph.
| UserConnection [] DeserializeUserConnections | ( | ) |
Deserializes manually created connections.
Connections are created in the A* inspector.
| uint GetChecksum | ( | ) |
|
private |
|
staticprivate |
Returns a cached StringBuilder.
This function only has one string builder cached and should thus only be called from a single thread and should not be called while using an earlier got string builder.
|
static |
| bool OpenDeserialize | ( | byte[] | bytes | ) |
| void OpenSerialize | ( | ) |
| void PostDeserialization | ( | ) |
|
static |
| byte [] Serialize | ( | NavGraph | graph | ) |
Serializes the graph settings to JSON and returns the data.
| void SerializeEditorSettings | ( | GraphEditorBase[] | editors | ) |
| void SerializeExtraInfo | ( | ) |
| void SerializeGraphs | ( | NavGraph[] | _graphs | ) |
|
private |
Serialize metadata about alll graphs.
|
private |
Serialize node connections for given graph index.
Connections structure is as follows. Bracket structure has nothing to do with data, just how it is structured:
| void SerializeNodes | ( | ) |
|
private |
| void SerializeUserConnections | ( | UserConnection[] | conns | ) |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
| JsonReaderSettings readerSettings |
|
private |
|
private |
| JsonWriterSettings writerSettings |
|
private |