public void AddBranch(ScenimaticSerializedNode newBranch)
        {
            EventBranchObjectData node = new EventBranchObjectData(newBranch, this);

            branchEntityDatas.Add(node);
            script.branches.Add(newBranch);
        }
        public void Initialize(ScenimaticScript newScript)
        {
            refreshConnections = new List <ConnectionPoint>();
            connectionPoints   = new Dictionary <string, ConnectionPoint>();
            script             = newScript;

            CreateBranchEditorWindow();

            zoomerSettings            = new ZoomerSettings();
            zoomerSettings.zoomOrigin = script.zoomOrigin;
            zoomerSettings.zoomScale  = script.zoomScale > ZoomWindow.MIN_ZOOM ? script.zoomScale : 1;

            if (!string.IsNullOrEmpty(script.spriteAtlas))
            {
                string[] matches = AssetDatabase.FindAssets(script.spriteAtlas);
                foreach (var match in matches)
                {
                    string path = AssetDatabase.GUIDToAssetPath(match);

                    if (Path.GetExtension(path) != ".spriteatlas")
                    {
                        Debug.Log(path + " not a spriteatlas");
                    }
                    else
                    {
                        spriteAtlas = AssetDatabase.LoadAssetAtPath <SpriteAtlas>(path);
                        break;
                    }
                }
            }

            ConnectionPoint.nodeGraph = this;

            inputNode         = new ScriptGatewayNodeData(this, newScript.inputNode);
            outputNode        = new ScriptGatewayNodeData(this, newScript.outputNode);
            branchEntityDatas = new List <GraphEntityData>();
            for (int i = 0; i < script.branches.Count; ++i)
            {
                ScenimaticSerializedNode branchData = script.branches[i];
                EventBranchObjectData    node       = new EventBranchObjectData(branchData, this);
                branchEntityDatas.Add(node);
            }


            if (script.lastSelectedNode < 0 || script.lastSelectedNode >= branchEntityDatas.Count)
            {
                SelectEntity(inputNode);
            }
            else
            {
                SelectEntity(branchEntityDatas[script.lastSelectedNode]);
            }
        }
 public EventBranchNodeWindow(EventBranchObjectData nodeData, INodeGraph graph) : base(nodeData, graph)
 {
     branch = nodeData.serializedNode.data;
 }