96 lines
2.2 KiB
C#
96 lines
2.2 KiB
C#
|
using Games.LogicObj;
|
|||
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
public class DoubleMountInvitePanel : MonoBehaviour
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 关闭按钮
|
|||
|
/// </summary>
|
|||
|
public Button closeBtn;
|
|||
|
/// <summary>
|
|||
|
/// 玩家列表容器
|
|||
|
/// </summary>
|
|||
|
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;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 请求服务器获取附近玩家信息
|
|||
|
/// </summary>
|
|||
|
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();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 初始化玩家列表
|
|||
|
/// </summary>
|
|||
|
/// <param name="packet">玩家数据</param>
|
|||
|
public void InitOtherPlayerList( GC_RET_DOUBLEMOUNT_INVITELIST packet)
|
|||
|
{
|
|||
|
if (null == packet)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
List<MountTeam> teamList = new List<MountTeam>();
|
|||
|
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);
|
|||
|
}
|
|||
|
}
|