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("组件")] public Button choseJuBenSettingBtn; public Button emergencySettingBtn; public Button peoplePublishBtn; public Button materialReserveBtn; public Button dateSelectionBtn; public Button personnelmanagementBtn; public Button setName;//设置人员 public Button setDuty;//设置职责 public Button setScene;//设置场景 public Text arrangeText;//整体安排 public Button sureBtn;//确认信息按钮 public ToggleGroup scenetoggleGroup;//场景的ToggleGroup public InputField shaixuaninputField;//筛选输入框 public GraphicRaycaster raycaster; // 画布上的射线投射器 public EventSystem eventSystem; // 事件系统 [Header("物体")] public GameObject ManagerPanel;//人员管理界面 public Transform peopleCountent;//人员的窗口 public GameObject peoplePrefab;//人员的预制体 public Transform panelContent; public GameObject dutyPrefab;//职责预制体 public Transform dutyCount;//职责的窗口 public GameObject scenePrefab; public Transform sceneCount; 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(); } // Update is called once per frame void Update() { GetData(); SetText(); //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