using Newtonsoft.Json; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using Unity.VisualScripting; using UnityEngine; using UnityEngine.Events; using UnityEngine.EventSystems; using UnityEngine.SceneManagement; using UnityEngine.UI; public class SelectedInfo { public string name;//角色名 public string duty;//职责 public string scene;//场景名 public string leader;//是否组长 public int dutyId;//职责的Id } public class Panel : MonoBehaviour { [Header("组件")] [Header("设置人员")] public Button setName;//设置人员 [Header("设置职责")] public Button setDuty;//设置职责 [Header("设置场景")] public Button setScene;//设置场景 [Header("整体安排")] public Text arrangeText;//整体安排 [Header("确认信息按钮")] public Button sureBtn;//确认信息按钮 [Header("场景的ToggleGroup")] public ToggleGroup scenetoggleGroup;//场景的ToggleGroup [Header("筛选输入框")] public InputField shaixuaninputField;//筛选输入框 [Header("画布上的射线投射器")] public GraphicRaycaster raycaster; // 画布上的射线投射器 [Header("事件系统")] public EventSystem eventSystem; // 事件系统 public ToggleGroup chooseGroup; [Header("面板选择")] public Toggle[] panelToggle;//面板选择Toggle public Sprite[] toggleImage;//面板选择图片 [Header("物体")] [Header("人员管理界面")] public GameObject ManagerPanel;//人员管理界面 [Header("人员的窗口")] public Transform peopleCountent;//人员的窗口 [Header("人员的预制体")] public GameObject peoplePrefab;//人员的预制体 [Header("物体")] public Transform panelContent; [Header("职责预制体")] public GameObject dutyPrefab;//职责预制体 [Header("职责的窗口")] public Transform dutyCount;//职责的窗口 [Header("场景预制体")] public GameObject scenePrefab;//场景预制体 [Header("存放场景预制体")] public Transform sceneCount;//存放场景预制体的地方 [Header("人员管理面板")] public GameObject ManagerPanelPrefab; // 预制体,包含人员管理面板 [Header("数据")] public string name, duty, scene; public int dutyId; public List peopleList = new List(); // 存储所有已加载的人员预制体 private List filteredPeopleList = new List(); // 存储筛选后的人员列表 private GameObject selectedPerson = null; // 当前选中的角色 private GameObject selectedDuty = null;//当前选中职责 private GameObject selectedScene = null;//当前选中场景 public SelectedInfo selectedInfo; public Dictionary> sceneDataDictionary = new Dictionary>();//不同的场景存取不同的人员数据 public ManagerPanel managerPanel1; public JSONReader jsonReader1; public SelectScenePanel selectScenePanel; public DatePanel datePanel; private bool isPersonSelected = false; // 标志是否选择了人员 private bool isDutySelected = false; // 标志是否选择了职责 private bool isSceneSelected = false; // 标志是否选择了场景 // Start is called before the first frame update void Start() { selectedInfo = new SelectedInfo(); DynamicLoadingPeople(); DynamicLoadingDuty(); DynamicLoadingScene(); for (int i = 1; i < panelToggle.Length; i++) { panelToggle[i].interactable = false; //panelToggle[i].gameObject. } } // Update is called once per frame void Update() { GetData(); SetText(); PanelToggelSet(); //SetInputFile(); } //==================================================================动态加载======================================================= //动态加载人员 public void DynamicLoadingPeople() { for (int i = 0; i < 20; i++) { GameObject item = GameObject.Instantiate(peoplePrefab, peopleCountent); PeopleItem peopleItem = item.GetComponent(); Button peoplebutton = item.transform.Find("TextBtn").GetComponent