模板Id传参

This commit is contained in:
lq 2024-12-12 19:14:48 +08:00
parent 3a3ff0429a
commit 61643f2e48
6 changed files with 171 additions and 25 deletions

View File

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

View File

@ -18,19 +18,21 @@ public class createTemplateInterface : MonoBehaviour
};
}
//新建模板
public async Task<newTemplateData> createTemplate()
public async Task<newTemplateData> 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<newTemplateData>(response);
Debug.Log(newTemplateData.data);
//=======================================================================
gameRoomReserve gameRoomReserve = new gameRoomReserve();
await gameRoomReserve.scheduledDrill(reserveDate, newTemplateData.data);
//======================================================================
return newTemplateData;
}
}

View File

@ -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<string, string> CreateHeaders()
{
Debug.Log("====5555=====" + GlobalData.ServerData.data.access_token);
return new Dictionary<string, string>
{
{ "Authorization","Bearer "+GlobalData.ServerData.data.access_token },
{"clientId", "e5cd7e4891bf95d1d19206ce24a7b32e" }
};
}
//预定演练
public async Task<ScheduledDrillResponse> 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<ScheduledDrillResponse>(response);
Debug.Log(scheduledDrillResponse.data);
return scheduledDrillResponse;
}
}
//====================================
public class ScheduledDrillBody
{
public string templateId;
public string reserveDate;
}
public class ScheduledDrillResponse : Response
{
public string data;//空
}

View File

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

View File

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

View File

@ -413,8 +413,7 @@ public class SelectScenePanel : MonoBehaviour
{
DifficultyInfo difficultyInfo = item.GetComponent<DifficultyInfo>();
this.difficultyId = difficultyInfo.difficulty;
this.difficulty = item.transform.parent.GetComponentInChildren<Text>().text;
Debug.Log("------------++++++++++++" + this.difficulty);
this.difficulty = item.transform.GetComponentInChildren<Text>().text;
createTemplateInfo.Instance.auth_CreateTemplate.mode = this.difficulty;
}
}