/// #pkgName FGUI包名
/// #panelName UIPanel名字
/// #UIName = $"{#pkgName}{#panelName}" UIKey名字
/// 该脚本由模板创建
/// created by cb 2024
using System.Collections.Generic;
using FairyGUI;
using FL.Data;
using XGame.Framework.UI;
namespace FL.FGUI
{
///
/// UI逻辑处理类
///
///
public partial class PartnerSbUpPanelCtrl : UIController
{
protected override void OnEnable(object intent)
{
AddUIListenres();
_pos = (int)intent;
ShowUI();
}
protected override void OnDisable()
{
RemoveUIListenres();
}
#region UI事件
private void AddUIListenres()
{
Context.AddListener(EventDefine.PartnerUpSelect, OnSelectUpSb);
}
private void RemoveUIListenres()
{
Context.RemoveListener(EventDefine.PartnerUpSelect, OnSelectUpSb);
}
private void OnSelectUpSb(int eventId, object args)
{
var id = (int)args;
PartnersService.Instance.RequestPartnerUpNew(_pos, id);
Context.ClosePanel();
}
#endregion
private bool _init = false;
private int _pos;
public void Init()
{
if (_init)
return;
_init = true;
VM.List.ListType = EGListType.Virtual;
}
public void ShowUI()
{
var list = PartnersData.Instance.PartnerList;
var sbId = PartnersData.Instance.UpSbMap.GetValueOrDefault(_pos, 0);
var dataList = new List();
foreach (var item in list)
{
if (item.Status > 0)
continue;
dataList.Add(item.TableId);
}
VM.List.BindDatas(dataList);
}
}
}