20 changed files with 5558 additions and 8119 deletions
File diff suppressed because it is too large
@ -0,0 +1,7 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: d92d41e0a0db273498457ecbfd3f0fe4 |
||||
|
PrefabImporter: |
||||
|
externalObjects: {} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
||||
File diff suppressed because it is too large
@ -1,72 +0,0 @@ |
|||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Text; |
|
||||
using UnityEngine; |
|
||||
using UnityEngine.UI; |
|
||||
|
|
||||
public class EffectForgCaseNode : MonoBehaviour |
|
||||
{ |
|
||||
public string linkID; |
|
||||
public string linkText; |
|
||||
public string newCondition; |
|
||||
public Text caseDescription; |
|
||||
public KeyValuePair<string, string> kvp; |
|
||||
public string casePostion; |
|
||||
|
|
||||
public bool isSelected;//被选中
|
|
||||
public GameObject mask; |
|
||||
|
|
||||
[Header("效果锻造预卡牌")] |
|
||||
public Transform cardFather; |
|
||||
public CardEntity previewCard; |
|
||||
|
|
||||
public void ChangeCardVal() |
|
||||
{ |
|
||||
/* if(isSelected ==false ) |
|
||||
{ |
|
||||
if (linkID.Equals("color")) |
|
||||
{ |
|
||||
ForgintPointManager.Instance.ChangeCardCaseVal(newCondition); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
|
|
||||
ForgintPointManager.Instance.ChangeCardColorCaseVal(kvp, linkID, casePostion); |
|
||||
} |
|
||||
|
|
||||
ChangeMask(); |
|
||||
}*/ |
|
||||
ChangeMask(); |
|
||||
} |
|
||||
public void SetUpCardPreview() |
|
||||
{ |
|
||||
if (previewCard != null) |
|
||||
{ |
|
||||
if (previewCard.CardId != ForgintPointManager .Instance .chooseCardEntity.CardId) |
|
||||
{ |
|
||||
CardOriginalDataList.Instance.existEffectCardOriginalDataList.Remove(previewCard.cardId); |
|
||||
} |
|
||||
Destroy(previewCard.gameObject); |
|
||||
} |
|
||||
|
|
||||
//获得新id
|
|
||||
string preCardID = ForgintPointManager.Instance.GetPreviewCardID(kvp, linkID, casePostion); |
|
||||
//创建预览卡牌
|
|
||||
var card = PlayerStatsManager.Instance.CreateCardWithIDForLook(preCardID, cardFather); |
|
||||
card.transform.localScale = new Vector3(2.5f, 2.5f, 2.5f); |
|
||||
card.transform.localPosition = new Vector3(0, 0, 0); |
|
||||
previewCard = card.GetComponent<CardEntity>(); |
|
||||
|
|
||||
} |
|
||||
public void ChangeMask() |
|
||||
{ |
|
||||
foreach (EffectForgCaseNode node in ForgintPointManager.Instance.effectCaseNodeList) |
|
||||
{ |
|
||||
node.mask.SetActive(false); |
|
||||
node.isSelected = false; |
|
||||
} |
|
||||
mask.SetActive(true); |
|
||||
isSelected = true; |
|
||||
ForgintPointManager.Instance.newEffectCardID = previewCard.cardId; |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,137 @@ |
|||||
|
using System.Collections; |
||||
|
using System.Collections.Generic; |
||||
|
using TMPro; |
||||
|
using UnityEngine; |
||||
|
using UnityEngine.EventSystems; |
||||
|
using UnityEngine.UI; |
||||
|
|
||||
|
public class ForgedMaterialDargNode : MonoBehaviour,IBeginDragHandler,IEndDragHandler,IDragHandler |
||||
|
{ |
||||
|
public BagForgedMaterialData_SO forgedMaterialData; |
||||
|
public TMP_Text nameText; |
||||
|
public TMP_Text descriptionText; |
||||
|
public TMP_Text countText; |
||||
|
public Image materialImage; |
||||
|
public GameObject inforPanel; |
||||
|
[Header("消耗计数")] |
||||
|
public int usedCount; |
||||
|
[Header("拖拽属性")] |
||||
|
public Transform dragNode; |
||||
|
public LayerMask moveMask; |
||||
|
Transform originParent; |
||||
|
Vector3 screenPosition;//将物体从世界坐标转换为屏幕坐标
|
||||
|
Vector3 mousePositionOnScreen;//获取到点击屏幕的屏幕坐标
|
||||
|
Vector3 mousePositionInWorld;//将点击屏幕的屏幕坐标转换为世界坐标
|
||||
|
|
||||
|
[Header("消耗预览")] |
||||
|
public GameObject previewPanel; |
||||
|
public TMP_Text previewName; |
||||
|
public TMP_Text previewCount; |
||||
|
public Image previewImage; |
||||
|
public GameObject banMask; |
||||
|
|
||||
|
public void OnBeginDrag(PointerEventData eventData) |
||||
|
{ |
||||
|
if (forgedMaterialData.materialCount - usedCount > 0) |
||||
|
{ |
||||
|
originParent = dragNode.transform.parent; |
||||
|
dragNode.SetParent(ForgintPointManager.Instance.colorForgingPanel.transform.GetChild(1)); |
||||
|
//获取鼠标在相机中(世界中)的位置,转换为屏幕坐标;
|
||||
|
screenPosition = Camera.main.WorldToScreenPoint(dragNode.transform.position); |
||||
|
//获取鼠标在场景中坐标
|
||||
|
mousePositionOnScreen = Input.mousePosition; |
||||
|
//让场景中的Z=鼠标坐标的Z
|
||||
|
mousePositionOnScreen.z = screenPosition.z; |
||||
|
//将相机中的坐标转化为世界坐标
|
||||
|
mousePositionInWorld = Camera.main.ScreenToWorldPoint(mousePositionOnScreen); |
||||
|
//物体跟随鼠标移动
|
||||
|
dragNode.transform.position = mousePositionInWorld; |
||||
|
|
||||
|
// dragNode.GetComponent<CanvasGroup>().blocksRaycasts = false;
|
||||
|
inforPanel.SetActive(false); |
||||
|
dragNode.gameObject.SetActive(true); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void OnDrag(PointerEventData eventData) |
||||
|
{ |
||||
|
if (forgedMaterialData.materialCount - usedCount > 0) |
||||
|
{ |
||||
|
GameObject targetObj = eventData.pointerCurrentRaycast.gameObject; |
||||
|
if (targetObj != null) |
||||
|
{ |
||||
|
//获取鼠标在相机中(世界中)的位置,转换为屏幕坐标;
|
||||
|
screenPosition = Camera.main.WorldToScreenPoint(dragNode.transform.position); |
||||
|
//获取鼠标在场景中坐标
|
||||
|
mousePositionOnScreen = Input.mousePosition; |
||||
|
//让场景中的Z=鼠标坐标的Z
|
||||
|
mousePositionOnScreen.z = screenPosition.z; |
||||
|
//将相机中的坐标转化为世界坐标
|
||||
|
mousePositionInWorld = Camera.main.ScreenToWorldPoint(mousePositionOnScreen); |
||||
|
//物体跟随鼠标移动
|
||||
|
dragNode.transform.position = mousePositionInWorld; |
||||
|
inforPanel.SetActive(false); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void OnEndDrag(PointerEventData eventData) |
||||
|
{ |
||||
|
if (forgedMaterialData.materialCount - usedCount > 0) |
||||
|
{ |
||||
|
dragNode.gameObject.SetActive(false); |
||||
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); |
||||
|
if (Physics.Raycast(ray, out RaycastHit raycastHit, 500, moveMask.value)) |
||||
|
{ |
||||
|
if (raycastHit.collider.gameObject.tag == "PictureMapUnity") |
||||
|
{ |
||||
|
MapUnity mapUnity = raycastHit.transform.GetComponent<MapUnity>(); |
||||
|
if (mapUnity.whoColour !=6 && mapUnity.whoColour != Name .stringColorToint (forgedMaterialData.materialNodeMark )) |
||||
|
{ |
||||
|
usedCount += 1; |
||||
|
countText.text = (forgedMaterialData.materialCount - usedCount).ToString(); |
||||
|
mapUnity.switchColorForging(forgedMaterialData.materialNodeMark); |
||||
|
Debug.Log(forgedMaterialData.materialNodeMark); |
||||
|
|
||||
|
//设定消耗预览
|
||||
|
previewPanel .SetActive(true); |
||||
|
previewPanel.transform.SetParent(ForgintPointManager.Instance.materialUsedPreviewFather); |
||||
|
previewCount.text = usedCount .ToString(); |
||||
|
//计算金币消耗
|
||||
|
ForgintPointManager.Instance.choosedMapUnity = mapUnity; |
||||
|
ForgintPointManager.Instance.SettltChangeColorCost(); |
||||
|
} |
||||
|
|
||||
|
if(forgedMaterialData.materialCount - usedCount<=0) |
||||
|
{ |
||||
|
countText.text = "0"; |
||||
|
banMask.SetActive(true); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
BackPosition(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void BackPosition() |
||||
|
{ |
||||
|
dragNode.transform.SetParent(originParent); |
||||
|
dragNode.transform.localPosition = Vector3.zero; |
||||
|
// GetComponent<CanvasGroup>().blocksRaycasts = true;
|
||||
|
} |
||||
|
public void SetUpMaterialDragNode(BagForgedMaterialData_SO materialData) |
||||
|
{ |
||||
|
forgedMaterialData = materialData; |
||||
|
nameText .text = materialData.materialName; |
||||
|
descriptionText.text = materialData.materialInfor; |
||||
|
countText.text = materialData.materialCount.ToString(); |
||||
|
materialImage.sprite = materialData.materialIcon; |
||||
|
dragNode .GetComponent <Image >().sprite = materialData.materialIcon; |
||||
|
dragNode.gameObject.SetActive(false); |
||||
|
|
||||
|
previewName.text = materialData.materialName; |
||||
|
previewImage.sprite = materialData.materialIcon; |
||||
|
} |
||||
|
} |
||||
@ -1,5 +1,5 @@ |
|||||
fileFormatVersion: 2 |
fileFormatVersion: 2 |
||||
guid: ee449c4649f693f46899e2a67219b66c |
guid: a03fbd6077c6bab46a17cb4ca030e27f |
||||
MonoImporter: |
MonoImporter: |
||||
externalObjects: {} |
externalObjects: {} |
||||
serializedVersion: 2 |
serializedVersion: 2 |
||||
@ -1,285 +0,0 @@ |
|||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Text.RegularExpressions; |
|
||||
using TMPro; |
|
||||
using UnityEngine; |
|
||||
using UnityEngine.EventSystems; |
|
||||
|
|
||||
[RequireComponent(typeof(TMP_Text))] |
|
||||
public class ForginTextLink : MonoBehaviour,IPointerClickHandler ,IPointerEnterHandler ,IPointerExitHandler |
|
||||
{ |
|
||||
public TMP_Text cardDescription; |
|
||||
public float zoomScale = 1.4f;//文字缩放比例
|
|
||||
public Color hoverColor = Color.red;//鼠标悬浮颜色
|
|
||||
private Color originalColor = new Color32 (0,88,254,255);//原本颜色
|
|
||||
|
|
||||
private bool isHover=false ;//鼠标悬停
|
|
||||
private int linkIndex = -1; |
|
||||
private int selectLink = -1; |
|
||||
|
|
||||
//光标设置
|
|
||||
Vector2 hotSpot = Vector2.zero; |
|
||||
CursorMode cursorMode = CursorMode.Auto; |
|
||||
|
|
||||
private void Awake() |
|
||||
{ |
|
||||
cardDescription = GetComponent<TMP_Text>(); |
|
||||
//originalColor = cardDescription.color;
|
|
||||
} |
|
||||
|
|
||||
private void Start() |
|
||||
{ |
|
||||
InsertColor(cardDescription.text); |
|
||||
} |
|
||||
//插入颜色,高亮可以被锻造的地方
|
|
||||
public void InsertColor(string inputString) |
|
||||
{ |
|
||||
|
|
||||
// 在 <link> 后插入 <1>
|
|
||||
string pattern1 = @"(<link)"; |
|
||||
string replacement1 = @"<b><i><color=#0058fe>$1"; |
|
||||
string result = Regex.Replace(inputString, pattern1, replacement1); |
|
||||
|
|
||||
// 在 </link> 前插入 </>
|
|
||||
string pattern2 = @"(</link>)"; |
|
||||
string replacement2 = @"$1</color></i></b>"; |
|
||||
result = Regex.Replace(result, pattern2, replacement2); |
|
||||
|
|
||||
cardDescription.text = result; |
|
||||
} |
|
||||
|
|
||||
private void LateUpdate() |
|
||||
{ |
|
||||
if(isHover ) |
|
||||
{ |
|
||||
int charIndex = TMP_TextUtilities.FindIntersectingCharacter(cardDescription, Input.mousePosition, null, true); |
|
||||
if( selectLink != -1 ) |
|
||||
{ |
|
||||
if(!IsValueInRange(charIndex,cardDescription.textInfo .linkInfo[selectLink].linkTextfirstCharacterIndex , cardDescription.textInfo.linkInfo[selectLink].linkTextfirstCharacterIndex+ cardDescription.textInfo.linkInfo[selectLink].linkIdLength )) |
|
||||
{ |
|
||||
ResetLink(selectLink); |
|
||||
selectLink = -1; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
linkIndex = TMP_TextUtilities.FindIntersectingLink(cardDescription,Input .mousePosition , Camera.main); |
|
||||
|
|
||||
if(linkIndex != -1 && selectLink != linkIndex) |
|
||||
{ |
|
||||
if(selectLink != -1) |
|
||||
{ |
|
||||
ResetLink(selectLink); |
|
||||
selectLink = -1; |
|
||||
} |
|
||||
|
|
||||
selectLink = linkIndex; |
|
||||
TMP_LinkInfo linkInfo = cardDescription.textInfo.linkInfo[linkIndex]; |
|
||||
|
|
||||
for(int i=0;i< linkInfo .linkTextLength;i++) |
|
||||
{ |
|
||||
int materialIndex = cardDescription.textInfo.characterInfo[linkInfo.linkTextfirstCharacterIndex + i].materialReferenceIndex; |
|
||||
int vertexIndex = cardDescription.textInfo.characterInfo[linkInfo.linkTextfirstCharacterIndex + i].vertexIndex; |
|
||||
//矩阵变换缩放
|
|
||||
Vector3[] vetices = cardDescription.textInfo.meshInfo[materialIndex].vertices; |
|
||||
|
|
||||
Vector2 charCenter = (vetices[vertexIndex + 0] + vetices[vertexIndex + 2]) / 2; |
|
||||
|
|
||||
Vector3 offset = charCenter; |
|
||||
vetices[vertexIndex + 0] -= offset; |
|
||||
vetices[vertexIndex + 1] -= offset; |
|
||||
vetices[vertexIndex + 2] -= offset; |
|
||||
vetices[vertexIndex + 3] -= offset; |
|
||||
|
|
||||
var m_matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3.one * zoomScale); |
|
||||
|
|
||||
vetices[vertexIndex + 0] = m_matrix.MultiplyPoint3x4(vetices[vertexIndex + 0]); |
|
||||
vetices[vertexIndex + 1] = m_matrix.MultiplyPoint3x4(vetices[vertexIndex + 1]); |
|
||||
vetices[vertexIndex + 2] = m_matrix.MultiplyPoint3x4(vetices[vertexIndex + 2]); |
|
||||
vetices[vertexIndex + 3] = m_matrix.MultiplyPoint3x4(vetices[vertexIndex + 3]); |
|
||||
|
|
||||
vetices[vertexIndex + 0] += offset; |
|
||||
vetices[vertexIndex + 1] += offset; |
|
||||
vetices[vertexIndex + 2] += offset; |
|
||||
vetices[vertexIndex + 3] += offset; |
|
||||
|
|
||||
//改颜色
|
|
||||
Color32[] vertextColors = cardDescription.textInfo.meshInfo[materialIndex].colors32; |
|
||||
|
|
||||
vertextColors[vertexIndex + 0] = hoverColor; |
|
||||
vertextColors[vertexIndex + 1] = hoverColor; |
|
||||
vertextColors[vertexIndex + 2] = hoverColor; |
|
||||
vertextColors[vertexIndex + 3] = hoverColor; |
|
||||
|
|
||||
} |
|
||||
//同步锻造消耗文本位置
|
|
||||
// 获取鼠标在屏幕上的位置
|
|
||||
Vector3 mousePos = Input.mousePosition; |
|
||||
// 将鼠标在屏幕上的位置转换为世界空间中的位置
|
|
||||
Vector3 worldPos = Camera.main.ScreenToWorldPoint(new Vector3(mousePos.x, mousePos.y+15, 10)); |
|
||||
ForgintPointManager.Instance.forgingCostIcon.gameObject.SetActive(true); |
|
||||
ForgintPointManager.Instance.forgingCostIcon.position = worldPos; |
|
||||
//同步消耗数值
|
|
||||
int cost; |
|
||||
string linkID = linkInfo.GetLinkID(); |
|
||||
if (linkID != "color") |
|
||||
{ |
|
||||
if (ForgintPointManager.Instance.effectForgingCost.TryGetValue(linkID, out cost)) |
|
||||
{ |
|
||||
ForgintPointManager.Instance.forgingCostText.text = cost.ToString(); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
ForgintPointManager.Instance.forgingCostText.text = "-6"; |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
ForgintPointManager.Instance.forgingCostText.text = "-3"; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
//刷新文本着色器
|
|
||||
cardDescription .UpdateVertexData(TMP_VertexDataUpdateFlags.All); |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
if (selectLink != -1) |
|
||||
{ |
|
||||
ResetLink(selectLink); |
|
||||
selectLink = -1; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
public void OnPointerClick(PointerEventData eventData) |
|
||||
{ |
|
||||
linkIndex = TMP_TextUtilities.FindIntersectingLink(cardDescription, eventData.position, Camera .main ); |
|
||||
if(linkIndex !=-1) |
|
||||
{ |
|
||||
if (PlayerStatsManager.Instance.playerState.forgingPoint >= -int.Parse(ForgintPointManager.Instance.forgingCostText.text)) |
|
||||
{ |
|
||||
//扣锻造点
|
|
||||
PlayerStatsManager.Instance.EffectFunction(Name.Reward.ForgingPoint, ForgintPointManager.Instance.forgingCostText.text); |
|
||||
//执行方法
|
|
||||
TMP_LinkInfo linkInfo = cardDescription.textInfo.linkInfo[linkIndex]; |
|
||||
// Debug.Log(linkInfo.GetLinkID());
|
|
||||
// Debug.Log(linkInfo.GetLinkText());
|
|
||||
ForgintPointManager.Instance.effectSelectPlan.SetActive(true); |
|
||||
|
|
||||
|
|
||||
ForgintPointManager.Instance.newEffectCardID = ForgintPointManager.Instance.chooseCardEntity.cardId; |
|
||||
ForgintPointManager.Instance.CreatEffectForgingCardPreview(); |
|
||||
string targetString = "<link=\"" + linkInfo.GetLinkID() + "\">"; |
|
||||
Debug.Log(targetString); |
|
||||
ForgintPointManager.Instance.tagPosition = CheckTagPosition(cardDescription.text, targetString); |
|
||||
ForgintPointManager.Instance.currentLinkID = linkInfo.GetLinkID(); |
|
||||
ForgintPointManager.Instance.currentLinkText = linkInfo.GetLinkText(); |
|
||||
ForgintPointManager.Instance.currentCardOriginalData = ForgintPointManager.Instance.chooseCardEntity.cardOriginalData; |
|
||||
ForgintPointManager.Instance.SetUPCaseChoosePanel(ForgintPointManager.Instance.currentLinkID, ForgintPointManager.Instance.currentLinkText, ForgintPointManager.Instance.currentCardOriginalData, ForgintPointManager.Instance.tagPosition); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
PlayerStatsManager.Instance.EffectFunction(6, "锻造点不足"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public void OnPointerEnter(PointerEventData eventData) |
|
||||
{ |
|
||||
isHover = true; |
|
||||
//改鼠标样式
|
|
||||
Cursor.SetCursor(ForgintPointManager.Instance.curcorIcon, hotSpot, cursorMode); |
|
||||
} |
|
||||
|
|
||||
public void OnPointerExit(PointerEventData eventData) |
|
||||
{ |
|
||||
isHover = false; |
|
||||
//恢复鼠标样式
|
|
||||
ForgintPointManager.Instance.forgingCostIcon.gameObject.SetActive(false); |
|
||||
Cursor.SetCursor(null, hotSpot, cursorMode); |
|
||||
} |
|
||||
private bool IsValueInRange(float value,float minValue,float maxValue) |
|
||||
{ |
|
||||
return value >= minValue && value <= maxValue; |
|
||||
} |
|
||||
private void ResetLink(int index) |
|
||||
{ |
|
||||
TMP_LinkInfo linkInfo = cardDescription.textInfo.linkInfo[index]; |
|
||||
|
|
||||
for (int i = 0; i < linkInfo.linkTextLength; i++) |
|
||||
{ |
|
||||
int materialIndex = cardDescription.textInfo.characterInfo[linkInfo.linkTextfirstCharacterIndex + i].materialReferenceIndex; |
|
||||
int vertexIndex = cardDescription.textInfo.characterInfo[linkInfo.linkTextfirstCharacterIndex + i].vertexIndex; |
|
||||
//矩阵变换缩放
|
|
||||
Vector3[] vetices = cardDescription.textInfo.meshInfo[materialIndex].vertices; |
|
||||
|
|
||||
Vector2 charCenter = (vetices[vertexIndex + 0] + vetices[vertexIndex + 2]) / 2; |
|
||||
|
|
||||
Vector3 offset = charCenter; |
|
||||
vetices[vertexIndex + 0] -= offset; |
|
||||
vetices[vertexIndex + 1] -= offset; |
|
||||
vetices[vertexIndex + 2] -= offset; |
|
||||
vetices[vertexIndex + 3] -= offset; |
|
||||
|
|
||||
var m_matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3.one * (1/zoomScale)); |
|
||||
|
|
||||
vetices[vertexIndex + 0] = m_matrix.MultiplyPoint3x4(vetices[vertexIndex + 0]); |
|
||||
vetices[vertexIndex + 1] = m_matrix.MultiplyPoint3x4(vetices[vertexIndex + 1]); |
|
||||
vetices[vertexIndex + 2] = m_matrix.MultiplyPoint3x4(vetices[vertexIndex + 2]); |
|
||||
vetices[vertexIndex + 3] = m_matrix.MultiplyPoint3x4(vetices[vertexIndex + 3]); |
|
||||
|
|
||||
vetices[vertexIndex + 0] += offset; |
|
||||
vetices[vertexIndex + 1] += offset; |
|
||||
vetices[vertexIndex + 2] += offset; |
|
||||
vetices[vertexIndex + 3] += offset; |
|
||||
|
|
||||
//改颜色
|
|
||||
Color32[] vertextColors = cardDescription.textInfo.meshInfo[materialIndex].colors32; |
|
||||
|
|
||||
vertextColors[vertexIndex + 0] = originalColor; |
|
||||
vertextColors[vertexIndex + 1] = originalColor; |
|
||||
vertextColors[vertexIndex + 2] = originalColor; |
|
||||
vertextColors[vertexIndex + 3] = originalColor; |
|
||||
} |
|
||||
ForgintPointManager.Instance.forgingCostIcon.gameObject.SetActive(false); |
|
||||
cardDescription.UpdateVertexData(TMP_VertexDataUpdateFlags.All); |
|
||||
} |
|
||||
|
|
||||
//查找link位置
|
|
||||
public string CheckTagPosition(string targetText, string dynamicTag) |
|
||||
{ |
|
||||
// 定义目标标签
|
|
||||
string targetTag = "<link=color>"; |
|
||||
|
|
||||
// 判断动态标签是否存在
|
|
||||
if (!Regex.IsMatch(targetText, Regex.Escape(dynamicTag))) |
|
||||
{ |
|
||||
Debug.Log($"{dynamicTag} 不存在于目标字符串中"); |
|
||||
return Name.CardChangePosition .Condition; |
|
||||
} |
|
||||
|
|
||||
// 构建正则表达式,匹配动态标签和 <link=color> 的位置关系
|
|
||||
string patternDynamicBefore = $"{Regex.Escape(dynamicTag)}.*?{Regex.Escape(targetTag)}"; |
|
||||
string patternDynamicAfter = $"{Regex.Escape(targetTag)}.*?{Regex.Escape(dynamicTag)}"; |
|
||||
|
|
||||
// 检查动态标签是否在 <link=color> 之前
|
|
||||
if (Regex.IsMatch(targetText, patternDynamicBefore)) |
|
||||
{ |
|
||||
Debug.Log($"{dynamicTag} 存在于目标字符串中,并且在 {targetTag} 之前"); |
|
||||
return Name.CardChangePosition.PartOne; |
|
||||
} |
|
||||
// 检查动态标签是否在 <link=color> 之后
|
|
||||
else if (Regex.IsMatch(targetText, patternDynamicAfter)) |
|
||||
{ |
|
||||
Debug.Log($"{dynamicTag} 存在于目标字符串中,并且在 {targetTag} 之后"); |
|
||||
return Name.CardChangePosition.PartTwo; |
|
||||
} |
|
||||
// 如果动态标签存在,但位置关系无法确定
|
|
||||
else |
|
||||
{ |
|
||||
Debug.Log($"{dynamicTag} 存在于目标字符串中,但与 {targetTag} 的位置关系无法确定"); |
|
||||
return Name.CardChangePosition.Condition; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: eba5be42a4c5e114499be88b4ddf933f |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
File diff suppressed because it is too large
Loading…
Reference in new issue