//TODO: Move this in GraphSerializationData object Reconstruction? bool LoadGraphData(GraphSerializationData data, bool validate) { if (data == null) { Debug.LogError("Can't Load graph, cause of null GraphSerializationData provided"); return(false); } if (data.type != this.GetType()) { Debug.LogError("Can't Load graph, cause of different Graph type serialized and required"); return(false); } data.Reconstruct(this); //grab the final data and set fields directly this._name = data.name; this._comments = data.comments; this._translation = data.translation; this._zoomFactor = data.zoomFactor; this._nodes = data.nodes; this._primeNode = data.primeNode; this._canvasGroups = data.canvasGroups; this._localBlackboard = data.localBlackboard; //IMPORTANT: Validate should be called in all deserialize cases outside of Unity's 'OnAfterDeserialize', //like for example when loading from json, or manualy calling this outside of OnAfterDeserialize. if (validate) { Validate(); } return(true); }
bool LoadGraphData(GraphSerializationData data, bool validate) { if (data == null) { Debug.LogError("Can't Load graph, cause of null GraphSerializationData provided"); return(false); } if (data.type != this.GetType()) { Debug.LogError("Can't Load graph, cause of different Graph type serialized and required"); return(false); } data.Reconstruct(this); this._name = data.name; this._translation = data.translation; this._zoomFactor = data.zoomFactor; this._nodes = data.nodes; this._primeNode = data.primeNode; if (this is UIGraph) { UIGraph.uiDics = data.uiDic; } else if (this is GameStateGraph) { UIGraph.uiDics = data.uiDic; } return(true); }
//TODO: Move this in GraphSerializationData object Reconstruction? bool LoadGraphData(GraphSerializationData data) { if (data == null) { Debug.LogError("Can't Load graph, cause of null GraphSerializationData provided"); return(false); } if (data.type != this.GetType()) { Debug.LogError("Can't Load graph, cause of different Graph type serialized and required"); return(false); } data.Reconstruct(this); //grab the final data and set 'raw' this._name = data.name; this._comments = data.comments; this._translation = data.translation; this._nodes = data.nodes; this._primeNode = data.primeNode; this._canvasGroups = data.canvasGroups; this._localBlackboard = data.localBlackboard; Validate(); return(true); }