改表
This commit is contained in:
parent
d13685c99e
commit
31eb5af6d7
File diff suppressed because it is too large
Load Diff
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user