MOD!
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Continentis.MainGame.Character;
|
||||
using Continentis.MainGame.Combat;
|
||||
using Continentis.MainGame.UI;
|
||||
using SoulliesFramework.General;
|
||||
using SLSFramework.General;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
@@ -9,6 +10,8 @@ namespace Continentis.MainGame.Card
|
||||
{
|
||||
public partial class HandCardView : IBeginDragHandler, IDragHandler, IEndDragHandler, IPointerClickHandler
|
||||
{
|
||||
public CombatCharacterViewBase currentTargetingCharacterView;
|
||||
|
||||
public List<CharacterBase> validTargets = new List<CharacterBase>();
|
||||
public List<CharacterBase> conditionNotMetTargets = new List<CharacterBase>();
|
||||
public List<CharacterBase> invalidTargets = new List<CharacterBase>();
|
||||
@@ -37,17 +40,30 @@ namespace Continentis.MainGame.Card
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
if (CombatUIManager.Instance.deckPage.handCardSelector.gameObject.activeInHierarchy)
|
||||
if (CombatUIManager.Instance.combatMainPage.handCardSelector.gameObject.activeInHierarchy)
|
||||
{
|
||||
if(isOccupied) return;
|
||||
|
||||
if (CombatUIManager.Instance.deckPage.handCardSelector.selectedCards.ContainsKey(cardInstance))
|
||||
if (CombatUIManager.Instance.combatMainPage.handCardSelector.selectedCards.Contains(cardInstance))
|
||||
{
|
||||
CombatUIManager.Instance.deckPage.handCardSelector.Deselect(this);
|
||||
CombatUIManager.Instance.combatMainPage.handCardSelector.Deselect(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
CombatUIManager.Instance.deckPage.handCardSelector.Select(this);
|
||||
CombatUIManager.Instance.combatMainPage.handCardSelector.Select(this);
|
||||
}
|
||||
}
|
||||
else if (CombatUIManager.Instance.combatMainPage.customCardSelector.gameObject.activeInHierarchy)
|
||||
{
|
||||
if(isOccupied) return;
|
||||
|
||||
if (CombatUIManager.Instance.combatMainPage.customCardSelector.selectedCards.Contains(cardInstance))
|
||||
{
|
||||
CombatUIManager.Instance.combatMainPage.customCardSelector.Deselect(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
CombatUIManager.Instance.combatMainPage.customCardSelector.Select(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,7 +74,7 @@ namespace Continentis.MainGame.Card
|
||||
CombatUIManager.Instance.selectingCardView = this;
|
||||
|
||||
cardInstance.user = CombatMainManager.Instance.currentCharacter;
|
||||
cardLogic.SetTargets(out validTargets, out conditionNotMetTargets, out invalidTargets);
|
||||
cardLogic.DetectTargetsValidity(out validTargets, out conditionNotMetTargets, out invalidTargets);
|
||||
|
||||
if (cardLogic.attributeSubmodule.targetCount == 1)
|
||||
{
|
||||
@@ -81,19 +97,26 @@ namespace Continentis.MainGame.Card
|
||||
Camera uiCamera = CombatUIManager.Instance.uiCamera;
|
||||
Camera worldCamera = CombatUIManager.Instance.combatCamera;
|
||||
|
||||
if (CombatUIManager.Instance.hoveringCharacterView != null)
|
||||
// 先检查悬停的视图是否和当前记录的目标视图发生了变化
|
||||
if (CombatUIManager.Instance.hoveringCharacterView != currentTargetingCharacterView)
|
||||
{
|
||||
cardLogic.Targeting(CombatUIManager.Instance.hoveringCharacterView.character);
|
||||
Debug.Log("Hovering over " + CombatUIManager.Instance.hoveringCharacterView.character);
|
||||
}
|
||||
else
|
||||
{
|
||||
cardLogic.Untargeting();
|
||||
// 如果悬停视图不是空的,说明鼠标移动到了一个新的目标上
|
||||
if (CombatUIManager.Instance.hoveringCharacterView != null)
|
||||
{
|
||||
cardLogic.eventSubmodule.onTargeting(CombatUIManager.Instance.hoveringCharacterView.character);
|
||||
currentTargetingCharacterView = CombatUIManager.Instance.hoveringCharacterView;
|
||||
}
|
||||
else // 悬停视图是空的,说明鼠标离开了之前的目标
|
||||
{
|
||||
cardLogic.eventSubmodule.onUntargeting();
|
||||
currentTargetingCharacterView = null;
|
||||
}
|
||||
|
||||
// 因为目标发生了变化(无论是选中了新的还是取消了),所以统一在这里更新描述
|
||||
CardTextInterpreter.InterpretText(cardLogic);
|
||||
cardDescriptionText.text = cardLogic.contentSubmodule.interpretedFunctionText;
|
||||
}
|
||||
|
||||
CardDescriptionInterpreter.InterpretDescription(cardLogic);
|
||||
cardDescriptionText.text = cardLogic.contentSubmodule.cardDescription;
|
||||
|
||||
Vector3 startPosition = cardTransform.position + new Vector3(0, cardTransform.rect.height * cardTransform.lossyScale.y / 2, 0);
|
||||
Vector3 endPosition = SpaceConverter.ScreenPointToUIPoint(arrowCanvasRect, eventData.position, uiCamera);
|
||||
PointerArrow mainPointerArrow = CombatUIManager.Instance.arrowsPage.mainPointerArrow;
|
||||
@@ -203,7 +226,7 @@ namespace Continentis.MainGame.Card
|
||||
CharacterBase hoveringCharacter = hoveringCharacterView != null ? hoveringCharacterView.character : null;
|
||||
Camera uiCamera = CombatUIManager.Instance.uiCamera;
|
||||
CombatUIManager.Instance.arrowsPage.ClearPointerArrows();
|
||||
|
||||
|
||||
if (isSelecting)
|
||||
{
|
||||
isSelecting = false;
|
||||
@@ -211,16 +234,21 @@ namespace Continentis.MainGame.Card
|
||||
CombatUIManager.Instance.selectingCardView = null;
|
||||
canvas.overrideSorting = false;
|
||||
canvas.sortingOrder = 0;
|
||||
cardLogic.Untargeting();
|
||||
CardDescriptionInterpreter.InterpretDescription(cardLogic);
|
||||
cardDescriptionText.text = cardLogic.contentSubmodule.cardDescription;
|
||||
cardLogic.eventSubmodule.onUntargeting();
|
||||
CardTextInterpreter.InterpretText(cardLogic);
|
||||
cardDescriptionText.text = cardLogic.contentSubmodule.interpretedFunctionText;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (cardLogic.HasKeyword("Unplayable")) // 如果有“不能打出”关键词,直接返回
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cardLogic.cardData.functionalTags.Contains("TargetSelf"))
|
||||
if (!cardLogic.HasTag("TargetSelf"))
|
||||
{
|
||||
if (!validTargets.Contains(hoveringCharacter))
|
||||
{
|
||||
@@ -236,15 +264,15 @@ namespace Continentis.MainGame.Card
|
||||
{
|
||||
if (!cardLogic.Play(new List<CharacterBase>() { CombatUIManager.Instance.hoveringCharacterView.character }))
|
||||
{
|
||||
cardLogic.Untargeting();
|
||||
CardDescriptionInterpreter.InterpretDescription(cardLogic);
|
||||
cardDescriptionText.text = cardLogic.contentSubmodule.cardDescription;
|
||||
cardLogic.eventSubmodule.onUntargeting();
|
||||
CardTextInterpreter.InterpretText(cardLogic);
|
||||
cardDescriptionText.text = cardLogic.contentSubmodule.interpretedFunctionText;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RectTransform dropZone = CombatUIManager.Instance.deckPage.dropZone;
|
||||
RectTransform dropZone = CombatUIManager.Instance.combatMainPage.dropZone;
|
||||
bool isInDropZone = RectTransformUtility.RectangleContainsScreenPoint(dropZone, eventData.position, uiCamera);
|
||||
List<CharacterBase> targetList = new List<CharacterBase>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user