疏散人群公布数据上传

This commit is contained in:
lq 2024-12-17 17:44:06 +08:00
parent 5156519b91
commit 98e20032fa
5 changed files with 19 additions and 14 deletions

View File

@ -60,7 +60,8 @@ public class NpcList//NPC
{
public string npcId;//NPC编号--------------------------------必须
public string areaId;//区域编号------------------------------必须
public int birthAreaId;//数量--------------------------------必须
public int num;//数量--------------------------------必须
public int isHere;//是否归属
}
public class MaterialList//设备器材列表
{

View File

@ -327,7 +327,6 @@ public class Panel : MonoBehaviour
string difficultyId = roleLimits[1];
string roleId = roleLimits[2]; // 职业ID
int minRequired = int.Parse(roleLimits[3]); // 最低要求人数
Debug.LogError("SceneId+" + selectScenePanel.idcidentId);
if (accidentLocationId == selectScenePanel.idcidentId.ToString() && roleId == id.ToString() && difficultyId == selectScenePanel.difficultyId.ToString())
{
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
@ -486,7 +485,6 @@ Debug.LogError("SceneId+" + selectScenePanel.idcidentId);
selectedInfo.name = name;
selectedInfo.peopleId = peopleItem.peopleId;
isPersonSelected = true; // 选择了人员
Debug.LogError(">>>>>>>>>>>>>>>>" + selectedInfo.peopleId);
}
else if (buttonText != null && buttonText.tag == Tags.scene) // 获取标签为场景的信息
{
@ -495,7 +493,6 @@ Debug.LogError("SceneId+" + selectScenePanel.idcidentId);
selectedInfo.scene = scene;
selectedInfo.sceneId= sceneItem.sceneId;
isSceneSelected = true; // 选择了场景
Debug.LogError(">>>>>>>>>>>>>>>>" + selectedInfo.sceneId);
}
else if (buttonText != null && buttonText.tag == Tags.duty) // 获取标签为职责的信息
{
@ -514,7 +511,6 @@ Debug.LogError("SceneId+" + selectScenePanel.idcidentId);
dutyId = item.dutyId;
selectedInfo.duty = duty;
selectedInfo.dutyId = dutyId.ToString();
Debug.LogError(">>>>>>>>>>>>>>>>" + selectedInfo.dutyId);
}
}
}

View File

@ -60,7 +60,8 @@ public class EvacuationPanel : MonoBehaviour
// Start is called before the first frame update
void Start()
{
SetNpcType();
redistributeBtn.interactable = false;
//SetNpcType();
//nonZeroAreas= GetNonZeroNpcRatioAreas();
jc = JuesechoicePop.GetComponent<JueseChoicePop>();
CountsubmitBtn.onClick.AddListener(Submit);
@ -79,12 +80,18 @@ public class EvacuationPanel : MonoBehaviour
//上传数据
public void totalSubmit()
{
NpcList nPC = new NpcList();
nPC.npcId = npcType;
nPC.areaId = roleid;
createTemplateInfo.Instance.auth_CreateTemplate.npcList = new List<NpcList>();
foreach(var npcInfo in personnelItems)
{
Debug.LogError("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
NpcList nPC = new NpcList();
nPC.npcId = npcInfo.npcId.ToString();
nPC.areaId = npcInfo.sceneId.ToString();
nPC.isHere=npcInfo.isHere;
nPC.num = npcInfo.NpcNum;
createTemplateInfo.Instance.auth_CreateTemplate.npcList.Add(nPC);
}
panel.panelToggle[3].interactable = true; // 启用第二个Toggle
panel.panelToggle[3].gameObject.transform.GetComponent<Image>().sprite = panel.toggleImage[1];
panel.panelToggle[4].interactable = true; // 启用第三个Toggle
@ -143,6 +150,7 @@ public class EvacuationPanel : MonoBehaviour
{
item.SetInfo(kvp.Value.ToString()); // 更新UI显示
item.NpcNum = kvp.Value; // 更新Npc数量
item.personnelImage.gameObject.SetActive(true); // 显示图标
Debug.Log($"Scene ID: {kvp.Key}, Assigned NPC Count: {kvp.Value}");
}
@ -168,7 +176,8 @@ public class EvacuationPanel : MonoBehaviour
{
int sceneId = item.sceneId; // 使用 PersonnelItem 的 sceneId
float ratio = float.Parse(parts[4]); // 第五项是分配比例
item.npcId = int.Parse(parts[2]);
item .isHere=int.Parse(parts[3]);
if (!sceneRatios.ContainsKey(sceneId))
{
sceneRatios.Add(sceneId, ratio);
@ -400,7 +409,6 @@ public class EvacuationPanel : MonoBehaviour
}
}
//设置文字颜色
public void OnSceneItemClicked(GameObject clickedItem, Color color, GameObject select)
{

View File

@ -383,7 +383,6 @@ public class SelectScenePanel : MonoBehaviour
toggle.isOn = false;
}
}
Debug.Log("=++++++++++++++++++++++=" + eventToggleList[randomIndex].GetComponent<EventInfo>());
// 选中随机事件
if (eventToggleList[randomIndex] != null && eventToggleList[randomIndex].GetComponent<IncidentInfo>().isOpen != false)
{

View File

@ -8,6 +8,7 @@ public class PersonnelItem : MonoBehaviour
public Text sceneText;
public Image personnelImage;
public Text personnelNum;
public int npcId;
public int sceneId;
public int Num = 0;
public int NpcNum = 0;