using Games.LogicObj;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DoubleMountInvitePanel : MonoBehaviour
{
///
/// 关闭按钮
///
public Button closeBtn;
///
/// 玩家列表容器
///
public UIContainerBase _TeamList;
public static DoubleMountInvitePanel Instance;
private void Awake()
{
Instance = this;
RequestServer();
}
private void OnDestroy()
{
Instance = null;
}
// Use this for initialization
void Start () { }
private void OnEnable()
{
//请求
RequestServer();
// GUIData.delNearbyPlayerUpdate += InitOtherPlayerList;
}
// Update is called once per frame
void Update () { }
private void OnDisable()
{
// GUIData.delNearbyPlayerUpdate -= InitOtherPlayerList;
}
///
/// 请求服务器获取附近玩家信息
///
public void RequestServer()
{
//请求
CG_REQ_DOUBLEMOUNT_INVITELIST packet = (CG_REQ_DOUBLEMOUNT_INVITELIST)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_DOUBLEMOUNT_INVITELIST);
packet.Flag = 1;
packet.SendPacket();
}
///
/// 初始化玩家列表
///
/// 玩家数据
public void InitOtherPlayerList( GC_RET_DOUBLEMOUNT_INVITELIST packet)
{
if (null == packet)
{
return;
}
List teamList = new List();
int idCount = packet.guidCount;
for (int i = 0; i < idCount; i++)
{
MountTeam team = new MountTeam();//
team.Guid = packet.GetGuid(i); //guid
team.Name = packet.GetName(i); //name
team.Profession = packet.professionIdList[i];//职业
teamList.Add(team);
}
_TeamList.InitContentItem(teamList);
}
public void OnCloseBtn()
{
//this.gameObject.SetActive(false);
UIManager.CloseUI(UIInfo.DoubleMountInvitePanel);
}
}