/// #pkgName FGUI包名
/// #panelName UIPanel名字
/// #UIName = $"{#pkgName}{#panelName}" UIKey名字
/// 该脚本由模板创建
/// created by cb 2024
using FairyGUI;
using FL.Data;
using XGame.Database;
using XGame.Framework.UI;
namespace FL.FGUI
{
///
/// UI逻辑处理类
///
///
public partial class PartnerEpiChangeListItemCtrl : UIController
{
protected override void OnEnable(object intent)
{
AddUIListenres();
}
protected override void OnDisable()
{
RemoveUIListenres();
}
#region UI事件
private void AddUIListenres()
{
VM.Panel.onClick.Add(OnClick);
}
private void RemoveUIListenres()
{
VM.Panel.onClick.Remove(OnClick);
}
private void OnClick(EventContext eventContext)
{
EventSingle.Instance.Notify(EventDefine.EpigraphChangeListClick, attr.id);
}
#endregion
#region 属性
private int sbId;
private EpigraphAttributes attr;
#endregion
#region 页面
public void OnRefresh(int index, EpiChangeListData data)
{
sbId = data.sbId;
attr = data.attrs;
UpEpiInfo();
}
private void UpEpiInfo()
{
var table = EpigraphTableRepo.Get(sbId);
if (table == null)
return;
VM.EpiLabel.Ctrl.SetEpiIcon(sbId, true);
VM.NameLabel.text = table.Name;
var info = EpigraphData.Instance.GetEpigraphInfo(sbId);
VM.IsUp.selectedIndex = info?.partnerId > 0 ? 1 : 0;
}
#endregion
}
}