Пример #1
0
        public void SetCurrentEditNode(string nodename)
        {
            var node = grc.GetNode(nodename);

            if (curEditNode != null)
            {
                if (curEditNode.name != nodename)
                {
                    lm.RemoveNodeColorOverride(curEditNode.name);
                }
            }
            curEditNode    = node;
            editNodeRegion = grc.regman.GetRegion(node.regid);
            linkUseType    = LinkUse.legacy;
            lm.SetNodeColorOverride(nodename, "green", node.go);
            foreach (var weg in node.wegtos)
            {
                var lnk = weg.link;
                if (lnk.regid == node.regid)
                {
                    linkUseType = lnk.usetype;
                    break;
                }
            }
            //sm.RequestRefresh("LinkEdit:SetCurrentEditMode");
        }
Пример #2
0
        public static JsonLinkCloud MakeJson(GraphCtrl lc, ref NodeRegion region)
        {
            int nnodes       = 0;
            int nlinks       = 0;
            var jsonlc       = new JsonLinkCloud(region, lc.floorMan);
            var regionFilter = region.regid;

            if (region.name == "default")
            {
                regionFilter = 0;
            }
            foreach (var nname in lc.nodenamelist)
            {
                var node = lc.GetNode(nname);
                if (node.IsInRegion(region.regid))
                {
                    jsonlc.AddNode(node.name, node.pt);
                    nnodes += 1;
                }
            }
            foreach (var lname in lc.linknamelist)
            {
                var link = lc.GetLink(lname);
                if (link.node1.IsInRegion(regionFilter) && link.node2.IsInRegion(regionFilter))
                {
                    jsonlc.AddLink(link.name, link.node1.name, link.node2.name, link.usetype.ToString());
                    nlinks += 1;
                }
            }
            //GraphUtil.Log("MakeJson nnodes:" + nnodes + " nlinks:" + nlinks);
            //Debug.Log("MakeJson nnodes:" + nnodes + " nlinks:" + nlinks);
            return(jsonlc);
        }