疏散人群公布弹窗修改

This commit is contained in:
lq 2024-12-11 01:32:11 +08:00
parent 0b05e7d0ef
commit 158082ec63
4 changed files with 66 additions and 43 deletions

View File

@ -2138,7 +2138,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &618256459
RectTransform:
m_ObjectHideFlags: 0
@ -2211,7 +2211,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 618256458}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 05b11d619e5d88a439384d80484d6952, type: 3}
m_Name:
@ -3413,7 +3413,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &805990076
RectTransform:
m_ObjectHideFlags: 0
@ -10337,6 +10337,14 @@ PrefabInstance:
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9196293257107006895, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: panel
value:
objectReference: {fileID: 618256462}
- target: {fileID: 9196293257107006895, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: jsonReader
value:
objectReference: {fileID: 1417128757}
- target: {fileID: 9196293257811847185, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: m_SizeDelta.x
value: -22.699951
@ -14666,9 +14674,9 @@ RectTransform:
m_Father: {fileID: 7468736063934366934}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 334.1322, y: -55}
m_SizeDelta: {x: 187, y: 110}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7468736064122132329
@ -14949,9 +14957,9 @@ RectTransform:
m_Father: {fileID: 7468736063934366934}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 753.3966, y: -55}
m_SizeDelta: {x: 187, y: 110}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7468736064198941274
@ -15709,7 +15717,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 3.3229}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: 1834, y: 1070}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7468736064579811972
GameObject:
@ -15731,7 +15739,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &7468736064579811982
MonoBehaviour:
m_ObjectHideFlags: 0
@ -16189,9 +16197,9 @@ RectTransform:
m_Father: {fileID: 7468736063934366934}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 543.7644, y: -55}
m_SizeDelta: {x: 187, y: 110}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7468736064659112359
@ -16395,9 +16403,9 @@ RectTransform:
m_Father: {fileID: 7468736064579811971}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 917, y: -53.335}
m_SizeDelta: {x: 1834, y: 106.67}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7468736064728012045
@ -16557,9 +16565,9 @@ RectTransform:
m_Father: {fileID: 7468736063934366934}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 124.5, y: -55}
m_SizeDelta: {x: 187, y: 110}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7468736064820222392
@ -16970,9 +16978,9 @@ RectTransform:
m_Father: {fileID: 7468736064579811971}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 917, y: -588.33496}
m_SizeDelta: {x: 1834, y: 498.685}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7468736064937661071

View File

@ -350,6 +350,7 @@ public class Panel : MonoBehaviour
// 如果没有达到上限,则可以添加人员信息
if (!isLimitReached)
{
Debug.Log(">>>>>>>>>>>>>>>>>>>"+ selectedInfo.dutyId);
// 通过创建一个新的 SelectedInfo 实例来避免引用同一个对象
SelectedInfo newSelectedInfo = new SelectedInfo
{
@ -436,8 +437,8 @@ public class Panel : MonoBehaviour
}
else if (buttonText != null && buttonText.tag == Tags.duty) // 获取标签为职责的信息
{
DutyItem item = clickedButton.GetComponentInParent<DutyItem>();
duty = buttonText.text;
DutyItem item = clickedButton.GetComponentInParent<DutyItem>();
if(duty=="主持人")
{
isDutySelected = true; // 选择了职责
@ -450,6 +451,7 @@ public class Panel : MonoBehaviour
}
dutyId = item.dutyId;
selectedInfo.duty = duty;
selectedInfo.dutyId = dutyId;
}
}
}

View File

@ -333,9 +333,9 @@ public class EvacuationPanel : MonoBehaviour
Button levelBtn = levelItem.transform.Find("chooseBtn2").GetComponent<Button>();
levelBtn.onClick.AddListener(() =>
{
jueseChoicePanel.gameObject .SetActive(true);
JueseChoicePop jueseChoicePop= jueseChoicePanel.gameObject.GetComponent<JueseChoicePop>();
jueseChoicePop.SetClass(personnelItem.sceneId);
jueseChoicePanel.gameObject .SetActive(true);
});
ClassItem classItem = levelItem.GetComponent<ClassItem>();
classItem.classname.text = locationData.Level.ToString();
@ -369,9 +369,6 @@ public class EvacuationPanel : MonoBehaviour
}
// 设置重新分配按钮的交互状态
redistributeBtn.interactable = canRedistribute;
// 调试输出
Debug.Log($"Redistribute button is {(canRedistribute ? "enabled" : "disabled")}");
}
//判断输入框的数字是否大于1

View File

@ -1,7 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.Networking.Types;
using UnityEngine.UI;
public class JueseChoicePop : MonoBehaviour
@ -18,13 +20,14 @@ public class JueseChoicePop : MonoBehaviour
public string s;
public JSONReader jsonReader;
public Panel panel;
//Start is called before the first frame update
void Start()
{
this.gameObject.SetActive(false);
CloseBtn.onClick.AddListener(CLosePop);
Surebtn.onClick.AddListener(CLosePop);
Surebtn.onClick.AddListener(SetFenguan);
//Surebtn.onClick.AddListener(SetFenguan);
//SetClass();
}
void CLosePop()
@ -48,6 +51,12 @@ public class JueseChoicePop : MonoBehaviour
}
public void SetClass(int id)
{
// 清除当前内容
foreach (Transform child in content)
{
Destroy(child.gameObject);
}
// »ñÈ¡Ö¸¶¨ ID µÄ LocationData
LocationData locationData = jsonReader.GetAreaDateById(id);
@ -60,26 +69,33 @@ public class JueseChoicePop : MonoBehaviour
// ·Ö¸î Oversee ×Ö¶Î
string[] overseeParts = locationData.Oversee.Split(',');
foreach (string part in overseeParts)
string firstElement = overseeParts[0];
string lastElement = overseeParts[1];
if (overseeParts.Length > 0)
{
// 检查每个部分的最后一位是否为 "1"
string[] elements = part.Split('|');
if (elements.Length > 1)
// 判断第一个元素是否为 "1"
if (lastElement == "1")
{
string lastElement = elements[elements.Length - 1];
if (lastElement == "1") // 如果最后一部分是 "1",实例化对象
foreach (var pair in panel.sceneDataDictionary)
{
foreach (var selectedInfo in pair.Value)
{
Debug.Log("+++++++++++++++++++++++"+ int.Parse(firstElement));
Debug.Log("-------------------------"+ selectedInfo.dutyId);
if (selectedInfo.dutyId == int.Parse(firstElement))
{
GameObject item = GameObject.Instantiate(classmatePrefab, content);
ClassMate classMate = item.GetComponent<ClassMate>();
// 设置 ClassMate 的名称或其他字段
classMate.classmatename.text = locationData.Note;
classMate.classmatename.text = selectedInfo.name;
}
}
}
Debug.Log($"Instantiated ClassMate for ID {id} with name {locationData.Name}");
}
}
}
}
public void SetClassItem(ClassItem classItem)