Compare commits
No commits in common. "2f632244d14b1bada761050bdd98b0ac250f89e8" and "7fc799c481e2bad92c9c9d3a09e387251248a042" have entirely different histories.
2f632244d1
...
7fc799c481
@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityEngine.Windows;
|
|
||||||
|
|
||||||
public enum TaskState
|
public enum TaskState
|
||||||
{
|
{
|
||||||
@ -20,30 +19,10 @@ public class TaskItem : MonoBehaviour
|
|||||||
public string taskName; // 任务名称
|
public string taskName; // 任务名称
|
||||||
public TaskState state; // 任务状态
|
public TaskState state; // 任务状态
|
||||||
public Text taskTxt; // 任务描述文本
|
public Text taskTxt; // 任务描述文本
|
||||||
public int overseeCond; //区域id
|
|
||||||
public int ishow;
|
|
||||||
public List<TaskTarget> Targets = new List<TaskTarget>(); // 任务目标1列表
|
public List<TaskTarget> Targets = new List<TaskTarget>(); // 任务目标1列表
|
||||||
private JSONReader jsonReader; // JSON 数据读取器
|
private JSONReader jsonReader; // JSON 数据读取器
|
||||||
|
|
||||||
List<int> ExtractNumbers(string input)
|
|
||||||
{
|
|
||||||
// 使用 '|' 分割字符串
|
|
||||||
string[] numberStrings = input.Split("");
|
|
||||||
|
|
||||||
// 创建一个列表存储数字
|
|
||||||
List<int> numbers = new List<int>();
|
|
||||||
|
|
||||||
foreach (string numberString in numberStrings)
|
|
||||||
{
|
|
||||||
// 尝试将字符串解析为整数
|
|
||||||
if (int.TryParse(numberString, out int number))
|
|
||||||
{
|
|
||||||
numbers.Add(number);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return numbers;
|
|
||||||
}
|
|
||||||
public void SetInfo(int id, JSONReader reader)
|
public void SetInfo(int id, JSONReader reader)
|
||||||
{
|
{
|
||||||
taskId = id;
|
taskId = id;
|
||||||
@ -56,15 +35,7 @@ public class TaskItem : MonoBehaviour
|
|||||||
Task_ info = jsonReader.GetTaskByID(taskId);
|
Task_ info = jsonReader.GetTaskByID(taskId);
|
||||||
taskName = info.Note;
|
taskName = info.Note;
|
||||||
state = TaskState.NotStarted;
|
state = TaskState.NotStarted;
|
||||||
Debug.Log(info.OverseeCond);
|
|
||||||
ishow = int.Parse(info.IsShow);
|
|
||||||
Debug.Log(ishow);
|
|
||||||
if (ishow == 1)
|
|
||||||
{
|
|
||||||
overseeCond = int.Parse(info.OverseeCond);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Debug.Log(info.Targets1);
|
Debug.Log(info.Targets1);
|
||||||
|
|
||||||
UpdateTxt();
|
UpdateTxt();
|
||||||
|
@ -5,8 +5,6 @@ using UnityEngine;
|
|||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using UnityEngine.Windows;
|
|
||||||
|
|
||||||
|
|
||||||
public class TaskPanel : Base
|
public class TaskPanel : Base
|
||||||
{
|
{
|
||||||
@ -32,21 +30,21 @@ public class TaskPanel : Base
|
|||||||
{
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
hideBtn.onClick.AddListener(OnClickHideButton);
|
hideBtn.onClick.AddListener(OnClickHideButton);
|
||||||
InitList();
|
//InitList();
|
||||||
InitTask(taskIDs);
|
//InitTask(taskIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitList()
|
//public void InitList()
|
||||||
{
|
//{
|
||||||
foreach (Task_ task in JSONReader.TaskDictionary.Values)
|
// foreach (Task_ task in JSONReader.TaskDictionary.Values)
|
||||||
{
|
// {
|
||||||
if (int.TryParse(task.ID, out int taskId))
|
// if (int.TryParse(task.ID, out int taskId))
|
||||||
{
|
// {
|
||||||
// ת»»³É¹¦£¬Ìí¼Óµ½ taskIDs Áбí
|
// // 转换成功,添加到 taskIDs 列表
|
||||||
taskIDs.Add(taskId);
|
// taskIDs.Add(taskId);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
//添加任务
|
//添加任务
|
||||||
public void Taskad(int id)
|
public void Taskad(int id)
|
||||||
@ -82,7 +80,7 @@ public class TaskPanel : Base
|
|||||||
AddTask(id);
|
AddTask(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将每条任务实例化
|
// 将每条任务实例化
|
||||||
public void AddTask(int taskId)
|
public void AddTask(int taskId)
|
||||||
{
|
{
|
||||||
@ -90,7 +88,7 @@ public class TaskPanel : Base
|
|||||||
TaskItem taskItem = go.GetComponent<TaskItem>();
|
TaskItem taskItem = go.GetComponent<TaskItem>();
|
||||||
taskItem.SetInfo(taskId, JSONReader);
|
taskItem.SetInfo(taskId, JSONReader);
|
||||||
taskItems.Add(taskItem);
|
taskItems.Add(taskItem);
|
||||||
go.SetActive(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新任务UI
|
// 更新任务UI
|
||||||
@ -104,19 +102,6 @@ public class TaskPanel : Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displaytask(int taskId)
|
|
||||||
{
|
|
||||||
TaskItem taskItem = taskItems.Find(t => t.overseeCond== taskId);
|
|
||||||
if (taskItem != null)
|
|
||||||
{
|
|
||||||
if (taskItem.ishow == 1)
|
|
||||||
{
|
|
||||||
taskItem.gameObject.SetActive(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 移除任务
|
// 移除任务
|
||||||
public void RemoveTask(int taskId)
|
public void RemoveTask(int taskId)
|
||||||
{
|
{
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,35 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class PlayerTask : MonoBehaviour
|
|
||||||
{
|
|
||||||
// Start is called before the first frame update
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnTriggerEnter(Collider collider)
|
|
||||||
{
|
|
||||||
if (collider.tag == "Task")
|
|
||||||
{
|
|
||||||
|
|
||||||
int id = collider.GetComponent<AreaID>().Id;
|
|
||||||
Debug.Log(1111111111111111111);
|
|
||||||
Debug.Log(id);
|
|
||||||
TaskPanel.instance.displaytask(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnTriggerExit(Collider collider)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 9e82f68a3a3dee6459425052ac338531
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Loading…
Reference in New Issue
Block a user