using Newtonsoft.Json; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Threading; using Unity.VisualScripting; using UnityEditor.SearchService; using UnityEngine; using UnityEngine.Events; using UnityEngine.EventSystems; using UnityEngine.SceneManagement; using UnityEngine.SocialPlatforms; using UnityEngine.UI; public class SelectedInfo { public string name;//角色名 public string duty;//职责 public string scene;//场景名 public string leader;//是否组长 public string sceneId;//场景Id public string dutyId;//职责的Id public string peopleId;//角色Id public string birthID;//出生地 } public class Panel : Base { [Header("组件")] [Header("设置人员")] public Button setName;//设置人员 [Header("设置职责")] public Button setDuty;//设置职责 [Header("设置场景")] public Button setScene;//设置场景 [Header("整体安排")] public Text arrangeText;//整体安排 [Header("确认信息按钮")] public Button sureBtn;//确认信息按钮 [Header("最少人员要求警告")] public Button requirementsBtn; [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("UI面板名")] public Text titleText; [Header("应急人员配置Toggle")] public Toggle sceneToggle; [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 GameObject requirementsPrefab; // 预制体,最低配置面板 [Header("数据")] public string name, duty, scene; public int dutyId; public string peopleId; 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 List userInfoList = new List(); public getPlayerList userInfo; public ManagerPanel managerPanel1; public JSONReader jsonReader1; public SelectScenePanel selectScenePanel; public DatePanel datePanel; public WarningPopPanel warningPopPanel; public RequirementPanel requirementPanel; private bool isPersonSelected = false; // 标志是否选择了人员 private bool isDutySelected = false; // 标志是否选择了职责 private bool isSceneSelected = false; // 标志是否选择了场景 // Start is called before the first frame update void Start() { sureBtn.interactable = false; ChangeImage(sureBtn.interactable); selectedInfo = new SelectedInfo(); requirementsBtn.onClick.AddListener(() => OnclickRequirementsBtn()); InstantiateToggle(); } // Update is called once per frame void Update() { GetData(); SetText(); PanelToggelSet(); //SetInputFile(); } //==================================================================动态加载======================================================= //动态加载人员 public async void DynamicLoadingPeople() { //for (int i = 0; i < 10; i++) //{ // GameObject item = GameObject.Instantiate(peoplePrefab, peopleCountent); // PeopleItem peopleItem = item.GetComponent(); // peopleItem.nameText.text = "角色1"; // peopleItem.peopleId = "0"; // Button peoplebutton = item.transform.Find("TextBtn").GetComponent