消防接口数据传输

This commit is contained in:
lq 2024-12-07 16:18:15 +08:00
parent 957e7cc035
commit d04be15484
8 changed files with 136 additions and 29 deletions

View File

@ -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

View File

@ -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<DutyItem>();

View File

@ -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()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 677e86cb0abf0dd44b23aba025b9c37a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -44,6 +44,7 @@ public class DatePanel : MonoBehaviour
//Ìá½»°´Å¥
public void OnClickSubmitPanel()
{
createTemplateInfo.Instance.auth_CreateTemplate.subjectId = PlaceText.text;
if (preservationToggle.isOn==true)
{
submitPanel.gameObject.SetActive(true);

View File

@ -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;

View File

@ -34,32 +34,23 @@ public class MaterialPanel : MonoBehaviour
GameObject item = GameObject.Instantiate<GameObject>(materialPrefab, materialContent);
MaterialItem materialItem = item.GetComponent<MaterialItem>();
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<MaterialItem>(); // 获取物品项的脚本
// 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 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());
}
}

View File

@ -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,6 +172,35 @@ 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<DifficultyInfo>();
if (difficultyInfo == null)
{
difficultyInfo = item.gameObject.AddComponent<DifficultyInfo>();
}
// 给每个Toggle设置不同的difficulty值
difficultyInfo.difficulty = int.Parse(difficulty[i]);
// 打印出设置的难度值,帮助调试
Debug.Log($"Toggle {i} - Difficulty: {difficultyInfo.difficulty}");
}
}
});
}
}
}
@ -177,7 +208,7 @@ public class SelectScenePanel : MonoBehaviour
//点击继续按钮后更换场景图片及名称
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;
}
}