_xiaofang/xiaofang/Assets/Res/gsj/scripts/ReadRoom.cs

67 lines
2.0 KiB
C#
Raw Normal View History

2024-12-25 22:10:20 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class ReadRoom : MonoBehaviour
{
public static ReadRoom instance;
public gameRoomList gameRoomListInstance; // <20><><EFBFBD><EFBFBD> gameRoomList <20>ű<EFBFBD>ʵ<EFBFBD><CAB5>
public GameRoomListResponse gameRoomListResponse;
private List<GameRoomListData> roomDataList;
public JSONReader js;
2024-12-26 03:46:07 +08:00
public bool isenter=false;//<2F><><EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>
2024-12-25 22:10:20 +08:00
// Start is called before the first frame update
void Start()
{
instance = this;
gameRoomListInstance = FindObjectOfType<gameRoomList>();
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӽ<EFBFBD><D3BD>뷿<EFBFBD><EBB7BF>Ҫ<EFBFBD><D2AA>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public async void head()
{
var response = await gameRoomListInstance.getGameRoomList();
if (response != null && response.Data != null)
{
roomDataList = response.Data;
Debug.Log($"<22><>ȡ<EFBFBD><C8A1><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>{roomDataList.Count}");
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
DateTime currentDate = DateTime.Now;
//<2F><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ڸ<EFBFBD>ʽ<EFBFBD><CABD>Ϊ "yyyy/MM/dd" <20><>ʽ
string formattedDate = currentDate.ToString("yyyy/MM/dd");
// <20><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD>Ԫ<EFBFBD><D4AA>
foreach (var room in roomDataList)
{
for (int i = 0; i < room.PlayerList.Count; i++)
{
if ((GlobalData.ServerData.data.userId == room.PlayerList[i].UserId) && ("2024/12/20" == room.ReserveDate))
{
Debug.Log("<22><><EFBFBD><EFBFBD>ֱ<EFBFBD>ӽ<EFBFBD><D3BD>뷿<EFBFBD><EBB7BF>");
2024-12-26 03:46:07 +08:00
SceneManager.LoadScene("Tmap 1");
isenter = true;
2024-12-25 22:10:20 +08:00
}
//else
//{
// Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӽ<EFBFBD><D3BD>뷿<EFBFBD><EBB7BF>");
// SceneManager.LoadScene(1);
//}
}
}
}
else
{
Debug.LogError("<22><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
}
}
// Update is called once per frame
void Update()
{
}
}