From 61643f2e488449e767c9e55f601a132b15610f26 Mon Sep 17 00:00:00 2001 From: lq <3298408835@qq.com> Date: Thu, 12 Dec 2024 19:14:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=9D=BFId=E4=BC=A0=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xiaofang/Assets/Scenes/Schedule_03.unity | 84 +++++++++++++++++++ .../DirllInterface/createTemplateInterface.cs | 10 ++- .../Script/DirllInterface/gameRoomReserve.cs | 47 +++++++++++ .../DirllInterface/gameRoomReserve.cs.meta | 11 +++ .../Assets/Script/UI/PanelUI/DatePanel.cs | 41 ++++----- .../Script/UI/PanelUI/SelectScenePanel.cs | 3 +- 6 files changed, 171 insertions(+), 25 deletions(-) create mode 100644 xiaofang/Assets/Script/DirllInterface/gameRoomReserve.cs create mode 100644 xiaofang/Assets/Script/DirllInterface/gameRoomReserve.cs.meta diff --git a/xiaofang/Assets/Scenes/Schedule_03.unity b/xiaofang/Assets/Scenes/Schedule_03.unity index de73d294..0e517126 100644 --- a/xiaofang/Assets/Scenes/Schedule_03.unity +++ b/xiaofang/Assets/Scenes/Schedule_03.unity @@ -1452,6 +1452,58 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 618256459} m_Modifications: + - target: {fileID: 521824338218413953, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 521824338218413953, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 521824338218413953, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 521824338318890041, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 521824338318890041, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 521824338318890041, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1373529960062900723, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1373529960062900723, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1373529960062900723, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 468742199} + - target: {fileID: 1373529960062900723, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1373529960062900723, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: OnClickSureToggle + objectReference: {fileID: 0} + - target: {fileID: 1373529960062900723, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: DatePanel, Assembly-CSharp + objectReference: {fileID: 0} + - target: {fileID: 1373529960062900723, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} - target: {fileID: 1373529960185383372, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size value: 1 @@ -1596,10 +1648,42 @@ PrefabInstance: propertyPath: m_FontData.m_VerticalOverflow value: 1 objectReference: {fileID: 0} + - target: {fileID: 1373529961266754347, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 1373529961381015436, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} propertyPath: m_SizeDelta.x value: 267.551 objectReference: {fileID: 0} + - target: {fileID: 3849503019427133883, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4599960695770769989, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4599960695770769989, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4599960695770769989, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5134555548762687368, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5134555548762687368, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5134555548762687368, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7187413038405322106, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} propertyPath: dataText value: diff --git a/xiaofang/Assets/Script/DirllInterface/createTemplateInterface.cs b/xiaofang/Assets/Script/DirllInterface/createTemplateInterface.cs index 9792cdc5..500c9751 100644 --- a/xiaofang/Assets/Script/DirllInterface/createTemplateInterface.cs +++ b/xiaofang/Assets/Script/DirllInterface/createTemplateInterface.cs @@ -18,19 +18,21 @@ public class createTemplateInterface : MonoBehaviour }; } //新建模板 - public async Task createTemplate() + public async Task createTemplate(string reserveDate) { //===================================================================================================================================================== Debug.Log(JsonConvert.SerializeObject(createTemplateInfo.Instance.auth_CreateTemplate) + "====================="); string response = await web.SendRequest(web.URL + "/game/gameTemplate/add", "POST", JsonConvert.SerializeObject(createTemplateInfo.Instance.auth_CreateTemplate), CreateHeaders()); - //string body = "{\"templateName\": \"11111\",\"sceneId\": \"11111\",\"subjectId\": \"111\",\"isTemplate\": \"111\",\"mode\": \"111\",\"playerList\": [{\"userId\": \"111\",\"roleId\": \"1111\",\"birthAreaId\": \"111\",\"chargeAreaId\": \"111\"}],\"npcList\": [{\"npcId\": \"111\",\"areaId\": \"111\",\"npcNum\": 0}],\"materialList\": [{\"materialId\": \"111\",\"num\": 0}]}"; - //Debug.Log("======="+body); - //string response = await web.SendRequest(web.URL + "/game/gameTemplate/add", "POST", body, CreateHeaders(serverData)); + Debug.Log("新建模板列表" + response); // 解析服务器返回的数据 newTemplateData newTemplateData = JsonConvert.DeserializeObject(response); Debug.Log(newTemplateData.data); + //======================================================================= + gameRoomReserve gameRoomReserve = new gameRoomReserve(); + await gameRoomReserve.scheduledDrill(reserveDate, newTemplateData.data); + //====================================================================== return newTemplateData; } } diff --git a/xiaofang/Assets/Script/DirllInterface/gameRoomReserve.cs b/xiaofang/Assets/Script/DirllInterface/gameRoomReserve.cs new file mode 100644 index 00000000..e6ba1eb6 --- /dev/null +++ b/xiaofang/Assets/Script/DirllInterface/gameRoomReserve.cs @@ -0,0 +1,47 @@ +using Newtonsoft.Json; +using System.Collections; +using System.Collections.Generic; +using System.Threading.Tasks; +using UnityEngine; + +public class gameRoomReserve : MonoBehaviour +{ + // 创建请求头,使用最新的 token + public Dictionary CreateHeaders() + { + + Debug.Log("====5555=====" + GlobalData.ServerData.data.access_token); + return new Dictionary + { + { "Authorization","Bearer "+GlobalData.ServerData.data.access_token }, + {"clientId", "e5cd7e4891bf95d1d19206ce24a7b32e" } + }; + } + //预定演练 + public async Task scheduledDrill(string reserveDate,string templateId) + { + ScheduledDrillBody body = new ScheduledDrillBody(); + body.reserveDate= reserveDate; + //body.templateId = GlobalData.newTemplateData.data; + body.templateId=templateId; + //===================================================================================================================================================== + Debug.Log(JsonConvert.SerializeObject(body) + "预定演练入参"); + string response = await web.SendRequest(web.URL + "/game/gameRoom/reserve", "POST", JsonConvert.SerializeObject(body), CreateHeaders()); + + Debug.Log("预定演练" + response); + // 解析服务器返回的数据 + ScheduledDrillResponse scheduledDrillResponse = JsonConvert.DeserializeObject(response); + Debug.Log(scheduledDrillResponse.data); + return scheduledDrillResponse; + } +} +//==================================== +public class ScheduledDrillBody +{ + public string templateId; + public string reserveDate; +} +public class ScheduledDrillResponse : Response +{ + public string data;//空 +} \ No newline at end of file diff --git a/xiaofang/Assets/Script/DirllInterface/gameRoomReserve.cs.meta b/xiaofang/Assets/Script/DirllInterface/gameRoomReserve.cs.meta new file mode 100644 index 00000000..5d0b9f45 --- /dev/null +++ b/xiaofang/Assets/Script/DirllInterface/gameRoomReserve.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8ef1ad54847a72f4bb9235a09766e98e +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 0c051cbe..9a246182 100644 --- a/xiaofang/Assets/Script/UI/PanelUI/DatePanel.cs +++ b/xiaofang/Assets/Script/UI/PanelUI/DatePanel.cs @@ -15,7 +15,6 @@ public class DatePanel : MonoBehaviour public Text SchoolText; //事故校区文本 public Text PlaceText; //事故地点文本 public Text NumberText; //参与人数文本 - public Toggle isTemplate; public InputField submitInputField; public Text submitText; @@ -49,11 +48,30 @@ public class DatePanel : MonoBehaviour public void OnClickSubmitPanel() { createTemplateInfo.Instance.auth_CreateTemplate.subjectId = placeId.ToString(); - if (preservationToggle.isOn==true) + if(preservationToggle.isOn) + { + createTemplateInfo.Instance.auth_CreateTemplate.isTemplate = "0"; + } + else + { + createTemplateInfo.Instance.auth_CreateTemplate.isTemplate = "1"; + } + createTemplateInterface.createTemplate(dataText.text); + } + + //模板面板确定按钮 + public void OnClickSurePanel() + { + submitPanel.gameObject.SetActive(false); + } + //判断是否保存为模板 + public void OnClickSureToggle() + { + if (preservationToggle.isOn == true) { submitPanel.gameObject.SetActive(true); - submitText.text = "演练模板"+ dataText.text; - if(inputText==null) + submitText.text = "演练模板" + dataText.text; + if (inputText == null) { createTemplateInfo.Instance.auth_CreateTemplate.templateName = submitInputField.text; } @@ -62,20 +80,5 @@ public class DatePanel : MonoBehaviour createTemplateInfo.Instance.auth_CreateTemplate.templateName = inputText.text; } } - if(isTemplate.isOn) - { - createTemplateInfo.Instance.auth_CreateTemplate.isTemplate = "0"; - } - else - { - createTemplateInfo.Instance.auth_CreateTemplate.isTemplate = "1"; - } - createTemplateInterface.createTemplate(); - } - - //模板面板确定按钮 - public void OnClickSurePanel() - { - submitPanel.gameObject.SetActive(false); } } diff --git a/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs b/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs index ba26a250..6f33f53f 100644 --- a/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs +++ b/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs @@ -413,8 +413,7 @@ public class SelectScenePanel : MonoBehaviour { DifficultyInfo difficultyInfo = item.GetComponent(); this.difficultyId = difficultyInfo.difficulty; - this.difficulty = item.transform.parent.GetComponentInChildren().text; - Debug.Log("------------++++++++++++" + this.difficulty); + this.difficulty = item.transform.GetComponentInChildren().text; createTemplateInfo.Instance.auth_CreateTemplate.mode = this.difficulty; } }