using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
///
/// 选课界面
///
public class PopServerGroup : PopBase
{
private ItemListView MItemList;//列表的组件
[SerializeField]
private Game3DButton CancelBtn;//创建普通房间的按钮
protected override void Awake()
{
base.Awake();
MItemList = this.GetComponentInChildren();
}
protected override void Start()
{
base.Start();
MItemList.InitClick(ItemClick);
CancelBtn.onClick.AddListener(CancelClick);
}
//框体类型
public override PopType MType { get { return PopType.ServerList; } }
protected override void OnDestroy()
{
base.OnDestroy();
CancelBtn.onClick.RemoveListener(CancelClick);
}
public override void Show()
{
base.Show();
RefreshItemList();
}
private bool isPublic;//是否是公开课
public override void Show(object data)
{
base.Show(data);
RefreshItemList();
}
private void RefreshItemList()
{
MItemList.InitInfo(GameServerInfo.Instance.servers.ToArray());
}
private void CancelClick()
{
this.Hide();
MessageCenterController.Instance.Broadcast(GameEnum.MESSAGE_SHOW_POP_BY_TYPE, new ShowPopData(PopType.Login, null));
}
private void ItemClick(ItemViewBase item)
{
if (item.ItemData == null)
{
return;
}
CDebug.Log("创建课的点击");
ServerData c_data = (ServerData)(item.ItemData);
GameServerInfo.Instance.CurServer = c_data;
this.Hide();
GameNetManager.Instance.mSocketMsgCenter.StartConnect();//启动Socket连接
}
}