加入房间

This commit is contained in:
huyulong 2024-12-29 15:03:13 +08:00
parent 700e90b5ed
commit 023dd663e1
4 changed files with 39 additions and 5 deletions

View File

@ -57,10 +57,10 @@ public class test : MonoBehaviour
//¼ÓÈë·¿¼ä
public void JoinRoom()
public void JoinRoom(string roomid)
{
JoinRoomRequest data = new JoinRoomRequest();
data.RoomId = "168888";
data.RoomId = roomid;
WSMessage msg = new WSMessage();
msg.Module = "hall";
msg.ServiceName = "JoinRoom";

View File

@ -19,6 +19,7 @@ public class ReadRoom : MonoBehaviour
public bool iszongzhihui = false;
public int RoleId;
public loginData playerdetail;
public test test;
// Start is called before the first frame update
void Start()
{
@ -75,7 +76,8 @@ public class ReadRoom : MonoBehaviour
//Player.CSZS.SetPlayerID(room.PlayerList[i].RoleId);
Debug.Log("可以直接进入房间");
SceneManager.LoadScene("Tmap 1");
//if(GlobalData.ServerData.data.openId==)
test.JoinRoom(room.RoomId);
//if,(GlobalData.ServerData.data.openId==)
//isenter = true;
found = true; // 找到匹配用户 ID
break; // 直接跳出循环

View File

@ -644,7 +644,7 @@ Transform:
m_GameObject: {fileID: 158686762}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 1, y: 1, z: 0.99999994}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
@ -867,6 +867,7 @@ MonoBehaviour:
isadministrator: 0
iszongzhihui: 0
RoleId: 0
test: {fileID: 7695717545649794846}
--- !u!114 &252707977
MonoBehaviour:
m_ObjectHideFlags: 0
@ -4870,6 +4871,8 @@ GameObject:
m_Component:
- component: {fileID: 7695717545649794842}
- component: {fileID: 7695717545649794843}
- component: {fileID: 7695717545649794846}
- component: {fileID: 7695717545649794845}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
@ -4877,6 +4880,35 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &7695717545649794845
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7695717545649794844}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 44720823678ca7c42a08f4409ab025ff, type: 3}
m_Name:
m_EditorClassIdentifier:
serverIP: ws://222.212.40.39
serverPort: 13497
type:
--- !u!114 &7695717545649794846
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7695717545649794844}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c68b1dcfbba61b44ca68572c16b16b95, type: 3}
m_Name:
m_EditorClassIdentifier:
token:
wEBScriptListener: {fileID: 0}
--- !u!222 &7801660036457041520
CanvasRenderer:
m_ObjectHideFlags: 0

View File

@ -20,7 +20,7 @@ public class TestButton : MonoBehaviour
public void JoinRoom()
{
test.JoinRoom();
//test.JoinRoom();
test.CreateNpcHandler();
joinroomBtn.gameObject.SetActive(false);
}