login脚本更改和结构体里面的难度赋值

This commit is contained in:
lq 2024-11-25 17:27:33 +08:00
parent 5da149088a
commit 36a71879f3
2 changed files with 11 additions and 7 deletions

View File

@ -55,8 +55,8 @@ public class SelectScenePanel : MonoBehaviour
this.schoolName = item.schoolName; this.schoolName = item.schoolName;
} }
} }
Debug.Log("###############1:"+ this.schoolId); //Debug.Log("###############1:"+ this.schoolId);
Debug.Log("###############2:" + this.schoolName); //Debug.Log("###############2:" + this.schoolName);
} }
//事件及难度选择 //事件及难度选择
public void SelectEvent() public void SelectEvent()
@ -71,20 +71,22 @@ public class SelectScenePanel : MonoBehaviour
this.eventName = item.eventName; this.eventName = item.eventName;
} }
} }
Debug.Log("%%%%%%%%%%%%%1:"+ this.eventId); //Debug.Log("%%%%%%%%%%%%%1:"+ this.eventId);
Debug.Log("%%%%%%%%%%%%%2:" + this.eventName); //Debug.Log("%%%%%%%%%%%%%2:" + this.eventName);
} }
//游戏难度选择 //游戏难度选择
public void SelsctDifficulty() public void SelsctDifficulty()
{ {
auth_createTemplate auth_CreateTemplate = new auth_createTemplate();
foreach(Toggle item in difficultyList) foreach(Toggle item in difficultyList)
{ {
if (item.isOn) if (item.isOn)
{ {
this.difficulty = item.transform.parent.GetComponentInChildren<Text>().text; this.difficulty = item.transform.parent.GetComponentInChildren<Text>().text;
auth_CreateTemplate.mode = this.difficulty;//给结构体“难度”赋值
} }
} }
Debug.Log("%%%%%%%%%%%%%3:" + this.difficulty); //Debug.Log("%%%%%%%%%%%%%3:" + this.difficulty);
} }
//继续按钮,点击后上传数据 //继续按钮,点击后上传数据
public void ContinueBtn() public void ContinueBtn()

View File

@ -126,8 +126,10 @@ public class login : MonoBehaviour
//新建模板 //新建模板
public async void createTemplate() public async void 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}]}"; auth_createTemplate auth_CreateTemplate = new auth_createTemplate();
string response = await web.SendRequest(web.URL + "/game/gameTemplate/add", "POST", body, CreateHeaders()); 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("新建模板列表" + response); Debug.Log("新建模板列表" + response);
// 解析服务器返回的数据 // 解析服务器返回的数据
newTemplateData newTemplateData = JsonConvert.DeserializeObject<newTemplateData>(response); newTemplateData newTemplateData = JsonConvert.DeserializeObject<newTemplateData>(response);