OpenDeserialize() 공개 메소드

public OpenDeserialize ( byte bytes ) : bool
bytes byte
리턴 bool
	public void DeserializeGraphs (byte[] bytes) {
		
		AstarPath.active.AddWorkItem (new AstarPath.AstarWorkItem (delegate (bool force) {
			Pathfinding.Serialization.AstarSerializer sr = new Pathfinding.Serialization.AstarSerializer(script.astarData);
			if (sr.OpenDeserialize(bytes)) {
				script.astarData.DeserializeGraphsPart (sr);
				
				//Make sure every graph has a graph editor
				CheckGraphEditors ();
				sr.DeserializeEditorSettings (graphEditors);
				
				sr.CloseDeserialize();
			} else {
				Debug.LogWarning ("Invalid data file (cannot read zip).\nThe data is either corrupt or it was saved using a 3.0.x or earlier version of the system");
				//Make sure every graph has a graph editor
				CheckGraphEditors ();
			}
			return true;
		}));
		
		//Make sure the above work item is run directly
		AstarPath.active.FlushWorkItems();
	}
예제 #2
0
	public void DeserializeGraphs (byte[] bytes) {
		
		Pathfinding.Serialization.AstarSerializer sr = new Pathfinding.Serialization.AstarSerializer(script.astarData);
		if (sr.OpenDeserialize(bytes)) {
			script.astarData.DeserializeGraphsPart (sr);
			
			//Make sure every graph has a graph editor
			CheckGraphEditors ();
			sr.DeserializeEditorSettings (graphEditors);
			
			sr.CloseDeserialize();
		} else {
			Debug.Log ("Invalid data file (cannot read zip). Trying to load with old deserializer (pre 3.1)...");
			AstarSerializer serializer = new AstarSerializer (script);
			script.astarData.DeserializeGraphs_oldInternal (serializer,bytes);
			
			//Make sure every graph has a graph editor
			CheckGraphEditors ();
		}
		
		
		/*serializer = serializer.OpenDeserialize (data);
		
		//Deserialize the main bulk of the data
		script.astarData.DeserializeGraphsPart (serializer);
		
		CheckGraphEditors ();
		
		//Deserialize editor data
		for (int i=0;i<script.graphs.Length;i++) {
			NavGraph graph = script.graphs[i];
			
			GraphEditor graphEditor = graphEditors[i];
			
			if (serializer.MoveToAnchor ("EditorSettings_"+i)) {
				ISerializableGraphEditor serializableEditor = graphEditor as ISerializableGraphEditor;
				if (serializableEditor != null) {
					//Set an unique prefix for all variables in this graph
					serializer.sPrefix = i.ToString ()+"E";
					serializer.DeSerializeEditorSettings (graph,serializableEditor,script);
					//serializableEditor.DeSerializeSettings (graph,serializer);
				}
			}
		}
		
		serializer.Close ();*/
		
		//script.astarData.DeserializeGraphs(data);
	}