示例#1
0
        void CreateGrcGos()
        {
            //Debug.Log("CreateGrcGos "+ gogencount);
            var grc = GetGraphCtrl();

            sman.leditor.SetGraphCtrl(grc);
            if (grcgos == null)
            {
                grcgos = new GameObject("GraphCtrl-" + gogencount);
                var gccomp = grcgos.AddComponent <GraphCtrlComp>();
                gccomp.Init(this, grctrl);
                grcgos.transform.parent = sman.rgo.transform;
                grcnodes = new GameObject("nodes");
                grcnodes.transform.parent = grcgos.transform;
                grclinks = new GameObject("links");
                grclinks.transform.parent = grcgos.transform;
                gogencount++;
            }
            if (linksvisible)
            {
                foreach (var lnkname in grc.linknamelist)
                {
                    var lnk = grc.GetLink(lnkname);
                    if (!CheckCapUseVisibility(lnk))
                    {
                        continue;
                    }
                    var clrname = linkcolor(lnk);
                    var linkrad = linkradius(lnk);
                    var go      = LinkGo.MakeLinkGo(sman, lnk, linkrad, clrname, 1 - linkTrans, this.flatlinks);
                    go.transform.parent = grclinks.transform;
                }
            }
            if (nodesvisible)
            {
                //Debug.Log("Recreating nodegos");
                foreach (string lptname in grc.linkpoints())
                {
                    var node = grc.GetNode(lptname);
                    if (!CheckCapUseVisibility(node))
                    {
                        continue;
                    }
                    CreateNodeGo(node);
                }
                if (showNearestPoint)
                {
                    var tup   = FindClosestPointOnLineCloud(nearestPointRef);
                    var npt   = tup.Item2;
                    var nname = "linknearsph-";

                    var pnsph = GraphUtil.CreateMarkerSphere(nname, npt, size: 2.5f * sman.linknodescale * markerNodeSize, clr: "red", alf: 1 - linkTrans);
                    pnsph.transform.parent = grcgos.transform;
                }
            }
            stats_nodes_links.x = grc.GetNodeCount();
            stats_nodes_links.y = grc.GetLinkCount();
        }
示例#2
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();                   //This goes first

            if (GUILayout.Button("Change Link Name")) // If the button is clicked
            {
                LinkGo linkgo = (LinkGo)target;       //The target script
                linkgo.ChangeLinkName();
            }
        }