_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Login/11/QueryRoomdetails512.cs

917 lines
29 KiB
C#
Raw Normal View History

2024-11-14 18:25:21 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Threading.Tasks;
using Newtonsoft.Json;
using UnityEngine.UI;
/*public class QueryRoomdetails512 : MonoBehaviour
{
public string token = null; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token<65><6E><EFBFBD><EFBFBD>ʼΪ null
public int escapeId = -1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId<49><64><EFBFBD><EFBFBD>ʼΪ -1 <20><>ʾδ<CABE><CEB4><EFBFBD><EFBFBD>
void Start()
{
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD> token ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HandleTokenReceived
LoginAndGetToken.OnTokenReceived += HandleTokenReceived;
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> escapeId <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> HandleGameEscapeIdUpdated<65><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
selectLatest511.OnGameEscapeIdUpdated += HandleGameEscapeIdUpdated;
}
// <20><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD> token ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> token
public void HandleTokenReceived(string receivedToken)
{
token = receivedToken; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
// <20>״ε<D7B4><CEB5>ü<EFBFBD><C3BC>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
LoadInitialData();
//LoadGameEscapeData();
//Debug.Log("<22><><EFBFBD>յ<EFBFBD><D5B5>µ<EFBFBD> token: " + token);
}
// <20><><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD> ID <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId
public async void HandleGameEscapeIdUpdated(int newGameEscapeId)
{
escapeId = newGameEscapeId; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId
await QueryEscapeRoomDetails();//=====================================================================<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><D4B7><EFBFBD><EFBFBD>κεط<CEB5><D8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>input.GetKeyDown.....<2E><><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD>Է<EFBFBD><D4B7><EFBFBD><EFBFBD><EFBFBD>
//Debug.Log("<22><><EFBFBD>յ<EFBFBD><D5B5>µ<EFBFBD> GameEscapeId: " + escapeId);
}
// <20><><EFBFBD>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ݣ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
public async void LoadInitialData()
{
if (string.IsNullOrEmpty(token))
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD><EFBFBD>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ݣ<EFBFBD>token δ<><CEB4><EFBFBD>á<EFBFBD>");
return;
}
await QueryEscapeRoomDetails();//=====================================================================<3D><><EFBFBD>ڴ˴<DAB4>ֻΪ<D6BB><CEAA><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD>Ҫ
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId <20><> token
public async void selectQueryKill1()
{
if (string.IsNullOrEmpty(token))
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>token δ<><CEB4><EFBFBD>á<EFBFBD>");
return;
}
if (escapeId == -1)
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>escapeId δ<><CEB4><EFBFBD>á<EFBFBD>");
return;
}
await QueryEscapeRoomDetails();//==========================================================================================================================================================================
}
//===============================================================================================================================================================================================================================
// <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public async Task QueryEscapeRoomDetails()
{
var headers = CreateHeaders();
string body = $@"
{{
""userId"": 106,
""escapeId"": {escapeId}
}}";
string response = await web.SendRequest("http://121.40.42.41:8080/snail/LatestGame511/queryEscapeRoomList", "POST", body, headers);
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + response);
}
//===============================================================================================================================================================================================================================
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(token))
{
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>
{
{ "Authorization", token }
};
}
void OnDestroy()
{
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>й©
LoginAndGetToken.OnTokenReceived -= HandleTokenReceived;
selectLatest511.OnGameEscapeIdUpdated -= HandleGameEscapeIdUpdated;
}
}*/
//<2F>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
/*public class QueryRoomdetails512 : MonoBehaviour
{
public string token = null; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token<65><6E><EFBFBD><EFBFBD>ʼΪ null
public int escapeId = -1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId<49><64><EFBFBD><EFBFBD>ʼΪ -1 <20><>ʾδ<CABE><CEB4><EFBFBD><EFBFBD>
private string lastEscapeRoomResponse = null; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>Ӧ
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>ť===================================================================================
public Button queryEscapeRoomButton;
void Start()
{
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD> token ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HandleTokenReceived
LoginAndGetToken.OnTokenReceived += HandleTokenReceived;
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> escapeId <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> HandleGameEscapeIdUpdated
selectLatest511.OnGameEscapeIdUpdated += HandleGameEscapeIdUpdated;
// <20><><EFBFBD>谴ť<E8B0B4><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> OnQueryEscapeRoomButtonClicked================================================================
if (queryEscapeRoomButton != null)
{
queryEscapeRoomButton.onClick.AddListener(OnQueryEscapeRoomButtonClicked);
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD> token ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> token
public void HandleTokenReceived(string receivedToken)
{
token = receivedToken; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
Debug.Log("<22><><EFBFBD>յ<EFBFBD><D5B5>µ<EFBFBD> token: " + token);
// <20>״ε<D7B4><CEB5>ü<EFBFBD><C3BC>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
LoadInitialData();
}
// <20><><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD> ID <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId
public async void HandleGameEscapeIdUpdated(int newGameEscapeId)
{
escapeId = newGameEscapeId; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId
Debug.Log("<22><><EFBFBD>յ<EFBFBD><D5B5>µ<EFBFBD> GameEscapeId: " + escapeId);
// <20>ڽ<EFBFBD><DABD>յ<EFBFBD> escapeId <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
lastEscapeRoomResponse = await QueryEscapeRoomDetails();
Debug.Log("HandleGameEscapeIdUpdated <20><><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + lastEscapeRoomResponse);
}
// <20><><EFBFBD>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ݣ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
public async void LoadInitialData()
{
if (string.IsNullOrEmpty(token))
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD><EFBFBD>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ݣ<EFBFBD>token δ<><CEB4><EFBFBD>á<EFBFBD>");
return;
}
// <20><><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9B7BD>
lastEscapeRoomResponse = await QueryEscapeRoomDetails();
Debug.Log("<22><>ʼ<EFBFBD><CABC><EFBFBD>صIJ<D8B5>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + lastEscapeRoomResponse);
}
// <20><>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD>󴥷<EFBFBD><F3B4A5B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
public async void OnQueryEscapeRoomButtonClicked()
{
// <20><><EFBFBD><EFBFBD> token <20><> escapeId <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>
if (string.IsNullOrEmpty(token))
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬token δ<><CEB4><EFBFBD>á<EFBFBD>");
return;
}
if (escapeId == -1)
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬escapeId δ<><CEB4><EFBFBD>á<EFBFBD>");
return;
}
// <20><><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9B7BD>
lastEscapeRoomResponse = await QueryEscapeRoomDetails();
Debug.Log("<22>û<EFBFBD><C3BB><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + lastEscapeRoomResponse);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
HandleEscapeRoomResponse(lastEscapeRoomResponse);
}
// <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public async Task<string> QueryEscapeRoomDetails()
{
if (string.IsNullOrEmpty(token))
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬token δ<><CEB4><EFBFBD>á<EFBFBD>");
return null;
}
if (escapeId == -1)
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬escapeId δ<><CEB4><EFBFBD>á<EFBFBD>");
return null;
}
var headers = CreateHeaders();
string body = $@"
{{
""userId"": 106,
""escapeId"": {escapeId}
}}";
Debug.Log("<22><><EFBFBD>ڲ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
string response = await web.SendRequest("http://121.40.42.41:8080/snail/LatestGame511/queryEscapeRoomList", "POST", body, headers);
Debug.Log("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + response);
return response; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(token))
{
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>
{
{ "Authorization", token }
};
}
// <20><><EFBFBD><EFBFBD> QueryEscapeRoomDetails <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
private void HandleEscapeRoomResponse(string response)
{
if (response.Contains("success"))
{
Debug.Log("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>");
}
else
{
Debug.LogWarning("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + response);
}
}
void OnDestroy()
{
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>й©
LoginAndGetToken.OnTokenReceived -= HandleTokenReceived;
selectLatest511.OnGameEscapeIdUpdated -= HandleGameEscapeIdUpdated;
// ȡ<><C8A1><EFBFBD><EFBFBD>ť<EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>================================================================================================
if (queryEscapeRoomButton != null)
{
queryEscapeRoomButton.onClick.RemoveListener(OnQueryEscapeRoomButtonClicked);
}
}
}*/
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*public class QueryRoomdetails512 : MonoBehaviour
{
public string token = null; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token<65><6E><EFBFBD><EFBFBD>ʼΪ null
public int escapeId = -1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId<49><64><EFBFBD><EFBFBD>ʼΪ -1 <20><>ʾδ<CABE><CEB4><EFBFBD><EFBFBD>
private string lastEscapeRoomResponse = null; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>Ӧ
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>ť
public Button queryEscapeRoomButton;
void Start()
{
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD> token ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HandleTokenReceived
LoginAndGetToken.OnTokenReceived += HandleTokenReceived;
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> escapeId <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> HandleGameEscapeIdUpdated
selectLatest511.OnGameEscapeIdUpdated += HandleGameEscapeIdUpdated;
// <20><><EFBFBD>谴ť<E8B0B4><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> OnQueryEscapeRoomButtonClicked
if (queryEscapeRoomButton != null)
{
queryEscapeRoomButton.onClick.AddListener(OnQueryEscapeRoomButtonClicked);
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD> token ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> token
public void HandleTokenReceived(string receivedToken)
{
token = receivedToken; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
Debug.Log("<22><><EFBFBD>յ<EFBFBD><D5B5>µ<EFBFBD> token: " + token);
// <20>״ε<D7B4><CEB5>ü<EFBFBD><C3BC>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
LoadInitialData();
}
// <20><><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD> ID <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId
public async void HandleGameEscapeIdUpdated(int newGameEscapeId)
{
escapeId = newGameEscapeId; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId
Debug.Log("<22><><EFBFBD>յ<EFBFBD><D5B5>µ<EFBFBD> GameEscapeId: " + escapeId);
// <20>ڽ<EFBFBD><DABD>յ<EFBFBD> escapeId <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
lastEscapeRoomResponse = await QueryEscapeRoomDetails();
Debug.Log("HandleGameEscapeIdUpdated <20><><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + lastEscapeRoomResponse);
}
// <20><><EFBFBD>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ݣ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
public async void LoadInitialData()
{
if (string.IsNullOrEmpty(token))
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD><EFBFBD>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ݣ<EFBFBD>token δ<><CEB4><EFBFBD>á<EFBFBD>");
return;
}
// <20><><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9B7BD>
lastEscapeRoomResponse = await QueryEscapeRoomDetails();
Debug.Log("<22><>ʼ<EFBFBD><CABC><EFBFBD>صIJ<D8B5>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + lastEscapeRoomResponse);
}
// <20><>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD>󴥷<EFBFBD><F3B4A5B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
public async void OnQueryEscapeRoomButtonClicked()
{
// <20><><EFBFBD><EFBFBD> token <20><> escapeId <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>
if (string.IsNullOrEmpty(token))
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬token δ<><CEB4><EFBFBD>á<EFBFBD>");
return;
}
if (escapeId == -1)
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬escapeId δ<><CEB4><EFBFBD>á<EFBFBD>");
return;
}
// <20><><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9B7BD>
lastEscapeRoomResponse = await QueryEscapeRoomDetails();
Debug.Log("<22>û<EFBFBD><C3BB><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + lastEscapeRoomResponse);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
HandleEscapeRoomResponse(lastEscapeRoomResponse);
}
// <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public async Task<string> QueryEscapeRoomDetails()
{
if (string.IsNullOrEmpty(token))
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬token δ<><CEB4><EFBFBD>á<EFBFBD>");
return null;
}
if (escapeId == -1)
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬escapeId δ<><CEB4><EFBFBD>á<EFBFBD>");
return null;
}
var headers = CreateHeaders();
string body = $@"
{{
""userId"": 106,
""escapeId"": {escapeId}
}}";
Debug.Log("<22><><EFBFBD>ڲ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
string response = await web.SendRequest("http://121.40.42.41:8080/snail/LatestGame511/queryEscapeRoomList", "POST", body, headers);
Debug.Log("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + response);
// <20><><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD> JSON <20><><EFBFBD><EFBFBD>Ϊ ServerResponse <20><><EFBFBD><EFBFBD>
ServerResponse serverResponse = JsonConvert.DeserializeObject<ServerResponse>(response);
if (serverResponse != null && serverResponse.code == 200)
{
// <20><><EFBFBD><EFBFBD><E6B7B4><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (serverResponse.data != null && serverResponse.data.gameEscapeRoomResponseVoList != null)
{
foreach (var room in serverResponse.data.gameEscapeRoomResponseVoList)
{
Debug.Log($"Escape ID: {room.escapeId}, Room No: {room.roomNo}, Room Beans Coin: {room.roomBeansCoin}");
}
}
}
else
{
Debug.LogWarning("<22><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܻ<EFBFBD><DCBB><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + response);
}
return response; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(token))
{
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>
{
{ "Authorization", token }
};
}
// <20><><EFBFBD><EFBFBD> QueryEscapeRoomDetails <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
private void HandleEscapeRoomResponse(string response)
{
ServerResponse serverResponse = JsonConvert.DeserializeObject<ServerResponse>(response);
if (serverResponse != null && serverResponse.code == 200)
{
Debug.Log("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>");
if (serverResponse.data != null && serverResponse.data.gameEscapeRoomResponseVoList != null)
{
foreach (var room in serverResponse.data.gameEscapeRoomResponseVoList)
{
Debug.Log($"Escape ID: {room.escapeId}, Room No: {room.roomNo}, Room Beans Coin: {room.roomBeansCoin}");
}
}
}
else
{
Debug.LogWarning("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + response);
}
}
void OnDestroy()
{
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>й©
LoginAndGetToken.OnTokenReceived -= HandleTokenReceived;
selectLatest511.OnGameEscapeIdUpdated -= HandleGameEscapeIdUpdated;
// ȡ<><C8A1><EFBFBD><EFBFBD>ť<EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (queryEscapeRoomButton != null)
{
queryEscapeRoomButton.onClick.RemoveListener(OnQueryEscapeRoomButtonClicked);
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
[Serializable]
public class GameEscapeRoomResponseVo
{
public int escapeId; // <20><>Ϸ<EFBFBD><CFB7>ID
public int roomNo; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public float roomBeansCoin; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD>ֶ<EFBFBD>
}
[Serializable]
public class Data
{
public List<GameEscapeRoomResponseVo> gameEscapeRoomResponseVoList; // <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
}
[Serializable]
public class ServerResponse
{
public int code; // <20><>Ӧ״̬<D7B4><CCAC>
public string message; // <20><>ʾ<EFBFBD><CABE>
public Data data; // <20><><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD>
}
}*/
//<2F><><EFBFBD><EFBFBD>+<2B><>Ƶ<EFBFBD><C6B5>
/*public class QueryRoomdetails512 : MonoBehaviour
{
public string token = null; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token<65><6E><EFBFBD><EFBFBD>ʼΪ null
public int escapeId = -1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId<49><64><EFBFBD><EFBFBD>ʼΪ -1 <20><>ʾδ<CABE><CEB4><EFBFBD><EFBFBD>
public int userId;
public string lastEscapeRoomResponse = null; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>Ӧ
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>ť
//public Button queryEscapeRoomButton;
private Coroutine queryCoroutine; // <20><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void Start()
{
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD> token ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HandleTokenReceived
LoginAndGetToken.OnTokenReceived += HandleTokenReceived;
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> escapeId <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> HandleGameEscapeIdUpdated
selectLatest511.OnGameEscapeIdUpdated += HandleGameEscapeIdUpdated;
//// <20><><EFBFBD>谴ť<E8B0B4><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> OnQueryEscapeRoomButtonClicked
//if (queryEscapeRoomButton != null)
//{
// queryEscapeRoomButton.onClick.AddListener(OnQueryEscapeRoomButtonClicked);
//}
// <20><><EFBFBD><EFBFBD>Э<EFBFBD>̣<EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯһ<D1AF><D2BB>
queryCoroutine = StartCoroutine(QueryEscapeRoomRoutine());
}
// <20><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD> token ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> token
public void HandleTokenReceived(string receivedToken)
{
token = receivedToken; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
Debug.Log("<22><><EFBFBD>յ<EFBFBD><D5B5>µ<EFBFBD> token: " + token);
// <20>״ε<D7B4><CEB5>ü<EFBFBD><C3BC>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
LoadInitialData();
}
// <20><><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD> ID <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId
public async void HandleGameEscapeIdUpdated(int newGameEscapeId)
{
escapeId = newGameEscapeId; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId
Debug.Log("<22><><EFBFBD>յ<EFBFBD><D5B5>µ<EFBFBD> GameEscapeId: " + escapeId);
// <20>ڽ<EFBFBD><DABD>յ<EFBFBD> escapeId <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
lastEscapeRoomResponse = await QueryEscapeRoomDetails();
Debug.Log("HandleGameEscapeIdUpdated <20><><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + lastEscapeRoomResponse);
}
// <20><><EFBFBD>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ݣ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
public async void LoadInitialData()
{
if (string.IsNullOrEmpty(token))
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD><EFBFBD>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ݣ<EFBFBD>token δ<><CEB4><EFBFBD>á<EFBFBD>");
return;
}
// <20><><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9B7BD>
lastEscapeRoomResponse = await QueryEscapeRoomDetails();
Debug.Log("<22><>ʼ<EFBFBD><CABC><EFBFBD>صIJ<D8B5>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + lastEscapeRoomResponse);
}
// <20><>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD>󴥷<EFBFBD><F3B4A5B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
public async void OnQueryEscapeRoomButtonClicked()
{
// <20><><EFBFBD><EFBFBD> token <20><> escapeId <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>
if (string.IsNullOrEmpty(token))
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬token δ<><CEB4><EFBFBD>á<EFBFBD>");
return;
}
if (escapeId == -1)
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬escapeId δ<><CEB4><EFBFBD>á<EFBFBD>");
return;
}
// <20><><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9B7BD>
lastEscapeRoomResponse = await QueryEscapeRoomDetails();
Debug.Log("<22>û<EFBFBD><C3BB><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + lastEscapeRoomResponse);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
HandleEscapeRoomResponse(lastEscapeRoomResponse);
}
// <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public async Task<string> QueryEscapeRoomDetails()
{
if (string.IsNullOrEmpty(token))
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬token δ<><CEB4><EFBFBD>á<EFBFBD>");
return null;
}
if (escapeId == -1)
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬escapeId δ<><CEB4><EFBFBD>á<EFBFBD>");
return null;
}
var headers = CreateHeaders();
string body = $@"
{{
""userId"": {userId},
""escapeId"": {escapeId}
}}";
Debug.Log("<22><><EFBFBD>ڲ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
string response = await web.SendRequest("http://121.40.42.41:8080/snail/LatestGame511/queryEscapeRoomList", "POST", body, headers);
Debug.Log("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + response);
// <20><><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD> JSON <20><><EFBFBD><EFBFBD>Ϊ ServerResponse <20><><EFBFBD><EFBFBD>
ServerResponse serverResponse = JsonConvert.DeserializeObject<ServerResponse>(response);
if (serverResponse != null && serverResponse.code == 200)
{
// <20><><EFBFBD><EFBFBD><E6B7B4><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (serverResponse.data != null && serverResponse.data.gameEscapeRoomResponseVoList != null)
{
foreach (var room in serverResponse.data.gameEscapeRoomResponseVoList)
{
Debug.Log($"Escape ID: {room.escapeId}, Room No: {room.roomNo}, Room Beans Coin: {room.roomBeansCoin}");
}
}
}
else
{
Debug.LogWarning("<22><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܻ<EFBFBD><DCBB><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + response);
}
return response; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(token))
{
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>
{
{ "Authorization", token }
};
}
// <20><><EFBFBD><EFBFBD> QueryEscapeRoomDetails <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
private void HandleEscapeRoomResponse(string response)
{
ServerResponse serverResponse = JsonConvert.DeserializeObject<ServerResponse>(response);
if (serverResponse != null && serverResponse.code == 200)
{
Debug.Log("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>");
if (serverResponse.data != null && serverResponse.data.gameEscapeRoomResponseVoList != null)
{
foreach (var room in serverResponse.data.gameEscapeRoomResponseVoList)
{
Debug.Log($"Escape ID: {room.escapeId}, Room No: {room.roomNo}, Room Beans Coin: {room.roomBeansCoin}");
}
}
}
else
{
Debug.LogWarning("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + response);
}
}
// ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯһ<D1AF><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><D0AD>
private IEnumerator QueryEscapeRoomRoutine()
{
while (true)
{
// ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9B2A2>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (!string.IsNullOrEmpty(token) && escapeId != -1)
{
yield return QueryEscapeRoomDetails();
}
yield return new WaitForSeconds(2f); // ÿ<><C3BF><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>һ<EFBFBD><D2BB>
}
}
void OnDestroy()
{
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>й©
LoginAndGetToken.OnTokenReceived -= HandleTokenReceived;
selectLatest511.OnGameEscapeIdUpdated -= HandleGameEscapeIdUpdated;
//// ȡ<><C8A1><EFBFBD><EFBFBD>ť<EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//if (queryEscapeRoomButton != null)
//{
// queryEscapeRoomButton.onClick.RemoveListener(OnQueryEscapeRoomButtonClicked);
//}
// ֹͣ<CDA3><D6B9>ѯЭ<D1AF>̣<EFBFBD><CCA3><EFBFBD>ֹ<EFBFBD>ڴ<EFBFBD>й©
if (queryCoroutine != null)
{
StopCoroutine(queryCoroutine);
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
[Serializable]
public class GameEscapeRoomResponseVo
{
public int escapeId; // <20><>Ϸ<EFBFBD><CFB7>ID
public int roomNo; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public float roomBeansCoin; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD>ֶ<EFBFBD>
}
[Serializable]
public class Data
{
public List<GameEscapeRoomResponseVo> gameEscapeRoomResponseVoList; // <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
}
[Serializable]
public class ServerResponse
{
public int code; // <20><>Ӧ״̬<D7B4><CCAC>
public string message; // <20><>ʾ<EFBFBD><CABE>
public Data data; // <20><><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD>
}
}*/
//<2F><><EFBFBD><EFBFBD>+<2B><>Ƶ+<2B><><EFBFBD><EFBFBD>
public class QueryRoomdetails512 : MonoBehaviour
{
// <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
public static QueryRoomdetails512 Instance { get; private set; }
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public int latestEscapeId; // <20><><EFBFBD>µ<EFBFBD> escapeId
public int latestRoomNo; // <20><><EFBFBD>µķ<C2B5><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public float latestRoomBeansCoin; // <20><><EFBFBD>µķ<C2B5><C4B7><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD>ֶ<EFBFBD>
public string token = null; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token<65><6E><EFBFBD><EFBFBD>ʼΪ null
public int escapeId = -1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId<49><64><EFBFBD><EFBFBD>ʼΪ -1 <20><>ʾδ<CABE><CEB4><EFBFBD><EFBFBD>
public int userId;
public string lastEscapeRoomResponse = null; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>Ӧ
private Coroutine queryCoroutine; // <20><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void Awake()
{
// ʵ<>ֵ<EFBFBD><D6B5><EFBFBD>ģʽ
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject); // <20><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
else
{
Destroy(gameObject); // ȷ<><C8B7>ֻ<EFBFBD><D6BB>һ<EFBFBD><D2BB>ʵ<EFBFBD><CAB5>
}
}
void Start()
{
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD> token ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HandleTokenReceived
LoginAndGetToken.OnTokenReceived += HandleTokenReceived;
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> escapeId <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> HandleGameEscapeIdUpdated
selectLatest511.OnGameEscapeIdUpdated += HandleGameEscapeIdUpdated;
// <20><><EFBFBD><EFBFBD>Э<EFBFBD>̣<EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯһ<D1AF><D2BB>
queryCoroutine = StartCoroutine(QueryEscapeRoomRoutine());
}
// <20><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD> token ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> token
public void HandleTokenReceived(string receivedToken)
{
token = receivedToken; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
Debug.Log("<22><><EFBFBD>յ<EFBFBD><D5B5>µ<EFBFBD> token: " + token);
// <20>״ε<D7B4><CEB5>ü<EFBFBD><C3BC>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
LoadInitialData();
}
// <20><><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD> ID <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId
public async void HandleGameEscapeIdUpdated(int newGameEscapeId)
{
escapeId = newGameEscapeId; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> escapeId
// Debug.Log("<22><><EFBFBD>յ<EFBFBD><D5B5>µ<EFBFBD> GameEscapeId: " + escapeId);
// <20>ڽ<EFBFBD><DABD>յ<EFBFBD> escapeId <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
lastEscapeRoomResponse = await QueryEscapeRoomDetails();
// Debug.Log("HandleGameEscapeIdUpdated <20><><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + lastEscapeRoomResponse);
}
// <20><><EFBFBD>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ݣ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
public async void LoadInitialData()
{
if (string.IsNullOrEmpty(token))
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD><EFBFBD>س<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ݣ<EFBFBD>token δ<><CEB4><EFBFBD>á<EFBFBD>");
return;
}
// <20><><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9B7BD>
lastEscapeRoomResponse = await QueryEscapeRoomDetails();
// Debug.Log("<22><>ʼ<EFBFBD><CABC><EFBFBD>صIJ<D8B5>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + lastEscapeRoomResponse);
}
// <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public async Task<string> QueryEscapeRoomDetails()
{
if (string.IsNullOrEmpty(token))
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬token δ<><CEB4><EFBFBD>á<EFBFBD>");
return null;
}
if (escapeId == -1)
{
Debug.LogWarning("<22>޷<EFBFBD><DEB7><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬escapeId δ<><CEB4><EFBFBD>á<EFBFBD>");
return null;
}
var headers = CreateHeaders();
string body = $@"
{{
""userId"": {userId},
""escapeId"": {escapeId}
}}";
// Debug.Log("<22><><EFBFBD>ڲ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
string response = await web.SendRequest("http://121.40.42.41:8080/snail/LatestGame511/queryEscapeRoomList", "POST", body, headers);
Debug.Log("5.1.2<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + response);
// <20><><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD> JSON <20><><EFBFBD><EFBFBD>Ϊ ServerResponse <20><><EFBFBD>󲢴<EFBFBD><F3B2A2B4><EFBFBD><EFBFBD><EFBFBD>Ӧ
HandleEscapeRoomResponse(response);
return response; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> token
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(token))
{
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>
{
{ "Authorization", token }
};
}
// <20><><EFBFBD><EFBFBD> QueryEscapeRoomDetails <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
private void HandleEscapeRoomResponse(string response)
{
ServerResponse serverResponse = JsonConvert.DeserializeObject<ServerResponse>(response);
if (serverResponse != null && serverResponse.code == 200)
{
Debug.Log("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>");
if (serverResponse.data != null && serverResponse.data.gameEscapeRoomResponseVoList != null)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>==============================================================================<3D><><EFBFBD><EFBFBD>һ===========================================================
var room = serverResponse.data.gameEscapeRoomResponseVoList[0];
latestEscapeId = room.escapeId;
latestRoomNo = room.roomNo;
latestRoomBeansCoin = room.roomBeansCoin;
foreach (var roomDetail in serverResponse.data.gameEscapeRoomResponseVoList)
{
Debug.Log($"Escape ID: {roomDetail.escapeId}, Room No: {roomDetail.roomNo}, Room Beans Coin: {roomDetail.roomBeansCoin}");
}
}
}
else
{
Debug.LogWarning("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ: " + response);
}
}
// ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯһ<D1AF><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><D0AD>
private IEnumerator QueryEscapeRoomRoutine()
{
while (true)
{
// ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9B2A2>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (!string.IsNullOrEmpty(token) && escapeId != -1)
{
yield return QueryEscapeRoomDetails();
}
yield return new WaitForSeconds(2f); // ÿ<><C3BF><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>һ<EFBFBD><D2BB>
}
}
void OnDestroy()
{
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>й©
LoginAndGetToken.OnTokenReceived -= HandleTokenReceived;
selectLatest511.OnGameEscapeIdUpdated -= HandleGameEscapeIdUpdated;
// ֹͣ<CDA3><D6B9>ѯЭ<D1AF>̣<EFBFBD><CCA3><EFBFBD>ֹ<EFBFBD>ڴ<EFBFBD>й©
if (queryCoroutine != null)
{
StopCoroutine(queryCoroutine);
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
[Serializable]
public class GameEscapeRoomResponseVo
{
public int escapeId; // <20><>Ϸ<EFBFBD><CFB7>ID
public int roomNo; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public float roomBeansCoin; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD>ֶ<EFBFBD>
}
[Serializable]
public class Data
{
public List<GameEscapeRoomResponseVo> gameEscapeRoomResponseVoList; // <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
}
[Serializable]
public class ServerResponse
{
public int code; // <20><>Ӧ״̬<D7B4><CCAC>
public string message; // <20><>ʾ<EFBFBD><CABE>
public Data data; // <20><><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD>
}
}
//<2F><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>ʾ<EFBFBD><CABE>
//public class AnotherClass : MonoBehaviour
//{
// void Start()
// {
// // ͨ<><CDA8> Singleton ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// int escapeId = QueryRoomdetails512.Instance.latestEscapeId;
// int roomNo = QueryRoomdetails512.Instance.latestRoomNo;
// float roomBeansCoin = QueryRoomdetails512.Instance.latestRoomBeansCoin;
// Debug.Log($"Latest Escape ID: {escapeId}, Room No: {roomNo}, Room Beans Coin: {roomBeansCoin}");
// }
//}