修改为支持webgl读取文件
This commit is contained in:
parent
d97ac1f6c8
commit
71a99fcbab
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
|
using UnityEngine.Networking;
|
||||||
|
|
||||||
// 可序列化的连线数据
|
// 可序列化的连线数据
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
|
|
@ -56,6 +57,10 @@ public class SerializableWireConnectionData
|
||||||
public float endPointColorR = 1f;
|
public float endPointColorR = 1f;
|
||||||
public float endPointColorG = 1f;
|
public float endPointColorG = 1f;
|
||||||
public float endPointColorB = 1f;
|
public float endPointColorB = 1f;
|
||||||
|
|
||||||
|
// 新增:接口头样式名称
|
||||||
|
public string startInterfaceStyleName = "";
|
||||||
|
public string endInterfaceStyleName = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WireDataPersistence : MonoBehaviour
|
public class WireDataPersistence : MonoBehaviour
|
||||||
|
|
@ -77,6 +82,10 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
public Color defaultStartPointColor = Color.green; // 默认起点颜色
|
public Color defaultStartPointColor = Color.green; // 默认起点颜色
|
||||||
public Color defaultEndPointColor = Color.red; // 默认终点颜色
|
public Color defaultEndPointColor = Color.red; // 默认终点颜色
|
||||||
|
|
||||||
|
[Header("接口头样式设置")]
|
||||||
|
public List<GameObject> interfaceStylePrefabs = new List<GameObject>(); // 接口头样式预制体列表
|
||||||
|
public string defaultInterfaceStyleName = "Default"; // 默认接口头样式名称
|
||||||
|
|
||||||
[Header("调试工具")]
|
[Header("调试工具")]
|
||||||
public bool enableDebugging = true; // 启用调试工具
|
public bool enableDebugging = true; // 启用调试工具
|
||||||
public KeyCode manualSaveKey = KeyCode.F5; // 手动保存快捷键
|
public KeyCode manualSaveKey = KeyCode.F5; // 手动保存快捷键
|
||||||
|
|
@ -130,7 +139,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
if (Input.GetKeyDown(manualLoadKey))
|
if (Input.GetKeyDown(manualLoadKey))
|
||||||
{
|
{
|
||||||
Debug.Log("手动加载触发");
|
Debug.Log("手动加载触发");
|
||||||
LoadWireData();
|
StartCoroutine(LoadWireDataCoroutine());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetKeyDown(debugInfoKey))
|
if (Input.GetKeyDown(debugInfoKey))
|
||||||
|
|
@ -157,33 +166,70 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
{
|
{
|
||||||
Debug.Log("=== 连线数据持久化调试信息 ===");
|
Debug.Log("=== 连线数据持久化调试信息 ===");
|
||||||
Debug.Log($"保存文件路径: {saveFilePath}");
|
Debug.Log($"保存文件路径: {saveFilePath}");
|
||||||
|
|
||||||
|
// WebGL中不能使用File.Exists,所以跳过这个检查
|
||||||
|
#if !UNITY_WEBGL
|
||||||
Debug.Log($"文件存在: {File.Exists(saveFilePath)}");
|
Debug.Log($"文件存在: {File.Exists(saveFilePath)}");
|
||||||
|
#endif
|
||||||
|
|
||||||
Debug.Log($"当前连线数量: {GetCurrentWireCount()}");
|
Debug.Log($"当前连线数量: {GetCurrentWireCount()}");
|
||||||
Debug.Log($"上次保存连线数量: {lastWireCount}");
|
Debug.Log($"上次保存连线数量: {lastWireCount}");
|
||||||
Debug.Log($"系统初始化: {isInitialized}");
|
Debug.Log($"系统初始化: {isInitialized}");
|
||||||
Debug.Log($"连线系统引用: {wireSystem != null}");
|
Debug.Log($"连线系统引用: {wireSystem != null}");
|
||||||
|
|
||||||
|
// 在WebGL中,我们无法直接检查文件存在,但可以尝试加载
|
||||||
|
StartCoroutine(CheckFileExistsCoroutine());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查文件是否存在的协程(WebGL兼容)
|
||||||
|
/// </summary>
|
||||||
|
private IEnumerator CheckFileExistsCoroutine()
|
||||||
|
{
|
||||||
|
#if UNITY_WEBGL
|
||||||
|
yield return StartCoroutine(CheckWebGLFileExists());
|
||||||
|
#else
|
||||||
|
CheckStandardFileExists();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WebGL平台检查文件存在
|
||||||
|
/// </summary>
|
||||||
|
private IEnumerator CheckWebGLFileExists()
|
||||||
|
{
|
||||||
|
string webglFilePath = Path.Combine(Application.streamingAssetsPath, saveFileName);
|
||||||
|
UnityWebRequest webRequest = UnityWebRequest.Get(webglFilePath);
|
||||||
|
yield return webRequest.SendWebRequest();
|
||||||
|
|
||||||
|
if (webRequest.result == UnityWebRequest.Result.Success)
|
||||||
|
{
|
||||||
|
Debug.Log($"WebGL文件存在: {webglFilePath}");
|
||||||
|
|
||||||
|
// 尝试读取文件内容
|
||||||
|
string jsonData = webRequest.downloadHandler.text;
|
||||||
|
if (!string.IsNullOrEmpty(jsonData))
|
||||||
|
{
|
||||||
|
ProcessFileContent(jsonData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("WebGL中没有找到连线数据文件");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 标准平台检查文件存在
|
||||||
|
/// </summary>
|
||||||
|
private void CheckStandardFileExists()
|
||||||
|
{
|
||||||
if (File.Exists(saveFilePath))
|
if (File.Exists(saveFilePath))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string jsonData = File.ReadAllText(saveFilePath);
|
string jsonData = File.ReadAllText(saveFilePath);
|
||||||
SerializableWireData data = JsonUtility.FromJson<SerializableWireData>(jsonData);
|
ProcessFileContent(jsonData);
|
||||||
Debug.Log($"保存文件中的连线数量: {data.wireCount}");
|
|
||||||
Debug.Log($"保存时间: {data.lastSaveTime}");
|
|
||||||
Debug.Log($"场景名称: {data.sceneName}");
|
|
||||||
Debug.Log($"实际保存的连线数据条数: {data.wires.Count}");
|
|
||||||
|
|
||||||
// 显示连线类型统计和颜色信息
|
|
||||||
var typeGroups = data.wires.GroupBy(w => w.wireType);
|
|
||||||
foreach (var group in typeGroups)
|
|
||||||
{
|
|
||||||
Debug.Log($"连线类型 '{group.Key}': {group.Count()} 条");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显示颜色信息
|
|
||||||
int coloredWires = data.wires.Count(w => w.hasCustomColor);
|
|
||||||
Debug.Log($"有自定义颜色的连线: {coloredWires}/{data.wires.Count}");
|
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
catch (System.Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -192,6 +238,52 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 处理文件内容(通用方法)
|
||||||
|
/// </summary>
|
||||||
|
private void ProcessFileContent(string jsonData)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SerializableWireData data = JsonUtility.FromJson<SerializableWireData>(jsonData);
|
||||||
|
Debug.Log($"保存文件中的连线数量: {data.wireCount}");
|
||||||
|
Debug.Log($"保存时间: {data.lastSaveTime}");
|
||||||
|
Debug.Log($"场景名称: {data.sceneName}");
|
||||||
|
Debug.Log($"实际保存的连线数据条数: {data.wires.Count}");
|
||||||
|
|
||||||
|
// 显示连线类型统计和颜色信息
|
||||||
|
var typeGroups = data.wires.GroupBy(w => w.wireType);
|
||||||
|
foreach (var group in typeGroups)
|
||||||
|
{
|
||||||
|
Debug.Log($"连线类型 '{group.Key}': {group.Count()} 条");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 显示颜色信息
|
||||||
|
int coloredWires = data.wires.Count(w => w.hasCustomColor);
|
||||||
|
Debug.Log($"有自定义颜色的连线: {coloredWires}/{data.wires.Count}");
|
||||||
|
|
||||||
|
// 显示接口头样式统计
|
||||||
|
var startStyleGroups = data.wires.GroupBy(w => w.startInterfaceStyleName);
|
||||||
|
var endStyleGroups = data.wires.GroupBy(w => w.endInterfaceStyleName);
|
||||||
|
|
||||||
|
Debug.Log("=== 起点接口头样式统计 ===");
|
||||||
|
foreach (var group in startStyleGroups)
|
||||||
|
{
|
||||||
|
Debug.Log($"起点样式 '{group.Key}': {group.Count()} 个");
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Log("=== 终点接口头样式统计 ===");
|
||||||
|
foreach (var group in endStyleGroups)
|
||||||
|
{
|
||||||
|
Debug.Log($"终点样式 '{group.Key}': {group.Count()} 个");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError($"处理文件内容失败: {e.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查连线数量变化
|
/// 检查连线数量变化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -283,7 +375,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
private IEnumerator DelayedLoad()
|
private IEnumerator DelayedLoad()
|
||||||
{
|
{
|
||||||
yield return new WaitForEndOfFrame();
|
yield return new WaitForEndOfFrame();
|
||||||
LoadWireData();
|
yield return LoadWireDataCoroutine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -329,7 +421,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
{
|
{
|
||||||
data.wires.Add(wireData);
|
data.wires.Add(wireData);
|
||||||
savedCount++;
|
savedCount++;
|
||||||
if (debugMode) Debug.Log($"成功保存连线数据: {wireData.wireName} (类型: {wireData.wireType}, 颜色: {wireData.hasCustomColor})");
|
if (debugMode) Debug.Log($"成功保存连线数据: {wireData.wireName} (类型: {wireData.wireType}, 颜色: {wireData.hasCustomColor}, 起点样式: {wireData.startInterfaceStyleName}, 终点样式: {wireData.endInterfaceStyleName})");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -341,6 +433,12 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
|
|
||||||
string jsonData = JsonUtility.ToJson(data, true);
|
string jsonData = JsonUtility.ToJson(data, true);
|
||||||
|
|
||||||
|
// WebGL和非WebGL平台使用不同的保存方式
|
||||||
|
#if UNITY_WEBGL
|
||||||
|
// 在WebGL中使用PlayerPrefs存储数据
|
||||||
|
PlayerPrefs.SetString("WireData", jsonData);
|
||||||
|
PlayerPrefs.Save();
|
||||||
|
#else
|
||||||
// 确保目录存在
|
// 确保目录存在
|
||||||
string directory = Path.GetDirectoryName(saveFilePath);
|
string directory = Path.GetDirectoryName(saveFilePath);
|
||||||
if (!Directory.Exists(directory))
|
if (!Directory.Exists(directory))
|
||||||
|
|
@ -349,6 +447,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
File.WriteAllText(saveFilePath, jsonData);
|
File.WriteAllText(saveFilePath, jsonData);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (debugMode)
|
if (debugMode)
|
||||||
{
|
{
|
||||||
|
|
@ -365,6 +464,22 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
// 显示颜色统计
|
// 显示颜色统计
|
||||||
int coloredWires = data.wires.Count(w => w.hasCustomColor);
|
int coloredWires = data.wires.Count(w => w.hasCustomColor);
|
||||||
Debug.Log($"保存的有颜色连线: {coloredWires}/{data.wires.Count}");
|
Debug.Log($"保存的有颜色连线: {coloredWires}/{data.wires.Count}");
|
||||||
|
|
||||||
|
// 显示接口头样式统计
|
||||||
|
var startStyleGroups = data.wires.GroupBy(w => w.startInterfaceStyleName);
|
||||||
|
var endStyleGroups = data.wires.GroupBy(w => w.endInterfaceStyleName);
|
||||||
|
|
||||||
|
Debug.Log("=== 保存的起点接口头样式 ===");
|
||||||
|
foreach (var group in startStyleGroups)
|
||||||
|
{
|
||||||
|
Debug.Log($"起点样式 '{group.Key}': {group.Count()} 个");
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Log("=== 保存的终点接口头样式 ===");
|
||||||
|
foreach (var group in endStyleGroups)
|
||||||
|
{
|
||||||
|
Debug.Log($"终点样式 '{group.Key}': {group.Count()} 个");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
catch (System.Exception e)
|
||||||
|
|
@ -372,32 +487,81 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
Debug.LogError($"WireDataPersistence: 保存数据失败: {e.Message}\n{e.StackTrace}");
|
Debug.LogError($"WireDataPersistence: 保存数据失败: {e.Message}\n{e.StackTrace}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 从文件加载连线数据
|
/// 从文件加载连线数据 - 协程版本(WebGL兼容)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LoadWireData()
|
public IEnumerator LoadWireDataCoroutine()
|
||||||
{
|
{
|
||||||
if (!isInitialized || wireSystem == null)
|
if (!isInitialized || wireSystem == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning("WireDataPersistence: 系统未初始化,无法加载数据");
|
Debug.LogWarning("WireDataPersistence: 系统未初始化,无法加载数据");
|
||||||
return;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string jsonData = "";
|
||||||
|
|
||||||
|
#if UNITY_WEBGL
|
||||||
|
// WebGL平台从PlayerPrefs加载数据
|
||||||
|
if (PlayerPrefs.HasKey("WireData"))
|
||||||
|
{
|
||||||
|
jsonData = PlayerPrefs.GetString("WireData");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果PlayerPrefs中没有数据,尝试从StreamingAssets加载
|
||||||
|
yield return StartCoroutine(LoadFromStreamingAssets(saveFileName, result => {
|
||||||
|
jsonData = result;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// 非WebGL平台使用文件系统
|
||||||
|
if (!File.Exists(saveFilePath))
|
||||||
|
{
|
||||||
|
if (debugMode) Debug.Log("WireDataPersistence: 没有找到连线数据文件");
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonData = File.ReadAllText(saveFilePath);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(jsonData))
|
||||||
|
{
|
||||||
|
if (debugMode) Debug.Log("WireDataPersistence: 没有找到连线数据");
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理加载的数据
|
||||||
|
yield return StartCoroutine(ProcessLoadedData(jsonData));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从StreamingAssets加载数据
|
||||||
|
/// </summary>
|
||||||
|
private IEnumerator LoadFromStreamingAssets(string fileName, System.Action<string> onComplete)
|
||||||
|
{
|
||||||
|
string filePath = Path.Combine(Application.streamingAssetsPath, fileName);
|
||||||
|
UnityWebRequest webRequest = UnityWebRequest.Get(filePath);
|
||||||
|
yield return webRequest.SendWebRequest();
|
||||||
|
|
||||||
|
if (webRequest.result == UnityWebRequest.Result.Success)
|
||||||
|
{
|
||||||
|
onComplete(webRequest.downloadHandler.text);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
onComplete("");
|
||||||
|
if (debugMode) Debug.Log("WireDataPersistence: 没有找到连线数据文件");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 处理加载的数据
|
||||||
|
/// </summary>
|
||||||
|
private IEnumerator ProcessLoadedData(string jsonData)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!File.Exists(saveFilePath))
|
|
||||||
{
|
|
||||||
if (debugMode) Debug.Log("WireDataPersistence: 没有找到连线数据文件");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string jsonData = File.ReadAllText(saveFilePath);
|
|
||||||
if (string.IsNullOrEmpty(jsonData))
|
|
||||||
{
|
|
||||||
Debug.LogError("WireDataPersistence: 保存文件为空");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SerializableWireData data = JsonUtility.FromJson<SerializableWireData>(jsonData);
|
SerializableWireData data = JsonUtility.FromJson<SerializableWireData>(jsonData);
|
||||||
|
|
||||||
if (debugMode)
|
if (debugMode)
|
||||||
|
|
@ -414,13 +578,29 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
// 显示颜色统计
|
// 显示颜色统计
|
||||||
int coloredWires = data.wires.Count(w => w.hasCustomColor);
|
int coloredWires = data.wires.Count(w => w.hasCustomColor);
|
||||||
Debug.Log($"要加载的有颜色连线: {coloredWires}/{data.wires.Count}");
|
Debug.Log($"要加载的有颜色连线: {coloredWires}/{data.wires.Count}");
|
||||||
|
|
||||||
|
// 显示接口头样式统计
|
||||||
|
var startStyleGroups = data.wires.GroupBy(w => w.startInterfaceStyleName);
|
||||||
|
var endStyleGroups = data.wires.GroupBy(w => w.endInterfaceStyleName);
|
||||||
|
|
||||||
|
Debug.Log("=== 要加载的起点接口头样式 ===");
|
||||||
|
foreach (var group in startStyleGroups)
|
||||||
|
{
|
||||||
|
Debug.Log($"起点样式 '{group.Key}': {group.Count()} 个");
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Log("=== 要加载的终点接口头样式 ===");
|
||||||
|
foreach (var group in endStyleGroups)
|
||||||
|
{
|
||||||
|
Debug.Log($"终点样式 '{group.Key}': {group.Count()} 个");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果 wires 为空但 wireCount > 0,说明数据有问题
|
// 如果 wires 为空但 wireCount > 0,说明数据有问题
|
||||||
if (data.wires.Count == 0 && data.wireCount > 0)
|
if (data.wires.Count == 0 && data.wireCount > 0)
|
||||||
{
|
{
|
||||||
Debug.LogError($"数据不一致: wireCount = {data.wireCount}, 但 wires 数组为空");
|
Debug.LogError($"数据不一致: wireCount = {data.wireCount}, 但 wires 数组为空");
|
||||||
return;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用连线系统的清除方法
|
// 调用连线系统的清除方法
|
||||||
|
|
@ -445,6 +625,11 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
{
|
{
|
||||||
reconstructedCount++;
|
reconstructedCount++;
|
||||||
}
|
}
|
||||||
|
// 每重建10条连线就等待一帧,避免卡顿
|
||||||
|
//if (reconstructedCount % 10 == 0)
|
||||||
|
//{
|
||||||
|
// yield return null;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debugMode) Debug.Log($"WireDataPersistence: 数据加载完成: {reconstructedCount}/{data.wires.Count} 条连线已恢复");
|
if (debugMode) Debug.Log($"WireDataPersistence: 数据加载完成: {reconstructedCount}/{data.wires.Count} 条连线已恢复");
|
||||||
|
|
@ -460,6 +645,15 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
Debug.LogError($"WireDataPersistence: 加载数据失败: {e.Message}\n{e.StackTrace}");
|
Debug.LogError($"WireDataPersistence: 加载数据失败: {e.Message}\n{e.StackTrace}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保持向后兼容的LoadWireData方法
|
||||||
|
/// </summary>
|
||||||
|
public void LoadWireData()
|
||||||
|
{
|
||||||
|
StartCoroutine(LoadWireDataCoroutine());
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 手动清除连线(备用方法)
|
/// 手动清除连线(备用方法)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -513,7 +707,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (debugMode) Debug.Log($"开始重建连线: {wireData.wireName} (类型: {wireData.wireType}, 颜色: {wireData.hasCustomColor})");
|
if (debugMode) Debug.Log($"开始重建连线: {wireData.wireName} (类型: {wireData.wireType}, 颜色: {wireData.hasCustomColor}, 起点样式: {wireData.startInterfaceStyleName}, 终点样式: {wireData.endInterfaceStyleName})");
|
||||||
|
|
||||||
// 查找接口物体
|
// 查找接口物体
|
||||||
GameObject startInterface = FindInterfaceByName(wireData.startInterfaceName);
|
GameObject startInterface = FindInterfaceByName(wireData.startInterfaceName);
|
||||||
|
|
@ -534,6 +728,8 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
{
|
{
|
||||||
Debug.Log($"起点接口: {wireData.startInterfaceName} -> {startInterface != null}");
|
Debug.Log($"起点接口: {wireData.startInterfaceName} -> {startInterface != null}");
|
||||||
Debug.Log($"终点接口: {wireData.endInterfaceName} -> {endInterface != null}");
|
Debug.Log($"终点接口: {wireData.endInterfaceName} -> {endInterface != null}");
|
||||||
|
Debug.Log($"起点接口头样式: {wireData.startInterfaceStyleName}");
|
||||||
|
Debug.Log($"终点接口头样式: {wireData.endInterfaceStyleName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据连线类型重建
|
// 根据连线类型重建
|
||||||
|
|
@ -553,8 +749,9 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重建圆柱体连线 - 使用保存的圆柱体数据
|
/// 重建圆柱体连线 - 使用保存的圆柱体数据和接口头样式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool ReconstructCylinderWire(SerializableWireConnectionData wireData, GameObject startInterface, GameObject endInterface)
|
private bool ReconstructCylinderWire(SerializableWireConnectionData wireData, GameObject startInterface, GameObject endInterface)
|
||||||
{
|
{
|
||||||
|
|
@ -584,6 +781,9 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
// 特别设置连接点引用(如果 CylinderWireData 需要它们)
|
// 特别设置连接点引用(如果 CylinderWireData 需要它们)
|
||||||
SetConnectionPointReferences(cylinderData, startConnectionPoint, endConnectionPoint);
|
SetConnectionPointReferences(cylinderData, startConnectionPoint, endConnectionPoint);
|
||||||
|
|
||||||
|
// 创建接口头样式
|
||||||
|
CreateInterfaceHeads(wireObject, wireData, startInterface, endInterface);
|
||||||
|
|
||||||
// 添加到连线系统
|
// 添加到连线系统
|
||||||
AddWireToSystem(wireObject, wireData, startInterface, endInterface);
|
AddWireToSystem(wireObject, wireData, startInterface, endInterface);
|
||||||
|
|
||||||
|
|
@ -595,6 +795,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
Debug.Log($"WireDataPersistence: 成功重建圆柱体连线: {wireData.wireName}");
|
Debug.Log($"WireDataPersistence: 成功重建圆柱体连线: {wireData.wireName}");
|
||||||
Debug.Log($"圆柱体缩放: {wireData.cylinderScale}, 位置: {wireData.cylinderPosition}");
|
Debug.Log($"圆柱体缩放: {wireData.cylinderScale}, 位置: {wireData.cylinderPosition}");
|
||||||
Debug.Log($"连线颜色: {wireData.hasCustomColor}");
|
Debug.Log($"连线颜色: {wireData.hasCustomColor}");
|
||||||
|
Debug.Log($"接口头样式 - 起点: {wireData.startInterfaceStyleName}, 终点: {wireData.endInterfaceStyleName}");
|
||||||
|
|
||||||
// 验证 CylinderWireData 字段是否设置正确
|
// 验证 CylinderWireData 字段是否设置正确
|
||||||
ValidateCylinderWireData(cylinderData);
|
ValidateCylinderWireData(cylinderData);
|
||||||
|
|
@ -608,6 +809,90 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建接口头样式
|
||||||
|
/// </summary>
|
||||||
|
private void CreateInterfaceHeads(GameObject wireObject, SerializableWireConnectionData wireData, GameObject startInterface, GameObject endInterface)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 创建起点接口头
|
||||||
|
if (!string.IsNullOrEmpty(wireData.startInterfaceStyleName) && startInterface != null)
|
||||||
|
{
|
||||||
|
GameObject startHeadPrefab = GetInterfaceHeadPrefab(wireData.startInterfaceStyleName);
|
||||||
|
if (startHeadPrefab != null)
|
||||||
|
{
|
||||||
|
GameObject startHead = Instantiate(startHeadPrefab);
|
||||||
|
startHead.name = $"InterfaceHead_Start_{wireData.startInterfaceStyleName}";
|
||||||
|
startHead.transform.SetParent(wireObject.transform);
|
||||||
|
|
||||||
|
// 设置接口头位置到起点接口位置
|
||||||
|
startHead.transform.position = startInterface.transform.position;
|
||||||
|
startHead.transform.rotation = startInterface.transform.rotation;
|
||||||
|
|
||||||
|
if (debugMode) Debug.Log($"创建起点接口头: {wireData.startInterfaceStyleName} 在 {startInterface.name}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"找不到起点接口头预制体: {wireData.startInterfaceStyleName}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建终点接口头
|
||||||
|
if (!string.IsNullOrEmpty(wireData.endInterfaceStyleName) && endInterface != null)
|
||||||
|
{
|
||||||
|
GameObject endHeadPrefab = GetInterfaceHeadPrefab(wireData.endInterfaceStyleName);
|
||||||
|
if (endHeadPrefab != null)
|
||||||
|
{
|
||||||
|
GameObject endHead = Instantiate(endHeadPrefab);
|
||||||
|
endHead.name = $"InterfaceHead_End_{wireData.endInterfaceStyleName}";
|
||||||
|
endHead.transform.SetParent(wireObject.transform);
|
||||||
|
|
||||||
|
// 设置接口头位置到终点接口位置
|
||||||
|
endHead.transform.position = endInterface.transform.position;
|
||||||
|
endHead.transform.rotation = endInterface.transform.rotation;
|
||||||
|
|
||||||
|
if (debugMode) Debug.Log($"创建终点接口头: {wireData.endInterfaceStyleName} 在 {endInterface.name}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"找不到终点接口头预制体: {wireData.endInterfaceStyleName}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError($"创建接口头失败: {e.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据样式名称获取接口头预制体
|
||||||
|
/// </summary>
|
||||||
|
private GameObject GetInterfaceHeadPrefab(string styleName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(styleName)) return null;
|
||||||
|
|
||||||
|
foreach (GameObject prefab in interfaceStylePrefabs)
|
||||||
|
{
|
||||||
|
if (prefab != null && prefab.name == styleName)
|
||||||
|
{
|
||||||
|
return prefab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果找不到指定名称的预制体,尝试使用默认样式
|
||||||
|
foreach (GameObject prefab in interfaceStylePrefabs)
|
||||||
|
{
|
||||||
|
if (prefab != null && prefab.name == defaultInterfaceStyleName)
|
||||||
|
{
|
||||||
|
return prefab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置连接点引用
|
/// 设置连接点引用
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -669,6 +954,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
Debug.LogError($"验证 CylinderWireData 失败: {e.Message}");
|
Debug.LogError($"验证 CylinderWireData 失败: {e.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 注册连接点到堆叠系统 - 增强版
|
/// 注册连接点到堆叠系统 - 增强版
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -772,6 +1058,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
Debug.LogError($"注册连接点到堆叠系统失败: {e.Message}");
|
Debug.LogError($"注册连接点到堆叠系统失败: {e.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 验证堆叠限制是否正常工作
|
/// 验证堆叠限制是否正常工作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -837,6 +1124,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
Debug.LogError($"验证堆叠系统失败: {e.Message}");
|
Debug.LogError($"验证堆叠系统失败: {e.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 注册单个连接点到接口堆叠系统
|
/// 注册单个连接点到接口堆叠系统
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -882,6 +1170,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
interfaceStacks[targetInterface.name].RemoveAll(item => item == null);
|
interfaceStacks[targetInterface.name].RemoveAll(item => item == null);
|
||||||
return interfaceStacks[targetInterface.name].Count;
|
return interfaceStacks[targetInterface.name].Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用反射设置 CylinderWireData 的所有字段 - 修复版
|
/// 使用反射设置 CylinderWireData 的所有字段 - 修复版
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -999,6 +1288,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
Debug.LogError($"设置额外圆柱体连线属性失败: {e.Message}");
|
Debug.LogError($"设置额外圆柱体连线属性失败: {e.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建圆柱体视觉表现 - 使用保存的圆柱体数据和颜色
|
/// 创建圆柱体视觉表现 - 使用保存的圆柱体数据和颜色
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -1299,7 +1589,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取连线的连接数据 - 关键修复方法,保存圆柱体数据和颜色
|
/// 获取连线的连接数据 - 关键修复方法,保存圆柱体数据、颜色和接口头样式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private SerializableWireConnectionData GetWireConnectionData(GameObject wireObject)
|
private SerializableWireConnectionData GetWireConnectionData(GameObject wireObject)
|
||||||
{
|
{
|
||||||
|
|
@ -1420,12 +1710,46 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查找接口头样式并保存
|
||||||
|
foreach (Transform child in wireObject.transform)
|
||||||
|
{
|
||||||
|
if (child.name.StartsWith("InterfaceHead_Start"))
|
||||||
|
{
|
||||||
|
// 从接口头名称中提取样式名称
|
||||||
|
string headName = child.name;
|
||||||
|
if (headName.Contains("_"))
|
||||||
|
{
|
||||||
|
string[] parts = headName.Split('_');
|
||||||
|
if (parts.Length >= 3)
|
||||||
|
{
|
||||||
|
connectionData.startInterfaceStyleName = parts[2];
|
||||||
|
if (debugMode) Debug.Log($"保存起点接口头样式: {connectionData.startInterfaceStyleName}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (child.name.StartsWith("InterfaceHead_End"))
|
||||||
|
{
|
||||||
|
// 从接口头名称中提取样式名称
|
||||||
|
string headName = child.name;
|
||||||
|
if (headName.Contains("_"))
|
||||||
|
{
|
||||||
|
string[] parts = headName.Split('_');
|
||||||
|
if (parts.Length >= 3)
|
||||||
|
{
|
||||||
|
connectionData.endInterfaceStyleName = parts[2];
|
||||||
|
if (debugMode) Debug.Log($"保存终点接口头样式: {connectionData.endInterfaceStyleName}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (debugMode)
|
if (debugMode)
|
||||||
{
|
{
|
||||||
Debug.Log($"从 CylinderWireData 组件获取连线数据: {connectionData.wireName}");
|
Debug.Log($"从 CylinderWireData 组件获取连线数据: {connectionData.wireName}");
|
||||||
Debug.Log($"起点: {connectionData.startPoint}, 终点: {connectionData.endPoint}");
|
Debug.Log($"起点: {connectionData.startPoint}, 终点: {connectionData.endPoint}");
|
||||||
Debug.Log($"起点接口: {connectionData.startInterfaceName}, 终点接口: {connectionData.endInterfaceName}");
|
Debug.Log($"起点接口: {connectionData.startInterfaceName}, 终点接口: {connectionData.endInterfaceName}");
|
||||||
Debug.Log($"连线颜色: {connectionData.hasCustomColor}");
|
Debug.Log($"连线颜色: {connectionData.hasCustomColor}");
|
||||||
|
Debug.Log($"接口头样式 - 起点: {connectionData.startInterfaceStyleName}, 终点: {connectionData.endInterfaceStyleName}");
|
||||||
}
|
}
|
||||||
return connectionData;
|
return connectionData;
|
||||||
}
|
}
|
||||||
|
|
@ -1496,6 +1820,35 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查找接口头样式并保存
|
||||||
|
foreach (Transform child in wireObject.transform)
|
||||||
|
{
|
||||||
|
if (child.name.StartsWith("InterfaceHead_Start"))
|
||||||
|
{
|
||||||
|
string headName = child.name;
|
||||||
|
if (headName.Contains("_"))
|
||||||
|
{
|
||||||
|
string[] parts = headName.Split('_');
|
||||||
|
if (parts.Length >= 3)
|
||||||
|
{
|
||||||
|
connectionData.startInterfaceStyleName = parts[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (child.name.StartsWith("InterfaceHead_End"))
|
||||||
|
{
|
||||||
|
string headName = child.name;
|
||||||
|
if (headName.Contains("_"))
|
||||||
|
{
|
||||||
|
string[] parts = headName.Split('_');
|
||||||
|
if (parts.Length >= 3)
|
||||||
|
{
|
||||||
|
connectionData.endInterfaceStyleName = parts[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (debugMode) Debug.Log($"从 WireData 组件获取连线数据: {connectionData.wireName}");
|
if (debugMode) Debug.Log($"从 WireData 组件获取连线数据: {connectionData.wireName}");
|
||||||
return connectionData;
|
return connectionData;
|
||||||
}
|
}
|
||||||
|
|
@ -1572,7 +1925,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ManualLoad()
|
public void ManualLoad()
|
||||||
{
|
{
|
||||||
LoadWireData();
|
StartCoroutine(LoadWireDataCoroutine());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1580,11 +1933,21 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ClearSavedData()
|
public void ClearSavedData()
|
||||||
{
|
{
|
||||||
|
#if UNITY_WEBGL
|
||||||
|
// WebGL中使用PlayerPrefs
|
||||||
|
if (PlayerPrefs.HasKey("WireData"))
|
||||||
|
{
|
||||||
|
PlayerPrefs.DeleteKey("WireData");
|
||||||
|
PlayerPrefs.Save();
|
||||||
|
if (debugMode) Debug.Log("WireDataPersistence: 已清除PlayerPrefs中的连线数据");
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (File.Exists(saveFilePath))
|
if (File.Exists(saveFilePath))
|
||||||
{
|
{
|
||||||
File.Delete(saveFilePath);
|
File.Delete(saveFilePath);
|
||||||
if (debugMode) Debug.Log("WireDataPersistence: 已清除保存的数据文件");
|
if (debugMode) Debug.Log("WireDataPersistence: 已清除保存的数据文件");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1592,6 +1955,43 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GetSaveInfo()
|
public string GetSaveInfo()
|
||||||
{
|
{
|
||||||
|
#if UNITY_WEBGL
|
||||||
|
if (PlayerPrefs.HasKey("WireData"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string jsonData = PlayerPrefs.GetString("WireData");
|
||||||
|
SerializableWireData data = JsonUtility.FromJson<SerializableWireData>(jsonData);
|
||||||
|
int coloredWires = data.wires.Count(w => w.hasCustomColor);
|
||||||
|
|
||||||
|
// 统计接口头样式
|
||||||
|
var startStyleGroups = data.wires.GroupBy(w => w.startInterfaceStyleName);
|
||||||
|
var endStyleGroups = data.wires.GroupBy(w => w.endInterfaceStyleName);
|
||||||
|
|
||||||
|
string styleInfo = "";
|
||||||
|
foreach (var group in startStyleGroups)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(group.Key))
|
||||||
|
styleInfo += $", 起点{group.Key}:{group.Count()}";
|
||||||
|
}
|
||||||
|
foreach (var group in endStyleGroups)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(group.Key))
|
||||||
|
styleInfo += $", 终点{group.Key}:{group.Count()}";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"WireDataPersistence: 已保存 {data.wires.Count} 条连线 ({coloredWires} 条有颜色{styleInfo}), 文件大小: {jsonData.Length} 字符, 存储: PlayerPrefs";
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return "WireDataPersistence: PlayerPrefs中存在数据但读取失败";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "WireDataPersistence: PlayerPrefs中暂无保存数据";
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (File.Exists(saveFilePath))
|
if (File.Exists(saveFilePath))
|
||||||
{
|
{
|
||||||
FileInfo fileInfo = new FileInfo(saveFilePath);
|
FileInfo fileInfo = new FileInfo(saveFilePath);
|
||||||
|
|
@ -1600,7 +2000,24 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
string jsonData = File.ReadAllText(saveFilePath);
|
string jsonData = File.ReadAllText(saveFilePath);
|
||||||
SerializableWireData data = JsonUtility.FromJson<SerializableWireData>(jsonData);
|
SerializableWireData data = JsonUtility.FromJson<SerializableWireData>(jsonData);
|
||||||
int coloredWires = data.wires.Count(w => w.hasCustomColor);
|
int coloredWires = data.wires.Count(w => w.hasCustomColor);
|
||||||
return $"WireDataPersistence: 已保存 {data.wires.Count} 条连线 ({coloredWires} 条有颜色), 文件大小: {fileInfo.Length} 字节, 路径: {saveFilePath}";
|
|
||||||
|
// 统计接口头样式
|
||||||
|
var startStyleGroups = data.wires.GroupBy(w => w.startInterfaceStyleName);
|
||||||
|
var endStyleGroups = data.wires.GroupBy(w => w.endInterfaceStyleName);
|
||||||
|
|
||||||
|
string styleInfo = "";
|
||||||
|
foreach (var group in startStyleGroups)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(group.Key))
|
||||||
|
styleInfo += $", 起点{group.Key}:{group.Count()}";
|
||||||
|
}
|
||||||
|
foreach (var group in endStyleGroups)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(group.Key))
|
||||||
|
styleInfo += $", 终点{group.Key}:{group.Count()}";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"WireDataPersistence: 已保存 {data.wires.Count} 条连线 ({coloredWires} 条有颜色{styleInfo}), 文件大小: {fileInfo.Length} 字节, 路径: {saveFilePath}";
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -1611,6 +2028,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
{
|
{
|
||||||
return "WireDataPersistence: 暂无保存数据";
|
return "WireDataPersistence: 暂无保存数据";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1618,7 +2036,11 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasSavedData()
|
public bool HasSavedData()
|
||||||
{
|
{
|
||||||
|
#if UNITY_WEBGL
|
||||||
|
return PlayerPrefs.HasKey("WireData");
|
||||||
|
#else
|
||||||
return File.Exists(saveFilePath);
|
return File.Exists(saveFilePath);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1651,6 +2073,10 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
int unknownCount = 0;
|
int unknownCount = 0;
|
||||||
int coloredWires = 0;
|
int coloredWires = 0;
|
||||||
|
|
||||||
|
// 统计接口头样式
|
||||||
|
Dictionary<string, int> startInterfaceStyles = new Dictionary<string, int>();
|
||||||
|
Dictionary<string, int> endInterfaceStyles = new Dictionary<string, int>();
|
||||||
|
|
||||||
if (allWires != null)
|
if (allWires != null)
|
||||||
{
|
{
|
||||||
foreach (var wire in allWires)
|
foreach (var wire in allWires)
|
||||||
|
|
@ -1671,17 +2097,73 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
coloredWires++;
|
coloredWires++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 统计接口头样式
|
||||||
|
foreach (Transform child in wire.transform)
|
||||||
|
{
|
||||||
|
if (child.name.StartsWith("InterfaceHead_Start"))
|
||||||
|
{
|
||||||
|
string styleName = ExtractStyleNameFromHead(child.name);
|
||||||
|
if (!string.IsNullOrEmpty(styleName))
|
||||||
|
{
|
||||||
|
if (startInterfaceStyles.ContainsKey(styleName))
|
||||||
|
startInterfaceStyles[styleName]++;
|
||||||
|
else
|
||||||
|
startInterfaceStyles[styleName] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (child.name.StartsWith("InterfaceHead_End"))
|
||||||
|
{
|
||||||
|
string styleName = ExtractStyleNameFromHead(child.name);
|
||||||
|
if (!string.IsNullOrEmpty(styleName))
|
||||||
|
{
|
||||||
|
if (endInterfaceStyles.ContainsKey(styleName))
|
||||||
|
endInterfaceStyles[styleName]++;
|
||||||
|
else
|
||||||
|
endInterfaceStyles[styleName] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $"当前场景中有 {allWires?.Count ?? 0} 条连线 (圆柱体: {cylinderCount}, LineRenderer: {lineRendererCount}, 未知: {unknownCount}, 有颜色: {coloredWires})";
|
string styleStats = "";
|
||||||
|
foreach (var kvp in startInterfaceStyles)
|
||||||
|
{
|
||||||
|
styleStats += $", 起点{kvp.Key}:{kvp.Value}";
|
||||||
|
}
|
||||||
|
foreach (var kvp in endInterfaceStyles)
|
||||||
|
{
|
||||||
|
styleStats += $", 终点{kvp.Key}:{kvp.Value}";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"当前场景中有 {allWires?.Count ?? 0} 条连线 (圆柱体: {cylinderCount}, LineRenderer: {lineRendererCount}, 未知: {unknownCount}, 有颜色: {coloredWires}{styleStats})";
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
catch (System.Exception e)
|
||||||
{
|
{
|
||||||
return $"获取统计信息失败: {e.Message}";
|
return $"获取统计信息失败: {e.Message}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从接口头名称中提取样式名称
|
||||||
|
/// </summary>
|
||||||
|
private string ExtractStyleNameFromHead(string headName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(headName)) return "";
|
||||||
|
|
||||||
|
if (headName.Contains("_"))
|
||||||
|
{
|
||||||
|
string[] parts = headName.Split('_');
|
||||||
|
if (parts.Length >= 3)
|
||||||
|
{
|
||||||
|
return parts[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 测试特定接口的堆叠限制
|
/// 测试特定接口的堆叠限制
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -1743,6 +2225,7 @@ public class WireDataPersistence : MonoBehaviour
|
||||||
Debug.LogError($"测试堆叠限制失败: {e.Message}");
|
Debug.LogError($"测试堆叠限制失败: {e.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 强制立即保存
|
/// 强制立即保存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -2138,7 +2138,10 @@ public class WireDrawingSystem : MonoBehaviour
|
||||||
|
|
||||||
public void SetColor_Model(string color)
|
public void SetColor_Model(string color)
|
||||||
{
|
{
|
||||||
|
if (currentState != DrawingState.Idle)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
switch (color)
|
switch (color)
|
||||||
{
|
{
|
||||||
case "ºì":
|
case "ºì":
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"wires": [
|
"wires": [
|
||||||
{
|
{
|
||||||
"startInterfaceName": "chudian233",
|
"startInterfaceName": "chudian231",
|
||||||
"endInterfaceName": "chudian227",
|
"endInterfaceName": "chudian227",
|
||||||
"startConnectionPointPosition": {
|
"startConnectionPointPosition": {
|
||||||
"x": -1.250161051750183,
|
"x": -1.2912330627441407,
|
||||||
"y": -0.28797510266304018,
|
"y": -0.26317930221557619,
|
||||||
"z": 0.08528154343366623
|
"z": 0.08528154343366623
|
||||||
},
|
},
|
||||||
"endConnectionPointPosition": {
|
"endConnectionPointPosition": {
|
||||||
|
|
@ -23,22 +23,22 @@
|
||||||
"y": 0.0,
|
"y": 0.0,
|
||||||
"z": 0.0
|
"z": 0.0
|
||||||
},
|
},
|
||||||
"wireName": "Wire_20251127163809",
|
"wireName": "Wire_20251127170856",
|
||||||
"cylinderScale": {
|
"cylinderScale": {
|
||||||
"x": 0.0020000000949949028,
|
"x": 0.0020000000949949028,
|
||||||
"y": 0.03422898054122925,
|
"y": 0.019346168264746667,
|
||||||
"z": 0.0020000000949949028
|
"z": 0.0020000000949949028
|
||||||
},
|
},
|
||||||
"cylinderPosition": {
|
"cylinderPosition": {
|
||||||
"x": -1.2843656539916993,
|
"x": -1.3049015998840333,
|
||||||
"y": -0.28926825523376467,
|
"y": -0.27687036991119387,
|
||||||
"z": 0.08528154343366623
|
"z": 0.08528154343366623
|
||||||
},
|
},
|
||||||
"cylinderRotation": {
|
"cylinderRotation": {
|
||||||
"x": 0.0,
|
"x": 0.0,
|
||||||
"y": 0.0,
|
"y": 0.0,
|
||||||
"z": 0.7203401327133179,
|
"z": 0.9240370392799377,
|
||||||
"w": 0.6936209797859192
|
"w": 0.38230299949645998
|
||||||
},
|
},
|
||||||
"cylinderRadius": 0.0020000000949949028,
|
"cylinderRadius": 0.0020000000949949028,
|
||||||
"hasStartInterface": true,
|
"hasStartInterface": true,
|
||||||
|
|
@ -46,8 +46,8 @@
|
||||||
"debugInfo": "从 CylinderWireData 组件获取",
|
"debugInfo": "从 CylinderWireData 组件获取",
|
||||||
"wireType": "CylinderWireData",
|
"wireType": "CylinderWireData",
|
||||||
"wireColorR": 0.5943396091461182,
|
"wireColorR": 0.5943396091461182,
|
||||||
"wireColorG": 0.18467968702316285,
|
"wireColorG": 0.18467965722084046,
|
||||||
"wireColorB": 0.12615689635276795,
|
"wireColorB": 0.12615686655044557,
|
||||||
"wireColorA": 1.0,
|
"wireColorA": 1.0,
|
||||||
"hasCustomColor": true,
|
"hasCustomColor": true,
|
||||||
"connectionPointScale": 0.004999999888241291,
|
"connectionPointScale": 0.004999999888241291,
|
||||||
|
|
@ -59,11 +59,69 @@
|
||||||
"endPointColorB": 0.7830188274383545
|
"endPointColorB": 0.7830188274383545
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"startInterfaceName": "chudian227",
|
"startInterfaceName": "chudian231",
|
||||||
|
"endInterfaceName": "chudian220",
|
||||||
|
"startConnectionPointPosition": {
|
||||||
|
"x": -1.2912330627441407,
|
||||||
|
"y": -0.26317930221557619,
|
||||||
|
"z": 0.09028154611587525
|
||||||
|
},
|
||||||
|
"endConnectionPointPosition": {
|
||||||
|
"x": -1.3185701370239258,
|
||||||
|
"y": -0.26755011081695559,
|
||||||
|
"z": 0.08528154343366623
|
||||||
|
},
|
||||||
|
"startPoint": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"endPoint": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"wireName": "Wire_20251127170859",
|
||||||
|
"cylinderScale": {
|
||||||
|
"x": 0.0020000000949949028,
|
||||||
|
"y": 0.013842142187058926,
|
||||||
|
"z": 0.0020000000949949028
|
||||||
|
},
|
||||||
|
"cylinderPosition": {
|
||||||
|
"x": -1.3049015998840333,
|
||||||
|
"y": -0.26536470651626589,
|
||||||
|
"z": 0.08528154343366623
|
||||||
|
},
|
||||||
|
"cylinderRotation": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.760881245136261,
|
||||||
|
"w": 0.6488911509513855
|
||||||
|
},
|
||||||
|
"cylinderRadius": 0.0020000000949949028,
|
||||||
|
"hasStartInterface": true,
|
||||||
|
"hasEndInterface": true,
|
||||||
|
"debugInfo": "从 CylinderWireData 组件获取",
|
||||||
|
"wireType": "CylinderWireData",
|
||||||
|
"wireColorR": 0.6112549304962158,
|
||||||
|
"wireColorG": 0.4606019854545593,
|
||||||
|
"wireColorB": 0.07094945758581162,
|
||||||
|
"wireColorA": 1.0,
|
||||||
|
"hasCustomColor": true,
|
||||||
|
"connectionPointScale": 0.004999999888241291,
|
||||||
|
"startPointColorR": 0.7830188274383545,
|
||||||
|
"startPointColorG": 0.7830188274383545,
|
||||||
|
"startPointColorB": 0.7830188274383545,
|
||||||
|
"endPointColorR": 0.7830188274383545,
|
||||||
|
"endPointColorG": 0.7830188274383545,
|
||||||
|
"endPointColorB": 0.7830188274383545
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"startInterfaceName": "chudian220",
|
||||||
"endInterfaceName": "chudian228",
|
"endInterfaceName": "chudian228",
|
||||||
"startConnectionPointPosition": {
|
"startConnectionPointPosition": {
|
||||||
"x": -1.3185701370239258,
|
"x": -1.3185701370239258,
|
||||||
"y": -0.2905614376068115,
|
"y": -0.26755011081695559,
|
||||||
"z": 0.09028154611587525
|
"z": 0.09028154611587525
|
||||||
},
|
},
|
||||||
"endConnectionPointPosition": {
|
"endConnectionPointPosition": {
|
||||||
|
|
@ -81,31 +139,31 @@
|
||||||
"y": 0.0,
|
"y": 0.0,
|
||||||
"z": 0.0
|
"z": 0.0
|
||||||
},
|
},
|
||||||
"wireName": "Wire_20251127163810",
|
"wireName": "Wire_20251127170903",
|
||||||
"cylinderScale": {
|
"cylinderScale": {
|
||||||
"x": 0.0020000000949949028,
|
"x": 0.0020000000949949028,
|
||||||
"y": 0.022208843380212785,
|
"y": 0.02605534717440605,
|
||||||
"z": 0.0020000000949949028
|
"z": 0.0020000000949949028
|
||||||
},
|
},
|
||||||
"cylinderPosition": {
|
"cylinderPosition": {
|
||||||
"x": -1.3406579494476319,
|
"x": -1.3406579494476319,
|
||||||
"y": -0.29287630319595339,
|
"y": -0.2813706398010254,
|
||||||
"z": 0.08528154343366623
|
"z": 0.08528154343366623
|
||||||
},
|
},
|
||||||
"cylinderRotation": {
|
"cylinderRotation": {
|
||||||
"x": 0.0,
|
"x": 0.0,
|
||||||
"y": 0.0,
|
"y": 0.0,
|
||||||
"z": 0.7430449724197388,
|
"z": 0.8747655749320984,
|
||||||
"w": 0.6692414879798889
|
"w": 0.48454639315605166
|
||||||
},
|
},
|
||||||
"cylinderRadius": 0.0020000000949949028,
|
"cylinderRadius": 0.0020000000949949028,
|
||||||
"hasStartInterface": true,
|
"hasStartInterface": true,
|
||||||
"hasEndInterface": true,
|
"hasEndInterface": true,
|
||||||
"debugInfo": "从 CylinderWireData 组件获取",
|
"debugInfo": "从 CylinderWireData 组件获取",
|
||||||
"wireType": "CylinderWireData",
|
"wireType": "CylinderWireData",
|
||||||
"wireColorR": 0.5943396091461182,
|
"wireColorR": 0.03410438448190689,
|
||||||
"wireColorG": 0.18467968702316285,
|
"wireColorG": 0.03504699096083641,
|
||||||
"wireColorB": 0.12615689635276795,
|
"wireColorB": 0.029494885355234147,
|
||||||
"wireColorA": 1.0,
|
"wireColorA": 1.0,
|
||||||
"hasCustomColor": true,
|
"hasCustomColor": true,
|
||||||
"connectionPointScale": 0.004999999888241291,
|
"connectionPointScale": 0.004999999888241291,
|
||||||
|
|
@ -139,7 +197,7 @@
|
||||||
"y": 0.0,
|
"y": 0.0,
|
||||||
"z": 0.0
|
"z": 0.0
|
||||||
},
|
},
|
||||||
"wireName": "Wire_20251127163811",
|
"wireName": "Wire_20251127170906",
|
||||||
"cylinderScale": {
|
"cylinderScale": {
|
||||||
"x": 0.0020000000949949028,
|
"x": 0.0020000000949949028,
|
||||||
"y": 0.01384253054857254,
|
"y": 0.01384253054857254,
|
||||||
|
|
@ -161,299 +219,9 @@
|
||||||
"hasEndInterface": true,
|
"hasEndInterface": true,
|
||||||
"debugInfo": "从 CylinderWireData 组件获取",
|
"debugInfo": "从 CylinderWireData 组件获取",
|
||||||
"wireType": "CylinderWireData",
|
"wireType": "CylinderWireData",
|
||||||
"wireColorR": 0.5943396091461182,
|
"wireColorR": 0.05406717211008072,
|
||||||
"wireColorG": 0.18467968702316285,
|
"wireColorG": 0.4245281517505646,
|
||||||
"wireColorB": 0.12615689635276795,
|
"wireColorB": 0.15887632966041566,
|
||||||
"wireColorA": 1.0,
|
|
||||||
"hasCustomColor": true,
|
|
||||||
"connectionPointScale": 0.004999999888241291,
|
|
||||||
"startPointColorR": 0.7830188274383545,
|
|
||||||
"startPointColorG": 0.7830188274383545,
|
|
||||||
"startPointColorB": 0.7830188274383545,
|
|
||||||
"endPointColorR": 0.7830188274383545,
|
|
||||||
"endPointColorG": 0.7830188274383545,
|
|
||||||
"endPointColorB": 0.7830188274383545
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"startInterfaceName": "chudian232",
|
|
||||||
"endInterfaceName": "chudian208",
|
|
||||||
"startConnectionPointPosition": {
|
|
||||||
"x": -1.378318190574646,
|
|
||||||
"y": -0.2723008692264557,
|
|
||||||
"z": 0.09028154611587525
|
|
||||||
},
|
|
||||||
"endConnectionPointPosition": {
|
|
||||||
"x": -1.406347632408142,
|
|
||||||
"y": -0.26232433319091799,
|
|
||||||
"z": 0.08528154343366623
|
|
||||||
},
|
|
||||||
"startPoint": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"endPoint": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"wireName": "Wire_20251127163812",
|
|
||||||
"cylinderScale": {
|
|
||||||
"x": 0.0020000000949949028,
|
|
||||||
"y": 0.014875994995236397,
|
|
||||||
"z": 0.0020000000949949028
|
|
||||||
},
|
|
||||||
"cylinderPosition": {
|
|
||||||
"x": -1.392332911491394,
|
|
||||||
"y": -0.26731258630752566,
|
|
||||||
"z": 0.08528154343366623
|
|
||||||
},
|
|
||||||
"cylinderRotation": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.5764879584312439,
|
|
||||||
"w": 0.8171056509017944
|
|
||||||
},
|
|
||||||
"cylinderRadius": 0.0020000000949949028,
|
|
||||||
"hasStartInterface": true,
|
|
||||||
"hasEndInterface": true,
|
|
||||||
"debugInfo": "从 CylinderWireData 组件获取",
|
|
||||||
"wireType": "CylinderWireData",
|
|
||||||
"wireColorR": 0.5943396091461182,
|
|
||||||
"wireColorG": 0.18467968702316285,
|
|
||||||
"wireColorB": 0.12615689635276795,
|
|
||||||
"wireColorA": 1.0,
|
|
||||||
"hasCustomColor": true,
|
|
||||||
"connectionPointScale": 0.004999999888241291,
|
|
||||||
"startPointColorR": 0.7830188274383545,
|
|
||||||
"startPointColorG": 0.7830188274383545,
|
|
||||||
"startPointColorB": 0.7830188274383545,
|
|
||||||
"endPointColorR": 0.7830188274383545,
|
|
||||||
"endPointColorG": 0.7830188274383545,
|
|
||||||
"endPointColorB": 0.7830188274383545
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"startInterfaceName": "chudian208",
|
|
||||||
"endInterfaceName": "chudian222",
|
|
||||||
"startConnectionPointPosition": {
|
|
||||||
"x": -1.406347632408142,
|
|
||||||
"y": -0.26232433319091799,
|
|
||||||
"z": 0.09028154611587525
|
|
||||||
},
|
|
||||||
"endConnectionPointPosition": {
|
|
||||||
"x": -1.382118821144104,
|
|
||||||
"y": -0.2516351342201233,
|
|
||||||
"z": 0.08528154343366623
|
|
||||||
},
|
|
||||||
"startPoint": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"endPoint": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"wireName": "Wire_20251127163813",
|
|
||||||
"cylinderScale": {
|
|
||||||
"x": 0.0020000000949949028,
|
|
||||||
"y": 0.013240980915725232,
|
|
||||||
"z": 0.0020000000949949028
|
|
||||||
},
|
|
||||||
"cylinderPosition": {
|
|
||||||
"x": -1.394233226776123,
|
|
||||||
"y": -0.25697973370552065,
|
|
||||||
"z": 0.08528154343366623
|
|
||||||
},
|
|
||||||
"cylinderRotation": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": -0.5460582971572876,
|
|
||||||
"w": 0.8377472162246704
|
|
||||||
},
|
|
||||||
"cylinderRadius": 0.0020000000949949028,
|
|
||||||
"hasStartInterface": true,
|
|
||||||
"hasEndInterface": true,
|
|
||||||
"debugInfo": "从 CylinderWireData 组件获取",
|
|
||||||
"wireType": "CylinderWireData",
|
|
||||||
"wireColorR": 0.5943396091461182,
|
|
||||||
"wireColorG": 0.18467968702316285,
|
|
||||||
"wireColorB": 0.12615689635276795,
|
|
||||||
"wireColorA": 1.0,
|
|
||||||
"hasCustomColor": true,
|
|
||||||
"connectionPointScale": 0.004999999888241291,
|
|
||||||
"startPointColorR": 0.7830188274383545,
|
|
||||||
"startPointColorG": 0.7830188274383545,
|
|
||||||
"startPointColorB": 0.7830188274383545,
|
|
||||||
"endPointColorR": 0.7830188274383545,
|
|
||||||
"endPointColorG": 0.7830188274383545,
|
|
||||||
"endPointColorB": 0.7830188274383545
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"startInterfaceName": "chudian222",
|
|
||||||
"endInterfaceName": "chudian244",
|
|
||||||
"startConnectionPointPosition": {
|
|
||||||
"x": -1.382118821144104,
|
|
||||||
"y": -0.2516351342201233,
|
|
||||||
"z": 0.09028154611587525
|
|
||||||
},
|
|
||||||
"endConnectionPointPosition": {
|
|
||||||
"x": -1.3187440633773804,
|
|
||||||
"y": -0.24335770308971406,
|
|
||||||
"z": 0.08528154343366623
|
|
||||||
},
|
|
||||||
"startPoint": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"endPoint": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"wireName": "Wire_20251127163814",
|
|
||||||
"cylinderScale": {
|
|
||||||
"x": 0.0020000000949949028,
|
|
||||||
"y": 0.031956516206264499,
|
|
||||||
"z": 0.0020000000949949028
|
|
||||||
},
|
|
||||||
"cylinderPosition": {
|
|
||||||
"x": -1.3504314422607422,
|
|
||||||
"y": -0.24749642610549928,
|
|
||||||
"z": 0.08528154343366623
|
|
||||||
},
|
|
||||||
"cylinderRotation": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": -0.6597307324409485,
|
|
||||||
"w": 0.7515020966529846
|
|
||||||
},
|
|
||||||
"cylinderRadius": 0.0020000000949949028,
|
|
||||||
"hasStartInterface": true,
|
|
||||||
"hasEndInterface": true,
|
|
||||||
"debugInfo": "从 CylinderWireData 组件获取",
|
|
||||||
"wireType": "CylinderWireData",
|
|
||||||
"wireColorR": 0.5943396091461182,
|
|
||||||
"wireColorG": 0.18467968702316285,
|
|
||||||
"wireColorB": 0.12615689635276795,
|
|
||||||
"wireColorA": 1.0,
|
|
||||||
"hasCustomColor": true,
|
|
||||||
"connectionPointScale": 0.004999999888241291,
|
|
||||||
"startPointColorR": 0.7830188274383545,
|
|
||||||
"startPointColorG": 0.7830188274383545,
|
|
||||||
"startPointColorB": 0.7830188274383545,
|
|
||||||
"endPointColorR": 0.7830188274383545,
|
|
||||||
"endPointColorG": 0.7830188274383545,
|
|
||||||
"endPointColorB": 0.7830188274383545
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"startInterfaceName": "chudian244",
|
|
||||||
"endInterfaceName": "chudian218",
|
|
||||||
"startConnectionPointPosition": {
|
|
||||||
"x": -1.3187440633773804,
|
|
||||||
"y": -0.24335770308971406,
|
|
||||||
"z": 0.09028154611587525
|
|
||||||
},
|
|
||||||
"endConnectionPointPosition": {
|
|
||||||
"x": -1.3303356170654297,
|
|
||||||
"y": -0.26755011081695559,
|
|
||||||
"z": 0.08528154343366623
|
|
||||||
},
|
|
||||||
"startPoint": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"endPoint": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"wireName": "Wire_20251127165051",
|
|
||||||
"cylinderScale": {
|
|
||||||
"x": 0.0020000000949949028,
|
|
||||||
"y": 0.0134130222722888,
|
|
||||||
"z": 0.0020000000949949028
|
|
||||||
},
|
|
||||||
"cylinderPosition": {
|
|
||||||
"x": -1.3245398998260499,
|
|
||||||
"y": -0.2554539144039154,
|
|
||||||
"z": 0.08528154343366623
|
|
||||||
},
|
|
||||||
"cylinderRotation": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.975147545337677,
|
|
||||||
"w": 0.22155660390853883
|
|
||||||
},
|
|
||||||
"cylinderRadius": 0.0020000000949949028,
|
|
||||||
"hasStartInterface": true,
|
|
||||||
"hasEndInterface": true,
|
|
||||||
"debugInfo": "从 CylinderWireData 组件获取",
|
|
||||||
"wireType": "CylinderWireData",
|
|
||||||
"wireColorR": 0.5943396091461182,
|
|
||||||
"wireColorG": 0.18467971682548524,
|
|
||||||
"wireColorB": 0.12615692615509034,
|
|
||||||
"wireColorA": 1.0,
|
|
||||||
"hasCustomColor": true,
|
|
||||||
"connectionPointScale": 0.004999999888241291,
|
|
||||||
"startPointColorR": 0.7830188274383545,
|
|
||||||
"startPointColorG": 0.7830188274383545,
|
|
||||||
"startPointColorB": 0.7830188274383545,
|
|
||||||
"endPointColorR": 0.7830188274383545,
|
|
||||||
"endPointColorG": 0.7830188274383545,
|
|
||||||
"endPointColorB": 0.7830188274383545
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"startInterfaceName": "chudian218",
|
|
||||||
"endInterfaceName": "chudian240",
|
|
||||||
"startConnectionPointPosition": {
|
|
||||||
"x": -1.3303356170654297,
|
|
||||||
"y": -0.26755011081695559,
|
|
||||||
"z": 0.09028154611587525
|
|
||||||
},
|
|
||||||
"endConnectionPointPosition": {
|
|
||||||
"x": -1.2700444459915162,
|
|
||||||
"y": -0.24335770308971406,
|
|
||||||
"z": 0.08528154343366623
|
|
||||||
},
|
|
||||||
"startPoint": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"endPoint": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"wireName": "Wire_20251127165105",
|
|
||||||
"cylinderScale": {
|
|
||||||
"x": 0.0020000000949949028,
|
|
||||||
"y": 0.03248190879821777,
|
|
||||||
"z": 0.0020000000949949028
|
|
||||||
},
|
|
||||||
"cylinderPosition": {
|
|
||||||
"x": -1.3001899719238282,
|
|
||||||
"y": -0.2554539144039154,
|
|
||||||
"z": 0.08528154343366623
|
|
||||||
},
|
|
||||||
"cylinderRotation": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": -0.5601793527603149,
|
|
||||||
"w": 0.8283713459968567
|
|
||||||
},
|
|
||||||
"cylinderRadius": 0.0020000000949949028,
|
|
||||||
"hasStartInterface": true,
|
|
||||||
"hasEndInterface": true,
|
|
||||||
"debugInfo": "从 CylinderWireData 组件获取",
|
|
||||||
"wireType": "CylinderWireData",
|
|
||||||
"wireColorR": 0.5943396091461182,
|
|
||||||
"wireColorG": 0.18467971682548524,
|
|
||||||
"wireColorB": 0.12615692615509034,
|
|
||||||
"wireColorA": 1.0,
|
"wireColorA": 1.0,
|
||||||
"hasCustomColor": true,
|
"hasCustomColor": true,
|
||||||
"connectionPointScale": 0.004999999888241291,
|
"connectionPointScale": 0.004999999888241291,
|
||||||
|
|
@ -466,15 +234,15 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"startInterfaceName": "chudian240",
|
"startInterfaceName": "chudian240",
|
||||||
"endInterfaceName": "chudian231",
|
"endInterfaceName": "chudian244",
|
||||||
"startConnectionPointPosition": {
|
"startConnectionPointPosition": {
|
||||||
"x": -1.2700444459915162,
|
"x": -1.2700444459915162,
|
||||||
"y": -0.24335770308971406,
|
"y": -0.24335770308971406,
|
||||||
"z": 0.09028154611587525
|
"z": 0.08528154343366623
|
||||||
},
|
},
|
||||||
"endConnectionPointPosition": {
|
"endConnectionPointPosition": {
|
||||||
"x": -1.2912330627441407,
|
"x": -1.3187440633773804,
|
||||||
"y": -0.26317930221557619,
|
"y": -0.24335770308971406,
|
||||||
"z": 0.08528154343366623
|
"z": 0.08528154343366623
|
||||||
},
|
},
|
||||||
"startPoint": {
|
"startPoint": {
|
||||||
|
|
@ -487,22 +255,22 @@
|
||||||
"y": 0.0,
|
"y": 0.0,
|
||||||
"z": 0.0
|
"z": 0.0
|
||||||
},
|
},
|
||||||
"wireName": "Wire_20251127165220",
|
"wireName": "Wire_20251127172103",
|
||||||
"cylinderScale": {
|
"cylinderScale": {
|
||||||
"x": 0.0020000000949949028,
|
"x": 0.0020000000949949028,
|
||||||
"y": 0.014507354237139225,
|
"y": 0.02434980869293213,
|
||||||
"z": 0.0020000000949949028
|
"z": 0.0020000000949949028
|
||||||
},
|
},
|
||||||
"cylinderPosition": {
|
"cylinderPosition": {
|
||||||
"x": -1.2806386947631837,
|
"x": -1.2943942546844483,
|
||||||
"y": -0.2532685101032257,
|
"y": -0.24335770308971406,
|
||||||
"z": 0.08528154343366623
|
"z": 0.08528154343366623
|
||||||
},
|
},
|
||||||
"cylinderRotation": {
|
"cylinderRotation": {
|
||||||
"x": 0.0,
|
"x": 0.0,
|
||||||
"y": 0.0,
|
"y": 0.0,
|
||||||
"z": 0.9173758625984192,
|
"z": 0.7071068286895752,
|
||||||
"w": 0.39802202582359316
|
"w": 0.7071068286895752
|
||||||
},
|
},
|
||||||
"cylinderRadius": 0.0020000000949949028,
|
"cylinderRadius": 0.0020000000949949028,
|
||||||
"hasStartInterface": true,
|
"hasStartInterface": true,
|
||||||
|
|
@ -511,7 +279,7 @@
|
||||||
"wireType": "CylinderWireData",
|
"wireType": "CylinderWireData",
|
||||||
"wireColorR": 0.6112549304962158,
|
"wireColorR": 0.6112549304962158,
|
||||||
"wireColorG": 0.4606019854545593,
|
"wireColorG": 0.4606019854545593,
|
||||||
"wireColorB": 0.07094951719045639,
|
"wireColorB": 0.070949487388134,
|
||||||
"wireColorA": 1.0,
|
"wireColorA": 1.0,
|
||||||
"hasCustomColor": true,
|
"hasCustomColor": true,
|
||||||
"connectionPointScale": 0.004999999888241291,
|
"connectionPointScale": 0.004999999888241291,
|
||||||
|
|
@ -523,16 +291,16 @@
|
||||||
"endPointColorB": 0.7830188274383545
|
"endPointColorB": 0.7830188274383545
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"startInterfaceName": "chudian231",
|
"startInterfaceName": "chudian213",
|
||||||
"endInterfaceName": "chudian234",
|
"endInterfaceName": "chudian235",
|
||||||
"startConnectionPointPosition": {
|
"startConnectionPointPosition": {
|
||||||
"x": -1.2912330627441407,
|
"x": -1.2700444459915162,
|
||||||
"y": -0.26317930221557619,
|
"y": -0.25326845049858096,
|
||||||
"z": 0.09028154611587525
|
"z": 0.08528154343366623
|
||||||
},
|
},
|
||||||
"endConnectionPointPosition": {
|
"endConnectionPointPosition": {
|
||||||
"x": -1.2700444459915162,
|
"x": -1.3187440633773804,
|
||||||
"y": -0.26317930221557619,
|
"y": -0.25326845049858096,
|
||||||
"z": 0.08528154343366623
|
"z": 0.08528154343366623
|
||||||
},
|
},
|
||||||
"startPoint": {
|
"startPoint": {
|
||||||
|
|
@ -545,21 +313,21 @@
|
||||||
"y": 0.0,
|
"y": 0.0,
|
||||||
"z": 0.0
|
"z": 0.0
|
||||||
},
|
},
|
||||||
"wireName": "Wire_20251127165450",
|
"wireName": "Wire_20251127172109",
|
||||||
"cylinderScale": {
|
"cylinderScale": {
|
||||||
"x": 0.0020000000949949028,
|
"x": 0.0020000000949949028,
|
||||||
"y": 0.010594308376312256,
|
"y": 0.02434980869293213,
|
||||||
"z": 0.0020000000949949028
|
"z": 0.0020000000949949028
|
||||||
},
|
},
|
||||||
"cylinderPosition": {
|
"cylinderPosition": {
|
||||||
"x": -1.2806386947631837,
|
"x": -1.2943942546844483,
|
||||||
"y": -0.26317930221557619,
|
"y": -0.25326845049858096,
|
||||||
"z": 0.08528154343366623
|
"z": 0.08528154343366623
|
||||||
},
|
},
|
||||||
"cylinderRotation": {
|
"cylinderRotation": {
|
||||||
"x": 0.0,
|
"x": 0.0,
|
||||||
"y": 0.0,
|
"y": 0.0,
|
||||||
"z": -0.7071068286895752,
|
"z": 0.7071068286895752,
|
||||||
"w": 0.7071068286895752
|
"w": 0.7071068286895752
|
||||||
},
|
},
|
||||||
"cylinderRadius": 0.0020000000949949028,
|
"cylinderRadius": 0.0020000000949949028,
|
||||||
|
|
@ -567,64 +335,6 @@
|
||||||
"hasEndInterface": true,
|
"hasEndInterface": true,
|
||||||
"debugInfo": "从 CylinderWireData 组件获取",
|
"debugInfo": "从 CylinderWireData 组件获取",
|
||||||
"wireType": "CylinderWireData",
|
"wireType": "CylinderWireData",
|
||||||
"wireColorR": 0.5943396091461182,
|
|
||||||
"wireColorG": 0.18467977643013,
|
|
||||||
"wireColorB": 0.1261569857597351,
|
|
||||||
"wireColorA": 1.0,
|
|
||||||
"hasCustomColor": true,
|
|
||||||
"connectionPointScale": 0.004999999888241291,
|
|
||||||
"startPointColorR": 0.7830188274383545,
|
|
||||||
"startPointColorG": 0.7830188274383545,
|
|
||||||
"startPointColorB": 0.7830188274383545,
|
|
||||||
"endPointColorR": 0.7830188274383545,
|
|
||||||
"endPointColorG": 0.7830188274383545,
|
|
||||||
"endPointColorB": 0.7830188274383545
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"startInterfaceName": "chudian234",
|
|
||||||
"endInterfaceName": "chudian236",
|
|
||||||
"startConnectionPointPosition": {
|
|
||||||
"x": -1.2700444459915162,
|
|
||||||
"y": -0.26317930221557619,
|
|
||||||
"z": 0.09028154611587525
|
|
||||||
},
|
|
||||||
"endConnectionPointPosition": {
|
|
||||||
"x": -1.2913323640823365,
|
|
||||||
"y": -0.3188800513744354,
|
|
||||||
"z": 0.08528154343366623
|
|
||||||
},
|
|
||||||
"startPoint": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"endPoint": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"wireName": "Wire_20251127165501",
|
|
||||||
"cylinderScale": {
|
|
||||||
"x": 0.0020000000949949028,
|
|
||||||
"y": 0.029815049842000009,
|
|
||||||
"z": 0.0020000000949949028
|
|
||||||
},
|
|
||||||
"cylinderPosition": {
|
|
||||||
"x": -1.2806884050369263,
|
|
||||||
"y": -0.291029691696167,
|
|
||||||
"z": 0.08528154343366623
|
|
||||||
},
|
|
||||||
"cylinderRotation": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.9833881855010986,
|
|
||||||
"w": 0.18151508271694184
|
|
||||||
},
|
|
||||||
"cylinderRadius": 0.0020000000949949028,
|
|
||||||
"hasStartInterface": true,
|
|
||||||
"hasEndInterface": true,
|
|
||||||
"debugInfo": "从 CylinderWireData 组件获取",
|
|
||||||
"wireType": "CylinderWireData",
|
|
||||||
"wireColorR": 0.03410438448190689,
|
"wireColorR": 0.03410438448190689,
|
||||||
"wireColorG": 0.03504699096083641,
|
"wireColorG": 0.03504699096083641,
|
||||||
"wireColorB": 0.029494885355234147,
|
"wireColorB": 0.029494885355234147,
|
||||||
|
|
@ -637,8 +347,124 @@
|
||||||
"endPointColorR": 0.7830188274383545,
|
"endPointColorR": 0.7830188274383545,
|
||||||
"endPointColorG": 0.7830188274383545,
|
"endPointColorG": 0.7830188274383545,
|
||||||
"endPointColorB": 0.7830188274383545
|
"endPointColorB": 0.7830188274383545
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"startInterfaceName": "chudian218",
|
||||||
|
"endInterfaceName": "chudian217",
|
||||||
|
"startConnectionPointPosition": {
|
||||||
|
"x": -1.3303356170654297,
|
||||||
|
"y": -0.26755011081695559,
|
||||||
|
"z": 0.08528154343366623
|
||||||
|
},
|
||||||
|
"endConnectionPointPosition": {
|
||||||
|
"x": -1.382118821144104,
|
||||||
|
"y": -0.26208674907684328,
|
||||||
|
"z": 0.08528154343366623
|
||||||
|
},
|
||||||
|
"startPoint": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"endPoint": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"wireName": "Wire_20251127172213",
|
||||||
|
"cylinderScale": {
|
||||||
|
"x": 0.0020000000949949028,
|
||||||
|
"y": 0.026035305112600328,
|
||||||
|
"z": 0.0020000000949949028
|
||||||
|
},
|
||||||
|
"cylinderPosition": {
|
||||||
|
"x": -1.356227159500122,
|
||||||
|
"y": -0.2648184299468994,
|
||||||
|
"z": 0.08528154343366623
|
||||||
|
},
|
||||||
|
"cylinderRotation": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.6689834594726563,
|
||||||
|
"w": 0.7432772517204285
|
||||||
|
},
|
||||||
|
"cylinderRadius": 0.0020000000949949028,
|
||||||
|
"hasStartInterface": true,
|
||||||
|
"hasEndInterface": true,
|
||||||
|
"debugInfo": "从 CylinderWireData 组件获取",
|
||||||
|
"wireType": "CylinderWireData",
|
||||||
|
"wireColorR": 0.03410438448190689,
|
||||||
|
"wireColorG": 0.03504699096083641,
|
||||||
|
"wireColorB": 0.029494885355234147,
|
||||||
|
"wireColorA": 1.0,
|
||||||
|
"hasCustomColor": true,
|
||||||
|
"connectionPointScale": 0.004999999888241291,
|
||||||
|
"startPointColorR": 0.7830188274383545,
|
||||||
|
"startPointColorG": 0.7830188274383545,
|
||||||
|
"startPointColorB": 0.7830188274383545,
|
||||||
|
"endPointColorR": 0.7830188274383545,
|
||||||
|
"endPointColorG": 0.7830188274383545,
|
||||||
|
"endPointColorB": 0.7830188274383545
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"startInterfaceName": "chudian222",
|
||||||
|
"endInterfaceName": "chudian208",
|
||||||
|
"startConnectionPointPosition": {
|
||||||
|
"x": -1.382118821144104,
|
||||||
|
"y": -0.2516351342201233,
|
||||||
|
"z": 0.08528154343366623
|
||||||
|
},
|
||||||
|
"endConnectionPointPosition": {
|
||||||
|
"x": -1.406347632408142,
|
||||||
|
"y": -0.26232433319091799,
|
||||||
|
"z": 0.08528154343366623
|
||||||
|
},
|
||||||
|
"startPoint": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"endPoint": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"wireName": "Wire_20251127172216",
|
||||||
|
"cylinderScale": {
|
||||||
|
"x": 0.0020000000949949028,
|
||||||
|
"y": 0.013240980915725232,
|
||||||
|
"z": 0.0020000000949949028
|
||||||
|
},
|
||||||
|
"cylinderPosition": {
|
||||||
|
"x": -1.394233226776123,
|
||||||
|
"y": -0.25697973370552065,
|
||||||
|
"z": 0.08528154343366623
|
||||||
|
},
|
||||||
|
"cylinderRotation": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.8377472162246704,
|
||||||
|
"w": 0.5460582375526428
|
||||||
|
},
|
||||||
|
"cylinderRadius": 0.0020000000949949028,
|
||||||
|
"hasStartInterface": true,
|
||||||
|
"hasEndInterface": true,
|
||||||
|
"debugInfo": "从 CylinderWireData 组件获取",
|
||||||
|
"wireType": "CylinderWireData",
|
||||||
|
"wireColorR": 0.5943396091461182,
|
||||||
|
"wireColorG": 0.18467974662780763,
|
||||||
|
"wireColorB": 0.12615695595741273,
|
||||||
|
"wireColorA": 1.0,
|
||||||
|
"hasCustomColor": true,
|
||||||
|
"connectionPointScale": 0.004999999888241291,
|
||||||
|
"startPointColorR": 0.7830188274383545,
|
||||||
|
"startPointColorG": 0.7830188274383545,
|
||||||
|
"startPointColorB": 0.7830188274383545,
|
||||||
|
"endPointColorR": 0.7830188274383545,
|
||||||
|
"endPointColorG": 0.7830188274383545,
|
||||||
|
"endPointColorB": 0.7830188274383545
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"wireCount": 11,
|
"wireCount": 8,
|
||||||
"sceneName": "xianchang"
|
"sceneName": "xianchang"
|
||||||
}
|
}
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue