1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.EventSystems;
- /// <summary>
- /// 选课界面
- /// </summary>
- public class PopServerGroup : PopBase
- {
- private ItemListView MItemList;//列表的组件
- [SerializeField]
- private Game3DButton CancelBtn;//创建普通房间的按钮
- protected override void Awake()
- {
- base.Awake();
- MItemList = this.GetComponentInChildren<ItemListView>();
- }
- 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连接
- }
- }
|