From 4451817b921c18271c8d196aadcb75713c1a4f4d Mon Sep 17 00:00:00 2001
From: lq <3298408835@qq.com>
Date: Fri, 13 Dec 2024 15:30:41 +0800
Subject: [PATCH] =?UTF-8?q?Language.json=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Assets/Resources/JsonAsset/Language.json | 35 ++++
xiaofang/Assets/Scenes/Schedule_03.unity | 4 +
.../Script/UI/PanelUI/EvacuationPanel.cs | 153 ++++++++----------
3 files changed, 105 insertions(+), 87 deletions(-)
diff --git a/xiaofang/Assets/Resources/JsonAsset/Language.json b/xiaofang/Assets/Resources/JsonAsset/Language.json
index c1801674..f1c9ec15 100644
--- a/xiaofang/Assets/Resources/JsonAsset/Language.json
+++ b/xiaofang/Assets/Resources/JsonAsset/Language.json
@@ -1624,6 +1624,41 @@
"Text": "网络延迟:{a1}ms",
"Note": "主界面"
},
+ {
+ "ID": "13003",
+ "Text": "对方正在讲话中",
+ "Note": "文本提示-对讲机"
+ },
+ {
+ "ID": "13004",
+ "Text": "取消",
+ "Note": "按钮名"
+ },
+ {
+ "ID": "13005",
+ "Text": "与服务器断开连接",
+ "Note": "断线提示"
+ },
+ {
+ "ID": "13006",
+ "Text": "自动重连 第({a1}/3)次尝试……",
+ "Note": "断线提示"
+ },
+ {
+ "ID": "13007",
+ "Text": "水枪方向",
+ "Note": "操控消火栓灭火时右摇杆上的文本"
+ },
+ {
+ "ID": "13008",
+ "Text": "执行中…",
+ "Note": "会读条的选项,进度条中的文字"
+ },
+ {
+ "ID": "13009",
+ "Text": "这里已经有人在处置了",
+ "Note": "Objects表配置为不支持多人操作的交互对象,点击按钮后的提示。"
+ },
{
"ID": "14000",
"Text": "[{a1}]报告:120急救队伍已到场",
diff --git a/xiaofang/Assets/Scenes/Schedule_03.unity b/xiaofang/Assets/Scenes/Schedule_03.unity
index 0e517126..9c70e7c1 100644
--- a/xiaofang/Assets/Scenes/Schedule_03.unity
+++ b/xiaofang/Assets/Scenes/Schedule_03.unity
@@ -10281,6 +10281,10 @@ PrefabInstance:
propertyPath: panel
value:
objectReference: {fileID: 618256462}
+ - target: {fileID: 2102021661377337229, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
+ propertyPath: m_Enabled
+ value: 1
+ objectReference: {fileID: 0}
- target: {fileID: 2102021661377337229, guid: 86668fbe8407a8741bb903177bc93fdb, type: 3}
propertyPath: classCount
value:
diff --git a/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs b/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs
index 701b860e..b7ab3e83 100644
--- a/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs
+++ b/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs
@@ -13,8 +13,7 @@ using static UnityEditor.Progress;
public class EvacuationPanel : MonoBehaviour
{
public Dictionary distributePeople = new Dictionary();//
- public List personnelItems;
-
+ public List personnelItems;//
public Transform personnelContent;
public Panel panel;
public GameObject personnelPrefabs;
@@ -58,6 +57,8 @@ public class EvacuationPanel : MonoBehaviour
private HashSet excludedAreas = new HashSet(); // յ ID
public SelectScenePanel selectScene;
private HashSet clearedAreas = new HashSet();
+ // ֵ
+ public Dictionary allocatedPeople = new Dictionary();
// Start is called before the first frame update
void Start()
{
@@ -65,14 +66,14 @@ public class EvacuationPanel : MonoBehaviour
nonZeroAreas= GetNonZeroNpcRatioAreas();
jc = JuesechoicePop.GetComponent();
//redistributeBtn.onClick.AddListener(ClearData);
- redistributeBtn.onClick.AddListener(() =>
- {
- if (redistributeBtn.interactable)
- {
- Debug.Log("Redistribute button clicked!");
- RedistributeLogic();
- }
- });
+ //redistributeBtn.onClick.AddListener(() =>
+ //{
+ // if (redistributeBtn.interactable)
+ // {
+ // Debug.Log("Redistribute button clicked!");
+ // RedistributeLogic();
+ // }
+ //});
CountsubmitBtn.onClick.AddListener(Submit);
submitBtn.onClick.AddListener(totalSubmit);
StuCountInputField.onEndEdit.AddListener(CheckInput);
@@ -84,6 +85,13 @@ public class EvacuationPanel : MonoBehaviour
CheckInput(StuCountInputField.text);
IsRedistribution();
IsOpen(selectScene.difficultyId);
+ if(Input.GetKey(KeyCode.A))
+ {
+ foreach(var item in personnelItems)
+ {
+ Debug.Log(item.sceneId);
+ }
+ }
}
//ϴ
public void totalSubmit()
@@ -126,12 +134,14 @@ public class EvacuationPanel : MonoBehaviour
}
}
- private void Submit()
+ //ֿύť
+ public void Submit()
{
// ȡ
int count = int.Parse(StuCountInputField.text); //
StuCountInputField.text = "";
+ // ʹ÷䷽
foreach (var item in personnelItems)
{
personnelItemsDict[item.sceneId] = item; // ʹ sceneId Ϊ
@@ -139,10 +149,10 @@ public class EvacuationPanel : MonoBehaviour
// nonZeroAreas תΪ ID
int[] sceneIds = nonZeroAreas.ToArray();
-
// ÷䷽
var result = DistributePeopleWithBalance(sceneIds, personnelItemsDict, count);
-
+ // 沢ʹ÷
+ allocatedPeople = result; // Ѿ˷ allocatedPeople ֵ
// UI ʾ
foreach (var kvp in result)
{
@@ -153,6 +163,7 @@ public class EvacuationPanel : MonoBehaviour
}
}
}
+
public Dictionary DistributePeopleWithBalance(int[] scenes, Dictionary personnelItemsDict, int totalPeople)
{
// 1. 㵱ǰÿʼ + ѷ
@@ -168,7 +179,6 @@ public class EvacuationPanel : MonoBehaviour
{
totalPeoplePerScene[scene] = 0;
}
-
// Debug ÿijʼ
Debug.Log($"Scene {scene}: Initial People = {totalPeoplePerScene[scene]}");
}
@@ -213,9 +223,13 @@ public class EvacuationPanel : MonoBehaviour
allocatedPeople[scene.Key] = scene.Value - initialPeople; // = - ʼ
}
+ //
+ this.allocatedPeople = allocatedPeople;
+
return allocatedPeople;
}
+
//
//private void ClearData()
//{
@@ -299,11 +313,13 @@ public class EvacuationPanel : MonoBehaviour
}
// Աб
personnelItems.Clear();
+
foreach (var sceneEntry in panel.sceneDataDictionary)
{
foreach (var sceneInfo in sceneEntry.Value)
{
LocationData area = js.GetAreaDateById(int.Parse(sceneInfo.sceneId));
+
// NpcRatioΪ"-1"ʾóЧ
if (area.NpcRatio != "-1")
{
@@ -323,29 +339,46 @@ public class EvacuationPanel : MonoBehaviour
personnelItem.sceneText.text = sceneEntry.Key;
personnelItem.sceneId = area.ID;
personnelItem.Num = 1; // óʼֵΪ 1
+
+ // ¼
button.onClick.AddListener(() =>
{
+ // ǵǰѡ
OnSceneItemClicked(item, Color.yellow, selectedScene);
+
+ // ѾԱ
+ if (personnelItem.Num > 0)
+ {
+ redistributeBtn.onClick.AddListener(() => {
+ // ѡԱ
+ RedistributeLogic(personnelItem.sceneId, personnelItem.Num);
+ });
+
+ }
+
+ // гµԱUI
foreach (Transform child in sceneCount)
{
Destroy(child.gameObject);
}
+
+ // ִкij
LocationData locationData = js.GetAreaDateById(personnelItem.sceneId);
- if(locationData.Level.ToString() != "0")
+ if (locationData.Level.ToString() != "0")
{
- GameObject levelItem = GameObject.Instantiate(scenePrefab, sceneCount);
+ GameObject levelItem = GameObject.Instantiate(scenePrefab, sceneCount);
Button levelBtn = levelItem.transform.Find("chooseBtn2").GetComponent