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); }
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); } }
/// <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(); } }
/// <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); }
/// <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("未指定节点"); } }
// 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); }
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; }); }
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 }); }
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); } }
public static void NewMovement() { AssetCreator.CreateAsset <MovementSpell>(BASE_FOLDER_NAME + "Movement"); }
public static void NewUseableItem() { AssetCreator.CreateAsset <UseableItem>(BASE_FOLDER_NAME + "Items/Useable"); }
public static void NewAttackAnimation() { AssetCreator.CreateAsset <AttackAnimation>(BASE_FOLDER_NAME + "Animations/Attack"); }
public static void CreateStoryNodeAsset() { AssetCreator <StoryNode> .CreateAsset(); }
public static void NewBiom() { AssetCreator.CreateAsset <BiomScriptableObject>(BASE_FOLDER_NAME + "Biom"); }
private static void Create() { AssetCreator.CreateAsset <EnemyDatabase>("Enemy Database"); }
public static void NewMovement() { AssetCreator.CreateAsset <BaseBuildingBlock>(BASE_FOLDER_NAME + "Building"); }
public static void NewEquipableItem() { AssetCreator.CreateAsset <EquipableItem>(BASE_FOLDER_NAME + "Items/Equipable"); }
public static void CreateStoryTreeAsset() { AssetCreator <StoryTree> .CreateAsset(); }
public static void NewInventoryItem() { AssetCreator.CreateAsset <InventoryItem>(BASE_FOLDER_NAME + "Items/Default"); }
public static void CreateStoryContentAsset() { AssetCreator <StoryContent> .CreateAsset(); }
public static void NewItemAnimation() { AssetCreator.CreateAsset <MoveAnimation>(BASE_FOLDER_NAME + "Animations/Movement"); }