99 lines
2.4 KiB
C#
99 lines
2.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class PvpRoomListPanel : MonoBehaviour {
|
|
|
|
public static PvpRoomListPanel Instance;
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
Instance = null;
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
ReqAllRoomList();
|
|
}
|
|
|
|
public UIContainerBase _RoomListItemContainer;
|
|
|
|
public SortRoomPanel _SortRoomPanel;
|
|
public PvpSearchRoomPanel _SearchRoomPanel;
|
|
public EnterPassWordPanel _PassWordPanel;
|
|
public CreateRoomPanel _CreateRoomPanel;
|
|
|
|
public void ReqAllRoomList()
|
|
{
|
|
ReqHonorBattlefieldMatchGetRoomList req = new ReqHonorBattlefieldMatchGetRoomList();
|
|
req.SegmentList = GameManager.gameManager.PlayerDataPool.pvpIfo.GetAllSegmentGradeList();
|
|
req.LeaderName = "";
|
|
req.SendMsg();
|
|
}
|
|
|
|
public void OnPacket(RespHonorBattlefieldMatchGetRoomList packet)
|
|
{
|
|
packet.RoomList.Sort(delegate(HonorBattlefieldMatchRoomInfo roomA, HonorBattlefieldMatchRoomInfo roomB) {
|
|
if(roomA.MemberCount == roomB.MemberCount)
|
|
{
|
|
return roomA.LeaderSegment > roomB.LeaderSegment ? -1 : 1;
|
|
}
|
|
else
|
|
{
|
|
return roomA.MemberCount > roomB.MemberCount ? 1 : -1;
|
|
}
|
|
});
|
|
|
|
_RoomListItemContainer.InitContentItem(packet.RoomList);
|
|
}
|
|
|
|
public void OnCreateRoomBtn()
|
|
{
|
|
if(!_CreateRoomPanel.isActiveAndEnabled)
|
|
{
|
|
_CreateRoomPanel.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
|
|
public void OnQuickPartInBtn()
|
|
{
|
|
ReqHonorBattlefieldMatchJoinRoom req = new ReqHonorBattlefieldMatchJoinRoom();
|
|
req.RoomId = -1;
|
|
req.Password = "";
|
|
req.SendMsg();
|
|
}
|
|
|
|
public void OnSortBtn()
|
|
{
|
|
if (!_SortRoomPanel.isActiveAndEnabled)
|
|
_SortRoomPanel.gameObject.SetActive(true);
|
|
}
|
|
|
|
public void OnCloseBtn()
|
|
{
|
|
UIManager.CloseUI(UIInfo.PvpRoomListPanel);
|
|
}
|
|
|
|
public void OnSearchBtn()
|
|
{
|
|
if(!_SearchRoomPanel.isActiveAndEnabled)
|
|
{
|
|
_SearchRoomPanel.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
|
|
public void ShowPassWordPanel(int roomId)
|
|
{
|
|
if(!_PassWordPanel.isActiveAndEnabled)
|
|
{
|
|
_PassWordPanel.gameObject.SetActive(true);
|
|
_PassWordPanel.InitRoomId(roomId);
|
|
}
|
|
}
|
|
}
|