总指挥判断

This commit is contained in:
liuliang 2024-12-28 14:30:01 +08:00
parent d31d805fd2
commit dbd2515609
5 changed files with 2020 additions and 65 deletions

View File

@ -31,7 +31,7 @@ public class Drill : MonoBehaviour
noRoomText.gameObject.SetActive(false); // 初始隐藏文本
content = transform.Find("Mid/Scroll View/Viewport/Content");
if(GlobalData.ServerData.data.isCreater=="N")
if(GlobalData.ServerData.data.isCreater=="Y")
{
username.text = $"[{GlobalData.ServerData.data.userId}](管理员)";
}

View File

@ -2,6 +2,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Analytics;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
@ -15,6 +16,7 @@ public class ReadRoom : MonoBehaviour
public bool isenter=false;//主持人进入
public bool isadministrator = false;//是否是管理员
private bool isStartRoom = false;//主持人是否已经点击演练开始
public bool iszongzhihui = false;
// Start is called before the first frame update
void Start()
{
@ -44,8 +46,33 @@ public class ReadRoom : MonoBehaviour
{
Debug.LogError(1);
SceneManager.LoadScene("yhj");
isadministrator=true;
isadministrator=false;
}else
{
isadministrator = true; ;
}
foreach(var item in response.Data)
{
foreach(var item1 in item.PlayerList)
{
if(GlobalData.ServerData.data.userId==item1.UserId)
{
if(item1.RoleId==8000)//Ö÷³ÖÈË
{
isenter=true;
}
else if(item1.RoleId == 8001)//×ÜÖ¸»Ó
{
iszongzhihui=true;
}
else
{
isenter = false;
}
}
}
}
roomDataList = response.Data;
Debug.Log($"获取到的房间数量:{roomDataList.Count}");
// 获取当前日期
@ -71,6 +98,7 @@ public class ReadRoom : MonoBehaviour
//Player.CSZS.SetPlayerID(room.PlayerList[i].RoleId);
Debug.Log("可以直接进入房间");
SceneManager.LoadScene("Tmap 1");
//if(GlobalData.ServerData.data.openId==)
isenter = true;
found = true; // 找到匹配用户 ID
break; // 直接跳出循环
@ -80,14 +108,14 @@ public class ReadRoom : MonoBehaviour
else
{
Debug.Log("主持人点击了开始演练,但没有进入场景,要进入大厅房间");
SceneManager.LoadScene("yhj");
//SceneManager.LoadScene("yhj");
break;
}
// 如果没有找到匹配的用户 ID跳转到 "yhj" 场景
if (!found)
{
Debug.Log("未找到匹配用户 ID跳转到场景 'yhj'");
SceneManager.LoadScene("yhj");
//SceneManager.LoadScene("yhj");
break;
}
// 如果找到了匹配房间,不需要再检查其他房间
@ -96,7 +124,7 @@ public class ReadRoom : MonoBehaviour
else
{
Debug.Log("状态不是 '进行中',跳转到场景 'yhj'");
SceneManager.LoadScene("yhj");
//SceneManager.LoadScene("yhj");
break;
}
}

View File

@ -5,6 +5,8 @@ using UnityEngine.UI;
using System.Threading.Tasks;
using UnityEngine.SceneManagement;
using Unity.VisualScripting;
using System.Runtime.CompilerServices;
public class Starthost : MonoBehaviour
{
// 定义委托事件
@ -35,7 +37,7 @@ public class Starthost : MonoBehaviour
private GameObject peopleposition;//人员的位置信息
//非主持人的画面
public bool ishost=false;
private Button ready;
public Button ready;
private Image image;
//语音内容
@ -58,9 +60,8 @@ public class Starthost : MonoBehaviour
audioSource= GetComponent<AudioSource>();
// 确保对讲机图标默认隐藏
walkieTalkieIcon.SetActive(false);
right=transform.Find("Panel1/right").gameObject;
ishost = ReadRoom.instance.isenter;
right =transform.Find("Panel1/right").gameObject;
panel = transform.Find("Panel1").gameObject;
posiBtn = transform.Find("Panel1/right/under/btnRenYuanDaoWei").GetComponent<Button>();
start = transform.Find("Panel1/right/under/btnRenYanLianStart").GetComponent<Button>();

View File

@ -10001,6 +10001,52 @@ Transform:
m_CorrespondingSourceObject: {fileID: 424166, guid: dd642d046532d6449b5c8884a203ada2, type: 3}
m_PrefabInstance: {fileID: 436677384}
m_PrefabAsset: {fileID: 0}
--- !u!1 &437306171
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 437306173}
- component: {fileID: 437306172}
m_Layer: 0
m_Name: BurstCollisionWorld
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &437306172
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 437306171}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f1a161c4294214a4fbcb7e9e94800494, type: 3}
m_Name:
m_EditorClassIdentifier:
cellSpans:
m_AlignBytes: 16
--- !u!4 &437306173
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 437306171}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 45
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &437592029
GameObject:
m_ObjectHideFlags: 0
@ -13425,6 +13471,14 @@ PrefabInstance:
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1407198451437384586, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1407198451437384586, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1407198451904434455, guid: 940be89243a038b4090a77556e45a06d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
@ -28691,7 +28745,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!81 &1707678917
AudioListener:
m_ObjectHideFlags: 0
@ -33923,52 +33977,6 @@ MeshCollider:
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: -6030086789198283598, guid: 00003e04dc9a2534eb207f108c7b0cd3, type: 3}
--- !u!1 &2079273703
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2079273705}
- component: {fileID: 2079273704}
m_Layer: 0
m_Name: BurstCollisionWorld
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2079273704
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2079273703}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f1a161c4294214a4fbcb7e9e94800494, type: 3}
m_Name:
m_EditorClassIdentifier:
cellSpans:
m_AlignBytes: 16
--- !u!4 &2079273705
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2079273703}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 45
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!64 &2081431309
MeshCollider:
m_ObjectHideFlags: 0
@ -45683,7 +45691,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!81 &4163391439018457502
AudioListener:
m_ObjectHideFlags: 0
@ -60223,6 +60231,7 @@ MonoBehaviour:
scaleDuration: 2
alertwindow: {fileID: 0}
ishost: 1
ready: {fileID: 0}
walkieTalkieIcon: {fileID: 5640692782032870078}
dialogueText: {fileID: 5640692781696125076}
staticNoiseClip: {fileID: 8300000, guid: 5912e270549bdb04c848923fd9751319, type: 3}
@ -60342,7 +60351,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!222 &5640692783309111107
CanvasRenderer:
m_ObjectHideFlags: 0
@ -64584,6 +64593,7 @@ MonoBehaviour:
scaleDuration: 2
alertwindow: {fileID: 0}
ishost: 0
ready: {fileID: 0}
walkieTalkieIcon: {fileID: 0}
dialogueText: {fileID: 0}
staticNoiseClip: {fileID: 0}

File diff suppressed because it is too large Load Diff