2024-11-21 13:55:05 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Newtonsoft.Json;
|
2024-11-25 09:45:47 +08:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using UnityEditor.PackageManager;
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using System.Data;
|
2024-11-21 13:55:05 +08:00
|
|
|
|
public class auth_login
|
|
|
|
|
{
|
|
|
|
|
public string clientId = "e5cd7e4891bf95d1d19206ce24a7b32e";
|
|
|
|
|
public string grantType = "password";
|
2024-11-25 16:31:30 +08:00
|
|
|
|
}
|
2024-11-29 17:27:21 +08:00
|
|
|
|
//public class auth_createTemplate
|
|
|
|
|
//{
|
|
|
|
|
// public string templateName;
|
|
|
|
|
// public string sceneId;
|
|
|
|
|
// public string subjectId;
|
|
|
|
|
// public string isTemplate;
|
|
|
|
|
// public string mode;
|
|
|
|
|
// public List<PlayerList> playerList;
|
|
|
|
|
// public List<NpcList> npcList;
|
|
|
|
|
// public List<MaterialList> materialList;
|
|
|
|
|
//}
|
|
|
|
|
//public class PlayerList
|
|
|
|
|
//{
|
|
|
|
|
// public string userId;
|
|
|
|
|
// public string roleId;
|
|
|
|
|
// public string birthAreaId;
|
|
|
|
|
// public string chargeAreaId;
|
|
|
|
|
//}
|
|
|
|
|
//public class NpcList
|
|
|
|
|
//{
|
|
|
|
|
// public string userId;
|
|
|
|
|
// public string roleId;
|
|
|
|
|
// public int birthAreaId;
|
|
|
|
|
//}
|
|
|
|
|
//public class MaterialList
|
|
|
|
|
//{
|
|
|
|
|
// public string materialId;
|
|
|
|
|
// public int num;
|
|
|
|
|
//}
|
2024-11-25 16:31:30 +08:00
|
|
|
|
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
|
|
|
|
//public class TemplateList//<2F>ɿ<EFBFBD>
|
|
|
|
|
//{
|
|
|
|
|
// public string templateId="";
|
|
|
|
|
// public string templateName;
|
|
|
|
|
// public string sceneId;
|
|
|
|
|
// public string subjectId;
|
|
|
|
|
// public string queryType;
|
|
|
|
|
//}
|
2024-11-29 17:27:21 +08:00
|
|
|
|
//public class createTemplate
|
|
|
|
|
//{
|
|
|
|
|
// public string templateName;
|
|
|
|
|
// public string sceneId;
|
|
|
|
|
// public string subjectId;
|
|
|
|
|
// public string isTemplate;
|
|
|
|
|
// public string mode;
|
|
|
|
|
//}
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================================
|
2024-11-21 13:55:05 +08:00
|
|
|
|
public class login : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public string token;//<2F><>¼<EFBFBD><C2BC><EFBFBD>ص<EFBFBD>token
|
2024-11-25 09:45:47 +08:00
|
|
|
|
public Global Global;
|
|
|
|
|
auth_login auth_Login = new auth_login();
|
|
|
|
|
public string clientId = "e5cd7e4891bf95d1d19206ce24a7b32e";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
|
|
|
|
|
public Dictionary<string, string> CreateHeaders()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
2024-11-29 17:27:21 +08:00
|
|
|
|
if (string.IsNullOrEmpty(Global.global.loginResponse.data.access_token))
|
2024-11-25 09:45:47 +08:00
|
|
|
|
{
|
|
|
|
|
Debug.LogWarning("<22><><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷʱ<CDB7><CAB1>token δ<><CEB4><EFBFBD>á<EFBFBD>");
|
|
|
|
|
return new Dictionary<string, string>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new Dictionary<string, string>
|
|
|
|
|
{
|
2024-11-29 17:27:21 +08:00
|
|
|
|
{ "Authorization","Bearer "+Global.global.loginResponse.data.access_token },
|
|
|
|
|
{"clientId", "e5cd7e4891bf95d1d19206ce24a7b32e" }
|
2024-11-25 09:45:47 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
//=================================================================================================
|
|
|
|
|
public async void Start()
|
2024-11-21 13:55:05 +08:00
|
|
|
|
{
|
2024-11-25 09:45:47 +08:00
|
|
|
|
await loging();
|
2024-11-29 17:27:21 +08:00
|
|
|
|
//SubmitTemplate();
|
|
|
|
|
//BindNPC();
|
|
|
|
|
//BindMaterial();
|
|
|
|
|
//BindPlayer();
|
|
|
|
|
//QueryDrillSubject();
|
|
|
|
|
//TemplateList();
|
|
|
|
|
//createTemplate();
|
|
|
|
|
//QueryScene();
|
|
|
|
|
//queryRoleList();
|
2024-11-21 13:55:05 +08:00
|
|
|
|
}
|
2024-11-25 09:45:47 +08:00
|
|
|
|
//<2F><>¼
|
|
|
|
|
public async Task loging()
|
2024-11-21 13:55:05 +08:00
|
|
|
|
{
|
|
|
|
|
auth_login auth_Login = new auth_login();
|
2024-11-23 14:08:04 +08:00
|
|
|
|
Debug.Log(JsonUtility.ToJson(auth_Login));
|
2024-11-21 13:55:05 +08:00
|
|
|
|
string response = await web.SendRequest(web.URL + "/auth/login", "POST", JsonUtility.ToJson(auth_Login));
|
2024-11-25 09:45:47 +08:00
|
|
|
|
Debug.Log("<22><>¼" + response);
|
2024-11-21 13:55:05 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
2024-11-29 17:27:21 +08:00
|
|
|
|
loginResponse serverData = JsonConvert.DeserializeObject<loginResponse>(response);
|
2024-11-25 09:45:47 +08:00
|
|
|
|
token = serverData.data.access_token;
|
|
|
|
|
Debug.Log("===========" + serverData.data.isCreater);
|
2024-11-21 13:55:05 +08:00
|
|
|
|
}
|
2024-11-25 09:45:47 +08:00
|
|
|
|
//<2F><>ȡģ<C8A1><C4A3><EFBFBD>б<EFBFBD>
|
2024-11-29 17:27:21 +08:00
|
|
|
|
//public async void TemplaRst()
|
|
|
|
|
//{
|
|
|
|
|
// string response = await web.SendRequest(web.URL + "/game/gameTemplate/list", "GET", "", CreateHeaders());
|
|
|
|
|
// Debug.Log("<22><>ȡģ<C8A1><C4A3><EFBFBD>б<EFBFBD>" + response);
|
|
|
|
|
// //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// TemplateListData templateListData = JsonConvert.DeserializeObject<TemplateListData>(response);
|
|
|
|
|
// Debug.Log("================" + templateListData.msg);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-25 09:45:47 +08:00
|
|
|
|
//<2F>½<EFBFBD>ģ<EFBFBD><C4A3>
|
2024-11-29 17:27:21 +08:00
|
|
|
|
//public async void createTemplate()
|
|
|
|
|
//{
|
|
|
|
|
// auth_createTemplate auth_CreateTemplate = new auth_createTemplate();
|
|
|
|
|
// string response = await web.SendRequest(web.URL + "/auth/login", "POST", JsonUtility.ToJson(auth_CreateTemplate));
|
|
|
|
|
// //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("<22>½<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>б<EFBFBD>" + response);
|
|
|
|
|
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// newTemplateData newTemplateData = JsonConvert.DeserializeObject<newTemplateData>(response);
|
|
|
|
|
// Debug.Log(newTemplateData.data);
|
|
|
|
|
//}
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
|
|
|
|
|
2024-11-29 17:27:21 +08:00
|
|
|
|
|
|
|
|
|
//<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>б<EFBFBD>
|
|
|
|
|
//public async void QueryScene()
|
|
|
|
|
//{
|
|
|
|
|
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// string response = await web.SendRequest(web.URL + "/game/scene/list", "GET", "", CreateHeaders());
|
|
|
|
|
// Debug.Log("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>б<EFBFBD>" + response);
|
|
|
|
|
|
|
|
|
|
// // ʹ<><CAB9>Newtonsoft.Json<6F><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>JSON<4F><4E><EFBFBD>ݵ<EFBFBD>QuerySceneData<74><61><EFBFBD><EFBFBD>
|
|
|
|
|
// QuerySceneData serverData = JsonConvert.DeserializeObject<QuerySceneData>(response);
|
|
|
|
|
|
|
|
|
|
// // <20><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ݵ<EFBFBD>ijЩ<C4B3><D0A9><EFBFBD><EFBFBD>
|
|
|
|
|
// if (serverData != null && serverData.data != null)
|
|
|
|
|
// {
|
|
|
|
|
// foreach (var scene in serverData.data)
|
|
|
|
|
// {
|
|
|
|
|
// Debug.Log("<22><><EFBFBD><EFBFBD>ID: " + scene.id);
|
|
|
|
|
// Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: " + scene.name);
|
|
|
|
|
// Debug.Log("<22><><EFBFBD><EFBFBD>: " + scene.description);
|
|
|
|
|
// Debug.Log("<22>۸<EFBFBD>: " + scene.price);
|
|
|
|
|
// Debug.Log("<22><>ҵ: " + scene.industryName);
|
|
|
|
|
|
|
|
|
|
// if (scene.fileList != null)
|
|
|
|
|
// {
|
|
|
|
|
// foreach (var file in scene.fileList)
|
|
|
|
|
// {
|
|
|
|
|
// Debug.Log("<22>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>: " + file.name);
|
|
|
|
|
// Debug.Log("<22>ļ<EFBFBD>URL: " + file.url);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>");
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
|
|
|
|
//<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ<EFBFBD>б<EFBFBD>
|
2024-11-29 20:06:53 +08:00
|
|
|
|
//public async void QueryDrillSubject()
|
|
|
|
|
//{
|
|
|
|
|
// string response = await web.SendRequest(web.URL + "/game/subject/list", "GET", "", CreateHeaders());
|
|
|
|
|
// Debug.Log("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ<EFBFBD>б<EFBFBD>: " + response);
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
2024-11-29 20:06:53 +08:00
|
|
|
|
// // ʹ<><CAB9> Newtonsoft.Json <20><><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD>л<EFBFBD>
|
|
|
|
|
// DrillSubject drillSubject = JsonConvert.DeserializeObject<DrillSubject>(response);
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
2024-11-29 20:06:53 +08:00
|
|
|
|
// // <20><><EFBFBD>鷴<EFBFBD><E9B7B4><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// if (drillSubject == null)
|
|
|
|
|
// {
|
|
|
|
|
// Debug.LogError("Failed to deserialize JSON. DrillSubject is null.");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
2024-11-29 20:06:53 +08:00
|
|
|
|
// if (drillSubject.data == null || drillSubject.data.Count == 0)
|
|
|
|
|
// {
|
|
|
|
|
// Debug.LogWarning("No subjects found in the returned data.");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
2024-11-29 20:06:53 +08:00
|
|
|
|
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD> data <20>б<EFBFBD>
|
|
|
|
|
// foreach (var subject in drillSubject.data)
|
|
|
|
|
// {
|
|
|
|
|
// Debug.Log("ID: " + subject.id);
|
|
|
|
|
// Debug.Log("Scene Names: " + subject.sceneNames);
|
|
|
|
|
// Debug.Log("Name: " + subject.name);
|
|
|
|
|
// Debug.Log("Suit Version: " + subject.suitVersion);
|
|
|
|
|
// Debug.Log("Type: " + subject.type);
|
|
|
|
|
// Debug.Log("Description: " + subject.description);
|
|
|
|
|
// Debug.Log("Price: " + subject.price);
|
|
|
|
|
// Debug.Log("Company ID: " + subject.companyId);
|
|
|
|
|
// Debug.Log("Status: " + subject.status);
|
|
|
|
|
// Debug.Log("Delete Flag: " + subject.delFlag);
|
|
|
|
|
// Debug.Log("Remark: " + subject.remark);
|
|
|
|
|
// Debug.Log("Game Name: " + subject.gameName);
|
|
|
|
|
// Debug.Log("OSS ID: " + subject.ossId);
|
|
|
|
|
// Debug.Log("File List: " + subject.fileList);
|
|
|
|
|
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶΣ<D6B6><CEA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// // <20><><EFBFBD>磬<EFBFBD><E7A3AC><EFBFBD>۸<EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD>ּ<EFBFBD><D6BC>㣬<EFBFBD><E3A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
2024-11-29 20:06:53 +08:00
|
|
|
|
////<2F><>ɫ<EFBFBD>б<EFBFBD>
|
|
|
|
|
//public async void queryRoleList()
|
|
|
|
|
//{
|
|
|
|
|
// string body = "{\"sceneId\": \"1845704588547301377\"}";
|
|
|
|
|
// string response = await web.SendRequest(web.URL + "/game/role/list", "GET", body, CreateHeaders());
|
|
|
|
|
// Debug.Log("<22><>ѯ<EFBFBD><D1AF>ɫ<EFBFBD>б<EFBFBD>: " + response);
|
|
|
|
|
// RoleList serverData = JsonConvert.DeserializeObject<RoleList>(response);
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
2024-11-29 20:06:53 +08:00
|
|
|
|
// // <20><><EFBFBD>鷴<EFBFBD><E9B7B4><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// if (serverData == null)
|
|
|
|
|
// {
|
|
|
|
|
// Debug.LogError("Failed to deserialize JSON. RoleList is null.");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
2024-11-29 20:06:53 +08:00
|
|
|
|
// if (serverData.data == null || serverData.data.Count == 0)
|
|
|
|
|
// {
|
|
|
|
|
// Debug.LogWarning("No role data found in the returned data.");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
2024-11-29 20:06:53 +08:00
|
|
|
|
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD>Ľ<EFBFBD>ɫ<EFBFBD>б<EFBFBD>
|
|
|
|
|
// foreach (var role in serverData.data)
|
|
|
|
|
// {
|
|
|
|
|
// Debug.Log("Role ID: " + role.id);
|
|
|
|
|
// Debug.Log("Role Name: " + role.roleName);
|
|
|
|
|
// Debug.Log("Scene ID: " + role.sceneId);
|
|
|
|
|
// Debug.Log("Game Name: " + role.gameName);
|
|
|
|
|
// Debug.Log("Role Attributions: " + role.roleAttributions);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
|
|
|
|
//ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD>Ұ<EFBFBD><D2B0><EFBFBD>
|
|
|
|
|
public async void BindPlayer()
|
|
|
|
|
{
|
|
|
|
|
string templateId = "1111";
|
|
|
|
|
string userId = "1";
|
|
|
|
|
string roleId = "1";
|
|
|
|
|
string birthAreaId = "11";
|
|
|
|
|
string chargeAreaId = "2";
|
2024-11-21 13:55:05 +08:00
|
|
|
|
|
2024-11-25 09:45:47 +08:00
|
|
|
|
string body = $@"
|
|
|
|
|
{{
|
|
|
|
|
""templateId"": ""{templateId}"",
|
|
|
|
|
""playerList"": [
|
|
|
|
|
{{
|
|
|
|
|
""userId"": ""{userId}"",
|
|
|
|
|
""roleId"": ""{roleId}"",
|
|
|
|
|
""birthAreaId"": ""{birthAreaId}"",
|
|
|
|
|
""chargeAreaId"": ""{chargeAreaId}""
|
|
|
|
|
}}
|
|
|
|
|
]
|
|
|
|
|
}}";
|
|
|
|
|
|
|
|
|
|
string response = await web.SendRequest(web.URL + "/game/gameTemplate/player", "POST", body, CreateHeaders());
|
|
|
|
|
Debug.Log("ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD>Ұ<EFBFBD><D2B0><EFBFBD>: " + response);
|
|
|
|
|
BindPlayer serverData = JsonConvert.DeserializeObject<BindPlayer>(response);
|
2024-11-21 13:55:05 +08:00
|
|
|
|
}
|
2024-11-25 09:45:47 +08:00
|
|
|
|
//ģ<><C4A3>NPC<50><43><EFBFBD><EFBFBD>
|
|
|
|
|
public async void BindNPC()
|
|
|
|
|
{
|
|
|
|
|
string templateId = "1111";
|
|
|
|
|
string npcId = "1";
|
|
|
|
|
string areaId = "1";
|
|
|
|
|
int npcNum = 1;
|
|
|
|
|
//string chargeAreaId = "2";
|
|
|
|
|
|
|
|
|
|
string body = $@"
|
|
|
|
|
{{
|
|
|
|
|
""templateId"": ""{templateId}"",
|
|
|
|
|
""npcList"": [
|
|
|
|
|
{{
|
|
|
|
|
""npcId"": ""{npcId}"",
|
|
|
|
|
""areaId"": ""{areaId}"",
|
|
|
|
|
""npcNum"": ""{npcNum}""
|
|
|
|
|
}}
|
|
|
|
|
]
|
|
|
|
|
}}";
|
|
|
|
|
|
|
|
|
|
string response = await web.SendRequest(web.URL + "/game/gameTemplate/npc", "POST", body, CreateHeaders());
|
|
|
|
|
Debug.Log("ģ<><C4A3>NPC<50><43><EFBFBD><EFBFBD>: " + response);
|
|
|
|
|
BindNPC serverData = JsonConvert.DeserializeObject<BindNPC>(response);
|
|
|
|
|
}
|
|
|
|
|
//ģ<><C4A3><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
|
|
|
|
public async void BindMaterial()
|
|
|
|
|
{
|
|
|
|
|
string templateId = "1111";
|
|
|
|
|
string materialId = "1";
|
|
|
|
|
int num = 0;
|
|
|
|
|
//string chargeAreaId = "2";
|
|
|
|
|
|
|
|
|
|
string body = $@"
|
|
|
|
|
{{
|
|
|
|
|
""templateId"": ""{templateId}"",
|
|
|
|
|
""materialList"": [
|
|
|
|
|
{{
|
|
|
|
|
""materialId"": ""{materialId}"",
|
|
|
|
|
""num"": ""{num}""
|
|
|
|
|
}}
|
|
|
|
|
]
|
|
|
|
|
}}";
|
|
|
|
|
|
|
|
|
|
string response = await web.SendRequest(web.URL + "/game/gameTemplate/material", "POST", body, CreateHeaders());
|
|
|
|
|
Debug.Log("ģ<><C4A3><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>: " + response);
|
|
|
|
|
BindMaterial serverData = JsonConvert.DeserializeObject<BindMaterial>(response);
|
|
|
|
|
if (serverData.data == null)
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
|
|
|
|
}
|
|
|
|
|
Debug.Log(serverData.data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>ύԤ<E1BDBB><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
|
|
public async void SubmitTemplate()
|
|
|
|
|
{
|
|
|
|
|
string templateId = "1111";
|
|
|
|
|
string reserveDate = "2024-11-22";
|
|
|
|
|
// int num = 0;
|
|
|
|
|
//string chargeAreaId = "2";
|
|
|
|
|
|
|
|
|
|
string body = $@"
|
|
|
|
|
{{
|
|
|
|
|
""templateId"": ""{templateId}"",
|
|
|
|
|
""reserveDate"":""{reserveDate}""
|
|
|
|
|
}}";
|
|
|
|
|
string response = await web.SendRequest(web.URL + "/game/gameRoom/reserve", "POST", body, CreateHeaders());
|
|
|
|
|
Debug.Log("<22>ύԤ<E1BDBB><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>: " + response);
|
|
|
|
|
BindMaterial serverData = JsonConvert.DeserializeObject<BindMaterial>(response);
|
|
|
|
|
if (serverData.data == null)
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
|
|
|
|
}
|
|
|
|
|
Debug.Log(serverData.data);
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-21 13:55:05 +08:00
|
|
|
|
}
|
2024-11-25 09:45:47 +08:00
|
|
|
|
|
|
|
|
|
|