增加JsonUtil工具类

This commit is contained in:
monitor1394
2024-05-09 13:13:51 +08:00
parent b86cae6717
commit 4e3182edfc
10 changed files with 161 additions and 24 deletions

View File

@@ -209,7 +209,7 @@ namespace XCharts.Runtime
}
}
public GraphNode AddNode(string nodeId, string nodeName, int dataIndex)
public GraphNode AddNode(string nodeId, string nodeName, int dataIndex, double value)
{
if (nodeMap.ContainsKey(nodeId))
{
@@ -248,9 +248,9 @@ namespace XCharts.Runtime
XLog.Warning("GraphData.AddEdge(): node2 is null");
return null;
}
if (node1 == node2)
if (directed && node1 == node2)
{
XLog.Warning("GraphData.AddEdge(): node1 == node2");
XLog.Warning("GraphData.AddEdge(): node1 == node2:" + node1);
return null;
}
string edgeKey = nodeId1 + "_" + nodeId2;
@@ -377,6 +377,7 @@ namespace XCharts.Runtime
{
public string id;
public string name;
public double value;
public List<GraphEdge> edges = new List<GraphEdge>();
public List<GraphEdge> inEdges = new List<GraphEdge>();
public List<GraphEdge> outEdges = new List<GraphEdge>();
@@ -386,11 +387,10 @@ namespace XCharts.Runtime
public int depth = -1;
public bool expand = true;
public int level = 0;
public Vector3 position;
public Vector3 delta;
public Vector3 position = Vector3.zero;
public Vector3 pp = Vector3.zero;
public float weight;
public float repulsion;
public Vector3 pp;
public GraphNode(string id, string name, int dataIndex)
{