_xiaofang/xiaofang/Assets/Script/Scheduled_03/Panel.cs

671 lines
26 KiB
C#
Raw Normal View History

using Newtonsoft.Json;
2024-12-02 10:50:31 +08:00
using System;
2024-11-25 16:33:54 +08:00
using System.Collections;
using System.Collections.Generic;
using System.Linq;
2024-11-27 02:11:27 +08:00
using System.Runtime.InteropServices;
2024-12-09 23:53:38 +08:00
using System.Threading;
2024-11-27 23:59:00 +08:00
using Unity.VisualScripting;
2024-11-25 16:33:54 +08:00
using UnityEngine;
2024-12-02 10:50:31 +08:00
using UnityEngine.Events;
2024-11-25 17:16:41 +08:00
using UnityEngine.EventSystems;
2024-11-25 16:33:54 +08:00
using UnityEngine.SceneManagement;
using UnityEngine.UI;
2024-11-27 02:11:27 +08:00
public class SelectedInfo
{
2024-12-04 16:37:51 +08:00
public string name;//<2F><>ɫ<EFBFBD><C9AB>
public string duty;//ְ<><D6B0>
public string scene;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public string leader;//<2F>Ƿ<EFBFBD><C7B7>
2024-12-12 15:21:07 +08:00
public string sceneId;//<2F><><EFBFBD><EFBFBD>Id
public string dutyId;//ְ<><D6B0><EFBFBD><EFBFBD>Id
2024-12-11 21:28:05 +08:00
public string peopleId;//<2F><>ɫId
2024-11-27 02:11:27 +08:00
}
2024-11-25 17:16:41 +08:00
2024-11-25 16:33:54 +08:00
public class Panel : MonoBehaviour
{
2024-11-27 02:11:27 +08:00
[Header("<22><><EFBFBD><EFBFBD>")]
2024-12-09 11:09:39 +08:00
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա")]
2024-11-25 17:16:41 +08:00
public Button setName;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
2024-12-09 11:09:39 +08:00
[Header("<22><><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0>")]
2024-11-25 17:16:41 +08:00
public Button setDuty;//<2F><><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0>
2024-12-09 11:09:39 +08:00
[Header("<22><><EFBFBD>ó<EFBFBD><C3B3><EFBFBD>")]
2024-11-25 17:16:41 +08:00
public Button setScene;//<2F><><EFBFBD>ó<EFBFBD><C3B3><EFBFBD>
2024-12-09 11:09:39 +08:00
[Header("<22><><EFBFBD><EFBFBD><E5B0B2>")]
2024-11-26 15:36:02 +08:00
public Text arrangeText;//<2F><><EFBFBD><EFBFBD><E5B0B2>
2024-12-09 11:09:39 +08:00
[Header("ȷ<><C8B7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ť")]
2024-11-25 16:33:54 +08:00
public Button sureBtn;//ȷ<><C8B7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ť
2024-12-09 11:09:39 +08:00
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ToggleGroup")]
2024-11-27 02:11:27 +08:00
public ToggleGroup scenetoggleGroup;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ToggleGroup
2024-12-09 11:09:39 +08:00
[Header("ɸѡ<C9B8><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")]
2024-11-27 02:11:27 +08:00
public InputField shaixuaninputField;//ɸѡ<C9B8><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-12-09 11:09:39 +08:00
[Header("<22><><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD><EFBFBD>")]
2024-11-25 17:16:41 +08:00
public GraphicRaycaster raycaster; // <20><><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD><EFBFBD>
2024-12-09 11:09:39 +08:00
[Header("<22>¼<EFBFBD>ϵͳ")]
2024-11-25 17:16:41 +08:00
public EventSystem eventSystem; // <20>¼<EFBFBD>ϵͳ
2024-12-09 11:09:39 +08:00
public ToggleGroup chooseGroup;
2024-12-09 11:37:36 +08:00
[Header("<22><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>")]
2024-12-09 11:09:39 +08:00
public Toggle[] panelToggle;//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>Toggle
2024-12-09 11:37:36 +08:00
public Sprite[] toggleImage;//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>ͼƬ
2024-12-09 11:09:39 +08:00
2024-11-27 02:11:27 +08:00
[Header("<22><><EFBFBD><EFBFBD>")]
2024-12-09 11:09:39 +08:00
[Header("<22><>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")]
2024-11-27 02:11:27 +08:00
public GameObject ManagerPanel;//<2F><>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-12-09 11:09:39 +08:00
[Header("<22><>Ա<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>")]
2024-11-27 02:11:27 +08:00
public Transform peopleCountent;//<2F><>Ա<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
2024-12-09 11:09:39 +08:00
[Header("<22><>Ա<EFBFBD><D4B1>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>")]
2024-11-27 02:11:27 +08:00
public GameObject peoplePrefab;//<2F><>Ա<EFBFBD><D4B1>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>
2024-12-09 11:09:39 +08:00
[Header("<22><><EFBFBD><EFBFBD>")]
2024-11-27 23:59:00 +08:00
public Transform panelContent;
2024-12-09 11:09:39 +08:00
[Header("ְ<><D6B0>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>")]
2024-11-30 23:32:17 +08:00
public GameObject dutyPrefab;//ְ<><D6B0>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>
2024-12-09 11:09:39 +08:00
[Header("ְ<><D6B0><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>")]
2024-11-30 23:32:17 +08:00
public Transform dutyCount;//ְ<><D6B0><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
2024-12-09 11:09:39 +08:00
[Header("<22><><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>")]
public GameObject scenePrefab;//<2F><><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>
[Header("<22><><EFBFBD>ų<EFBFBD><C5B3><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>")]
public Transform sceneCount;//<2F><><EFBFBD>ų<EFBFBD><C5B3><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD>ĵط<C4B5>
[Header("<22><>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")]
2024-11-27 23:59:00 +08:00
public GameObject ManagerPanelPrefab; // Ԥ<><D4A4><EFBFBD><EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-11-27 02:11:27 +08:00
[Header("<22><><EFBFBD><EFBFBD>")]
public string name, duty, scene;
2024-12-04 16:37:51 +08:00
public int dutyId;
2024-12-11 21:28:05 +08:00
public string peopleId;
2024-12-02 00:35:53 +08:00
public List<GameObject> peopleList = new List<GameObject>(); // <20><EFBFBD><E6B4A2><EFBFBD><EFBFBD><EFBFBD>Ѽ<EFBFBD><D1BC>ص<EFBFBD><D8B5><EFBFBD>ԱԤ<D4B1><D4A4><EFBFBD><EFBFBD>
2024-11-27 02:11:27 +08:00
private List<GameObject> filteredPeopleList = new List<GameObject>(); // <20>洢ɸѡ<C9B8><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>б<EFBFBD>
private GameObject selectedPerson = null; // <20><>ǰѡ<C7B0>еĽ<D0B5>ɫ
2024-12-02 19:40:49 +08:00
private GameObject selectedDuty = null;//<2F><>ǰѡ<C7B0><D1A1>ְ<EFBFBD><D6B0>
private GameObject selectedScene = null;//<2F><>ǰѡ<C7B0>г<EFBFBD><D0B3><EFBFBD>
2024-11-27 02:11:27 +08:00
public SelectedInfo selectedInfo;
2024-11-27 16:54:09 +08:00
public Dictionary<string, List<SelectedInfo>> sceneDataDictionary = new Dictionary<string, List<SelectedInfo>>();//<2F><>ͬ<EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>
2024-12-11 15:32:27 +08:00
public List<PlayerListData> userInfoList = new List<PlayerListData>();
public getPlayerList userInfo;
public ManagerPanel managerPanel1;
2024-11-30 23:32:17 +08:00
public JSONReader jsonReader1;
2024-12-01 22:36:41 +08:00
public SelectScenePanel selectScenePanel;
2024-12-02 00:35:53 +08:00
public DatePanel datePanel;
2024-12-11 15:32:27 +08:00
private bool isPersonSelected = false; // <20><>־<EFBFBD>Ƿ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
private bool isDutySelected = false; // <20><>־<EFBFBD>Ƿ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0>
private bool isSceneSelected = false; // <20><>־<EFBFBD>Ƿ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>
2024-11-27 02:11:27 +08:00
2024-11-25 16:33:54 +08:00
// Start is called before the first frame update
void Start()
2024-12-09 23:53:38 +08:00
{
selectedInfo = new SelectedInfo();
InstantiateToggle();
2024-12-09 11:09:39 +08:00
}
2024-11-25 16:33:54 +08:00
// Update is called once per frame
void Update()
2024-12-11 15:32:27 +08:00
{
GetData();
SetText();
PanelToggelSet();
//SetInputFile();
}
2024-12-02 19:40:49 +08:00
//==================================================================<3D><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>=======================================================
2024-12-04 16:37:51 +08:00
//<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
2024-12-11 15:32:27 +08:00
public async void DynamicLoadingPeople()
{
PlayerListResponse playerListResponse=await userInfo.GetPlayerList();
foreach(PlayerListData player in playerListResponse.data)
2024-11-27 02:11:27 +08:00
{
2024-12-12 15:21:07 +08:00
Debug.Log("UserName: " + player.UserName);
Debug.Log("Id: " + player.Id);
Debug.Log("CompanyId: " + player.CompanyId);
Debug.Log("UserId: " + player.UserId);
Debug.Log("IsAdmin: " + player.IsAdmin);
Debug.Log("Status: " + player.Status);
Debug.Log("Remark: " + player.Remark);
Debug.Log("DepartmentName: " + player.DepartmentName);
Debug.Log("PostName: " + player.PostName);
Debug.Log("NickName: " + player.NickName);
Debug.Log("CreateTime: " + player.CreateTime);
2024-12-11 15:32:27 +08:00
GameObject item = GameObject.Instantiate<GameObject>(peoplePrefab, peopleCountent);
PeopleItem peopleItem = item.GetComponent<PeopleItem>();
peopleItem.nameText.text = player.NickName;
2024-12-12 15:21:07 +08:00
peopleItem.peopleId = player.UserId;
2024-12-11 15:32:27 +08:00
Button peoplebutton = item.transform.Find("TextBtn").GetComponent<Button>();
peoplebutton.onClick.AddListener(() => OnPeopleItemClicked(item, Color.yellow, selectedPerson));
peopleList.Add(item);// <20><>ÿ<EFBFBD><C3BF>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ӵ<EFBFBD><D3B5>б<EFBFBD><D0B1><EFBFBD>
2024-11-27 02:11:27 +08:00
}
2024-12-11 15:32:27 +08:00
}
2024-11-27 23:59:00 +08:00
//<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0>
2024-12-09 23:53:38 +08:00
public void DynamicLoadingDuty(int id)
2024-11-27 23:59:00 +08:00
{
2024-12-09 23:53:38 +08:00
if (selectScenePanel.difficultyToRoles.ContainsKey(id))
2024-11-30 23:32:17 +08:00
{
2024-12-09 23:53:38 +08:00
List<string> rolesForSelectedDifficulty = selectScenePanel.difficultyToRoles[id];
2024-12-04 16:37:51 +08:00
2024-12-09 23:53:38 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
foreach (var role in rolesForSelectedDifficulty)
{
int roleId = int.Parse(role);
NPCData npcData = jsonReader1.GetRoleDateById(roleId);
if (jsonReader1.npcDictionary.ContainsKey(roleId))
2024-12-01 22:36:41 +08:00
{
2024-12-09 23:53:38 +08:00
var npcInfo = jsonReader1.npcDictionary[roleId];
// <20><><EFBFBD><EFBFBD>DutyItemʵ<6D><CAB5>
GameObject item = GameObject.Instantiate(dutyPrefab, dutyCount);
DutyItem dutyItem = item.GetComponent<DutyItem>();
Button dutuybutton = item.transform.Find("TextBtn").GetComponent<Button>();
dutuybutton.onClick.AddListener(() =>
2024-12-01 22:36:41 +08:00
{
2024-12-09 23:53:38 +08:00
OnDutyItemClicked(item, Color.red, selectedDuty);
if(dutyItem.dutyNameText.text=="<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
{
peopleList.Clear();
foreach (Transform child in sceneCount)
{
Destroy(child.gameObject);
}
Debug.Log("<22><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>λ<EFBFBD><CEBB>");
}
else
{
SetScene(dutyItem.dutyId);
}
});
dutyItem.dutyNameText.text = npcData.Note;
dutyItem.leader = npcData.GroupLeader;
dutyItem.dutyId = npcData.ID;
peopleList.Add(item);
2024-12-01 22:36:41 +08:00
}
}
2024-11-30 23:32:17 +08:00
}
2024-11-27 23:59:00 +08:00
}
//<2F><>̬<EFBFBD><CCAC><EFBFBD>س<EFBFBD><D8B3><EFBFBD>
public void DynamicLoadingScene()
2024-12-09 23:53:38 +08:00
{
foreach (var npcData in jsonReader1.locationDictionary)
2024-11-30 23:32:17 +08:00
{
2024-12-09 23:53:38 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
string roleLimit = npcData.Value.RoleLimit;
int sceneLimit = npcData.Value.Scene;
if (!string.IsNullOrEmpty(roleLimit))
{
2024-12-09 23:53:38 +08:00
// <20>Ȱ<EFBFBD><C8B0><EFBFBD>|<7C><><EFBFBD>ָ<EFBFBD>
string[] roleLimitSections = roleLimit.Split('|');
// <20><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD>|<7C><><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool shouldInstantiate = true; // <20><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫʵ<D2AA><CAB5><EFBFBD><EFBFBD>
foreach (string section in roleLimitSections)
{
2024-12-09 23:53:38 +08:00
string[] roleLimits = section.Split(',');
// <20>жϵ<D0B6>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD> "-1" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>
if (section.Contains("-1"))
{
2024-12-09 23:53:38 +08:00
if (roleLimits[0] == "-1")
{
2024-12-09 23:53:38 +08:00
shouldInstantiate = false; // <20><>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NPC
break; // <20><><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD>ֱ<EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>NPC
2024-12-04 16:37:51 +08:00
}
2024-12-09 23:53:38 +08:00
}
else
{
if(selectScenePanel.scnenId== sceneLimit)
2024-12-04 16:37:51 +08:00
{
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
SceneItem sceneItem = item.GetComponent<SceneItem>();
Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
2024-12-04 22:58:31 +08:00
scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
2024-12-04 16:37:51 +08:00
// <20><><EFBFBD><EFBFBD>limitNum
2024-12-12 15:21:07 +08:00
sceneItem.sceneId = npcData.Key.ToString();
sceneItem.dutyId = roleLimits[1];
2024-12-04 16:37:51 +08:00
sceneItem.limitNum = int.Parse(roleLimits[2]);
sceneItem.sceneName.text = npcData.Value.Note;
// <20><>ÿ<EFBFBD><C3BF>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ӵ<EFBFBD><D3B5>б<EFBFBD><D0B1><EFBFBD>
peopleList.Add(item);
}
2024-12-02 00:35:53 +08:00
}
2024-12-09 23:53:38 +08:00
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰNPC<50><43>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>
if (!shouldInstantiate)
{
continue;
2024-12-01 15:06:22 +08:00
}
}
2024-11-30 23:32:17 +08:00
}
2024-12-09 23:53:38 +08:00
}
2024-12-01 17:51:09 +08:00
//=============================================================<3D><>ť<EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>¼<EFBFBD>==================================================
2024-12-04 16:37:51 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
2024-11-26 15:36:02 +08:00
public void ClickPersonnelManagement()
2024-12-04 16:37:51 +08:00
{
foreach (Transform child in panelContent)
{
Destroy(child.gameObject);
}
2024-12-04 16:37:51 +08:00
foreach (var sceneEntry in sceneDataDictionary)
{
//Debug.Log($"<22><><EFBFBD><EFBFBD>: {sceneEntry.Key}<7D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: {sceneEntry.Value.Count}");
GameObject managerPanelInstance = Instantiate(ManagerPanelPrefab, panelContent);
Button button = managerPanelInstance.GetComponent<Button>();
button.onClick.AddListener(() => managerPanel1.OnItemClicked(managerPanelInstance));
Text sceneText = managerPanelInstance.transform.Find("top/sceneName").GetComponent<Text>();
sceneText.text = sceneEntry.Key;
managerPanel1.CreateScenePanel(sceneEntry.Key, sceneEntry.Value, managerPanelInstance);
//managerPanel1.SetPlate();
ManagerPanel.gameObject.SetActive(true);
}
2024-11-27 23:59:00 +08:00
}
2024-12-09 23:53:38 +08:00
//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
public void SetScene(int id)
{
peopleList.Clear();
foreach(Transform child in sceneCount)
{
Destroy(child.gameObject);
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD> NPC <20><><EFBFBD><EFBFBD>
foreach (var npcData in jsonReader1.locationDictionary)
{
// <20>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڵ<EFBFBD>ǰѡ<C7B0><D1A1><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>
if (npcData.Value.Scene == selectScenePanel.scnenId)
{
// <20><><EFBFBD><EFBFBD>|<7C><><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>ͬ<EFBFBD>Ľ<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>
string[] roleLimitSections = npcData.Value.RoleLimit.Split('|');
bool shouldInstantiate = true;
// <20><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>
foreach (var section in roleLimitSections)
{
// <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>¹<EFBFBD>λ<EFBFBD><CEBB>ID<49><44>ְҵID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
string[] roleLimits = section.Split(',');
if (section.Contains("-1"))
{
if (roleLimits[0] == "-1")
{
shouldInstantiate = false; // <20><>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NPC
break; // <20><><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD>ֱ<EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>NPC
}
}
else
{
2024-12-12 15:21:07 +08:00
string accidentLocationId = roleLimits[0]; // <20>¹<EFBFBD>λ<EFBFBD><CEBB>ID
string roleId = roleLimits[1]; // ְҵID
2024-12-09 23:53:38 +08:00
int minRequired = int.Parse(roleLimits[2]); // <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-12-12 15:21:07 +08:00
if (accidentLocationId == selectScenePanel.idcidentId.ToString() && roleId == id.ToString())
2024-12-09 23:53:38 +08:00
{
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
SceneItem sceneItem = item.GetComponent<SceneItem>();
2024-12-10 08:05:28 +08:00
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>λ<EFBFBD>ø<EFBFBD>ְҵ<D6B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int currentPeopleCount = GetCurrentPeopleCount(accidentLocationId, roleId);
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD>ǣ<EFBFBD><C7A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (minRequired > currentPeopleCount)
{
sceneItem.sceneImage.gameObject.SetActive(true); // <20><>ʾ<EFBFBD>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD><EFBFBD>
}
else
{
sceneItem.sceneImage.gameObject.SetActive(false); // <20><><EFBFBD><EFBFBD><EFBFBD>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD><EFBFBD>
}
2024-12-09 23:53:38 +08:00
Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
2024-12-12 15:21:07 +08:00
sceneItem.sceneId = npcData.Key.ToString();
2024-12-09 23:53:38 +08:00
sceneItem.dutyId = accidentLocationId;
sceneItem.limitNum = minRequired;
sceneItem.sceneName.text = npcData.Value.Note;
peopleList.Add(item);
}
}
}
}
}
}
2024-12-10 08:05:28 +08:00
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>λ<EFBFBD>ø<EFBFBD>ְҵ<D6B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-12-12 15:21:07 +08:00
private int GetCurrentPeopleCount(string accidentLocationId, string roleId)
2024-12-10 08:05:28 +08:00
{
int count = 0;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ䣬ͳ<E4A3AC>Ƹ<EFBFBD><C6B8>¹<EFBFBD>λ<EFBFBD>ú<EFBFBD>ְҵ<D6B0><D2B5><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>
foreach (var sceneData in sceneDataDictionary)
2024-11-27 02:11:27 +08:00
{
2024-12-10 08:05:28 +08:00
foreach (var selectedInfo in sceneData.Value)
{
2024-12-10 08:05:28 +08:00
if (selectedInfo.sceneId == accidentLocationId && selectedInfo.dutyId == roleId)
2024-12-04 16:37:51 +08:00
{
2024-12-10 08:05:28 +08:00
count++;
2024-12-04 16:37:51 +08:00
}
2024-12-10 08:05:28 +08:00
}
}
return count;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>ϰ<EFBFBD>ť
public void ClickSureBtn()
{
// ֻ<><D6BB><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ְ<EFBFBD><D6B0><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><C2A3>Ż<EFBFBD>ִ<EFBFBD>к<EFBFBD><D0BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (isPersonSelected && isDutySelected && isSceneSelected)
{
// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD>е<EFBFBD><D0B5><EFBFBD>Ա<EFBFBD><D4B1>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>
string sceneName = selectedInfo.scene;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
if (!sceneDataDictionary.ContainsKey(sceneName))
{
sceneDataDictionary[sceneName] = new List<SelectedInfo>();
}
2024-12-10 08:05:28 +08:00
// <20><>Ҫ<EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFB5BD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>
bool isLimitReached = false;
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>Ϣ
List<SelectedInfo> currentSceneInfo = sceneDataDictionary[sceneName];
// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ˡ<EFBFBD><CBA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD><CBA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9B3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ1
if (selectedInfo.duty == "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" || selectedInfo.duty == "<22>鳤" || selectedInfo.duty == "<22><>ָ<EFBFBD><D6B8>")
{
int count = currentSceneInfo.Count(info => info.duty == selectedInfo.duty); // ͳ<>Ƶ<EFBFBD>ǰְ<C7B0><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-12-04 16:37:51 +08:00
2024-12-10 08:05:28 +08:00
if (count >= 1) // <20><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ
2024-12-04 16:37:51 +08:00
{
2024-12-10 08:05:28 +08:00
isLimitReached = true; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>
}
}
2024-12-10 08:05:28 +08:00
// <20><><EFBFBD><EFBFBD>û<EFBFBD>дﵽ<D0B4><EFB5BD><EFBFBD>ޣ<EFBFBD><DEA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>Ϣ
if (!isLimitReached)
{
2024-12-10 08:05:28 +08:00
// ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>µ<EFBFBD> SelectedInfo ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬһ<CDAC><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SelectedInfo newSelectedInfo = new SelectedInfo
{
name = selectedInfo.name,
duty = selectedInfo.duty,
scene = selectedInfo.scene,
dutyId = selectedInfo.dutyId,
2024-12-11 21:28:05 +08:00
sceneId = selectedInfo.sceneId,
peopleId=selectedInfo.peopleId
2024-12-10 08:05:28 +08:00
};
2024-12-11 01:32:11 +08:00
2024-12-10 08:05:28 +08:00
// <20><><EFBFBD><EFBFBD>ǰѡ<C7B0>е<EFBFBD><D0B5><EFBFBD>Ա<EFBFBD><D4B1>Ϣ<EFBFBD><CFA2><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>б<EFBFBD><D0B1><EFBFBD>
currentSceneInfo.Add(newSelectedInfo);
// <20><><EFBFBD><EFBFBD>ȷ<EFBFBD>ϰ<EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>־
sureBtn.interactable = false;
isPersonSelected = false;
isDutySelected = false;
isSceneSelected = false;
2024-12-12 15:21:07 +08:00
UploadData(peopleId = selectedInfo.peopleId, selectedInfo.dutyId.ToString(), selectedInfo.sceneId.ToString());
2024-12-10 08:05:28 +08:00
// <20>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ɫ
UpdatePeopleListVisual();
}
}
2024-12-10 08:05:28 +08:00
else
{
Debug.LogError("<22><>ȷ<EFBFBD><C8B7>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ְ<EFBFBD><D6B0><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD>");
}
datePanel.NumberText.text = "<22><>" + (sceneDataDictionary.Keys.Count * sceneDataDictionary.Values.Count).ToString() + "<22>˲<EFBFBD><CBB2><EFBFBD>";
}
2024-11-27 02:11:27 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رհ<D8B1>ť
2024-11-26 18:24:12 +08:00
public void ClickCloseBtn()
2024-12-04 16:37:51 +08:00
{
transform.gameObject.SetActive(false);
}
2024-11-25 16:33:54 +08:00
2024-11-25 17:58:45 +08:00
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ϣ
public void GetData()
2024-12-10 08:05:28 +08:00
{
ManagerPanel managerPanel = new ManagerPanel();
2024-12-04 16:37:51 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>м<EFBFBD><D0BC><EFBFBD>
2024-12-10 08:05:28 +08:00
if (Input.GetMouseButtonDown(0))
{
// ȷ<><C8B7> raycaster <20><> eventSystem <20><>Ϊ<EFBFBD><CEAA>
if (raycaster == null || eventSystem == null)
2024-12-04 16:37:51 +08:00
{
2024-12-10 08:05:28 +08:00
Debug.LogError("Raycaster <20><> EventSystem δ<><CEB4>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><E4A3AC><EFBFBD><EFBFBD> Inspector <20>н<EFBFBD><D0BD>з<EFBFBD><D0B7>䡣");
return;
}
2024-11-25 17:16:41 +08:00
2024-12-10 08:05:28 +08:00
// <20><><EFBFBD><EFBFBD> PointerEventData <20><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PointerEventData pointerData = new PointerEventData(eventSystem);
pointerData.position = Input.mousePosition; // <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
2024-12-10 08:05:28 +08:00
// <20><><EFBFBD>ڴ洢<DAB4><E6B4A2><EFBFBD>߼<EFBFBD><DFBC><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
List<RaycastResult> results = new List<RaycastResult>();
2024-11-25 17:16:41 +08:00
2024-12-10 08:05:28 +08:00
// <20><><EFBFBD>߼<EFBFBD><DFBC><EFBFBD> UI
raycaster.Raycast(pointerData, results);
2024-12-10 08:05:28 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߼<EFBFBD><DFBC><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
foreach (RaycastResult result in results)
{
// <20><><EFBFBD><EFBFBD><E2B5BD><EFBFBD><EFBFBD><EFBFBD>˰<EFBFBD>ť
Button clickedButton = result.gameObject.GetComponent<Button>();
if (clickedButton != null)
2024-11-25 17:16:41 +08:00
{
2024-12-10 08:05:28 +08:00
Text buttonText = clickedButton.GetComponentInChildren<Text>();
if (buttonText != null && buttonText.tag == Tags.people) // <20><>ȡ<EFBFBD><C8A1>ǩΪ<C7A9><CEAA>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>Ϣ
{
name = buttonText.text;
2024-12-12 15:21:07 +08:00
PeopleItem peopleItem = buttonText.gameObject.GetComponentInParent<PeopleItem>();
2024-12-10 08:05:28 +08:00
selectedInfo.name = name;
2024-12-12 15:21:07 +08:00
selectedInfo.peopleId = peopleItem.peopleId;
2024-12-10 08:05:28 +08:00
isPersonSelected = true; // ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
2024-12-11 21:28:05 +08:00
Debug.LogError(">>>>>>>>>>>>>>>>" + selectedInfo.peopleId);
2024-12-10 08:05:28 +08:00
}
else if (buttonText != null && buttonText.tag == Tags.scene) // <20><>ȡ<EFBFBD><C8A1>ǩΪ<C7A9><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
{
scene = buttonText.text;
SceneItem sceneItem = buttonText.gameObject.GetComponentInParent<SceneItem>();
selectedInfo.scene = scene;
selectedInfo.sceneId= sceneItem.sceneId;
isSceneSelected = true; // ѡ<><D1A1><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>
}
else if (buttonText != null && buttonText.tag == Tags.duty) // <20><>ȡ<EFBFBD><C8A1>ǩΪְ<CEAA><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
{
2024-12-04 22:58:31 +08:00
duty = buttonText.text;
2024-12-11 01:32:11 +08:00
DutyItem item = clickedButton.GetComponentInParent<DutyItem>();
2024-12-10 08:05:28 +08:00
if(duty=="<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
{
2024-12-04 16:37:51 +08:00
isDutySelected = true; // ѡ<><D1A1><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0>
2024-12-10 08:05:28 +08:00
isSceneSelected = true;
2024-12-04 16:37:51 +08:00
}
2024-12-10 08:05:28 +08:00
else
{
isDutySelected = true;
isSceneSelected = false;
}
dutyId = item.dutyId;
selectedInfo.duty = duty;
2024-12-12 15:21:07 +08:00
selectedInfo.dutyId = dutyId.ToString();
2024-11-25 17:16:41 +08:00
}
}
2024-12-04 16:37:51 +08:00
}
2024-12-10 08:05:28 +08:00
// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>ϰ<EFBFBD>ť
UpdateConfirmButtonState();
2024-11-25 17:16:41 +08:00
}
2024-12-10 08:05:28 +08:00
}
2024-12-01 17:51:09 +08:00
//==========================================================<3D><><EFBFBD><EFBFBD>===========================================
2024-12-09 11:37:36 +08:00
//<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7>ܹ<EFBFBD><DCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
2024-12-09 11:09:39 +08:00
public void PanelToggelSet()
{
if(selectScenePanel.isSure)
{
panelToggle[1].interactable = selectScenePanel.isSure; // <20><><EFBFBD>õڶ<C3B5><DAB6><EFBFBD>Toggle
2024-12-09 14:12:43 +08:00
panelToggle[1].gameObject.transform.GetComponent<Image>().sprite = toggleImage[1];
2024-12-09 11:09:39 +08:00
panelToggle[2].interactable = selectScenePanel.isSure; // <20><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>Toggle
2024-12-09 14:12:43 +08:00
panelToggle[2].gameObject.transform.GetComponent<Image>().sprite = toggleImage[1];
2024-12-09 11:09:39 +08:00
}
}
2024-12-09 23:53:38 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>Toggle<6C><65>״̬
public void InstantiateToggle()
{
for (int i = 1; i < panelToggle.Length; i++)
{
panelToggle[i].interactable = false;
panelToggle[i].gameObject.transform.GetComponent<Image>().sprite = toggleImage[0];
}
}
2024-12-09 11:09:39 +08:00
2024-12-09 23:53:38 +08:00
//<2F>ж<EFBFBD>ȷ<EFBFBD>ϰ<EFBFBD>ť<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD>
private void UpdateConfirmButtonState()
2024-12-04 16:37:51 +08:00
{
2024-12-10 08:05:28 +08:00
if(isDutySelected)
2024-12-04 16:37:51 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ְ<EFBFBD><D6B0><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>ϰ<EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sureBtn.interactable = isPersonSelected && isDutySelected && isSceneSelected;
}
2024-11-26 15:36:02 +08:00
//<2F><><EFBFBD>ð<EFBFBD><C3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public void SetText()
2024-12-04 16:37:51 +08:00
{
arrangeText.text = "[" + name + "]<5D><><EFBFBD><EFBFBD>[" + duty + "],λ<><CEBB>[" + scene + "]";
}
2024-11-27 02:11:27 +08:00
//ɸѡ
public void SetInputFile()
{
2024-12-04 16:37:51 +08:00
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
string filterText = shaixuaninputField.text.Trim();
2024-12-04 16:37:51 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԱԤ<D4B1><D4A4><EFBFBD><EFBFBD>
foreach (Transform child in peopleCountent)
2024-11-27 02:11:27 +08:00
{
2024-12-04 16:37:51 +08:00
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD> Text <20><><EFBFBD><EFBFBD>
Text personNameText = child.GetComponentInChildren<Text>();
if (personNameText != null)
2024-11-27 02:11:27 +08:00
{
2024-12-04 16:37:51 +08:00
// <20>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>
if (personNameText.text.Contains(filterText))
{
// <20><><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD><E4A3AC>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Ա
child.gameObject.SetActive(true);
}
else
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD><E4A3AC><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>Ա
child.gameObject.SetActive(false);
}
2024-11-27 02:11:27 +08:00
}
}
}
2024-12-04 22:58:31 +08:00
// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD>н<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ı<EFBFBD><C4B1>Ӿ<EFBFBD>Ч<EFBFBD><D0A7>
2024-12-04 16:37:51 +08:00
public void OnPeopleItemClicked(GameObject clickedItem, Color color, GameObject select)
2024-11-27 02:11:27 +08:00
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰѡ<C7B0>еĽ<D0B5>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӿ<EFBFBD>Ч<EFBFBD><D0A7>
2024-12-04 22:58:31 +08:00
if (selectedPerson != null && select != clickedItem)
{
Text prevText = selectedPerson.GetComponentInChildren<Text>();
if (prevText != null)
{
prevText.fontSize = 32; // <20>ָ<EFBFBD>ԭʼ<D4AD>ֺ<EFBFBD>
prevText.color = Color.white; // <20>ָ<EFBFBD>ԭʼ<D4AD><CABC>ɫ
}
}
// <20><><EFBFBD>õ<EFBFBD>ǰѡ<C7B0>еĽ<D0B5>ɫΪѡ<CEAA><D1A1>״̬
selectedPerson = clickedItem; // <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Text personText = clickedItem.GetComponentInChildren<Text>();
if (personText != null)
{
// <20>ֺű<D6BA><C5B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>״̬<D7B4><CCAC>
personText.fontSize = 36;
personText.color = color; // ѡ<><D1A1><EFBFBD><EFBFBD>ɫ
}
}
// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>ְ<EFBFBD>𣬸ı<F0A3ACB8><C4B1>Ӿ<EFBFBD>Ч<EFBFBD><D0A7>
public void OnDutyItemClicked(GameObject clickedItem, Color color, GameObject select)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰѡ<C7B0>еĽ<D0B5>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӿ<EFBFBD>Ч<EFBFBD><D0A7>
if (selectedDuty != null && select != clickedItem)
{
Text prevText = selectedDuty.GetComponentInChildren<Text>();
if (prevText != null)
{
prevText.fontSize = 32; // <20>ָ<EFBFBD>ԭʼ<D4AD>ֺ<EFBFBD>
prevText.color = Color.white; // <20>ָ<EFBFBD>ԭʼ<D4AD><CABC>ɫ
}
}
// <20><><EFBFBD>õ<EFBFBD>ǰѡ<C7B0>еĽ<D0B5>ɫΪѡ<CEAA><D1A1>״̬
selectedDuty = clickedItem; // <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Text personText = clickedItem.GetComponentInChildren<Text>();
if (personText != null)
{
// <20>ֺű<D6BA><C5B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>״̬<D7B4><CCAC>
personText.fontSize = 36;
personText.color = color; // ѡ<><D1A1><EFBFBD><EFBFBD>ɫ
}
}
// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD>н<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ı<EFBFBD><C4B1>Ӿ<EFBFBD>Ч<EFBFBD><D0A7>
public void OnSceneItemClicked(GameObject clickedItem, Color color, GameObject select)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰѡ<C7B0>еĽ<D0B5>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӿ<EFBFBD>Ч<EFBFBD><D0A7>
if (selectedScene != null && select != clickedItem)
2024-11-27 02:11:27 +08:00
{
2024-12-04 22:58:31 +08:00
Text prevText = selectedScene.GetComponentInChildren<Text>();
2024-11-27 02:11:27 +08:00
if (prevText != null)
{
prevText.fontSize = 32; // <20>ָ<EFBFBD>ԭʼ<D4AD>ֺ<EFBFBD>
prevText.color = Color.white; // <20>ָ<EFBFBD>ԭʼ<D4AD><CABC>ɫ
}
}
// <20><><EFBFBD>õ<EFBFBD>ǰѡ<C7B0>еĽ<D0B5>ɫΪѡ<CEAA><D1A1>״̬
2024-12-04 22:58:31 +08:00
selectedScene = clickedItem; // <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-11-27 02:11:27 +08:00
Text personText = clickedItem.GetComponentInChildren<Text>();
if (personText != null)
{
// <20>ֺű<D6BA><C5B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>״̬<D7B4><CCAC>
personText.fontSize = 36;
2024-12-02 19:40:49 +08:00
personText.color = color; // ѡ<><D1A1><EFBFBD><EFBFBD>ɫ
2024-11-27 02:11:27 +08:00
}
}
2024-11-30 16:19:19 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ɫ
private void UpdatePeopleListVisual()
{
2024-12-04 16:37:51 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѽ<EFBFBD><D1BC>ص<EFBFBD><D8B5><EFBFBD>ԱԤ<D4B1><D4A4><EFBFBD><EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD>
foreach (GameObject personItem in peopleList)
2024-11-30 16:19:19 +08:00
{
2024-12-04 16:37:51 +08:00
// <20><>ȡ<EFBFBD><C8A1>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD>ֺ<EFBFBD><D6BA><EFBFBD>ʾ<EFBFBD>ı<EFBFBD>
Text personText = personItem.GetComponentInChildren<Text>();
2024-11-30 16:19:19 +08:00
2024-12-04 16:37:51 +08:00
if (personText != null)
2024-11-30 16:19:19 +08:00
{
2024-12-04 16:37:51 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
bool isPersonAdded = sceneDataDictionary[selectedInfo.scene].Any(info => info.name == personText.text);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ɫΪ<C9AB><CEAA>ɫ
if (isPersonAdded)
{
personText.color = Color.blue; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>ɫ
}
else
{
personText.color = Color.white; // δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>ɫ
}
2024-11-30 16:19:19 +08:00
}
}
}
2024-12-12 15:21:07 +08:00
//<2F>ϴ<EFBFBD><CFB4><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>
public void UploadData(string userId,string roleId,string areaId)
{
createTemplateInfo.Instance.auth_CreateTemplate.playerList = new List<PlayerList>();
foreach (var peopleItem in sceneDataDictionary)
{
foreach (var peopleInfo in peopleItem.Value)
{
PlayerList playerList = new PlayerList();
playerList.userId = userId;
playerList.roleId = roleId;
playerList.birthAreaId = areaId;
2024-12-12 15:34:43 +08:00
playerList.chargeAreaId = areaId;
2024-12-12 15:21:07 +08:00
createTemplateInfo.Instance.auth_CreateTemplate.playerList.Add(playerList);
}
}
2024-11-30 16:19:19 +08:00
}
2024-12-12 15:21:07 +08:00
}
2024-12-04 16:37:51 +08:00
2024-11-27 02:11:27 +08:00