|
@@ -8,6 +8,7 @@ using System.Collections.Generic;
|
|
|
using FairyGUI;
|
|
|
using FL.Data;
|
|
|
using XGame;
|
|
|
+using XGame.Database;
|
|
|
using XGame.Framework.UI;
|
|
|
|
|
|
namespace FL.FGUI
|
|
@@ -43,10 +44,12 @@ namespace FL.FGUI
|
|
|
VM.CancelBtn.onClick.Add(OnClickCancelBtn);
|
|
|
EventSingle.Instance.AddListener(EventDefine.PartnerFinishUpMode, OnFinishUpMode);
|
|
|
EventSingle.Instance.AddListener(EventDefine.PartnerOpenUpMode, OnOpenUpMode);
|
|
|
- EventSingle.Instance.AddListener(
|
|
|
- EventDefine.PartnerUpModeSelect,
|
|
|
- OnPartnerUpModeSelect
|
|
|
- );
|
|
|
+ EventSingle.Instance.AddListener(EventDefine.PartnerMainSelect, OnPartnerUpModeSelect);
|
|
|
+ EventSingle.Instance.AddListener(EventDefine.PartnerUpLevel, OnUpLevel);
|
|
|
+ EventSingle.Instance.AddListener(EventDefine.PartnerUpStar, OnUpStar);
|
|
|
+ EventSingle.Instance.AddListener(EventDefine.PartnerDown, OnSbUp);
|
|
|
+ EventSingle.Instance.AddListener(EventDefine.PartnerUp, OnSbUp);
|
|
|
+ EventSingle.Instance.AddListener(EventDefine.PartnerWearAll, OnSbUp);
|
|
|
}
|
|
|
|
|
|
private void RemoveUIListenres()
|
|
@@ -62,44 +65,78 @@ namespace FL.FGUI
|
|
|
EventSingle.Instance.RemoveListener(EventDefine.PartnerFinishUpMode, OnFinishUpMode);
|
|
|
EventSingle.Instance.RemoveListener(EventDefine.PartnerOpenUpMode, OnOpenUpMode);
|
|
|
EventSingle.Instance.RemoveListener(
|
|
|
- EventDefine.PartnerUpModeSelect,
|
|
|
+ EventDefine.PartnerMainSelect,
|
|
|
OnPartnerUpModeSelect
|
|
|
);
|
|
|
+ EventSingle.Instance.RemoveListener(EventDefine.PartnerUpLevel, OnUpLevel);
|
|
|
+ EventSingle.Instance.RemoveListener(EventDefine.PartnerUpStar, OnUpStar);
|
|
|
+ EventSingle.Instance.RemoveListener(EventDefine.PartnerDown, OnSbUp);
|
|
|
+ EventSingle.Instance.RemoveListener(EventDefine.PartnerUp, OnSbUp);
|
|
|
+ EventSingle.Instance.RemoveListener(EventDefine.PartnerWearAll, OnSbUp);
|
|
|
}
|
|
|
|
|
|
- private void OnClickReplaceBtn(EventContext context) {
|
|
|
- Context.UI.OpenAsync(UIKeys.PartnerSbReplacePanel, _sbId);
|
|
|
+ private void OnSbUp(int eventId, object args)
|
|
|
+ {
|
|
|
+ RefreshGoneUpPartners(false);
|
|
|
+ UpdateDetail();
|
|
|
+ }
|
|
|
+ private void OnUpLevel(int eventId, object args)
|
|
|
+ {
|
|
|
+ RefreshGoneUpPartners(false);
|
|
|
+ UpdateDetail();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnUpStar(int eventId, object args)
|
|
|
+ {
|
|
|
+ RefreshGoneUpPartners(false);
|
|
|
+ UpdateDetail();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickReplaceBtn(EventContext context)
|
|
|
+ {
|
|
|
+ Context.UI.OpenAsync(UIKeys.PartnerSbReplacePanel, _curSelectPos);
|
|
|
}
|
|
|
|
|
|
private void OnClickStrengthBtn(EventContext context)
|
|
|
{
|
|
|
- var slot = PartnersData.Instance.GetPlanSlot(
|
|
|
- PartnersData.Instance.UsePlanId,
|
|
|
- _curSelectPos
|
|
|
- );
|
|
|
- if (slot == null || slot.SbId == 0)
|
|
|
+ var sbId = PartnersData.Instance.UpSbMap.GetValueOrDefault(_curSelectPos, 0);
|
|
|
+ if (sbId <= 0)
|
|
|
{
|
|
|
Context.ShowTips(StringDefine.PartnerEmptyTips);
|
|
|
return;
|
|
|
}
|
|
|
- Context.UI.OpenAsync(UIKeys.PartnerSbStrengthPanel, slot.SbId);
|
|
|
+ Context.UI.OpenAsync(UIKeys.PartnerSbStrengthPanel, sbId);
|
|
|
}
|
|
|
|
|
|
- private void OnClickOneUpBtn(EventContext context) { }
|
|
|
+ private void OnClickOneUpBtn(EventContext context)
|
|
|
+ {
|
|
|
+ PartnersService.Instance.RequestPartnerOneKeyUp();
|
|
|
+ }
|
|
|
|
|
|
- private void OnClickRecommendBtn(EventContext context) {
|
|
|
+ private void OnClickRecommendBtn(EventContext context)
|
|
|
+ {
|
|
|
Context.UI.OpenAsync(UIKeys.PartnerSbRecommendPanel);
|
|
|
}
|
|
|
|
|
|
- private void OnClickBagBtn(EventContext context) {
|
|
|
+ private void OnClickBagBtn(EventContext context)
|
|
|
+ {
|
|
|
Context.UI.OpenAsync(UIKeys.PartnerSbBagPanel);
|
|
|
}
|
|
|
|
|
|
private void OnClickMaskBtn(EventContext context) { }
|
|
|
|
|
|
- private void OnClickConfirmBtn(EventContext context) { }
|
|
|
+ private void OnClickConfirmBtn(EventContext context)
|
|
|
+ {
|
|
|
+ PartnersService.Instance.RequestPartnerUpNew(
|
|
|
+ _curSelectPos,
|
|
|
+ PartnersData.Instance.UpModeSelect
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- private void OnClickCancelBtn(EventContext context) { }
|
|
|
+ private void OnClickCancelBtn(EventContext context)
|
|
|
+ {
|
|
|
+ PartnersService.Instance.FinishUpPartnerMode();
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 圣兵上阵打开事件
|
|
@@ -119,9 +156,18 @@ namespace FL.FGUI
|
|
|
private void OnPartnerUpModeSelect(int eventId, object args)
|
|
|
{
|
|
|
var pos = (int)args;
|
|
|
+ if (PartnersData.Instance.UpModeSelect <= 0)
|
|
|
+ {
|
|
|
+ var sbId = PartnersData.Instance.UpSbMap.GetValueOrDefault(pos, 0);
|
|
|
+ if (sbId == 0)
|
|
|
+ {
|
|
|
+ Context.UI.OpenAsync(UIKeys.PartnerSbUpPanel, pos);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (pos == _curSelectPos)
|
|
|
return;
|
|
|
_curSelectPos = pos;
|
|
|
+ RefreshGoneUpPartners(false);
|
|
|
UpdateDetail();
|
|
|
}
|
|
|
#endregion
|
|
@@ -143,6 +189,7 @@ namespace FL.FGUI
|
|
|
{
|
|
|
RefreshGoneUpPartners(true);
|
|
|
UpdateDetail();
|
|
|
+ UpdateAttr();
|
|
|
}
|
|
|
|
|
|
private void ShowUpMode()
|
|
@@ -151,10 +198,6 @@ namespace FL.FGUI
|
|
|
{
|
|
|
VM.UpPartner.selectedIndex = 1;
|
|
|
}
|
|
|
- else if (EpigraphData.Instance.UpModeSelect > 0)
|
|
|
- {
|
|
|
- VM.UpPartner.selectedIndex = 1;
|
|
|
- }
|
|
|
else
|
|
|
{
|
|
|
VM.UpPartner.selectedIndex = 0;
|
|
@@ -163,19 +206,13 @@ namespace FL.FGUI
|
|
|
|
|
|
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)
|
|
|
+ var sbId = PartnersData.Instance.UpSbMap.GetValueOrDefault(i, 0);
|
|
|
+ if (sbId > 0)
|
|
|
{
|
|
|
_curSelectPos = i;
|
|
|
break;
|
|
@@ -197,16 +234,9 @@ namespace FL.FGUI
|
|
|
|
|
|
private void UpdateDetail()
|
|
|
{
|
|
|
- var plan = PartnersData.Instance.CurUsePlan;
|
|
|
- if (plan == null)
|
|
|
- {
|
|
|
- Log.Error($"圣兵上阵方案不存在,id:{PartnersData.Instance.CurUsePlan}");
|
|
|
- return;
|
|
|
- }
|
|
|
- var slot = plan.GetSlot(_curSelectPos);
|
|
|
- _sbId = slot?.SbId ?? 0;
|
|
|
- VM.SbDetailNested.Ctrl.ShowUI(slot?.SbId ?? 0);
|
|
|
- if (slot == null || slot.SbId == 0)
|
|
|
+ var sbId = PartnersData.Instance.UpSbMap.GetValueOrDefault(_curSelectPos, 0);
|
|
|
+ VM.SbDetailNested.Ctrl.ShowUI(sbId);
|
|
|
+ if (sbId == 0)
|
|
|
{
|
|
|
VM.IsEmpty.selectedIndex = 1;
|
|
|
}
|
|
@@ -214,6 +244,24 @@ namespace FL.FGUI
|
|
|
{
|
|
|
VM.IsEmpty.selectedIndex = 0;
|
|
|
}
|
|
|
+ var gObj = VM.SbList.GetChildAt(_curSelectPos);
|
|
|
+ var localPos = gObj.position + VM.SbList.position;
|
|
|
+ localPos.x += gObj.width / 2;
|
|
|
+ VM.DownArr.x = localPos.x;
|
|
|
+ VM.ChangeArr.position = VM.DownArr.position;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpdateAttr()
|
|
|
+ {
|
|
|
+ var sbList = PartnersData.Instance.PartnerList;
|
|
|
+ int val = 0;
|
|
|
+ foreach (var sb in sbList)
|
|
|
+ {
|
|
|
+ var table = PartnerTableRepo.Get(sb.TableId);
|
|
|
+ XGame.Framework.Assert.IsNotNull($"圣兵表不存在,id:{sb.TableId}");
|
|
|
+ val += table.Own_attr[1];
|
|
|
+ }
|
|
|
+ VM.AttrLabel.SetVar("val", (val / 100).ToString()).FlushVars();
|
|
|
}
|
|
|
#endregion
|
|
|
}
|