|
@@ -4,7 +4,10 @@
|
|
|
/// 该脚本由模板创建
|
|
|
/// created by cb 2024
|
|
|
|
|
|
+using System.Collections.Generic;
|
|
|
using FairyGUI;
|
|
|
+using FL.Data;
|
|
|
+using XGame;
|
|
|
using XGame.Framework.UI;
|
|
|
|
|
|
namespace FL.FGUI
|
|
@@ -18,11 +21,15 @@ namespace FL.FGUI
|
|
|
protected override void OnEnable(object intent)
|
|
|
{
|
|
|
AddUIListenres();
|
|
|
+ InitView();
|
|
|
+ ShowUI();
|
|
|
}
|
|
|
+
|
|
|
protected override void OnDisable()
|
|
|
{
|
|
|
RemoveUIListenres();
|
|
|
}
|
|
|
+
|
|
|
#region UI事件
|
|
|
private void AddUIListenres()
|
|
|
{
|
|
@@ -34,8 +41,8 @@ namespace FL.FGUI
|
|
|
VM.MaskBtn.onClick.Add(OnClickMaskBtn);
|
|
|
VM.ConfirmBtn.onClick.Add(OnClickConfirmBtn);
|
|
|
VM.CancelBtn.onClick.Add(OnClickCancelBtn);
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
private void RemoveUIListenres()
|
|
|
{
|
|
|
VM.ReplaceBtn.onClick.Remove(OnClickReplaceBtn);
|
|
@@ -46,33 +53,88 @@ namespace FL.FGUI
|
|
|
VM.MaskBtn.onClick.Remove(OnClickMaskBtn);
|
|
|
VM.ConfirmBtn.onClick.Remove(OnClickConfirmBtn);
|
|
|
VM.CancelBtn.onClick.Remove(OnClickCancelBtn);
|
|
|
-
|
|
|
- }
|
|
|
- private void OnClickReplaceBtn(EventContext context)
|
|
|
- {
|
|
|
}
|
|
|
- private void OnClickStrengthBtn(EventContext context)
|
|
|
- {
|
|
|
- }
|
|
|
- private void OnClickOneUpBtn(EventContext context)
|
|
|
- {
|
|
|
- }
|
|
|
- private void OnClickRecommendBtn(EventContext context)
|
|
|
- {
|
|
|
- }
|
|
|
- private void OnClickBagBtn(EventContext context)
|
|
|
+
|
|
|
+ private void OnClickReplaceBtn(EventContext context) { }
|
|
|
+
|
|
|
+ private void OnClickStrengthBtn(EventContext context) { }
|
|
|
+
|
|
|
+ private void OnClickOneUpBtn(EventContext context) { }
|
|
|
+
|
|
|
+ private void OnClickRecommendBtn(EventContext context) { }
|
|
|
+
|
|
|
+ private void OnClickBagBtn(EventContext context) { }
|
|
|
+
|
|
|
+ private void OnClickMaskBtn(EventContext context) { }
|
|
|
+
|
|
|
+ private void OnClickConfirmBtn(EventContext context) { }
|
|
|
+
|
|
|
+ private void OnClickCancelBtn(EventContext context) { }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ #region 属性
|
|
|
+ private bool _initView = false;
|
|
|
+ private int _curSelectPos = 0;
|
|
|
+ #endregion
|
|
|
+ #region 页面
|
|
|
+ private void InitView()
|
|
|
{
|
|
|
+ if (_initView)
|
|
|
+ return;
|
|
|
+ _initView = true;
|
|
|
+ VM.SbList.ListType = EGListType.None;
|
|
|
}
|
|
|
- private void OnClickMaskBtn(EventContext context)
|
|
|
+
|
|
|
+ private void ShowUI()
|
|
|
{
|
|
|
+ RefreshGoneUpPartners(true);
|
|
|
+ UpdateDetail();
|
|
|
}
|
|
|
- private void OnClickConfirmBtn(EventContext context)
|
|
|
+
|
|
|
+ private void RefreshGoneUpPartners(bool chooseFirstSb)
|
|
|
{
|
|
|
+ var plan = PartnersData.Instance.CurUsePlan;
|
|
|
+ if(plan == null)
|
|
|
+ {
|
|
|
+ Log.Error($"圣兵上阵方案不存在,id:{PartnersData.Instance.CurUsePlan}");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (chooseFirstSb)
|
|
|
+ {
|
|
|
+ _curSelectPos = 0;
|
|
|
+ for (int i = 0; i < PartnersData.GoneUpLimit; i++)
|
|
|
+ {
|
|
|
+ var slot = plan.GetSlot(i);
|
|
|
+ if (slot?.SbId > 0)
|
|
|
+ {
|
|
|
+ _curSelectPos = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var list = new List<PartnerSbUpListItemParam>();
|
|
|
+ for (int i = 0; i < PartnersData.GoneUpLimit; i++)
|
|
|
+ {
|
|
|
+ var data = new PartnerSbUpListItemParam()
|
|
|
+ {
|
|
|
+ PosId = i,
|
|
|
+ CurSelectPos = _curSelectPos,
|
|
|
+ };
|
|
|
+ list.Add(data);
|
|
|
+ }
|
|
|
+ VM.SbList.BindDatas(list);
|
|
|
}
|
|
|
- private void OnClickCancelBtn(EventContext context)
|
|
|
- {
|
|
|
+ private void UpdateDetail()
|
|
|
+ {
|
|
|
+ var plan = PartnersData.Instance.CurUsePlan;
|
|
|
+ if (plan == null)
|
|
|
+ {
|
|
|
+ Log.Error($"圣兵上阵方案不存在,id:{PartnersData.Instance.CurUsePlan}");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var slot = plan.GetSlot(_curSelectPos);
|
|
|
+ VM.SbDetailNested.Ctrl.ShowUI(slot?.SbId ?? 0);
|
|
|
}
|
|
|
-
|
|
|
#endregion
|
|
|
}
|
|
|
-}
|
|
|
+}
|