This commit is contained in:
SoulliesOfficial
2025-12-11 17:25:49 -05:00
parent f7cab3e784
commit b54c5f796b
17 changed files with 113 additions and 36 deletions

View File

@@ -37,7 +37,7 @@ namespace Continentis.MainGame
public static string Parse(Interpreter interpreter, string template)
{
try
//try
{
while (template.Contains("$"))
{
@@ -58,10 +58,10 @@ namespace Continentis.MainGame
template = template.Substring(0, startIndex) + resultAsLiteral + template.Substring(endIndex + 1);
}
}
catch (Exception ex)
/*catch (Exception ex)
{
throw new Exception($"解析模板时发生严重错误: {ex.Message}\nStackTrace: {ex.StackTrace}");
}
}*/
return template;
}

View File

@@ -191,11 +191,6 @@ namespace Continentis.MainGame.Card
this.user.ModifyStamina(-GetAttribute("StaminaCost"));
this.user.ModifyMana(-GetAttribute("ManaCost"));
if (this.user is PlayerHero)
{
CombatUIManager.Instance.combatMainPage.combatResourcesDisplayer.UpdateIcons();
}
Debug.Log($"Starting to play card: {contentSubmodule.cardName}");
CommandQueueManager.Instance.AddCommand(new Cmd_Function(() =>

View File

@@ -33,9 +33,10 @@ namespace Continentis.MainGame.Card
/// </summary>
/// <param name="commandGroup">目标指令组</param>
/// <param name="title">选择卡牌的描述性标题</param>
/// <param name="includeTeam">是否包含队伍内的卡牌,如果不包含,则强制切换到角色手牌,且禁用切换按钮</param>
/// <param name="maxSelection">最大选择数量</param>
/// <param name="forceMax">是否强制选择最大数量</param>
public void AddSelectionCommands(ref CommandGroup commandGroup, string title, int maxSelection, bool forceMax = false)
public void AddSelectionCommands(ref CommandGroup commandGroup, string title, int maxSelection, bool forceMax = false, bool includeTeam = false)
{
selectedCards = new List<CardInstance>();
HandCardSelectionInterface handCardSelector = CombatUIManager.Instance.combatMainPage.handCardSelector;
@@ -43,12 +44,21 @@ namespace Continentis.MainGame.Card
commandGroup.AddCommand(new Cmd_Function(() =>
{
handCardSelector.Setup(title, mainLogic.card, maxSelection, selectCondition, forceMax);
if (!includeTeam)
{
CombatUIManager.Instance.combatMainPage.teamSwitchButton.SwitchToCurrentCharacter();
CombatUIManager.Instance.combatMainPage.teamSwitchButton.button.interactable = false;
}
}));
commandGroup.AddCommand(new Cmd_WaitForUI(handCardSelector));
commandGroup.AddCommand(new Cmd_Function(() =>
{
selectedCards = handCardSelector.selectedCards.ToList();
selectedCards.ForEach(selectEffect);
if (!includeTeam)
{
CombatUIManager.Instance.combatMainPage.teamSwitchButton.button.interactable = true;
}
}));
}

View File

@@ -39,7 +39,7 @@ namespace Continentis.MainGame.Character
modifiedAttributes.AddRange(numericChange.Select(kvp => kvp.Key));
modifiedAttributes.AddRange(percentageChangeOfAccumulation.Select(kvp => kvp.Key));
modifiedAttributes.AddRange(percentageChangeOfMultiplication.Select(kvp => kvp.Key));
modifiedAttributes.ForEach(attr => character.attributeSubmodule.RefreshCoreAttribute(attr));
character.attributeSubmodule.RefreshAllGeneralAttributes(); //刷新核心属性后,需要刷新通用属性

View File

@@ -46,6 +46,11 @@ namespace Continentis.MainGame.Character
{
ModifyAttribute("Stamina", staminaValue);
ClampAttribute("Stamina", 0, GetAttribute("MaximumStamina"));
if (this is PlayerHero)
{
CombatUIManager.Instance.combatMainPage.combatResourcesDisplayer.UpdateIcons();
}
}
/// <summary>
@@ -63,6 +68,11 @@ namespace Continentis.MainGame.Character
{
ModifyAttribute("Mana", manaValue);
ClampAttribute("Stamina", 0, GetAttribute("MaximumStamina"));
if (this is PlayerHero)
{
CombatUIManager.Instance.combatMainPage.combatResourcesDisplayer.UpdateIcons();
}
}
}

View File

@@ -93,6 +93,7 @@ namespace Continentis.MainGame.Character
new Cmd_DiscardCards(card.deck, new List<CardInstance>() { card }, initiative, interval),
new Cmd_Function(0, () =>
{
CombatUIManager.Instance.combatMainPage.teamSwitchButton.UpdateTeamPileText(owner.team);
//Debug.Log((context.sharedInfo["DrawnCards"] as List<CardInstance>).Count); //TODO: 弃牌后的处理
}));
@@ -111,6 +112,7 @@ namespace Continentis.MainGame.Character
}
discardCardGroup.AddCommand(new Cmd_Function(0, () =>
{
CombatUIManager.Instance.combatMainPage.teamSwitchButton.UpdateTeamPileText(owner.team);
//Debug.Log((context.sharedInfo["DrawnCards"] as List<CardInstance>).Count); //TODO: 弃牌后的处理
}));
@@ -124,9 +126,9 @@ namespace Continentis.MainGame.Character
new Cmd_ExhaustCards(owner is PlayerHero, card.deck, new List<CardInstance>() { card }, interval),
new Cmd_Function(0, () =>
{
CombatUIManager.Instance.combatMainPage.teamSwitchButton.UpdateTeamPileText(owner.team);
//Debug.Log((context.sharedInfo["DrawnCards"] as List<CardInstance>).Count); //TODO: 消耗牌后的处理
}));
return discardCardGroup;
}
@@ -142,6 +144,7 @@ namespace Continentis.MainGame.Character
}
discardCardGroup.AddCommand(new Cmd_Function(0, () =>
{
CombatUIManager.Instance.combatMainPage.teamSwitchButton.UpdateTeamPileText(owner.team);
//Debug.Log((context.sharedInfo["DrawnCards"] as List<CardInstance>).Count); //TODO: 弃牌后的处理
}));
@@ -155,6 +158,7 @@ namespace Continentis.MainGame.Character
new Cmd_UsePowerCards(owner is PlayerHero, card.deck, new List<CardInstance>() { card }, interval),
new Cmd_Function(0, () =>
{
CombatUIManager.Instance.combatMainPage.teamSwitchButton.UpdateTeamPileText(owner.team);
//Debug.Log((context.sharedInfo["DrawnCards"] as List<CardInstance>).Count); //TODO: 消耗牌后的处理
}));
@@ -173,6 +177,7 @@ namespace Continentis.MainGame.Character
}
discardCardGroup.AddCommand(new Cmd_Function(0, () =>
{
CombatUIManager.Instance.combatMainPage.teamSwitchButton.UpdateTeamPileText(owner.team);
//Debug.Log((context.sharedInfo["DrawnCards"] as List<CardInstance>).Count); //TODO: 弃牌后的处理
}));

View File

@@ -40,6 +40,12 @@ namespace Continentis.MainGame.UI
discardPile.cardViews.Clear();
exhaustPile.cardViews.Clear();
gravePile.cardViews.Clear();
drawPile.UpdateCountText();
handPile.UpdateCountText();
discardPile.UpdateCountText();
exhaustPile.UpdateCountText();
gravePile.UpdateCountText();
}
public PileBase Pile(string pileName)

View File

@@ -26,7 +26,7 @@ namespace Continentis.MainGame.UI
if (count == 0 || index < 0)
return Vector2.zero;
float cardSpacing = cardSpacingBase + cardSpacingFactor / count;
float cardSpacing = cardSpacingBase + Mathf.Max((cardSpacingFactor - (count * 20)), -200) / count;
// 计算中间索引,保证手牌居中排列
float midIndex = (count - 1) / 2f;

View File

@@ -15,7 +15,6 @@ namespace Continentis.MainGame.UI
{
base.Awake();
cardViews = new List<CardViewBase>();
UpdateCountText();
}
public virtual void AddCard(CardViewBase cardObject)
@@ -40,7 +39,7 @@ namespace Continentis.MainGame.UI
//Debug.Log($"Removed {cardObject.cardInstance.cardLogic.contentSubmodule.cardName} from {this.name}" );
}
private void UpdateCountText()
public void UpdateCountText()
{
if (cardCountText != null)
{

View File

@@ -21,24 +21,24 @@ namespace Continentis.MainGame.UI
button.onClick.AddListener(() =>
{
isTeam = !isTeam;
if (isTeam)
{
SwitchToTeam();
buttonText.text = "Team";
teamPileText.gameObject.SetActive(true);
SwitchToCurrentCharacter();
}
else
{
SwitchToCurrentCharacter();
buttonText.text = "Hero";
teamPileText.gameObject.SetActive(false);
SwitchToTeam();
}
});
}
private void SwitchToTeam()
public void SwitchToTeam()
{
if(isTeam) return;
isTeam = true;
Sequence seq = DOTween.Sequence();
seq.Append(CombatUIManager.Instance.combatMainPage.handPile.rectTransform.DOAnchorPosY(-300f, 0.2f)
.OnComplete(() =>
@@ -49,6 +49,8 @@ namespace Continentis.MainGame.UI
{
card.user = CombatMainManager.Instance.currentCharacter;
card.RefreshCardAttributes();
buttonText.text = "Team";
teamPileText.gameObject.SetActive(true);
});
}));
@@ -57,8 +59,10 @@ namespace Continentis.MainGame.UI
seq.Play();
}
private void SwitchToCurrentCharacter()
public void SwitchToCurrentCharacter()
{
if(!isTeam) return;
isTeam = false;
if (CombatMainManager.Instance.currentCharacter is PlayerHero playerHero)
{
Sequence seq = DOTween.Sequence();
@@ -67,6 +71,8 @@ namespace Continentis.MainGame.UI
{
CombatUIManager.Instance.combatMainPage.ClearAllCardViews();
playerHero.deckSubmodule.SetUpHandCardViews();
buttonText.text = "Hero";
teamPileText.gameObject.SetActive(false);
}));
seq.AppendInterval(0.1f);
seq.Append(CombatUIManager.Instance.combatMainPage.handPile.rectTransform.DOAnchorPosY(80f, 0.2f));
@@ -81,6 +87,8 @@ namespace Continentis.MainGame.UI
public void UpdateTeamPileText(CombatTeam team)
{
int currentCardCount = team.deckSubmodule.HandPile.Count;
Debug.Log($"Current team hand pile count: {currentCardCount}");
gameObject.SetActive(currentCardCount != 0);