예제 #1
0
    public void drawSelectionConnectors()
    {
        float elementHeight = headerHeight + footerHeight + selectionConnectors.Count * selectionConnectorPrefab.GetComponent <RectTransform>().rect.height;

        GetComponent <RectTransform>().sizeDelta = new Vector2(NodeGraphicRect.rect.width, elementHeight);
        PageNodeGraphicManager.stackUIElements(selectionConnectors.ToArray(), GetComponent <RectTransform>(), headerHeight);
    }
예제 #2
0
    public GameObject addPageGraphic(Page page)
    {
        GameObject             go   = GameObject.Instantiate(AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Prefabs/StoryEditor/NodeGraphic_Mk2.prefab"), gm.scrollContent);
        PageNodeGraphicManager pngm = go.GetComponent <PageNodeGraphicManager>();

        pngm.buildFromPage(page);
        pageGraphics.Add(pngm.gameObject);
        return(go);
    }
예제 #3
0
    public void drawConnectionCurves()
    {
        StoryEditorManager sem = FindObjectOfType <StoryEditorManager>();

        foreach (GameObject element in nodeParts) //for every element in this pages nodeparts
        {
            ElementNodeGraphicManager engm = element.GetComponent <ElementNodeGraphicManager>();
            int connectionKey = 0;                                              //this will increment with every processed selection connector so that it will apply each connection to a selection connector
            foreach (GameObject selectionConnector in engm.selectionConnectors) //for every selection connector in this element
            {
                //get the connection
                ConnectionInfo            connection = engm.associatedElement.GetComponent <PageElementEventTrigger>().connections[connectionKey++];
                BezierCurve4PointRenderer curve      = GameObject.Instantiate(AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Prefabs/StoryEditor/CurveRenderer.prefab")
                                                                              , contentWindow).GetComponent <BezierCurve4PointRenderer>();

                selectionConnector.GetComponentInChildren <ManipulateNodeLines>().curve = curve;
                curve.originConnector = selectionConnector.GetComponentInChildren <ManipulateNodeLines>().gameObject;

                foreach (GameObject graphic in sem.pageGraphics)
                {
                    PageNodeGraphicManager pngm = graphic.GetComponent <PageNodeGraphicManager>();
                    if (connection.connectedPage.Equals(pngm.page))                                                                                //if the connected page matches this page
                    {
                        if (connection.connectedElement != null)                                                                                   //if its connected to an element node and not a page node
                        {
                            foreach (GameObject otherElement in pngm.nodeParts)                                                                    //check all the elements in the origin page
                            {
                                if (connection.connectedElement.Equals(otherElement.GetComponent <ElementNodeGraphicManager>().associatedElement)) //when one matches thats the origin connector
                                {
                                    ReceiveNodeLines rnl = otherElement.GetComponentInChildren <ReceiveNodeLines>();
                                    curve.receivingConnector = rnl.gameObject;
                                    rnl.curves.Add(curve);
                                }
                            }
                        }
                        else
                        {
                            //The first ReceiveNodeLines should be the PageNodeConnector receiver since it his highest in hierarchy
                            ReceiveNodeLines rnl = pngm.GetComponentInChildren <ReceiveNodeLines>();
                            curve.receivingConnector = rnl.gameObject;
                            rnl.curves.Add(curve);
                        }
                    }
                }
                curve.setAction(connection.action);
                curve.snapEndpointsToConnectors();
            }
        }
    }
예제 #4
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        PageNodeGraphicManager pngm = (PageNodeGraphicManager)target;

        GUILayout.Label("Rect height/width (" + pngm.GetComponent <RectTransform>().rect.height + "," + pngm.GetComponent <RectTransform>().rect.width + ")");

        if (GUILayout.Button("Redraw elements"))
        {
            pngm.drawElementNodes();
        }

        GUILayout.Label("nodeParts");
        foreach (GameObject nodePart in pngm.nodeParts)
        {
            GUILayout.Label(nodePart.name);
        }
    }
    public new void OnPointerClick(PointerEventData data)
    {
        if (editingFunction == EditingFunction.Delete)
        {
            if (appliedToPage) //This is a page
            {
                PageNodeGraphicManager pngm = GetComponentInParent <PageNodeGraphicManager>();
                pngm.page.storyRef.removePage(pngm.page.name);
                GameObject.Destroy(pngm.gameObject);
            }
            else //This is an element
            {
                Debug.Log("Deleting Element");
                PageElementEventTrigger peet = GetComponentInParent <PageElementEventTrigger>();
                Page       pageRef           = peet.pageRef;
                GameObject element           = peet.gameObject;
                pageRef.removePageElement(element);
            }
        }
        else if (editingFunction == EditingFunction.EditProperties)
        {
            //Implement EditProperties here
            if (appliedToPage)
            {
                //Go to editPage Mode for this page
                gm.changeMode(GameManager.Mode.EditPage, GetComponentInParent <PageNodeGraphicManager>().page);
            }
            else
            {
                //open options based on what type of PageElement this is: such as a photo selector for image
            }
        }
        else if (editingFunction == EditingFunction.Play)
        {
            gm.changeMode(GameManager.Mode.Play, GetComponentInParent <PageNodeGraphicManager>().page);
        }

        //Resizing handles don't do anything when clicked
    }