推进度!
This commit is contained in:
@@ -11,7 +11,10 @@
|
||||
"GUID:6463cfac4956c284ba7542bd246502cc",
|
||||
"GUID:21b0c8d1703a94250bfac916590cea4f",
|
||||
"GUID:776d03a35f1b52c4a9aed9f56d7b4229",
|
||||
"GUID:a031cbf5ca7656a4183ccaf405b762ef"
|
||||
"GUID:a031cbf5ca7656a4183ccaf405b762ef",
|
||||
"GUID:21d1eb854b91ade49bc69a263d12bee2",
|
||||
"GUID:8f24f501fa8e1fb48a03f1d7e6d03db4",
|
||||
"GUID:d8b63aba1907145bea998dd612889d6b"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Continentis.MainGame.Card
|
||||
{
|
||||
public class IntentionCardView : CardViewBase
|
||||
{
|
||||
|
||||
public IntentionCardViewMain intentionCardMain;
|
||||
public IntentionCardViewMark intentionMark;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Continentis.MainGame.Card
|
||||
{
|
||||
public class IntentionCardViewMain : MonoBehaviour, IPointerExitHandler
|
||||
{
|
||||
public IntentionCardView intentionCardView;
|
||||
public CanvasGroup canvasGroup;
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
this.canvasGroup.alpha = 0f;
|
||||
this.canvasGroup.blocksRaycasts = false;
|
||||
intentionCardView.intentionMark.canvasGroup.alpha = 1f;
|
||||
intentionCardView.intentionMark.canvasGroup.blocksRaycasts = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f07394846ef57947aaa7d870f454c4a
|
||||
@@ -0,0 +1,29 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Continentis.MainGame.Card
|
||||
{
|
||||
public class IntentionCardViewMark : MonoBehaviour, IPointerEnterHandler
|
||||
{
|
||||
public IntentionCardView intentionCardView;
|
||||
public CanvasGroup canvasGroup;
|
||||
public Image markImage;
|
||||
public TMP_Text markText;
|
||||
|
||||
public void SetMark(Sprite sprite, string text)
|
||||
{
|
||||
markImage.sprite = sprite;
|
||||
markText.text = text;
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
intentionCardView.intentionCardMain.canvasGroup.alpha = 1f;
|
||||
intentionCardView.intentionCardMain.canvasGroup.blocksRaycasts = true;
|
||||
this.canvasGroup.alpha = 0f;
|
||||
this.canvasGroup.blocksRaycasts = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a306d710bf3fe3f4084a08c654fbcb5e
|
||||
@@ -1,7 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using SLSFramework.General;
|
||||
using UI_Spline_Renderer;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Splines;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UI.Extensions;
|
||||
|
||||
|
||||
namespace Continentis.MainGame.UI
|
||||
{
|
||||
@@ -11,17 +15,18 @@ namespace Continentis.MainGame.UI
|
||||
public RectTransform startPoint;
|
||||
|
||||
[Tooltip("箭头线条")]
|
||||
public UILineRenderer arrowBody;
|
||||
|
||||
[Tooltip("箭头头部的RectTransform")]
|
||||
public Image endPoint;
|
||||
public SplineContainer splineContainer;
|
||||
public UISplineRenderer arrowBody;
|
||||
|
||||
[Tooltip("箭头头部的图片")]
|
||||
public Image endImage;
|
||||
|
||||
[Header("曲线设置")]
|
||||
[Tooltip("曲线的弯曲程度,数值越大越弯曲")]
|
||||
public float curveOffset = 150f;
|
||||
|
||||
[Tooltip("曲线的平滑度,点越多越平滑,性能开销也越大")]
|
||||
[Range(20, 100)]
|
||||
[Range(1, 100)]
|
||||
public int lineSegments = 50;
|
||||
|
||||
public void SetArrow(Vector3 start, Vector3 end)
|
||||
@@ -42,31 +47,26 @@ namespace Continentis.MainGame.UI
|
||||
Vector2 direction = (uiEnd - uiStart).normalized;
|
||||
Vector2 perpendicular = new Vector2(-direction.y, direction.x); // 计算垂直向量
|
||||
Vector2 controlPoint = midPoint + perpendicular * (isEndOnLeftSide ? -curveOffset : curveOffset);
|
||||
|
||||
splineContainer.Spline.Clear();
|
||||
|
||||
// 2. 计算贝塞尔曲线上所有的点
|
||||
Vector2[] points = new Vector2[lineSegments];
|
||||
List<BezierKnot> knots = new List<BezierKnot>();
|
||||
for (int i = 0; i < lineSegments; i++)
|
||||
{
|
||||
float t = (float)i / (lineSegments - 1);
|
||||
// 二次贝塞尔曲线公式: B(t) = (1-t)² * P₀ + 2(1-t)t * P₁ + t² * P₂
|
||||
points[i] = Mathf.Pow(1 - t, 2) * uiStart +
|
||||
2 * (1 - t) * t * controlPoint +
|
||||
Mathf.Pow(t, 2) * uiEnd;
|
||||
float3 point = math.pow(1 - t, 2) * new float3(uiStart.x, uiStart.y, 0) +
|
||||
2 * (1 - t) * t * new float3(controlPoint.x, controlPoint.y, 0) +
|
||||
math.pow(t, 2) * new float3(uiEnd.x, uiEnd.y, 0);
|
||||
knots.Add(new BezierKnot(point));
|
||||
}
|
||||
|
||||
arrowBody.Points = points;
|
||||
splineContainer.Spline.Knots = knots;
|
||||
arrowBody.SetAllDirty(); // 通知UI系统重绘
|
||||
|
||||
|
||||
endPoint.rectTransform.localPosition = uiEnd;
|
||||
Vector2 headDirection = (uiEnd - points[lineSegments - 2]).normalized;
|
||||
float angle = Vector2.SignedAngle(Vector2.up, headDirection);
|
||||
endPoint.rectTransform.localRotation = Quaternion.Euler(0, 0, angle);
|
||||
}
|
||||
|
||||
public void SetColor(Color color)
|
||||
{
|
||||
endPoint.color = color;
|
||||
endImage.color = color;
|
||||
arrowBody.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Continentis.MainGame.Card;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
@@ -8,12 +9,13 @@ namespace Continentis.MainGame.UI
|
||||
public class PileBase : UIElementBase
|
||||
{
|
||||
public List<CardViewBase> cardViews;
|
||||
public TMP_Text cardCountText;
|
||||
|
||||
public virtual void AddCard(CardViewBase cardObject)
|
||||
{
|
||||
cardViews.Add(cardObject);
|
||||
cardObject.transform.SetParent(rectTransform);
|
||||
|
||||
UpdateCountText();
|
||||
}
|
||||
|
||||
public virtual void InsertCard(CardViewBase cardObject, int index)
|
||||
@@ -21,12 +23,22 @@ namespace Continentis.MainGame.UI
|
||||
cardViews.Insert(index, cardObject);
|
||||
cardObject.transform.SetParent(rectTransform);
|
||||
cardObject.transform.SetSiblingIndex(index);
|
||||
UpdateCountText();
|
||||
}
|
||||
|
||||
public virtual void RemoveCard(CardViewBase cardObject)
|
||||
{
|
||||
cardViews.Remove(cardObject);
|
||||
UpdateCountText();
|
||||
//Debug.Log($"Removed {cardObject.cardInstance.cardLogic.contentSubmodule.cardName} from {this.name}" );
|
||||
}
|
||||
|
||||
private void UpdateCountText()
|
||||
{
|
||||
if (cardCountText != null)
|
||||
{
|
||||
cardCountText.text = cardViews.Count.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace Continentis.Menu
|
||||
enterGameButton.onClick.AddListener(EnterGame);
|
||||
enterGameButton.interactable = true;
|
||||
//Set Language to Simplified Chinese
|
||||
languageToSet = "Simplified Chinese";
|
||||
if(string.IsNullOrEmpty(languageToSet)) languageToSet = "Simplified Chinese";
|
||||
LocalizationManager.CurrentLanguage = languageToSet;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ MonoBehaviour:
|
||||
data:
|
||||
guid: f6633c3e-9e6c-41dd-8828-09e7562ff730
|
||||
position: {x: 746, y: 302}
|
||||
characterData: {fileID: 11400000, guid: fd38f8d56d51bce4cba0715d468b6333, type: 2}
|
||||
storyCharacterData: {fileID: 11400000, guid: fd38f8d56d51bce4cba0715d468b6333, type: 2}
|
||||
expressionKey: Default
|
||||
characterPosition: {x: 0, y: 0}
|
||||
dialogueText:
|
||||
@@ -118,7 +118,7 @@ MonoBehaviour:
|
||||
data:
|
||||
guid: 97bc6a1e-55aa-4a81-9bf1-99cd70ea8247
|
||||
position: {x: 1563.3334, y: 186}
|
||||
characterData: {fileID: 0}
|
||||
storyCharacterData: {fileID: 0}
|
||||
expressionKey:
|
||||
characterPosition: {x: 0, y: 0}
|
||||
dialogueText:
|
||||
|
||||
Reference in New Issue
Block a user