1
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Assets.MyGame.Scripts.Net;
|
||||
using Assets.MyGame.Scripts.Net.WebResponses;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -24,6 +25,7 @@ public class BG_SelectRoom
|
||||
}
|
||||
public class UIHome_BY_SelectRoomLevelPanel : SubUIBase
|
||||
{
|
||||
|
||||
[Header("DefaultGame")]
|
||||
[Header("快速进入")]
|
||||
public Button SelectRoom1;
|
||||
@@ -38,50 +40,87 @@ public class UIHome_BY_SelectRoomLevelPanel : SubUIBase
|
||||
public List<BG_SelectRoom> bG_SelectRooms=new List<BG_SelectRoom>();
|
||||
public Image img_BG;
|
||||
int leave = 1;
|
||||
public bool isMySelectRoom=false;
|
||||
public override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
WebSocketManager.Instance.Connect(SocketType.room);
|
||||
MySelectRoom1.onClick.AddListener(() =>
|
||||
{
|
||||
OnSelectRoom(currGameType);
|
||||
isMySelectRoom=true;
|
||||
leave = 1;
|
||||
OnSelectRoom(leave);
|
||||
});
|
||||
MySelectRoom2.onClick.AddListener(() =>
|
||||
{
|
||||
OnSelectRoom(currGameType);
|
||||
isMySelectRoom = true;
|
||||
leave = 2;
|
||||
OnSelectRoom(leave);
|
||||
});
|
||||
MySelectRoom3.onClick.AddListener(() =>
|
||||
{
|
||||
OnSelectRoom(currGameType);
|
||||
isMySelectRoom=true;
|
||||
leave = 3;
|
||||
OnSelectRoom(leave);
|
||||
});
|
||||
SelectRoom1.onClick.AddListener(() =>
|
||||
{
|
||||
StartGame(currGameType);
|
||||
//StartGame(currGameType);
|
||||
isMySelectRoom = false;
|
||||
leave = 1;
|
||||
OnSelectRoom(leave);
|
||||
});
|
||||
SelectRoom2.onClick.AddListener(() =>
|
||||
{
|
||||
StartGame(currGameType);
|
||||
isMySelectRoom = false;
|
||||
leave = 2;
|
||||
OnSelectRoom(leave);
|
||||
});
|
||||
SelectRoom3.onClick.AddListener(() =>
|
||||
{
|
||||
StartGame(currGameType);
|
||||
isMySelectRoom = false;
|
||||
leave = 3;
|
||||
OnSelectRoom(leave);
|
||||
});
|
||||
}
|
||||
public void OnSelectRoom(object json)
|
||||
public void OnSelectRoom(int leave)
|
||||
{
|
||||
WebSocketSendList.GetRoomListFish(1,1);
|
||||
//这里有问题 玩的人多了就不能完了
|
||||
WebSocketSendList.GetRoomListFish(leave, 1);
|
||||
//WebSocketManager.Instance.Send(SocketType.room, "{\"type\":1,\"target\":\"GetRoomList\",\"invocationId\":\"1\",\"arguments\":[\""+GameManager.Instance.user.id+"\","+(int)GameManager.Instance.gameData.currGameType+","+leave+",1]}");
|
||||
//这里想websocket发送链接请求
|
||||
//panel_UIHome_BY_MySelectRoomPenel.Show(json);
|
||||
}
|
||||
public void StartGame(object o)
|
||||
public static void StartGame(RoomChangeResponse o)
|
||||
{
|
||||
//这里写判断条件
|
||||
GameManager.Instance.StartGame();
|
||||
|
||||
Dictionary<int,bool> keyValuePairs = new Dictionary<int,bool>();
|
||||
for (int i = 0; i < o.maxPlayerCount; i++)
|
||||
{
|
||||
keyValuePairs.Add(i, true);
|
||||
}
|
||||
|
||||
foreach (var item in o.players)
|
||||
{
|
||||
keyValuePairs[item.position] = false;
|
||||
}
|
||||
foreach(var item in keyValuePairs)
|
||||
{
|
||||
if (item.Value)
|
||||
{
|
||||
GameManager.Instance.StartGame(() =>
|
||||
{
|
||||
WebSocketSendList.JoinRoom(o.roomId, GameManager.Instance.user.id, item.Key);
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
//这里写判断条件
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
public override void Show(object args = null)
|
||||
|
||||
Reference in New Issue
Block a user