Files
JJBB/Assets/Project/Script/GUI/Guild/GuildHistoryWnd.cs

68 lines
1.8 KiB
C#
Raw Normal View History

2024-08-23 15:49:34 +08:00
//帮会历程界面
using Games.LogicObj;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
using GCGame;
using Module.Log;
using Games.GlobeDefine;
using System.Collections.Generic;
using GCGame.Table;
using System;
public class GuildHistoryWnd : MonoBehaviour
{
public UIContainerBase m_Container;
void Awake()
{
Hashtable add = new Hashtable();
add["name"] = "history";
Games.Events.MessageEventCallBack call = InitGuildHistory;
add["callFun"] = call;
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.GuildHistoryInfo, add);
}
void OnDestroy()
{
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.GuildHistoryInfo, "history");
}
void OnEnable()
{
CG_GUILD_REQ_INFO send = (CG_GUILD_REQ_INFO)PacketDistributed.CreatePacket(MessageID.PACKET_CG_GUILD_REQ_INFO);
send.SetReqType((int)CG_GUILD_REQ_INFO.REQ_TYPE.HISTORY_INFO);
send.SendPacket();
}
int SortList(HistoryRecord t1, HistoryRecord t2)
{
if (t1.Time > t2.Time)
return -1;
if (t1.Time < t2.Time)
return 1;
return 0;
}
public void InitGuildHistory(Hashtable add,Hashtable send)
{
if (send.ContainsKey("data") == false)
return;
GC_GUILD_HISTORY_INFO packet = (GC_GUILD_HISTORY_INFO)send["data"];
List<HistoryRecord> historys = new List<HistoryRecord>();
historys.AddRange(packet.recordList);
historys.Sort(SortList);
if (packet == null)
return;
if (m_Container == null)
return;
m_Container.InitContentItem(historys);
}
public void Click_Close()
{
UIManager.CloseUI(UIInfo.GuildHistory);
}
}