示例#1
0
    public ConversationNode addNode(string name, int x, int y)
    {
        ConversationNode conversationNode = ScriptableObject.CreateInstance <ConversationNode> ();

        GameObject newGO = new GameObject();

        newGO.name = name;

        ConversationGenerator newConversation = newGO.AddComponent <ConversationGenerator> ();

        newConversation.initialize();
        newConversation.reset();
        newConversation.addProgram();
        newConversation.addEvent();

        newConversation.windowX = x;
        newConversation.windowY = y;

        conversationNode.folder      = folder;
        conversationNode.windowTitle = name;
        conversationNode.windowRect  = new Rect(x, y, 300, 360);
        conversationNode.root        = newConversation;
        conversationNode.rootGO      = newGO;
        conversationNode.theEditor   = this;
        windows.Add(conversationNode);

        PrefabUtility.SaveAsPrefabAssetAndConnect(newGO, "Assets/Resources/Prefabs/NodeEditorObjects/" + folder + "/" + name + ".prefab", InteractionMode.AutomatedAction);

        return(conversationNode);
    }
示例#2
0
    void ContextCallback(object obj)
    {
        string clb = obj.ToString();


        if (clb.Equals("conversationNode"))
        {
            GameObject            newGO = new GameObject();
            ConversationGenerator wo    = newGO.AddComponent <ConversationGenerator> ();
            wo.initialize();
            wo.reset();
            wo.addEvent();
            wo.addProgram();
            wo.registerEventName("none");              // to be altered later

            ObjectNode objectNode = ScriptableObject.CreateInstance <ObjectNode> ();
            objectNode.initialize();

            objectNode.currentFolder = currentFolder;
            objectNode.windowTitle   = "New Conversation";
            objectNode.windowRect    = new Rect(mousePos.x, mousePos.y, 200, 240);
            objectNode.theObject     = newGO;
            objectNode.theWO         = wo;

            objectNode.theWO.isRoot = true;

            windows.Add(objectNode);
        }
    }