diff --git a/xiaofang/Assets/Scenes/Schedule_03.unity b/xiaofang/Assets/Scenes/Schedule_03.unity index c845af2e..699994b8 100644 --- a/xiaofang/Assets/Scenes/Schedule_03.unity +++ b/xiaofang/Assets/Scenes/Schedule_03.unity @@ -1604,6 +1604,10 @@ PrefabInstance: propertyPath: dataText value: objectReference: {fileID: 1423464739} + - target: {fileID: 7187413038405322106, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: isTemplate + value: + objectReference: {fileID: 981298357} - target: {fileID: 7187413038405322106, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} propertyPath: submitText value: @@ -1620,6 +1624,10 @@ PrefabInstance: propertyPath: preservationToggle value: objectReference: {fileID: 981298357} + - target: {fileID: 7187413038405322106, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} + propertyPath: createTemplateInterface + value: + objectReference: {fileID: 1201261373} - target: {fileID: 8789802341354697854, guid: 26d5710936f5f7d468eb5eb9da96112e, type: 3} propertyPath: m_AnchorMax.x value: 1 @@ -2138,7 +2146,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &618256459 RectTransform: m_ObjectHideFlags: 0 @@ -6851,6 +6859,7 @@ GameObject: m_Component: - component: {fileID: 1201261372} - component: {fileID: 1201261371} + - component: {fileID: 1201261373} m_Layer: 0 m_Name: UserInfo m_TagString: Untagged @@ -6885,6 +6894,18 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1201261373 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1201261370} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ec15685532562834f86746af6ec16907, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1234276884 GameObject: m_ObjectHideFlags: 0 @@ -8266,6 +8287,7 @@ MonoBehaviour: NPCJosnFile: {fileID: 4900000, guid: 41009f009f0718647a782c7e1aec97dd, type: 3} LanguageJsonFile: {fileID: 4900000, guid: 62a41129c4663ee41a06274114d28feb, type: 3} SelectJsonFile: {fileID: 4900000, guid: 3efd15f4195557144a45659d2baa1ba3, type: 3} + TaskJsonFile: {fileID: 4900000, guid: 4dec25769ed4ed3469693b1c881248af, type: 3} --- !u!4 &1417128758 Transform: m_ObjectHideFlags: 0 @@ -14719,9 +14741,9 @@ RectTransform: m_Father: {fileID: 7468736063934366934} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 334.1322, y: -55} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 187, y: 110} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064122132329 @@ -15002,9 +15024,9 @@ RectTransform: m_Father: {fileID: 7468736063934366934} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 753.3966, y: -55} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 187, y: 110} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064198941274 @@ -15762,7 +15784,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: 1834, y: 1070} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064579811972 GameObject: @@ -15784,7 +15806,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!114 &7468736064579811982 MonoBehaviour: m_ObjectHideFlags: 0 @@ -16242,9 +16264,9 @@ RectTransform: m_Father: {fileID: 7468736063934366934} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 543.7644, y: -55} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 187, y: 110} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064659112359 @@ -16448,9 +16470,9 @@ RectTransform: m_Father: {fileID: 7468736064579811971} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 917, y: -53.335} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 1834, y: 106.67} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064728012045 @@ -16610,9 +16632,9 @@ RectTransform: m_Father: {fileID: 7468736063934366934} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 124.5, y: -55} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 187, y: 110} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064820222392 @@ -17023,9 +17045,9 @@ RectTransform: m_Father: {fileID: 7468736064579811971} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 917, y: -588.33496} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 1834, y: 498.685} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064937661071 diff --git a/xiaofang/Assets/Script/DirllInterface/createTemplate.cs b/xiaofang/Assets/Script/DirllInterface/createTemplateInterface.cs similarity index 66% rename from xiaofang/Assets/Script/DirllInterface/createTemplate.cs rename to xiaofang/Assets/Script/DirllInterface/createTemplateInterface.cs index cb40038d..191e06fc 100644 --- a/xiaofang/Assets/Script/DirllInterface/createTemplate.cs +++ b/xiaofang/Assets/Script/DirllInterface/createTemplateInterface.cs @@ -6,14 +6,27 @@ using UnityEngine; public class createTemplateInterface : 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 createTemplate() { - auth_createTemplate CreateTemplateBody = new auth_createTemplate(); - CreateTemplateBody.templateName="模板名称"; - string response = await web.SendRequest(web.URL + "/auth/login", "POST", JsonUtility.ToJson(CreateTemplateBody)); + + //===================================================================================================================================================== + 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}]}"; - //string response = await web.SendRequest(web.URL + "/game/gameTemplate/add", "POST", body, CreateHeaders()); + //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); @@ -43,8 +56,8 @@ public class PlayerList// } public class NpcList//NPC列表 { - public string userId;//NPC编号-------------------------------必须 - public string roleId;//区域编号------------------------------必须 + public string npcId;//NPC编号-------------------------------必须 + public string areaId;//区域编号------------------------------必须 public int birthAreaId;//数量--------------------------------必须 } public class MaterialList//设备器材列表 diff --git a/xiaofang/Assets/Script/DirllInterface/createTemplate.cs.meta b/xiaofang/Assets/Script/DirllInterface/createTemplateInterface.cs.meta similarity index 100% rename from xiaofang/Assets/Script/DirllInterface/createTemplate.cs.meta rename to xiaofang/Assets/Script/DirllInterface/createTemplateInterface.cs.meta diff --git a/xiaofang/Assets/Script/UI/PanelUI/DatePanel.cs b/xiaofang/Assets/Script/UI/PanelUI/DatePanel.cs index ca43ed5e..0c051cbe 100644 --- a/xiaofang/Assets/Script/UI/PanelUI/DatePanel.cs +++ b/xiaofang/Assets/Script/UI/PanelUI/DatePanel.cs @@ -15,12 +15,14 @@ public class DatePanel : MonoBehaviour public Text SchoolText; //事故校区文本 public Text PlaceText; //事故地点文本 public Text NumberText; //参与人数文本 + public Toggle isTemplate; public InputField submitInputField; public Text submitText; public Text inputText; public Text dataText; public int placeId; + public createTemplateInterface createTemplateInterface=new createTemplateInterface(); // Start is called before the first frame update void Start() { @@ -60,6 +62,15 @@ 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(); } //模板面板确定按钮 diff --git a/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs b/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs index ecdcdbe4..8cb2599a 100644 --- a/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs +++ b/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs @@ -88,8 +88,8 @@ public class EvacuationPanel : MonoBehaviour { Debug.Log(createTemplateInfo.Instance.auth_CreateTemplate + "==============="); NpcList nPC = new NpcList(); - nPC.userId = npcType; - nPC.roleId = roleid; + nPC.npcId = npcType; + nPC.areaId = roleid; createTemplateInfo.Instance.auth_CreateTemplate.npcList = new List(); createTemplateInfo.Instance.auth_CreateTemplate.npcList.Add(nPC); panel.panelToggle[3].interactable = true; // 启用第二个Toggle diff --git a/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs b/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs index f8945d11..1f5f1428 100644 --- a/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs +++ b/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs @@ -407,7 +407,6 @@ public class SelectScenePanel : MonoBehaviour //游戏难度选择 public void SelsctDifficulty() { - auth_createTemplate auth_CreateTemplate = new auth_createTemplate(); foreach (Toggle item in difficultyList) { if (item.isOn) @@ -415,7 +414,8 @@ public class SelectScenePanel : MonoBehaviour DifficultyInfo difficultyInfo = item.GetComponent(); this.difficultyId = difficultyInfo.difficulty; this.difficulty = item.transform.parent.GetComponentInChildren().text; - auth_CreateTemplate.mode = this.difficulty;//给结构体“难度”赋值 + Debug.Log("------------++++++++++++" + this.difficulty); + createTemplateInfo.Instance.auth_CreateTemplate.mode = this.difficulty; } } } diff --git a/xiaofang/Assets/Script/UI/TemplateInfo.cs b/xiaofang/Assets/Script/UI/TemplateInfo.cs index fd2102b7..6589bc6e 100644 --- a/xiaofang/Assets/Script/UI/TemplateInfo.cs +++ b/xiaofang/Assets/Script/UI/TemplateInfo.cs @@ -5,13 +5,7 @@ using UnityEngine.UI; public class TemplateInfo : MonoBehaviour { -<<<<<<< HEAD:xiaofang/Assets/Script/hylScripts/Free01/NetPings.cs - - -======= public Text templateText; ->>>>>>> e0ef89a8cfb64341378541f16f1e9f5cffbc01eb:xiaofang/Assets/Script/UI/TemplateInfo.cs - // Start is called before the first frame update void Start() {