场景修改
This commit is contained in:
parent
7a377f27a0
commit
4cd2b4e776
@ -36,6 +36,83 @@ public class ReadRoom : MonoBehaviour
|
||||
// 取消订阅事件
|
||||
Starthost.OnBoolStart -= HandleRoomControl;
|
||||
}
|
||||
public async void adHead()
|
||||
{
|
||||
var response = await gameRoomListInstance.getGameRoomList();
|
||||
if (response != null && response.Data != null)
|
||||
{
|
||||
if (GlobalData.ServerData.data.isCreater == "Y")
|
||||
{
|
||||
Debug.LogError(2);
|
||||
|
||||
isadministrator = true;
|
||||
}
|
||||
roomDataList = response.Data;
|
||||
Debug.Log($"获取到的房间数量:{roomDataList.Count}");
|
||||
// 获取当前日期
|
||||
DateTime currentDate = DateTime.Now;
|
||||
|
||||
//将当前日期格式化为 "yyyy/MM/dd" 形式
|
||||
string formattedDate = currentDate.ToString("yyyy/MM/dd");
|
||||
|
||||
// 调用方法,动态生成房间元素
|
||||
foreach (var room in roomDataList)
|
||||
{
|
||||
if (room.Status == "1" || room.Status == "0")
|
||||
{
|
||||
bool found = false; // 标记是否找到匹配的用户 ID
|
||||
if (!isStartRoom)
|
||||
{
|
||||
for (int i = 0; i < room.PlayerList.Count; i++)
|
||||
{
|
||||
Debug.LogError(GlobalData.ServerData.data.userId);
|
||||
Debug.LogError(1111111111111111111);
|
||||
Debug.LogError(room.PlayerList[i].UserId);
|
||||
if ((GlobalData.ServerData.data.userId == room.PlayerList[i].UserId) && (formattedDate == room.ReserveDate))
|
||||
{
|
||||
|
||||
//传人物职业ID
|
||||
//Player.CSZS.SetPlayerID(room.PlayerList[i].RoleId);
|
||||
Debug.Log("可以直接进入房间");
|
||||
SceneManager.LoadScene("Tmap 1");
|
||||
//if(GlobalData.ServerData.data.openId==)
|
||||
isenter = true;
|
||||
found = true; // 找到匹配用户 ID
|
||||
break; // 直接跳出循环
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("主持人点击了开始演练,但没有进入场景,要进入大厅房间");
|
||||
//SceneManager.LoadScene("yhj");
|
||||
break;
|
||||
}
|
||||
// 如果没有找到匹配的用户 ID,跳转到 "yhj" 场景
|
||||
if (!found)
|
||||
{
|
||||
Debug.Log("未找到匹配用户 ID,跳转到场景 'yhj'");
|
||||
//SceneManager.LoadScene("yhj");
|
||||
break;
|
||||
}
|
||||
// 如果找到了匹配房间,不需要再检查其他房间
|
||||
if (found) break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("状态不是 '进行中',跳转到场景 'yhj'");
|
||||
//SceneManager.LoadScene("yhj");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("获取房间列表失败!");
|
||||
}
|
||||
}
|
||||
//主持人直接进入房间要获取的数据
|
||||
public async void head()
|
||||
{
|
||||
@ -51,6 +128,7 @@ public class ReadRoom : MonoBehaviour
|
||||
isadministrator=false;
|
||||
}else
|
||||
{
|
||||
SceneManager.LoadScene("yhj");
|
||||
isadministrator = true;
|
||||
}
|
||||
foreach(var item in response.Data)
|
||||
@ -94,9 +172,14 @@ public class ReadRoom : MonoBehaviour
|
||||
bool found = false; // 标记是否找到匹配的用户 ID
|
||||
if (!isStartRoom)
|
||||
{
|
||||
Debug.LogError(room.PlayerList.Count);
|
||||
for (int i = 0; i < room.PlayerList.Count; i++)
|
||||
{
|
||||
|
||||
Debug.LogError(GlobalData.ServerData.data.userId);
|
||||
Debug.LogError(room.PlayerList[i].UserId);
|
||||
Debug.LogError("------------");
|
||||
Debug.LogError(formattedDate);
|
||||
Debug.LogError(room.ReserveDate);
|
||||
if ((GlobalData.ServerData.data.userId == room.PlayerList[i].UserId) && (formattedDate == room.ReserveDate))
|
||||
{
|
||||
//传人物职业ID
|
||||
@ -121,7 +204,7 @@ public class ReadRoom : MonoBehaviour
|
||||
{
|
||||
Debug.Log("未找到匹配用户 ID,跳转到场景 'yhj'");
|
||||
//SceneManager.LoadScene("yhj");
|
||||
break;
|
||||
//break;
|
||||
}
|
||||
// 如果找到了匹配房间,不需要再检查其他房间
|
||||
if (found) break;
|
||||
|
@ -102,7 +102,7 @@ public class RoomManager : MonoBehaviour
|
||||
{
|
||||
if (GlobalData.ServerData.data.userId== room.PlayerList[i].UserId)
|
||||
{
|
||||
Debug.Log("可以直接进入房间");
|
||||
//Debug.Log("可以直接进入房间");
|
||||
//SceneManager.LoadScene(2);
|
||||
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class LoginPanel : Base
|
||||
grantType = "password",
|
||||
clientId = "e5cd7e4891bf95d1d19206ce24a7b32e",
|
||||
userType = "company_user",
|
||||
username = "13699802230",
|
||||
username = "13699802230",//"ZF16c788632",
|
||||
password = "YYL5371!"
|
||||
};
|
||||
image.gameObject.SetActive (true);
|
||||
@ -69,6 +69,7 @@ public class LoginPanel : Base
|
||||
{
|
||||
Debug.LogError(11);
|
||||
ReadRoom.instance.isadministrator=true;
|
||||
//ReadRoom.instance.adHead();
|
||||
SceneManager.LoadScene("yhj");
|
||||
}
|
||||
else if(id.text == "13699802230" && pwd.text == "YYL5371!")
|
||||
|
Loading…
Reference in New Issue
Block a user