This commit is contained in:
林小智丶 2024-12-29 16:31:33 +08:00
parent d13685c99e
commit 31eb5af6d7
2 changed files with 6286 additions and 6279 deletions

File diff suppressed because it is too large Load Diff

View File

@ -345,7 +345,7 @@ public class ZZUIManager : MonoBehaviour
public bool isluxian = false; public bool isluxian = false;
public static int louhao;//ÅжϼǺÅÂ¥ public static int louhao;//ÅжϼǺÅÂ¥
public string TempNPC; public string TempNPC;
public List<string> NPCdian; public List<Vector3> NPCdian;
public int ID = 0; public int ID = 0;
public void Awake() public void Awake()
{ {
@ -1314,31 +1314,38 @@ public class ZZUIManager : MonoBehaviour
} }
/// <summary> /// <summary>
/// 拆分字符串并过滤数据,取 `#` 前的部分 /// 解析字符串并将 Vector3 数据存入列表
/// </summary> /// </summary>
/// <param name="input">输入字符串</param> /// <param name="input">输入字符串</param>
private void SplitData(string input) private void SplitData(string input)
{ {
// 检查是否包含 `#` // 取 `#` 前的数据
if (input.Contains("#")) if (input.Contains("#"))
{ {
// 取 `#` 前面的部分
input = input.Split('#')[0]; input = input.Split('#')[0];
} }
// 按 `|` 分数据 // 按 `|` 数据
string[] items = input.Split('|'); string[] segments = input.Split('|');
// 将每个数据存入列表 foreach (string segment in segments)
foreach (string item in items) {
// 按 `,` 分割每段数据
string[] components = segment.Split(',');
if (components.Length == 3 &&
float.TryParse(components[0], out float x) &&
float.TryParse(components[1], out float y) &&
float.TryParse(components[2], out float z))
{ {
string[] subItems = item.Split(','); // 按逗号分割 // 将解析的 Vector3 数据存入列表
foreach (string subItem in subItems) NPCdian.Add(new Vector3(x, y, z));
{
NPCdian.Add(subItem); // 存入拆分后的值
}
} }
else
{
Debug.LogWarning($"无法解析为 Vector3 的数据段:{segment}");
}
}
} }
#endregion #endregion