1:对战斗开始选择萌妖进行限制,新增携带萌妖有最大携带量。

2:修复选择一个属性萌妖到携带列表,然后在下方切换萌妖属性显示,再把萌妖拿回,萌妖会显示在不属于自己属性的列表中。目前萌妖只会出现在对应属性列表。
This commit is contained in:
wulongxiao 2025-01-07 10:12:59 +08:00
parent 425673347c
commit c0523eb4bb
2 changed files with 30 additions and 6 deletions

View File

@ -7030,6 +7030,7 @@ MonoBehaviour:
EnemyGeneratePos: {fileID: 8646173537015180660} EnemyGeneratePos: {fileID: 8646173537015180660}
CarryGeneratePos: {fileID: 8646173536992652429} CarryGeneratePos: {fileID: 8646173536992652429}
MengyaoGeneratePos: {fileID: 8646173537342263721} MengyaoGeneratePos: {fileID: 8646173537342263721}
MaxCarryCardCount: 3
CardBTN: CardBTN:
- {fileID: 7273037110982156962} - {fileID: 7273037110982156962}
- {fileID: 6557249533962720523} - {fileID: 6557249533962720523}
@ -9171,10 +9172,10 @@ RectTransform:
m_Father: {fileID: 8646173537015180660} m_Father: {fileID: 8646173537015180660}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 132, y: -174.5} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 264, y: 349} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8646173537325353418 --- !u!222 &8646173537325353418
CanvasRenderer: CanvasRenderer:

View File

@ -23,6 +23,11 @@ public class Battle_Selection : BaseUI
private List<Button> CarryCard = new List<Button>(); private List<Button> CarryCard = new List<Button>();
private List<Button> MengyaoCard = new List<Button>(); private List<Button> MengyaoCard = new List<Button>();
public int MaxCarryCardCount;
private int carryCardCount=0;
[Header("所有卡牌按钮列表")] [Header("所有卡牌按钮列表")]
public List<Button> CardBTN = new List<Button>(); public List<Button> CardBTN = new List<Button>();
@ -39,6 +44,9 @@ public class Battle_Selection : BaseUI
public GameObject loadPanelPrefab; public GameObject loadPanelPrefab;
private int NowShuXing=-1;//当前的属性
// Start is called before the first frame update // Start is called before the first frame update
async void Start() async void Start()
{ {
@ -93,10 +101,19 @@ public class Battle_Selection : BaseUI
if (MengyaoCard.Contains(btn)) if (MengyaoCard.Contains(btn))
{ {
if (carryCardCount>=MaxCarryCardCount)
{
Promptmgr.Instance.PromptBubble("已达到最大携程数");
return;
}
// 从萌妖卡列表移除,添加到携带卡列表 // 从萌妖卡列表移除,添加到携带卡列表
MengyaoCard.Remove(btn); MengyaoCard.Remove(btn);
CarryCard.Add(btn); CarryCard.Add(btn);
carryCardCount++;//增加数量
// 更改父节点并播放动画 // 更改父节点并播放动画
AnimateCardScaling(btn.transform, CarryGeneratePos, () => AnimateCardScaling(btn.transform, CarryGeneratePos, () =>
{ {
@ -111,6 +128,8 @@ public class Battle_Selection : BaseUI
CarryCard.Remove(btn); CarryCard.Remove(btn);
MengyaoCard.Add(btn); MengyaoCard.Add(btn);
carryCardCount--;//减少数量
// 更改父节点并播放动画 // 更改父节点并播放动画
AnimateCardScaling(btn.transform, MengyaoGeneratePos, () => AnimateCardScaling(btn.transform, MengyaoGeneratePos, () =>
{ {
@ -161,18 +180,22 @@ public class Battle_Selection : BaseUI
onComplete?.Invoke(); onComplete?.Invoke();
}); });
ShowCardOfShuixing(this.NowShuXing);//显示和隐藏
// 开始动画 // 开始动画
mySequence.Play(); mySequence.Play();
} }
public void ShowCardOfShuixing(int shuxing) public void ShowCardOfShuixing(int shuxing)
{ {
this.NowShuXing= shuxing;
foreach (Button key in MengyaoCard) foreach (Button key in MengyaoCard)
{ {
if (shuxing==-1) if (this.NowShuXing == -1)
{ {
key.gameObject.SetActive(true); key.gameObject.SetActive(true);
} }
else if (key.GetComponent<CardInfo>().shuxing == shuxing) else if (key.GetComponent<CardInfo>().shuxing == this.NowShuXing)
{ {
key.gameObject.SetActive(true); key.gameObject.SetActive(true);
} }