public static EditorCache SaveCanvas(string filePath, bool createCopy, EditorCache cache)
        {
            if (!ValidPath(ref filePath))
            {
                Debug.LogError("the file path: " + filePath + ", does not exist");
                return(cache);
            }
            Reset();

            if (createCopy)
            {
                CopyRefs(cache);
                cache = ReplaceSO(cache) as EditorCache;
                ReplaceRefs(cache);
            }
            SaveAsset(cache, filePath);

            foreach (ScriptableObject objRef in cache.GetAllReferences(true))
            {
                if (!objRef)
                {
                    throw new UnityException("' " + objRef.GetType() + "' Database is missing reference. Cannot save the dialogue canvas.");
                }
                SaveRefs(objRef, cache, false);
            }
            DialogueEditorGUI.Save();
            return(cache);
        }
Beispiel #2
0
        public static bool ValidateCanvas(EditorCache cache)
        {
            if (!cache)
            {
                Debug.LogError("Validation failed. No fking cache mate");
                return(false);
            }

            if (string.IsNullOrEmpty(cache.CanvasName))
            {
                Debug.LogError("Validation failed. This Cache does not have a name.");
                return(false);
            }

            if (cache.States == null)
            {
                cache.states = new EditorStates(cache);
                //Debug.LogError ("Validation failed. This Cache does not have a EditorStates reference");
                //return false;
            }

            foreach (ScriptableObject obj in cache.GetAllReferences(true))
            {
                if (!obj)
                {
                    Debug.LogError("Validation failed. The reference object '" + obj.GetType().Name + "' is missing reference.");
                    return(false);
                }

                if (!obj.name.Contains(cache.CanvasName))
                {
                    Debug.LogError("Validation failed. The reference object '" + obj.GetType().Name + "' does not match the cache.");
                    return(false);
                }
                //if (!cache.ValidateObject (obj))
                //    return false;
            }
            return(true);
        }