Ejemplo n.º 1
0
        static void CreateNewGraph()
        {
            var    root = AssetCreator.CreateAsset <DialogueGraph>();
            string name = root.Name;

            root.Name = "DialogueRoot";
            root.EditorInit(null, Vector2.zero);
            root.Name = name;

            ConversationFlow c      = new ConversationFlow();
            SimpleEvent      onOpen = AssetCreator.CreateAsset <SimpleEvent>(root);

            onOpen.Name = c.EVENT_NAME;
            onOpen.EditorInit(root, new Vector2(0, -50));
            onOpen.CanCopy   = false;
            onOpen.CanDelete = false;
            root.Nodes.Add(onOpen);

            AmbientDialogue a      = new AmbientDialogue();
            SimpleEvent     onBark = AssetCreator.CreateAsset <SimpleEvent>(root);

            onBark.Name = a.EVENT_NAME;
            onBark.EditorInit(root, new Vector2(0, 50));
            onBark.CanCopy   = false;
            onBark.CanDelete = false;
            root.Nodes.Add(onBark);
        }
Ejemplo n.º 2
0
        void OnGUI()
        {
            RunemarkGUI.inspectorTitle.Draw("Dialogue System UI Globals", "");

            // If globals doesn't exists create new one.
            if (_globals == null)
            {
                float w = position.width;
                float h = position.height;
                Rect  r = new Rect(20, 60, w - 40, 30);

                EditorGUI.HelpBox(r, "You have to create a new Dialogue System Global asset. ", MessageType.Warning);
                r.y += r.height + 10;
                if (GUI.Button(r, "Create"))
                {
                    string path = EditorUtility.SaveFilePanelInProject(
                        "Create a new Dialogue System Global asset",
                        "Dialogue System Global.asset",
                        "asset", ""
                        );
                    // Check if the path is a Resources folder.
                    if (!path.Contains("Resources"))
                    {
                        var    pathArr  = path.Split('/').ToList();
                        string filename = pathArr[pathArr.Count - 1];
                        pathArr.RemoveAt(pathArr.Count - 1);
                        path = string.Join("/", pathArr.ToArray());

                        if (!Directory.Exists(path + "/Resources"))
                        {
                            AssetDatabase.CreateFolder(path, "Resources");
                        }

                        path = path + "/Resources";
                        path = path + "/" + filename;
                    }
                    RunemarkDebug.Log("Dialogue System Global created. Path: " + path);
                    _globals = AssetCreator.CreateAsset <DialogueSystemGlobals>(path);
                    OnEnable();
                }
                return;
            }

            Rect rectLeft  = new Rect(5, 45, 250, this.position.height - 50);
            Rect rectRight = new Rect(265, 45, position.width - 275, this.position.height - 50);

            EditorGUI.BeginChangeCheck();

            _variableList.Draw(rectLeft);

            VariableEditor.OnInspectorGUI(rectRight, _selected);

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(_globals);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 创建故事树
        /// </summary>
        private void CreateStoryTree()
        {
            StoryTree storyTree = AssetCreator <StoryTree> .CreateAsset(ConfigInfo.StoryTreeFolder, "Story");

            if (storyTree != null)
            {
                OpenStoryTree(storyTree);
                AssetDatabase.Refresh();
            }
        }
        /// <summary>
        /// 创建故事
        /// </summary>
        private static void CreateStory()
        {
            ScriptableStory story = AssetCreator <ScriptableStory> .CreateAsset(Config.StoryResourcesFolder, "Story");

            if (story != null)
            {
                OpenStory(story);
                AssetDatabase.Refresh();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 创建节点资源
        /// </summary>
        /// <param name="type"></param>
        private void CreateStoryNodeContent(StoryNode node)
        {
            StoryContent Content = AssetCreator <StoryContent> .CreateAsset(ConfigInfo.StoryContentFolder, node.name);

            if (Content != null)
            {
                node.Content           = Content;
                Selection.activeObject = Content;
            }
            RefreshStoryNodeHeight(node);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 创建故事节点
        /// </summary>
        private void CreateStoryNode(StoryTree tree)
        {
            StoryNode storyNode = AssetCreator <StoryNode> .CreateAsset(ConfigInfo.StoryNodeFolder, tree.name);

            if (storyNode != null)
            {
                storyNode.Rect = new Rect(m_MousePos.x, m_MousePos.y, ConfigInfo.DefaultNodeSize.x, ConfigInfo.DefaultNodeSize.y);
                if (tree.Nodes == null)
                {
                    tree.Nodes = new List <StoryNode>();
                }
                tree.Nodes.Add(storyNode);
                Selection.activeObject = storyNode;
            }
        }
        /// <summary>
        /// 创建节点内容
        /// </summary>
        /// <param name="type"></param>
        private static void CreateContent()
        {
            if (CurrentStory.Nodes.Contains(CurrentNode))
            {
                ScriptableContent storyContent = AssetCreator <ScriptableContent> .CreateAsset(Config.StoryResourcesFolder, "Content");

                if (storyContent != null)
                {
                    CurrentNode.Content    = storyContent;
                    Selection.activeObject = storyContent;
                    RefreshNodeHeight(CurrentNode);
                }
            }
            else
            {
                Debug.LogWarning("未指定节点");
            }
        }
Ejemplo n.º 8
0
        // Create new graph
        //[MenuItem("Assets/Create/Runemark/Visual Editor/New Graph")]
        static void CreateNewGraph()
        {
            var root = AssetCreator.CreateAsset <FunctionGraph>();

            SimpleEvent onEnter = AssetCreator.CreateAsset <SimpleEvent>(root);

            onEnter.Name = "OnEnter";
            onEnter.EditorInit(root, new Vector2(0, -50));
            onEnter.CanCopy   = false;
            onEnter.CanDelete = false;
            root.Nodes.Add(onEnter);

            SimpleEvent onExit = AssetCreator.CreateAsset <SimpleEvent>(root);

            onExit.Name = "OnExit";
            onExit.EditorInit(root, new Vector2(0, 50));
            onExit.CanCopy   = false;
            onExit.CanDelete = false;
            root.Nodes.Add(onExit);
        }
Ejemplo n.º 9
0
        private void SelectDatabase()
        {
            string searchString = "Search...";

            LoginConfigurations[] databases = UnityEditorUtility.FindAssets <LoginConfigurations>();

            UtilityInstanceWindow.ShowWindow("Select Configuration", delegate() {
                searchString = UnityEditorUtility.SearchField(searchString);

                for (int i = 0; i < databases.Length; i++)
                {
                    if (!string.IsNullOrEmpty(searchString) && !searchString.Equals("Search...") && !databases[i].name.Contains(searchString))
                    {
                        continue;
                    }
                    databases[i].settings = databases[i].settings.OrderBy(x => x.Order).ToList();

                    GUIStyle style = new GUIStyle("button");
                    style.wordWrap = true;
                    if (GUILayout.Button(AssetDatabase.GetAssetPath(databases[i]), style))
                    {
                        database = databases[i];
                        ResetChildEditors();
                        Show();
                        UtilityInstanceWindow.CloseWindow();
                    }
                }
                GUILayout.FlexibleSpace();
                Color color         = GUI.backgroundColor;
                GUI.backgroundColor = Color.green;
                if (GUILayout.Button("Create"))
                {
                    LoginConfigurations db = AssetCreator.CreateAsset <LoginConfigurations>(true);
                    if (db != null)
                    {
                        ArrayUtility.Add <LoginConfigurations>(ref databases, db);
                    }
                }
                GUI.backgroundColor = color;
            });
        }
Ejemplo n.º 10
0
        public List <Node> NodeCreate(string name, System.Type type, System.Type subtype = null)
        {
            UnityEngine.Object o = _loadedGraph as FunctionGraph;
            if (o == null)
            {
                o = _loadedGraph as MacroGraph;
            }
            if (o == null)
            {
                RunemarkDebug.Error("Can't create node in the opened graph, since its not a INodeCollection");
                return(new List <Node>());
            }

            var node = (Node)AssetCreator.CreateAsset(name, type, o);

            node.EditorInit(_loadedGraph, _zoomArea.AbsolutePosition(_lastMousePosition), subtype);
            _loadedGraph.Nodes.Add(node);
            CreateLayout(node);
            Repaint();
            return(new List <Node>()
            {
                node
            });
        }
Ejemplo n.º 11
0
        private void TryCreateObject(Type targetType)
        {
            //Check if the current path or name is invalid
            bool invalidName = string.IsNullOrEmpty(currentTargetName);
            bool invalidPath = !currentTargetPath.Contains(Application.dataPath);

            if (invalidName)
            {
                Debug.LogError("Cannot create an asset without a given name.");
                currentTargetName = "INVALID NAME";
            }

            if (invalidPath)
            {
                Debug.LogError("Invalid path given.");
                currentTargetPath = "INVALID PATH";
            }

            //Create the asset
            if (!invalidName && !invalidPath)
            {
                AssetCreator.CreateAsset(targetType, currentTargetName, currentTargetPath);
            }
        }
Ejemplo n.º 12
0
 public static void NewMovement()
 {
     AssetCreator.CreateAsset <MovementSpell>(BASE_FOLDER_NAME + "Movement");
 }
Ejemplo n.º 13
0
 public static void NewUseableItem()
 {
     AssetCreator.CreateAsset <UseableItem>(BASE_FOLDER_NAME + "Items/Useable");
 }
Ejemplo n.º 14
0
 public static void NewAttackAnimation()
 {
     AssetCreator.CreateAsset <AttackAnimation>(BASE_FOLDER_NAME + "Animations/Attack");
 }
Ejemplo n.º 15
0
 public static void CreateStoryNodeAsset()
 {
     AssetCreator <StoryNode> .CreateAsset();
 }
Ejemplo n.º 16
0
 public static void NewBiom()
 {
     AssetCreator.CreateAsset <BiomScriptableObject>(BASE_FOLDER_NAME + "Biom");
 }
Ejemplo n.º 17
0
 private static void Create()
 {
     AssetCreator.CreateAsset <EnemyDatabase>("Enemy Database");
 }
Ejemplo n.º 18
0
 public static void NewMovement()
 {
     AssetCreator.CreateAsset <BaseBuildingBlock>(BASE_FOLDER_NAME + "Building");
 }
Ejemplo n.º 19
0
 public static void NewEquipableItem()
 {
     AssetCreator.CreateAsset <EquipableItem>(BASE_FOLDER_NAME + "Items/Equipable");
 }
Ejemplo n.º 20
0
 public static void CreateStoryTreeAsset()
 {
     AssetCreator <StoryTree> .CreateAsset();
 }
Ejemplo n.º 21
0
 public static void NewInventoryItem()
 {
     AssetCreator.CreateAsset <InventoryItem>(BASE_FOLDER_NAME + "Items/Default");
 }
Ejemplo n.º 22
0
 public static void CreateStoryContentAsset()
 {
     AssetCreator <StoryContent> .CreateAsset();
 }
Ejemplo n.º 23
0
 public static void NewItemAnimation()
 {
     AssetCreator.CreateAsset <MoveAnimation>(BASE_FOLDER_NAME + "Animations/Movement");
 }