diff --git a/xiaofang/Assets/Scenes/Schedule_03.unity b/xiaofang/Assets/Scenes/Schedule_03.unity index f79e3349..181f3449 100644 --- a/xiaofang/Assets/Scenes/Schedule_03.unity +++ b/xiaofang/Assets/Scenes/Schedule_03.unity @@ -2133,7 +2133,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 @@ -2501,7 +2501,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: -193.59004, y: 309.8263} - m_SizeDelta: {x: 388.1544, y: 58.599} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 1} --- !u!114 &667280288 MonoBehaviour: @@ -5997,8 +5997,7 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 3900195428984076543} + m_Children: [] m_Father: {fileID: 1324221058} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -9027,7 +9026,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &1600693806 RectTransform: m_ObjectHideFlags: 0 @@ -12238,112 +12237,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_ShowMaskGraphic: 0 ---- !u!1001 &3900195428984076542 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 1034927193} - m_Modifications: - - target: {fileID: 3344224971532102794, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 618256462} - - target: {fileID: 3344224972021141760, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_Name - value: btnDutyChoose - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_RootOrder - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_AnchorMin.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_SizeDelta.x - value: 388.1544 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_SizeDelta.y - value: 53.678 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} ---- !u!224 &3900195428984076543 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 3344224972021141763, guid: 4f774e025e4a15442aedb0588ab62396, type: 3} - m_PrefabInstance: {fileID: 3900195428984076542} - m_PrefabAsset: {fileID: 0} --- !u!1 &3969360846526504285 GameObject: m_ObjectHideFlags: 0 @@ -14733,9 +14626,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 @@ -14748,6 +14641,7 @@ GameObject: m_Component: - component: {fileID: 7468736064122132328} - component: {fileID: 7468736064122132343} + - component: {fileID: 7468736064122132344} m_Layer: 5 m_Name: Toggle (1) m_TagString: Untagged @@ -14803,6 +14697,19 @@ MonoBehaviour: m_PersistentCalls: m_Calls: [] m_IsOn: 0 +--- !u!114 &7468736064122132344 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7468736064122132329} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 677e86cb0abf0dd44b23aba025b9c37a, type: 3} + m_Name: + m_EditorClassIdentifier: + difficulty: 0 --- !u!114 &7468736064182248776 MonoBehaviour: m_ObjectHideFlags: 0 @@ -15002,9 +14909,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 @@ -15017,6 +14924,7 @@ GameObject: m_Component: - component: {fileID: 7468736064198941273} - component: {fileID: 7468736064198941272} + - component: {fileID: 7468736064198941275} m_Layer: 5 m_Name: Toggle (3) m_TagString: Untagged @@ -15024,6 +14932,19 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!114 &7468736064198941275 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7468736064198941274} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 677e86cb0abf0dd44b23aba025b9c37a, type: 3} + m_Name: + m_EditorClassIdentifier: + difficulty: 0 --- !u!222 &7468736064232871099 CanvasRenderer: m_ObjectHideFlags: 0 @@ -15748,7 +15669,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: @@ -15770,7 +15691,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 @@ -15801,7 +15722,7 @@ MonoBehaviour: eventChoiceLable: {fileID: 3969360846526504285} incidentLable: {fileID: 7468736064937661071} randomEventBtn: {fileID: 7468736064832119474} - text20008: {fileID: 0} + text20008: {fileID: 7468736063763417177} title: {fileID: 7468736063763417177} schoolInfoList: - {fileID: 7468736064927213727} @@ -16235,9 +16156,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 @@ -16250,6 +16171,7 @@ GameObject: m_Component: - component: {fileID: 7468736064659112358} - component: {fileID: 7468736064659112357} + - component: {fileID: 7468736064659112360} m_Layer: 5 m_Name: Toggle (2) m_TagString: Untagged @@ -16257,6 +16179,19 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!114 &7468736064659112360 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7468736064659112359} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 677e86cb0abf0dd44b23aba025b9c37a, type: 3} + m_Name: + m_EditorClassIdentifier: + difficulty: 0 --- !u!222 &7468736064688766488 CanvasRenderer: m_ObjectHideFlags: 0 @@ -16427,9 +16362,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 @@ -16589,9 +16524,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 @@ -16604,6 +16539,7 @@ GameObject: m_Component: - component: {fileID: 7468736064820222343} - component: {fileID: 7468736064820222342} + - component: {fileID: 7468736064820222393} m_Layer: 5 m_Name: Toggle m_TagString: Untagged @@ -16611,6 +16547,19 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!114 &7468736064820222393 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7468736064820222392} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 677e86cb0abf0dd44b23aba025b9c37a, type: 3} + m_Name: + m_EditorClassIdentifier: + difficulty: 0 --- !u!222 &7468736064832119472 CanvasRenderer: m_ObjectHideFlags: 0 @@ -16988,9 +16937,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 diff --git a/xiaofang/Assets/Script/Scheduled_03/Panel.cs b/xiaofang/Assets/Script/Scheduled_03/Panel.cs index ae2f5dca..f81badfa 100644 --- a/xiaofang/Assets/Script/Scheduled_03/Panel.cs +++ b/xiaofang/Assets/Script/Scheduled_03/Panel.cs @@ -117,9 +117,6 @@ public class Panel : MonoBehaviour if (jsonReader1.npcDictionary.ContainsKey(key)) { var npcInfo = jsonReader1.npcDictionary[key]; - // 在此处可以使用npcInfo做进一步的处理 - Debug.Log("Found NPC: " + npcInfo.Name); - // 创建DutyItem实例 GameObject item = GameObject.Instantiate(dutyPrefab, dutyCount); DutyItem dutyItem = item.GetComponent(); diff --git a/xiaofang/Assets/Script/UI/DifficultyInfo.cs b/xiaofang/Assets/Script/UI/DifficultyInfo.cs new file mode 100644 index 00000000..2b29d989 --- /dev/null +++ b/xiaofang/Assets/Script/UI/DifficultyInfo.cs @@ -0,0 +1,19 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class DifficultyInfo : MonoBehaviour +{ + [Header("难度")] public int difficulty; + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/xiaofang/Assets/Script/UI/DifficultyInfo.cs.meta b/xiaofang/Assets/Script/UI/DifficultyInfo.cs.meta new file mode 100644 index 00000000..99947d6b --- /dev/null +++ b/xiaofang/Assets/Script/UI/DifficultyInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 677e86cb0abf0dd44b23aba025b9c37a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/xiaofang/Assets/Script/UI/PanelUI/DatePanel.cs b/xiaofang/Assets/Script/UI/PanelUI/DatePanel.cs index fd75e211..68fb1ace 100644 --- a/xiaofang/Assets/Script/UI/PanelUI/DatePanel.cs +++ b/xiaofang/Assets/Script/UI/PanelUI/DatePanel.cs @@ -43,8 +43,9 @@ public class DatePanel : MonoBehaviour //提交按钮 public void OnClickSubmitPanel() - { - if(preservationToggle.isOn==true) + { + createTemplateInfo.Instance.auth_CreateTemplate.subjectId = PlaceText.text; + if (preservationToggle.isOn==true) { submitPanel.gameObject.SetActive(true); submitText.text = "演练模板"+ dataText.text; diff --git a/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs b/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs index 0ec2171b..623a5444 100644 --- a/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs +++ b/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs @@ -59,6 +59,7 @@ public class EvacuationPanel : MonoBehaviour public void totalSubmit() { + Debug.Log("----------------->>>>>>>>>>>" + createTemplateInfo.Instance.auth_CreateTemplate.npcList==null); foreach(var item in createTemplateInfo.Instance.auth_CreateTemplate.npcList) { item.userId = npcType; diff --git a/xiaofang/Assets/Script/UI/PanelUI/MaterialPanel.cs b/xiaofang/Assets/Script/UI/PanelUI/MaterialPanel.cs index cb3e8af8..f3dd5278 100644 --- a/xiaofang/Assets/Script/UI/PanelUI/MaterialPanel.cs +++ b/xiaofang/Assets/Script/UI/PanelUI/MaterialPanel.cs @@ -34,32 +34,23 @@ public class MaterialPanel : MonoBehaviour GameObject item = GameObject.Instantiate(materialPrefab, materialContent); MaterialItem materialItem = item.GetComponent(); materialItem.materialNameText.text = materialData.Value.Note; - Debug.Log(materialData.Value.Note); - //Debug.Log("$$$$$$$$$$$$$$" + dutyItem.dutyNameText.text); - //materialItems.Add(item);// 将每个实例化的角色添加到列表中 + materialItem.materialId = materialData.Key.ToString(); + materialItems.Add(materialItem); } - //for (int i = 0; i < 8; i++) // 假设你有8个物品 - //{ - // GameObject item = Instantiate(materialPrefab, materialContent); // 实例化物品项 - // MaterialItem materialItem = item.GetComponent(); // 获取物品项的脚本 - - // materialItems.Add(materialItem); // 将物品项添加到列表中 - - // // 设置物品的名称和其他数据(如果有的话) - // materialItem.materialName = "物品" + (i + 1); // 设置物品名称 - // materialItem.materialNameText.text = materialItem.materialName; // 更新UI中的名称 - //} } // 获取所有物品的数量并提交 public void SubmitMaterialData() { - int index = 0; + Debug.Log("???????????????????????????????????????/" + materialItems.Count); foreach (var materialItem in materialItems) { - createTemplateInfo.Instance.auth_CreateTemplate.materialList[index].materialId = materialItem.materialId; - createTemplateInfo.Instance.auth_CreateTemplate.materialList[index].num = materialItem.materialNum; - index++; + createTemplateInfo.Instance.auth_CreateTemplate.materialList = new List(); + MaterialList materialList = new MaterialList(); + materialList.materialId = materialItem.materialId; + Debug.Log("materialList.materialId--------------------" + materialList.materialId); + materialList.num = materialItem.materialNum; + createTemplateInfo.Instance.auth_CreateTemplate.materialList.Add(materialList); Debug.Log(materialItem.materialName + " 数量: " + materialItem.GetMaterialNum()); } } diff --git a/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs b/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs index bd367dc5..0fffaee4 100644 --- a/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs +++ b/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs @@ -52,6 +52,8 @@ public class SelectScenePanel : MonoBehaviour public string sceneName { get; set; } public int eventId { get; set; } public string eventName { get; set; } + public int idcidentId{ get; set; } + public string idcidentName{ get; set; } public string difficulty { get; set; } public string isBuy { get; set; } public bool isSure { get; set; }//判断是否点击了提交按钮 @@ -145,7 +147,7 @@ public class SelectScenePanel : MonoBehaviour } } - //动态加载事件选择预制体 + //动态加载对应的事件地点 public void InstantiateIncidentPrefab(int eventId) { foreach (var eventData in jsonReader.incidentSiteDictionary) @@ -165,19 +167,52 @@ public class SelectScenePanel : MonoBehaviour toggle.group = incidentGroup; toggle.isOn = false; incidentInfos.Add(item); + if (incidentInfos.Count > 1) + { + //随机按钮设置 + } } else { break; } - } + toggle.onValueChanged.AddListener((isSelected) => + { + + if (isSelected) + { + this.idcidentName = item.incidentText.text; + string[] difficulty = eventData.Value.Difficulty.Split('|'); + + // 确保difficultyList和difficulty的长度匹配 + for (int i = 0; i < difficultyList.Count && i < difficulty.Length; i++) + { + Toggle item = difficultyList[i]; // 获取对应的Toggle + DifficultyInfo difficultyInfo = item.gameObject.GetComponent(); + + if (difficultyInfo == null) + { + difficultyInfo = item.gameObject.AddComponent(); + } + + // 给每个Toggle设置不同的difficulty值 + difficultyInfo.difficulty = int.Parse(difficulty[i]); + + // 打印出设置的难度值,帮助调试 + Debug.Log($"Toggle {i} - Difficulty: {difficultyInfo.difficulty}"); + } + } + }); + + + } } } //点击继续按钮后更换场景图片及名称 public void InstantiateEventPrefab(int id) { - + text20008.text = sceneName; // 通过 id 获取对应的 sceneData if (jsonReader.sceneDictionary.TryGetValue(id, out var sceneData)) { @@ -215,6 +250,7 @@ public class SelectScenePanel : MonoBehaviour eventInfoList.Add(item); evnetsceneList.Add(toggle); } + //添加点击事件 toggle.onValueChanged.AddListener((isSelected) => { if (isSelected) // 只有当Toggle被选中时,才调用SelectEventBtn @@ -234,7 +270,6 @@ public class SelectScenePanel : MonoBehaviour InstantiateIncidentPrefab(int.Parse(disasterLocation)); OnRandomEventClick(); } - createTemplateInfo.Instance.auth_CreateTemplate.sceneId = item.eventId.ToString(); } }); @@ -310,7 +345,6 @@ public class SelectScenePanel : MonoBehaviour //随机事件 public void OnRandomEventClick() { - // 随机选择一个事件 if (eventInfoList.Count > 1) { @@ -384,7 +418,6 @@ public class SelectScenePanel : MonoBehaviour { SelectEvent(); SelsctDifficulty(); - //SelectEvnentBtn(); SetDataPanelInfo(); this.gameObject.SetActive(false); panel.gameObject.SetActive(true); @@ -449,31 +482,38 @@ public class SelectScenePanel : MonoBehaviour { bool anyToggleSelected = false; bool anyeventSelected = false; + bool isOk = false; Debug.Log("evnetsceneList>>>>"+ evnetsceneList.Count()); // 检查场景选择 foreach (Toggle toggle in evnetsceneList) { if (toggle.isOn) { + anyToggleSelected = true; break; // 如果有一个场景 Toggle 被选中,停止检查 } } foreach (Toggle toggle in eventToggleList) { + Debug.LogError("事件选择:" + anyToggleSelected); if (toggle.isOn) { anyeventSelected = true; + break; // 如果有一个场景 Toggle 被选中,停止检查 } } // 根据是否有 Toggle 被选中,设置 ContinueBtn 是否可交互 if (submitBtn != null && anyToggleSelected == true&& anyeventSelected==true) { - submitBtn.interactable = anyToggleSelected; // 如果有选中的 Toggle,继续按钮可交互,否则不可交互 + Debug.LogError("提交按钮组件未找到!"); + isOk = true; + submitBtn.interactable = isOk; // 如果有选中的 Toggle,继续按钮可交互,否则不可交互 } else { + submitBtn.interactable = isOk; Debug.LogWarning("提交按钮组件未找到!"); } } @@ -553,7 +593,7 @@ public class SelectScenePanel : MonoBehaviour //设置日期界面的数据 public void SetDataPanelInfo() { - datePanel.SchoolText.text = schoolName; - datePanel.PlaceText.text = eventName; + datePanel.SchoolText.text = sceneName; + datePanel.PlaceText.text = idcidentName; } } \ No newline at end of file