12.10 进度 基本完成
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SLSFramework.General;
|
||||
using UI_Spline_Renderer;
|
||||
@@ -29,6 +30,11 @@ namespace Continentis.MainGame.UI
|
||||
[Range(1, 100)]
|
||||
public int lineSegments = 50;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
GetComponent<Canvas>().sortingLayerName = "UI";
|
||||
}
|
||||
|
||||
public void SetArrow(Vector3 start, Vector3 end)
|
||||
{
|
||||
startPoint.position = start;
|
||||
@@ -47,6 +53,8 @@ namespace Continentis.MainGame.UI
|
||||
Vector2 direction = (uiEnd - uiStart).normalized;
|
||||
Vector2 perpendicular = new Vector2(-direction.y, direction.x); // 计算垂直向量
|
||||
Vector2 controlPoint = midPoint + perpendicular * (isEndOnLeftSide ? -curveOffset : curveOffset);
|
||||
controlPoint += new Vector2(0, Mathf.Abs(uiEnd.y - uiStart.y)); //增加一些垂直偏移
|
||||
//controlPoint += new Vector2(0f, 500f);
|
||||
splineContainer.Spline.Clear();
|
||||
|
||||
// 2. 计算贝塞尔曲线上所有的点
|
||||
@@ -66,8 +74,21 @@ namespace Continentis.MainGame.UI
|
||||
|
||||
public void SetColor(Color color)
|
||||
{
|
||||
endImage.color = color;
|
||||
arrowBody.color = color;
|
||||
if (color == Color.clear)
|
||||
{
|
||||
endImage.material.SetFloat("_SineGlowFade", 0);
|
||||
arrowBody.material.SetFloat("_SineGlowFade", 0);
|
||||
endImage.material.SetColor("_SineGlowColor", Color.white);
|
||||
arrowBody.material.SetColor("_SineGlowColor", Color.white);
|
||||
}
|
||||
else
|
||||
{
|
||||
float emissionIntensity = 1.5f;
|
||||
endImage.material.SetFloat("_SineGlowFade", 1);
|
||||
arrowBody.material.SetFloat("_SineGlowFade", 1);
|
||||
endImage.material.SetColor("_SineGlowColor", color * Mathf.Pow(2, emissionIntensity));
|
||||
arrowBody.material.SetColor("_SineGlowColor", color * Mathf.Pow(2, emissionIntensity));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user