diff --git a/xiaofang/Assets/Scenes/Schedule_03.unity b/xiaofang/Assets/Scenes/Schedule_03.unity index f79e3349..8003c8c0 100644 --- a/xiaofang/Assets/Scenes/Schedule_03.unity +++ b/xiaofang/Assets/Scenes/Schedule_03.unity @@ -12681,7 +12681,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!222 &5745561351907901231 CanvasRenderer: m_ObjectHideFlags: 0 @@ -14748,6 +14748,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 +14804,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 @@ -15017,6 +15031,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 +15039,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 @@ -15801,7 +15829,7 @@ MonoBehaviour: eventChoiceLable: {fileID: 3969360846526504285} incidentLable: {fileID: 7468736064937661071} randomEventBtn: {fileID: 7468736064832119474} - text20008: {fileID: 0} + text20008: {fileID: 7468736063763417177} title: {fileID: 7468736063763417177} schoolInfoList: - {fileID: 7468736064927213727} @@ -16250,6 +16278,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 +16286,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 @@ -16604,6 +16646,7 @@ GameObject: m_Component: - component: {fileID: 7468736064820222343} - component: {fileID: 7468736064820222342} + - component: {fileID: 7468736064820222393} m_Layer: 5 m_Name: Toggle m_TagString: Untagged @@ -16611,6 +16654,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 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..b3b374cc 100644 --- a/xiaofang/Assets/Script/UI/PanelUI/DatePanel.cs +++ b/xiaofang/Assets/Script/UI/PanelUI/DatePanel.cs @@ -44,7 +44,8 @@ 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..3e299f55 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) @@ -170,14 +172,43 @@ public class SelectScenePanel : MonoBehaviour { 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)) { @@ -553,7 +584,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