diff --git a/xiaofang/Assets/Res/HYLUI/TaskPanel.cs b/xiaofang/Assets/Res/HYLUI/TaskPanel.cs index 785f185e..6da73538 100644 --- a/xiaofang/Assets/Res/HYLUI/TaskPanel.cs +++ b/xiaofang/Assets/Res/HYLUI/TaskPanel.cs @@ -22,14 +22,29 @@ public class TaskPanel : Base public float hidePositionX = 125f; public float showPositionX = -198f; + public List taskIDs = new List(); + private List taskItems = new List(); // 当前显示的任务列表 void Start() { instance = this; hideBtn.onClick.AddListener(OnClickHideButton); + InitList(); + //InitTask(taskIDs); } + public void InitList() + { + foreach (Task_ task in JSONReader.TaskDictionary.Values) + { + if (int.TryParse(task.ID, out int taskId)) + { + // 转换成功,添加到 taskIDs 列表 + taskIDs.Add(taskId); + } + } + } // 将任务栏收起或显示 public void OnClickHideButton() { diff --git a/xiaofang/Assets/Script/npc/RecuseNpc.cs b/xiaofang/Assets/Script/npc/RecuseNpc.cs index c12ad6aa..3c895936 100644 --- a/xiaofang/Assets/Script/npc/RecuseNpc.cs +++ b/xiaofang/Assets/Script/npc/RecuseNpc.cs @@ -86,21 +86,22 @@ public class RecuseNpc : MonoBehaviour //娣诲姞npc鐨勭洰鐨勫湴鍒發ist涓 public void SetNpcDes(Vector3 tar) { - Debug.Log(tar); + Debug.Log(tar+"鐩爣璺緞鐐"); - target.position = tar; - Debug.Log(target); - NavMeshHit hit; - if (!NavMesh.SamplePosition(tar, out hit, 1.0f, NavMesh.AllAreas)) - { - Debug.LogError($"鐩爣鐐 {target} 涓嶅湪瀵艰埅缃戞牸涓"); - } - else - { - tar = hit.position; // 灏嗙洰鏍囩偣璋冩暣鍒版渶杩戠殑瀵艰埅缃戞牸浣嶇疆 - } - Debug.Log("杩涘叆濂旇窇++++++="); - targetPoints.Add(tar); + //target.position = tar; + //Debug.Log(target); + //NavMeshHit hit; + //if (!NavMesh.SamplePosition(tar, out hit, 1.0f, NavMesh.AllAreas)) + //{ + // Debug.LogError($"鐩爣鐐 {target} 涓嶅湪瀵艰埅缃戞牸涓"); + //} + //else + //{ + // tar = hit.position; // 灏嗙洰鏍囩偣璋冩暣鍒版渶杩戠殑瀵艰埅缃戞牸浣嶇疆 + //} + //Debug.Log("杩涘叆濂旇窇++++++="); + //targetPoints.Add(tar); + navMeshAgent.SetDestination(tar); }