Archived
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dae34edce5 | ||
|
|
45944e4539 | ||
|
|
88200ef82b | ||
|
|
6af5616e50 | ||
|
|
d938aa9929 | ||
|
|
c11f07aa19 |
@@ -1,229 +1,42 @@
|
||||
# Package Starter Kit
|
||||
# UIGraphRenderer
|
||||
|
||||
The purpose of this starter kit is to provide the data structure and development guidelines for new packages meant for the **Unity Package Manager (UPM)**.
|
||||
Unity UI 图形渲染插件,提供在 Canvas 上直接绘制线条、多边形和自定义图形的组件。
|
||||
|
||||
## Are you ready to become a package?
|
||||
The Package Manager is a work in progress for Unity. Because of that, your package needs to meet these criteria to become an official Unity package:
|
||||
- **Your code accesses public Unity C# APIs only.**
|
||||
- **Your code doesn't require security, obfuscation, or conditional access control.**
|
||||
## 功能组件
|
||||
|
||||
### UILineRenderer
|
||||
UI 线条渲染组件,在指定的顶点之间绘制连线。支持:
|
||||
- 线条厚度、居中显示、循环线路
|
||||
- 两种渲染模式:DSL5(简易直线)和 CFAL(圆弧转角)
|
||||
- 倒角设置(细分数量、内圆弧半径)
|
||||
- 线段上绘制矢量箭头
|
||||
- 顶点自动合并
|
||||
|
||||
## Package structure
|
||||
### UIPatternRenderer
|
||||
UI 正多边形渲染组件(三角形到三十二边形),支持:
|
||||
- 填充颜色和边框颜色(含双色渐变)
|
||||
- 边框厚度控制
|
||||
- 圆角/倒角(贝塞尔曲线平滑)
|
||||
- 起始角度自定义
|
||||
|
||||
```none
|
||||
<root>
|
||||
├── package.json
|
||||
├── README.md
|
||||
├── CHANGELOG.md
|
||||
├── Third Party Notices.md
|
||||
├── Editor
|
||||
│ ├── Lrss3.Uilinerenderer.Editor.asmdef
|
||||
│ └── EditorExample.cs
|
||||
├── Runtime
|
||||
│ ├── Lrss3.Uilinerenderer.asmdef
|
||||
│ └── RuntimeExample.cs
|
||||
├── Tests
|
||||
│ ├── .tests.json
|
||||
│ ├── Editor
|
||||
│ │ ├── Lrss3.Uilinerenderer.Editor.Tests.asmdef
|
||||
│ │ └── EditorExampleTest.cs
|
||||
│ └── Runtime
|
||||
│ ├── Lrss3.Uilinerenderer.Tests.asmdef
|
||||
│ └── RuntimeExampleTest.cs
|
||||
├── Samples
|
||||
│ └── Example
|
||||
│ ├── .sample.json
|
||||
│ └── SampleExample.cs
|
||||
└── Documentation
|
||||
├── UILineRenderer.md
|
||||
└── Images
|
||||
```
|
||||
### UIAnyPatternRenderer
|
||||
任意图形渲染组件,通过顶点列表定义自定义形状。支持:
|
||||
- 多图形分组,每组可独立设置填充/描边
|
||||
- 距离场计算(简单中心、中轴变换、网格采样三种模式)
|
||||
- 顶点辅助标记和中轴线可视化(调试用)
|
||||
|
||||
## Develop your package
|
||||
Package development works best within the Unity Editor. Here's how to get started:
|
||||
## 基础架构
|
||||
|
||||
1. Enter your package name. The name you choose should contain your default organization followed by the name you typed. For example: `Lrss3.Uilinerenderer`.
|
||||
- **XericRendererComponent**:所有渲染组件的基类,提供顶点阵列功能(支持平移、旋转、缩放和颜色批量复制)
|
||||
- **XericRendererUtils**:静态工具类,提供数学计算、UV 计算、线段生成等辅助方法
|
||||
|
||||
2. [Enter the information](#FillOutFields) for your package in the `package.json` file.
|
||||
## 着色器
|
||||
|
||||
3. [Rename and update](#Asmdef) assembly definition files.
|
||||
- `XericLibrary/UILine/UILineRender` — 线条渲染着色器
|
||||
- `XericLibrary/UILine/UIPattern` — 多边形渲染着色器(含边框厚度和颜色渐变支持)
|
||||
|
||||
4. [Document](#Doc) your package.
|
||||
## 使用方式
|
||||
|
||||
5. [Add samples](#Populate) to your package (code & assets).
|
||||
|
||||
6. [Validate](#Valid) your package.
|
||||
|
||||
7. [Add tests](#Tests) to your package.
|
||||
|
||||
8. Update the `CHANGELOG.md` file.
|
||||
|
||||
Every new feature or bug fix should have a trace in this file. For more details on the chosen changelog format, see [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
9. Make sure your package [meets all legal requirements](#Legal).
|
||||
|
||||
10. Publish your package.
|
||||
|
||||
|
||||
|
||||
<a name="FillOutFields"></a>
|
||||
### Completing the package manifest
|
||||
|
||||
You can either modify the package manifest (`package.json`) file directly in the Inspector or by using an external editor.
|
||||
|
||||
To use the Inspector, select the `package.json` file in the Project browser. The **Package UILineRenderer Manifest** page opens for editing.
|
||||
|
||||
Update these required attributes in the `package.json` file:
|
||||
|
||||
| **Attribute name:** | **Description:** |
|
||||
| ------------------- | ------------------------------------------------------------ |
|
||||
| **name** | The officially registered package name. This name must conform to the [Unity Package Manager naming convention](https://docs.unity3d.com/Manual/upm-manifestPkg.html#name), which uses reverse domain name notation. For example: <br />`"com.[YourCompanyName].[your-package-name]"` |
|
||||
| **displayName** | A user-friendly name to appear in the Unity Editor (for example, in the Project Browser, the Package Manager window, etc.). For example: <br />`"Terrain Builder SDK"` <br/>__NOTE:__ Use a display name that will help users understand what your package is intended for. |
|
||||
| **version** | The package version number (**'MAJOR.MINOR.PATCH"**). This value must respect [semantic versioning](http://semver.org/). For more information, see [Package version](https://docs.unity3d.com/Manual/upm-manifestPkg.html#pkg-ver) in the Unity User Manual. |
|
||||
| **unity** | The lowest Unity version the package is compatible with. If omitted, the package is considered compatible with all Unity versions. <br /><br />The expected format is "**<MAJOR>.<MINOR>**" (for example, **2018.3**). |
|
||||
| **description** | A brief description of the package. This is the text that appears in the [details view](upm-ui-details) of the Packages window. Any [UTF-8](https://en.wikipedia.org/wiki/UTF-8) character code is supported. This means that you can use special formatting character codes, such as line breaks (**\n**) and bullets (**\u25AA**). |
|
||||
|
||||
Update the following recommended fields in file **package.json**:
|
||||
|
||||
| **Attribute name:** | **Description:** |
|
||||
| ------------------- | ------------------------------------------------------------ |
|
||||
| **dependencies** | A map of package dependencies. Keys are package names, and values are specific versions. They indicate other packages that this package depends on. For more information, see [Dependencies](https://docs.unity3d.com/Manual/upm-dependencies.html) in the Unity User Manual.<br /><br />**NOTE**: The Package Manager does not support range syntax, only **SemVer** versions. |
|
||||
| **keywords** | An array of keywords used by the Package Manager search APIs. This helps users find relevant packages. |
|
||||
|
||||
|
||||
|
||||
<a name="Asmdef"></a>
|
||||
### Updating the Assembly Definition files
|
||||
|
||||
You must associate scripts inside a package to an assembly definition file (.asmdef). Assembly definition files are the Unity equivalent to a C# project in the .NET ecosystem. You must set explicit references in the assembly definition file to other assemblies (whether in the same package or in external packages). See [Assembly Definitions](https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html) for more details.
|
||||
|
||||
Use these conventions for naming and storing your assembly definition files to ensure that the compiled assembly filenames follow the [.NET Framework Design Guidelines](https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/):
|
||||
|
||||
* Store Editor-specific code under a root editor assembly definition file:
|
||||
|
||||
`Editor/Lrss3.Uilinerenderer.Editor.asmdef`
|
||||
|
||||
* Store runtime-specific code under a root runtime assembly definition file:
|
||||
|
||||
`Runtime/Lrss3.Uilinerenderer.asmdef`
|
||||
|
||||
* Configure related test assemblies for your editor and runtime scripts:
|
||||
|
||||
`Tests/Editor/Lrss3.Uilinerenderer.Editor.Tests.asmdef`
|
||||
|
||||
`Tests/Runtime/Lrss3.Uilinerenderer.Tests.asmdef`
|
||||
|
||||
To get a more general view of a recommended package folder layout, see [Package layout](https://docs.unity3d.com/Manual/cus-layout.html).
|
||||
|
||||
|
||||
|
||||
<a name="Doc"></a>
|
||||
### Providing documentation
|
||||
|
||||
Use the `Documentations~/UILineRenderer.md` documentation file to create preliminary, high-level documentation. This document should introduce users to the features and sample files included in your package. Your package documentation files will be used to generate online and local docs, available from the Package Manager UI.
|
||||
|
||||
**Document your public APIs**
|
||||
* All public APIs need to be documented with **XmlDoc**.
|
||||
* API documentation is generated from [XmlDoc tags](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/xml-documentation-comments) included with all public APIs found in the package. See [Editor/EditorExample.cs](Editor/EditorExample.cs) for an example.
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="Populate"></a>
|
||||
### Adding Assets to your package
|
||||
|
||||
If your package contains a sample, rename the `Samples/Example` folder, and update the `.sample.json` file in it.
|
||||
|
||||
In the case where your package contains multiple samples, you can make a copy of the `Samples/Example` folder for each sample, and update the `.sample.json` file accordingly.
|
||||
|
||||
Similar to `.tests.json` file, there is a `"createSeparatePackage"` field in `.sample.json`. If set to true, the CI will create a separate package for the sample.
|
||||
|
||||
Delete the `Samples` folder altogether if your package does not need samples.
|
||||
|
||||
As of Unity release 2019.1, the Package Manager recognizes the `/Samples` directory in a package. Unity doesn't automatically import samples when a user adds the package to a Project. However, users can click a button in the details view of a package in the **Packages** window to optionally import samples into their `/Assets` directory.
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="Valid"></a>
|
||||
### Validating your package
|
||||
|
||||
Before you publish your package, you need to make sure that it passes all the necessary validation checks by using the Package Validation Suite extension (optional).
|
||||
|
||||
Once you install the Validation Suite package, a **Validate** button appears in the details view of a package in the **Packages** window. To install the extension, follow these steps:
|
||||
|
||||
1. Point your Project manifest to a staging registry by adding this line to the manifest:
|
||||
`"registry": "https://staging-packages.unity.com"`
|
||||
2. Install the **Package Validation Suite v0.3.0-preview.13** or above from the **Packages** window in Unity. Make sure the package scope is set to **All Packages**, and select **Show preview packages** from the **Advanced** menu.
|
||||
3. After installation, a **Validate** button appears in the **Packages** window. Click the button to run a series of tests, then click the **See Results** button for additional information:
|
||||
* If it succeeds, a green bar with a **Success** message appears.
|
||||
* If it fails, a red bar with a **Failed** message appears.
|
||||
|
||||
**NOTE:** The validation suite is still in preview.
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="Tests"></a>
|
||||
### Adding tests to your package
|
||||
|
||||
All packages must contain tests. Tests are essential for Unity to ensure that the package works as expected in different scenarios.
|
||||
|
||||
**Editor tests**
|
||||
* Write all your Editor Tests in `Tests/Editor`
|
||||
|
||||
**Playmode Tests**
|
||||
|
||||
* Write all your Playmode Tests in `Tests/Runtime`.
|
||||
|
||||
#### Separating the tests from the package
|
||||
|
||||
You can create a separate package for the tests, which allows you to exclude a large number of tests and Assets from being published in your main package, while still making it easy to test it.
|
||||
|
||||
Open the `Tests/.tests.json` file and set the **createSeparatePackage** attribute:
|
||||
|
||||
| **Value to set:** | **Result:** |
|
||||
| ----------------- | ------------------------------------------------------------ |
|
||||
| **true** | CI creates a separate package for these tests. At publish time, the Package Manager adds metadata to link the packages together. |
|
||||
| **false** | Keep the tests as part of the published package. |
|
||||
|
||||
|
||||
|
||||
<a name="Legal"></a>
|
||||
### Meeting the legal requirements
|
||||
|
||||
You can use the Third Party Notices.md file to make sure your package meets any legal requirements. For example, here is a sample license file from the Unity Timeline package:
|
||||
|
||||
```
|
||||
Unity Timeline copyright © 2017-2019 Unity Technologies ApS
|
||||
|
||||
Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License).
|
||||
|
||||
Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions.
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Third Party Notices
|
||||
|
||||
If your package has third-party elements, you can include the licenses in a Third Party Notices.md file. You can include a **Component Name**, **License Type**, and **Provide License Details** section for each license you want to include. For example:
|
||||
|
||||
```
|
||||
This package contains third-party software components governed by the license(s) indicated below:
|
||||
|
||||
Component Name: Semver
|
||||
|
||||
License Type: "MIT"
|
||||
|
||||
[SemVer License](https://github.com/myusername/semver/blob/master/License.txt)
|
||||
|
||||
Component Name: MyComponent
|
||||
|
||||
License Type: "MyLicense"
|
||||
|
||||
[MyComponent License](https://www.mycompany.com/licenses/License.txt)
|
||||
|
||||
```
|
||||
|
||||
**NOTE**: Any URLs you use should point to a location that contains the reproduced license and the copyright information (if applicable).
|
||||
1. 通过菜单 `GameObject/Xeric Library/UI/` 创建对应组件
|
||||
2. 或手动将组件添加到带有 `CanvasRenderer` 的 UI 对象上
|
||||
3. 通过 Inspector 或代码配置顶点、颜色、线条厚度等参数
|
||||
|
||||
@@ -1,221 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XericLibrary.Runtime.UIGraph
|
||||
{
|
||||
public static class TriangulateHelp
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 添加填充多边形
|
||||
/// </summary>
|
||||
public static void AddFilledPolygon(VertexHelper vh, List<Vector2> vertices, List<int> triangles, Color color)
|
||||
{
|
||||
int vertexStartIndex = vh.currentVertCount;
|
||||
|
||||
// 添加顶点
|
||||
foreach (var vertex in vertices)
|
||||
{
|
||||
vh.AddVert(vertex, color, Vector2.zero);
|
||||
}
|
||||
|
||||
// 添加三角形索引
|
||||
for (int i = 0; i < triangles.Count; i += 3)
|
||||
{
|
||||
vh.AddTriangle(
|
||||
vertexStartIndex + triangles[i],
|
||||
vertexStartIndex + triangles[i + 1],
|
||||
vertexStartIndex + triangles[i + 2]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加描边
|
||||
/// </summary>
|
||||
public static void AddStroke(VertexHelper vh, List<Vector2> vertices, float width, Color color)
|
||||
{
|
||||
if (vertices.Count < 2)
|
||||
return;
|
||||
|
||||
float halfWidth = width * 0.5f;
|
||||
|
||||
// 为每条边生成两个三角形(形成矩形)
|
||||
for (int i = 0; i < vertices.Count; i++)
|
||||
{
|
||||
int next = (i + 1) % vertices.Count;
|
||||
|
||||
Vector2 p1 = vertices[i];
|
||||
Vector2 p2 = vertices[next];
|
||||
|
||||
// 计算边的法线
|
||||
Vector2 edge = p2 - p1;
|
||||
Vector2 normal = new Vector2(-edge.y, edge.x).normalized;
|
||||
|
||||
// 生成四个顶点(矩形)
|
||||
Vector2 v1 = p1 + normal * halfWidth;
|
||||
Vector2 v2 = p1 - normal * halfWidth;
|
||||
Vector2 v3 = p2 - normal * halfWidth;
|
||||
Vector2 v4 = p2 + normal * halfWidth;
|
||||
|
||||
int startIndex = vh.currentVertCount;
|
||||
|
||||
vh.AddVert(v1, color, Vector2.zero);
|
||||
vh.AddVert(v2, color, Vector2.zero);
|
||||
vh.AddVert(v3, color, Vector2.zero);
|
||||
vh.AddVert(v4, color, Vector2.zero);
|
||||
|
||||
// 两个三角形
|
||||
vh.AddTriangle(startIndex, startIndex + 1, startIndex + 2);
|
||||
vh.AddTriangle(startIndex, startIndex + 2, startIndex + 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 耳切法三角剖分
|
||||
/// </summary>
|
||||
public static List<int> TriangulatePolygon(List<Vector2> polygonVertices)
|
||||
{
|
||||
List<int> triangles = new List<int>();
|
||||
|
||||
if (polygonVertices == null || polygonVertices.Count < 3)
|
||||
return triangles;
|
||||
|
||||
// 复制顶点列表以便修改
|
||||
List<Vector2> verticesCopy = new List<Vector2>(polygonVertices);
|
||||
List<int> indices = Enumerable.Range(0, verticesCopy.Count).ToList();
|
||||
|
||||
// 确保顶点顺序是逆时针(耳切法要求)
|
||||
if (!IsCounterClockwise(verticesCopy))
|
||||
{
|
||||
verticesCopy.Reverse();
|
||||
indices.Reverse();
|
||||
}
|
||||
|
||||
int n = verticesCopy.Count;
|
||||
|
||||
// 当顶点数大于3时继续切耳朵
|
||||
while (n > 3)
|
||||
{
|
||||
bool foundEar = false;
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
int prev = (i - 1 + n) % n;
|
||||
int curr = i;
|
||||
int next = (i + 1) % n;
|
||||
|
||||
// 检查是否是耳朵
|
||||
if (IsEar(verticesCopy, prev, curr, next, n))
|
||||
{
|
||||
// 添加三角形
|
||||
triangles.Add(indices[prev]);
|
||||
triangles.Add(indices[curr]);
|
||||
triangles.Add(indices[next]);
|
||||
|
||||
// 移除耳朵顶点
|
||||
verticesCopy.RemoveAt(curr);
|
||||
indices.RemoveAt(curr);
|
||||
n--;
|
||||
foundEar = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有找到耳朵,可能是复杂多边形,退出
|
||||
if (!foundEar)
|
||||
{
|
||||
Debug.LogWarning("无法完成三角剖分,可能是自相交多边形");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加最后一个三角形
|
||||
if (n == 3)
|
||||
{
|
||||
triangles.Add(indices[0]);
|
||||
triangles.Add(indices[1]);
|
||||
triangles.Add(indices[2]);
|
||||
}
|
||||
|
||||
return triangles;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查顶点顺序是否为逆时针
|
||||
/// </summary>
|
||||
public static bool IsCounterClockwise(List<Vector2> vertices)
|
||||
{
|
||||
float sum = 0;
|
||||
int n = vertices.Count;
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
Vector2 v1 = vertices[i];
|
||||
Vector2 v2 = vertices[(i + 1) % n];
|
||||
sum += (v2.x - v1.x) * (v2.y + v1.y);
|
||||
}
|
||||
|
||||
return sum < 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// 检查三个顶点是否构成耳朵
|
||||
/// </summary>
|
||||
public static bool IsEar(List<Vector2> vertices, int prev, int curr, int next, int n)
|
||||
{
|
||||
Vector2 a = vertices[prev];
|
||||
Vector2 b = vertices[curr];
|
||||
Vector2 c = vertices[next];
|
||||
|
||||
// 检查是否是凸角
|
||||
if (!IsConvex(a, b, c))
|
||||
return false;
|
||||
|
||||
// 检查三角形内部是否包含其他顶点
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (i == prev || i == curr || i == next)
|
||||
continue;
|
||||
|
||||
if (PointInTriangle(vertices[i], a, b, c))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查点是否在三角形内部
|
||||
/// </summary>
|
||||
public static bool PointInTriangle(Vector2 p, Vector2 a, Vector2 b, Vector2 c)
|
||||
{
|
||||
float area = Mathf.Abs(CrossProduct(a, b, c));
|
||||
float area1 = Mathf.Abs(CrossProduct(p, a, b));
|
||||
float area2 = Mathf.Abs(CrossProduct(p, b, c));
|
||||
float area3 = Mathf.Abs(CrossProduct(p, c, a));
|
||||
|
||||
return Mathf.Abs(area - (area1 + area2 + area3)) < 0.001f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查三点是否构成凸角(逆时针)
|
||||
/// </summary>
|
||||
public static bool IsConvex(Vector2 a, Vector2 b, Vector2 c)
|
||||
{
|
||||
return CrossProduct(a, b, c) > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算叉积
|
||||
/// </summary>
|
||||
public static float CrossProduct(Vector2 a, Vector2 b, Vector2 c)
|
||||
{
|
||||
return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45ff8ace448e4691b1db19cb52906ddd
|
||||
timeCreated: 1775549185
|
||||
+243
-118
@@ -13,7 +13,7 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
internal static class XericRendererUtils
|
||||
{
|
||||
#region 数学计算
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 计算线路的总长度
|
||||
/// </summary>
|
||||
@@ -54,7 +54,8 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
/// <param name="center">是否要居中显示</param>
|
||||
/// <param name="rectSize">整个绘制矩形范围的尺寸</param>
|
||||
/// <returns></returns>
|
||||
public static Vector2 SwitchCenterOffset(bool center, Vector2 rectSize) => center ? Vector2.zero : -(rectSize / 2);
|
||||
public static Vector2 SwitchCenterOffset(bool center, Vector2 rectSize) =>
|
||||
center ? Vector2.zero : -(rectSize / 2);
|
||||
|
||||
/// <summary>
|
||||
/// 获取两个点之间的法线,副法线
|
||||
@@ -65,19 +66,21 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
/// <param name="distance">两点间距离</param>
|
||||
/// <param name="normal">起点到终点的法线</param>
|
||||
/// <param name="subTangent">垂直与起点到终点的法线(法线左转90)</param>
|
||||
/// <param name="reverseVector">反转矢量</param>
|
||||
/// <returns></returns>
|
||||
private static bool GetNormalizedVector(Vector2 startPoint, Vector2 endPoint,
|
||||
out Vector2 vector, out float distance, out Vector2 normal, out Vector2 subTangent)
|
||||
private static bool GetNormalizedVector(Vector2 startPoint, Vector2 endPoint,
|
||||
out Vector2 vector, out float distance, out Vector2 normal, out Vector2 subTangent,
|
||||
bool reverseVector = false)
|
||||
{
|
||||
vector = endPoint - startPoint;
|
||||
vector = reverseVector ? startPoint - endPoint : endPoint - startPoint;
|
||||
distance = vector.magnitude;
|
||||
normal = Vector2.zero;
|
||||
subTangent = Vector2.zero;
|
||||
|
||||
|
||||
// 距离过小时不绘制
|
||||
if (distance <= float.Epsilon)
|
||||
return false;
|
||||
|
||||
|
||||
// 线段的法线和副法线
|
||||
normal = vector / distance;
|
||||
subTangent = Vector2.Perpendicular(normal);
|
||||
@@ -96,19 +99,20 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
/// <param name="totalLength">总线路的长度</param>
|
||||
/// <param name="startUVY">起点处的uv y</param>
|
||||
/// <param name="endUVY">终点处的uv y</param>
|
||||
private static void GetCurrentLengthUVY(float startLength, float currentLength, float totalLength, out float startUVY, out float endUVY)
|
||||
private static void GetCurrentLengthUVY(float startLength, float currentLength, float totalLength,
|
||||
out float startUVY, out float endUVY)
|
||||
{
|
||||
startUVY = totalLength > 0 ? startLength / totalLength : 0f;
|
||||
endUVY = totalLength > 0 ? (startLength + currentLength) / totalLength : 0f;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 简易线路绘制
|
||||
|
||||
|
||||
// 在点与点之间绘制给定宽度(thickness)的方片,转角处用两个三角形链接
|
||||
// 这样会造成一根线会出现5个顶点,所以叫做 DSL5 (直接简单的5点直线 directly simple line 5)
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建线段的顶点数据
|
||||
/// 每个线段由 5 个顶点组成:
|
||||
@@ -124,8 +128,10 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
/// <param name="color">线条的颜色</param>
|
||||
/// <param name="startLength">当前线段起点在线路中的累积长度</param>
|
||||
/// <param name="totalLength">线路的总长度</param>
|
||||
public static List<UIVertex> GetSingleLineSegmentVerts_DSL5(List<UIVertex> vertices, Vector2 startPoint, Vector2 endPoint,
|
||||
float thickness, Color color, float startLength, out float distance, float totalLength, Vector3 offset)
|
||||
public static List<UIVertex> GetSingleLineSegmentVerts_DSL5(List<UIVertex> vertices, Vector2 startPoint,
|
||||
Vector2 endPoint,
|
||||
float thickness, Color color, Vector2 normal, Vector2 subTangent, float startUVY, float endUVY,
|
||||
Vector3 offset)
|
||||
{
|
||||
if (vertices == null)
|
||||
throw new Exception("没有指定线段片段顶点容器列表");
|
||||
@@ -134,35 +140,29 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
UIVertex vertex = UIVertex.simpleVert;
|
||||
vertex.color = color;
|
||||
|
||||
if (!GetNormalizedVector(startPoint, endPoint,
|
||||
out var vector, out distance, out var normal, out var subTangent))
|
||||
return vertices;
|
||||
|
||||
// 线段单侧宽度
|
||||
var width = thickness / 2;
|
||||
|
||||
GetCurrentLengthUVY(startLength, distance, totalLength, out var startUVY, out var endUVY);
|
||||
|
||||
vertex.position = (startPoint +
|
||||
subTangent * width);
|
||||
|
||||
vertex.position = (startPoint +
|
||||
subTangent * width);
|
||||
vertex.position += offset;
|
||||
vertex.uv0 = new Vector2(0f, startUVY); // 左侧顶点的UV
|
||||
vertices.Add(vertex);
|
||||
|
||||
vertex.position = (startPoint +
|
||||
subTangent * -width);
|
||||
|
||||
vertex.position = (startPoint +
|
||||
subTangent * -width);
|
||||
vertex.position += offset;
|
||||
vertex.uv0 = new Vector2(1f, startUVY); // 右侧顶点的UV
|
||||
vertices.Add(vertex);
|
||||
|
||||
vertex.position = (endPoint +
|
||||
subTangent * width);
|
||||
vertex.position = (endPoint +
|
||||
subTangent * width);
|
||||
vertex.position += offset;
|
||||
vertex.uv0 = new Vector2(0f, endUVY); // 左侧顶点的UV
|
||||
vertices.Add(vertex);
|
||||
|
||||
vertex.position = (endPoint +
|
||||
subTangent * -width);
|
||||
|
||||
vertex.position = (endPoint +
|
||||
subTangent * -width);
|
||||
vertex.position += offset;
|
||||
vertex.uv0 = new Vector2(1f, endUVY); // 右侧顶点的UV
|
||||
vertices.Add(vertex);
|
||||
@@ -181,25 +181,26 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
/// <param name="vh">构建网格对象</param>
|
||||
/// <param name="segmentPartIndex">该线路片段索引(比如第一段线应该是0)</param>
|
||||
/// <param name="verts">该片段顶点</param>
|
||||
public static void AddSingleLineSegmentVertsAndTriangle_DSL5(this VertexHelper vh, int segmentPartIndex, IEnumerable<UIVertex> verts)
|
||||
public static void AddSingleLineSegmentVertsAndTriangle_DSL5(this VertexHelper vh, int segmentPartIndex,
|
||||
IEnumerable<UIVertex> verts)
|
||||
{
|
||||
foreach (var vert in verts)
|
||||
vh.AddVert(vert);
|
||||
int index = segmentPartIndex * 5;
|
||||
|
||||
|
||||
// 添加线段的两个三角形(构成矩形线段)
|
||||
vh.AddTriangle(index, index+1, index+3);
|
||||
vh.AddTriangle(index+3, index+2, index);
|
||||
|
||||
vh.AddTriangle(index, index + 1, index + 3);
|
||||
vh.AddTriangle(index + 3, index + 2, index);
|
||||
|
||||
// 为线段之间添加斜角边缘
|
||||
// 使用上一个线段的终点和当前线段的起点创建过渡三角形
|
||||
if (segmentPartIndex != 0)
|
||||
{
|
||||
vh.AddTriangle(index, index-1, index-3);
|
||||
vh.AddTriangle(index+1, index-1, index-2);
|
||||
vh.AddTriangle(index, index - 1, index - 3);
|
||||
vh.AddTriangle(index + 1, index - 1, index - 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 推送顶点绘制线路
|
||||
/// </summary>
|
||||
@@ -207,56 +208,94 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
/// <param name="points"></param>
|
||||
/// <param name="thickness"></param>
|
||||
/// <param name="cycleLoop"></param>
|
||||
/// <param name="color"></param>
|
||||
/// <param name="lineColor"></param>
|
||||
/// <param name="offset"></param>
|
||||
public static void PopulateLineByPointsArray_DSL5(this VertexHelper vh, Vector2[] points, float thickness, bool cycleLoop, Color color, Vector3 offset)
|
||||
/// <param name="enableArrow"></param>
|
||||
/// <param name="arrowColor"></param>
|
||||
/// <param name="arrowSize">宽x长y</param>
|
||||
/// <param name="pointProgress"></param>
|
||||
/// <param name="arrowPointProgress"></param>
|
||||
/// <param name="absProgressPoint"></param>
|
||||
/// <param name="reverseDir"></param>
|
||||
public static void PopulateLineByPointsArray_DSL5(this VertexHelper vh, Vector2[] points,
|
||||
float thickness, bool cycleLoop, Color lineColor, Vector3 offset,
|
||||
bool enableArrow,
|
||||
Color arrowColor, Vector2 arrowSize, float pointProgress, float arrowPointProgress,
|
||||
bool absProgressPoint = true, bool reverseDir = false)
|
||||
{
|
||||
// 至少需要 2 个点才能绘制线条
|
||||
if (points.Length < 2)
|
||||
return;
|
||||
|
||||
|
||||
// 计算线路总长度
|
||||
var totalLength = points.CalculateTotalLength(cycleLoop);
|
||||
var currentLength = 0f;
|
||||
var vertices = ListPool<UIVertex>.Get();
|
||||
var lineVertices = ListPool<UIVertex>.Get();
|
||||
var arrowVertices = ListPool<UIVertex>.Get();
|
||||
var arrowindices = ListPool<int>.Get();
|
||||
for (int i = 0; i < points.Length - (cycleLoop ? 0 : 1); i++)
|
||||
{
|
||||
vh.AddSingleLineSegmentVertsAndTriangle_DSL5(i,
|
||||
GetSingleLineSegmentVerts_DSL5(vertices, points[i], points[(i + 1) % points.Length], thickness, color, currentLength, out var distance, totalLength, offset));
|
||||
var thisPoint = points[i];
|
||||
var nextPoint = points[(i + 1) % points.Length];
|
||||
|
||||
// 先计算线的矢量参数,以及uv。
|
||||
if (!GetNormalizedVector(thisPoint, nextPoint,
|
||||
out var vector, out var distance, out var normal, out var subTangent))
|
||||
continue;
|
||||
GetCurrentLengthUVY(currentLength, distance, totalLength, out var startUvy, out var endUvy);
|
||||
|
||||
vh.AddSingleLineSegmentVertsAndTriangle_DSL5(i,
|
||||
GetSingleLineSegmentVerts_DSL5(lineVertices, thisPoint, nextPoint, thickness, lineColor, normal,
|
||||
subTangent, startUvy, endUvy, offset));
|
||||
|
||||
if (enableArrow)
|
||||
{
|
||||
PopulateTriangleArrowByPointArray(arrowVertices, thisPoint, nextPoint, arrowColor, arrowSize.y,
|
||||
arrowSize.x, pointProgress, arrowPointProgress, absProgressPoint, reverseDir);
|
||||
arrowindices.AddFaceByConsecutiveVertices(arrowVertices, i * 3, 3, i * 3);
|
||||
}
|
||||
currentLength += distance;
|
||||
}
|
||||
ListPool<UIVertex>.Release(vertices);
|
||||
|
||||
if (enableArrow)
|
||||
{
|
||||
vh.AddUIVertexStream(arrowVertices, arrowindices);
|
||||
}
|
||||
ListPool<UIVertex>.Release(lineVertices);
|
||||
ListPool<UIVertex>.Release(arrowVertices);
|
||||
ListPool<int>.Release(arrowindices);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 圆弧过度的线路绘制
|
||||
|
||||
// 在简易线路绘制的基础上,修改了转角处的处理
|
||||
// 线的顶点还是5,但是转角圆弧处理会更细节,叫它 CFAL (中心对齐的圆弧转角直线,center fanshaped arc Line)
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 在网格构建对象上添加这个直线片段
|
||||
/// </summary>
|
||||
/// <param name="vh">构建网格对象</param>
|
||||
/// <param name="segmentPartIndex">该线路片段索引(比如第一段线应该是0)</param>
|
||||
/// <param name="verts">该片段顶点</param>
|
||||
public static void AddSingleLineSegmentVertsAndTriangle_CFAL(this VertexHelper vh, int segmentPartIndex, IEnumerable<UIVertex> verts)
|
||||
public static void AddSingleLineSegmentVertsAndTriangle_CFAL(this VertexHelper vh, int segmentPartIndex,
|
||||
IEnumerable<UIVertex> verts)
|
||||
{
|
||||
foreach (var vert in verts)
|
||||
vh.AddVert(vert);
|
||||
int index = segmentPartIndex * 5;
|
||||
|
||||
|
||||
// 添加线段的两个三角形(构成矩形线段)
|
||||
vh.AddTriangle(index, index+1, index+3);
|
||||
vh.AddTriangle(index+3, index+2, index);
|
||||
|
||||
vh.AddTriangle(index, index + 1, index + 3);
|
||||
vh.AddTriangle(index + 3, index + 2, index);
|
||||
|
||||
// 为线段之间添加斜角边缘
|
||||
// 使用上一个线段的终点和当前线段的起点创建过渡三角形
|
||||
if (segmentPartIndex != 0)
|
||||
{
|
||||
vh.AddTriangle(index, index-1, index-3);
|
||||
vh.AddTriangle(index+1, index-1, index-2);
|
||||
vh.AddTriangle(index, index - 1, index - 3);
|
||||
vh.AddTriangle(index + 1, index - 1, index - 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,49 +317,50 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
/// <param name="innerRadius">内圆弧半径</param>
|
||||
/// <param name="distance">返回线段的距离</param>
|
||||
/// <returns>包含线段顶点的列表</returns>
|
||||
public static List<UIVertex> GetSingleLineSegmentVerts_CFAL(List<UIVertex> vertices, Vector2 startPoint, Vector2 endPoint, Vector2 nextPoint, Vector2 prevPoint,
|
||||
float thickness, Color color, float startLength, out float distance, float totalLength, Vector3 offset,
|
||||
public static List<UIVertex> GetSingleLineSegmentVerts_CFAL(List<UIVertex> vertices, Vector2 startPoint,
|
||||
Vector2 endPoint, Vector2 nextPoint, Vector2 prevPoint,
|
||||
float thickness, Color color, float startLength, out float distance, float totalLength, Vector3 offset,
|
||||
int chamferSegments = 0, float innerRadius = 0f)
|
||||
{
|
||||
if (vertices == null)
|
||||
throw new Exception("没有指定线段片段顶点容器列表");
|
||||
vertices.Clear();
|
||||
|
||||
|
||||
// 创建顶点模板,设置颜色为组件的当前颜色
|
||||
UIVertex vertex = UIVertex.simpleVert;
|
||||
vertex.color = color;
|
||||
|
||||
if (!GetNormalizedVector(startPoint, endPoint,
|
||||
if (!GetNormalizedVector(startPoint, endPoint,
|
||||
out var vector, out distance, out var normal, out var subTangent))
|
||||
return vertices;
|
||||
|
||||
|
||||
// 线段单侧宽度
|
||||
var width = thickness / 2;
|
||||
|
||||
|
||||
GetCurrentLengthUVY(startLength, distance, totalLength, out var startUVY, out var endUVY);
|
||||
|
||||
|
||||
// 计算起点和终点的夹角
|
||||
float startAngle = 0f;
|
||||
float endAngle = 0f;
|
||||
|
||||
|
||||
if (prevPoint != startPoint)
|
||||
{
|
||||
var prevVector = startPoint - prevPoint;
|
||||
var prevNormal = prevVector.normalized;
|
||||
startAngle = Vector2.Angle(normal, -prevNormal);
|
||||
}
|
||||
|
||||
|
||||
if (nextPoint != endPoint)
|
||||
{
|
||||
var nextVector = nextPoint - endPoint;
|
||||
var nextNormal = nextVector.normalized;
|
||||
endAngle = Vector2.Angle(-normal, nextNormal);
|
||||
}
|
||||
|
||||
|
||||
// 计算顶点偏移量
|
||||
float startOffset = 0f;
|
||||
float endOffset = 0f;
|
||||
|
||||
|
||||
if (Mathf.Abs(startAngle) > 0.1f)
|
||||
{
|
||||
if (innerRadius > 0f)
|
||||
@@ -332,7 +372,7 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
startOffset = width / Mathf.Sin(startAngle * Mathf.Deg2Rad / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Mathf.Abs(endAngle) > 0.1f)
|
||||
{
|
||||
if (innerRadius > 0f)
|
||||
@@ -344,46 +384,46 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
endOffset = width / Mathf.Sin(endAngle * Mathf.Deg2Rad / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 添加起点的左侧顶点
|
||||
vertex.position = (startPoint +
|
||||
subTangent * width +
|
||||
normal * startOffset);
|
||||
vertex.position = (startPoint +
|
||||
subTangent * width +
|
||||
normal * startOffset);
|
||||
vertex.position += offset;
|
||||
vertex.uv0 = new Vector2(0f, startUVY);
|
||||
vertices.Add(vertex);
|
||||
|
||||
|
||||
// 添加起点的右侧顶点
|
||||
vertex.position = (startPoint +
|
||||
subTangent * -width +
|
||||
normal * startOffset);
|
||||
vertex.position = (startPoint +
|
||||
subTangent * -width +
|
||||
normal * startOffset);
|
||||
vertex.position += offset;
|
||||
vertex.uv0 = new Vector2(1f, startUVY);
|
||||
vertices.Add(vertex);
|
||||
|
||||
// 添加终点的左侧顶点
|
||||
vertex.position = (endPoint +
|
||||
subTangent * width +
|
||||
normal * -endOffset);
|
||||
vertex.position = (endPoint +
|
||||
subTangent * width +
|
||||
normal * -endOffset);
|
||||
vertex.position += offset;
|
||||
vertex.uv0 = new Vector2(0f, endUVY);
|
||||
vertices.Add(vertex);
|
||||
|
||||
|
||||
// 添加终点的右侧顶点
|
||||
vertex.position = (endPoint +
|
||||
subTangent * -width +
|
||||
normal * -endOffset);
|
||||
vertex.position = (endPoint +
|
||||
subTangent * -width +
|
||||
normal * -endOffset);
|
||||
vertex.position += offset;
|
||||
vertex.uv0 = new Vector2(1f, endUVY);
|
||||
vertices.Add(vertex);
|
||||
|
||||
// 添加终点的中心点
|
||||
vertex.position = (endPoint +
|
||||
normal * -endOffset);
|
||||
vertex.position = (endPoint +
|
||||
normal * -endOffset);
|
||||
vertex.position += offset;
|
||||
vertex.uv0 = new Vector2(0.5f, endUVY);
|
||||
vertices.Add(vertex);
|
||||
|
||||
|
||||
return vertices;
|
||||
}
|
||||
|
||||
@@ -398,40 +438,89 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
/// <param name="offset">偏移量</param>
|
||||
/// <param name="chamferSegments">倒角细分数量</param>
|
||||
/// <param name="innerRadius">内圆弧半径</param>
|
||||
public static void PopulateLineByPointsArray_CFAL(this VertexHelper vh, Vector2[] points, float thickness, bool cycleLoop, Color color, Vector3 offset,
|
||||
public static void PopulateLineByPointsArray_CFAL(this VertexHelper vh, Vector2[] points, float thickness,
|
||||
bool cycleLoop, Color color, Vector3 offset,
|
||||
int chamferSegments = 0, float innerRadius = 0f)
|
||||
{
|
||||
// 至少需要 2 个点才能绘制线条
|
||||
if (points.Length < 2)
|
||||
return;
|
||||
|
||||
|
||||
// 计算线路总长度
|
||||
var totalLength = points.CalculateTotalLength(cycleLoop);
|
||||
var currentLength = 0f;
|
||||
var vertices = ListPool<UIVertex>.Get();
|
||||
|
||||
|
||||
for (int i = 0; i < points.Length - (cycleLoop ? 0 : 1); i++)
|
||||
{
|
||||
var startPoint = points[i];
|
||||
var endPoint = points[(i + 1) % points.Length];
|
||||
var prevPoint = i > 0 ? points[i - 1] : cycleLoop ? points[^1] : startPoint;
|
||||
var nextPoint = points[(i + 2) % points.Length];
|
||||
|
||||
vh.AddSingleLineSegmentVertsAndTriangle_CFAL(i,
|
||||
GetSingleLineSegmentVerts_CFAL(vertices, startPoint, endPoint, nextPoint, prevPoint,
|
||||
thickness, color, currentLength, out var distance, totalLength, offset,
|
||||
|
||||
vh.AddSingleLineSegmentVertsAndTriangle_CFAL(i,
|
||||
GetSingleLineSegmentVerts_CFAL(vertices, startPoint, endPoint, nextPoint, prevPoint,
|
||||
thickness, color, currentLength, out var distance, totalLength, offset,
|
||||
chamferSegments, innerRadius));
|
||||
currentLength += distance;
|
||||
}
|
||||
|
||||
|
||||
ListPool<UIVertex>.Release(vertices);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 箭头绘制工具
|
||||
|
||||
/// <summary>
|
||||
/// 绘制一个三角形箭头
|
||||
/// </summary>
|
||||
/// <param name="start">起点</param>
|
||||
/// <param name="end">终点</param>
|
||||
/// <param name="color">颜色</param>
|
||||
/// <param name="sizeL">箭头的长度</param>
|
||||
/// <param name="sizeW">箭头的宽度</param>
|
||||
/// <param name="pointProgress">箭头所处坐标相对线的进度,使用绝对距离时,进度为世界单位;使用相对距离时,进度为单位距离</param>
|
||||
/// <param name="arrowPointProgress">箭头的哪部分与所处坐标对齐,0为头部对齐,1为尾部对齐</param>
|
||||
/// <param name="absProgressPoint">箭头做出坐标是否为绝对距离</param>
|
||||
/// <param name="reverseDir">反转方向</param>
|
||||
/// <remarks>
|
||||
/// 箭头默认在
|
||||
/// </remarks>
|
||||
public static List<UIVertex> PopulateTriangleArrowByPointArray(List<UIVertex> vertices, Vector2 start,
|
||||
Vector2 end, Color color, float sizeL, float sizeW, float pointProgress, float arrowPointProgress,
|
||||
bool absProgressPoint = true, bool reverseDir = false)
|
||||
{
|
||||
GetNormalizedVector(start, end, out var vector, out var length, out var normal, out var tangent,
|
||||
reverseDir);
|
||||
|
||||
var progressPosition = absProgressPoint
|
||||
? pointProgress * normal
|
||||
: pointProgress * vector;
|
||||
// 加上坐标
|
||||
progressPosition += reverseDir ? end : start;
|
||||
// 加上箭头偏移量
|
||||
progressPosition += arrowPointProgress * sizeL * normal;
|
||||
|
||||
// 绘制箭头
|
||||
UIVertex vertex = UIVertex.simpleVert;
|
||||
vertex.color = color;
|
||||
|
||||
vertex.position = progressPosition;
|
||||
vertices.Add(vertex);
|
||||
|
||||
vertex.position = progressPosition + -sizeL * normal + sizeW * 0.5f * tangent;
|
||||
vertices.Add(vertex);
|
||||
vertex.position += (Vector3)(-sizeW * tangent);
|
||||
vertices.Add(vertex);
|
||||
|
||||
return vertices;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 带有顶合并的线路绘制方法
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建线段的顶点数据
|
||||
/// 每个线段由 5 个顶点组成:
|
||||
@@ -450,7 +539,9 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
/// <param name="vh">用于添加顶点的 VertexHelper 对象</param>
|
||||
/// <param name="startLength">当前线段起点在线路中的累积长度</param>
|
||||
/// <param name="totalLength">线路的总长度</param>
|
||||
public static void CreateLineSegment_CFAL(this VertexHelper vh, Vector2 startPoint, Vector2 endPoint, float angle0, float angle3, float thickness, bool center, Vector2 rectSize, Color color, float startLength, float totalLength)
|
||||
public static void CreateLineSegment_CFAL(this VertexHelper vh, Vector2 startPoint, Vector2 endPoint,
|
||||
float angle0, float angle3, float thickness, bool center, Vector2 rectSize, Color color, float startLength,
|
||||
float totalLength)
|
||||
{
|
||||
// 计算偏移量:如果需要居中显示,则偏移到组件中心
|
||||
Vector2 offset = center ? (rectSize / 2) : Vector2.zero;
|
||||
@@ -466,39 +557,44 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
// 线段单侧宽度
|
||||
var width = thickness / 2;
|
||||
//顶点偏移量,根据夹角计算内侧交点相对坐标点应该退后的距离
|
||||
var pointOffset1 = Mathf.Abs(angle0) <= 0.1f ? 0 : width / Mathf.Sin(angle0 * Mathf.Deg2Rad) + (angle0 > 90 ? width : 0);
|
||||
var pointOffset2 = Mathf.Abs(angle3) <= 0.1f ? 0 : width / Mathf.Sin(angle3 * Mathf.Deg2Rad) + (angle3 > 90 ? width : 0);
|
||||
Debug.Log($"{angle0} = {Mathf.Sin(angle0 * Mathf.Deg2Rad)} , {angle3} = {Mathf.Sin(angle3 * Mathf.Deg2Rad)}");
|
||||
var pointOffset1 = Mathf.Abs(angle0) <= 0.1f
|
||||
? 0
|
||||
: width / Mathf.Sin(angle0 * Mathf.Deg2Rad) + (angle0 > 90 ? width : 0);
|
||||
var pointOffset2 = Mathf.Abs(angle3) <= 0.1f
|
||||
? 0
|
||||
: width / Mathf.Sin(angle3 * Mathf.Deg2Rad) + (angle3 > 90 ? width : 0);
|
||||
Debug.Log(
|
||||
$"{angle0} = {Mathf.Sin(angle0 * Mathf.Deg2Rad)} , {angle3} = {Mathf.Sin(angle3 * Mathf.Deg2Rad)}");
|
||||
// 计算起点和终点的UV坐标Y值
|
||||
float startUVY = totalLength > 0 ? startLength / totalLength : 0f;
|
||||
float endUVY = totalLength > 0 ? (startLength + distance) / totalLength : 0f;
|
||||
|
||||
vertex.position = (Vector3)(startPoint +
|
||||
subTangent * width +
|
||||
|
||||
vertex.position = (Vector3)(startPoint +
|
||||
subTangent * width +
|
||||
normal * pointOffset1) - (Vector3)offset;
|
||||
vertex.uv0 = new Vector2(0f, startUVY); // 左侧顶点的UV
|
||||
vh.AddVert(vertex);
|
||||
|
||||
vertex.position = (Vector3)(startPoint +
|
||||
subTangent * -width +
|
||||
|
||||
vertex.position = (Vector3)(startPoint +
|
||||
subTangent * -width +
|
||||
normal * pointOffset1) - (Vector3)offset;
|
||||
vertex.uv0 = new Vector2(1f, startUVY); // 右侧顶点的UV
|
||||
vh.AddVert(vertex);
|
||||
|
||||
vertex.position = (Vector3)(endPoint +
|
||||
subTangent * width +
|
||||
vertex.position = (Vector3)(endPoint +
|
||||
subTangent * width +
|
||||
normal * -pointOffset2) - (Vector3)offset;
|
||||
vertex.uv0 = new Vector2(0f, endUVY); // 左侧顶点的UV
|
||||
vh.AddVert(vertex);
|
||||
|
||||
vertex.position = (Vector3)(endPoint +
|
||||
subTangent * -width +
|
||||
|
||||
vertex.position = (Vector3)(endPoint +
|
||||
subTangent * -width +
|
||||
normal * -pointOffset2) - (Vector3)offset;
|
||||
vertex.uv0 = new Vector2(1f, endUVY); // 右侧顶点的UV
|
||||
vh.AddVert(vertex);
|
||||
|
||||
// 添加终点的中心点,用于连接后续线段
|
||||
vertex.position = (Vector3)(endPoint +
|
||||
vertex.position = (Vector3)(endPoint +
|
||||
normal * -pointOffset2) - (Vector3)offset;
|
||||
vertex.uv0 = new Vector2(0.5f, endUVY); // 中心点的UV
|
||||
vh.AddVert(vertex);
|
||||
@@ -513,19 +609,20 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
u = (pos.x - rect.xMin) / rect.width;
|
||||
v = (pos.y - rect.yMin) / rect.height;
|
||||
}
|
||||
|
||||
|
||||
public static void Get(this IList<UIVertex> vertexList, Vector4 uv2)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 顶点列表工具
|
||||
|
||||
private static readonly Color32 s_DefaultColor = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
|
||||
private static readonly Vector4 s_DefaultTangent = new Vector4(1f, 0.0f, 0.0f, -1f);
|
||||
|
||||
|
||||
private static readonly Color32 s_DefaultColor =
|
||||
new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
|
||||
|
||||
private static readonly Vector4 s_DefaultTangent = new Vector4(1f, 0.0f, 0.0f, -1f);
|
||||
|
||||
/// <summary>
|
||||
/// 添加一个顶点信息
|
||||
/// </summary>
|
||||
@@ -547,6 +644,7 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
uv3 = uv
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加一个三角面索引
|
||||
/// </summary>
|
||||
@@ -560,7 +658,34 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
indices.Add(index1);
|
||||
indices.Add(index2);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 向顶点管理器添加顶点列表中的顶点构成的面
|
||||
/// </summary>
|
||||
/// <param name="vh"></param>
|
||||
/// <param name="vertexList"></param>
|
||||
/// <param name="startVertexIndex">开始连成面的顶点</param>
|
||||
/// <param name="faceVertexRange">连成面的顶点范围</param>
|
||||
/// <param name="centerVertexIndex">作为连接面中心的顶点</param>
|
||||
public static void AddFaceByConsecutiveVertices(this ICollection<int> indices, IList<UIVertex> vertexList,
|
||||
int startVertexIndex, int faceVertexRange, int centerVertexIndex)
|
||||
{
|
||||
if (faceVertexRange < 3)
|
||||
throw new IndexOutOfRangeException("无法创建小于3个点的面");
|
||||
var length = startVertexIndex + faceVertexRange - 1;
|
||||
for (int i = startVertexIndex + 1; i < length; i++)
|
||||
{
|
||||
if (i < 0 || i > vertexList.Count)
|
||||
throw new IndexOutOfRangeException(
|
||||
$"在向顶点集添加顶点时,从{startVertexIndex}开始的{faceVertexRange}个顶点(以及{centerVertexIndex})可能超出{vertexList.Count}的范围(预定范围{length}),导致构建超出预期");
|
||||
var next = startVertexIndex + 1;
|
||||
|
||||
if (next >= vertexList.Count)
|
||||
return;
|
||||
indices.AddTriangle(centerVertexIndex, startVertexIndex, startVertexIndex + 1);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 MiB |
@@ -1,127 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 980e274b7ed2de945bdefcc1d0423472
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,14 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XericLibrary.Runtime.UIGraph
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class DirectedAcyclicXUIGraphRenderer : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b59fa9388a46c4c43b3461854775735e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -3,6 +3,10 @@ using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace XericLibrary.Runtime.UIGraph
|
||||
{
|
||||
/// <summary>
|
||||
@@ -794,6 +798,19 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
base.OnValidate();
|
||||
isDirty = true;
|
||||
}
|
||||
|
||||
|
||||
[MenuItem("GameObject/Xeric Library/UI/UIAnyPatternRenderer", false, 10)]
|
||||
private static void CreateGameObject()
|
||||
{
|
||||
GameObject newObject = new GameObject(nameof(UIAnyPatternRenderer), typeof(UIAnyPatternRenderer));
|
||||
|
||||
if (Selection.activeGameObject != null)
|
||||
newObject.transform.SetParent(Selection.activeGameObject.transform);
|
||||
|
||||
Undo.RegisterCreatedObjectUndo(newObject, $"Create {nameof(UIAnyPatternRenderer)}");
|
||||
Selection.activeObject = newObject;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@ using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace XericLibrary.Runtime.UIGraph
|
||||
{
|
||||
/// <summary>
|
||||
@@ -23,12 +27,34 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
public List<Vector2> points = new List<Vector2>();
|
||||
private Vector2[] _points;
|
||||
|
||||
/// <summary>
|
||||
/// 线路宽度
|
||||
/// </summary>
|
||||
public float thickness = 10f;
|
||||
/// <summary>
|
||||
/// 居中对齐
|
||||
/// </summary>
|
||||
public bool center = true;
|
||||
/// <summary>
|
||||
/// 循环线路
|
||||
/// </summary>
|
||||
public bool cycleLoop = false;
|
||||
/// <summary>
|
||||
/// 启用额外绘制的矢量箭头
|
||||
/// </summary>
|
||||
public bool enableVectorArrow = false;
|
||||
/// <summary>
|
||||
/// 矢量箭头尺寸(宽长)
|
||||
/// </summary>
|
||||
public Vector2 vectorArrowSize = Vector2.one;
|
||||
|
||||
public bool absVectorProgress = true;
|
||||
public float vectorProgress = 15f;
|
||||
public float vectorArrowProgress = 0.5f;
|
||||
public bool reverseVector = false;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用倒角功能
|
||||
/// 是/否启用倒角功能
|
||||
/// </summary>
|
||||
public bool useChamfer = false;
|
||||
|
||||
@@ -76,7 +102,7 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
points.Clear();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成线条网格
|
||||
/// </summary>
|
||||
@@ -89,15 +115,18 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
var offset = XericRendererUtils.SwitchCenterOffset(center, rectTransform.sizeDelta);
|
||||
_points = points.ToArray();
|
||||
|
||||
// 切换线路绘制模式
|
||||
if (useChamfer)
|
||||
{
|
||||
vh.PopulateLineByPointsArray_CFAL(_points, thickness, cycleLoop, color, offset, chamferSegments, innerRadius);
|
||||
}
|
||||
else
|
||||
{
|
||||
vh.PopulateLineByPointsArray_DSL5(_points, thickness, cycleLoop, color, offset);
|
||||
}
|
||||
|
||||
{
|
||||
vh.PopulateLineByPointsArray_DSL5(_points, thickness, cycleLoop, color, offset,
|
||||
enableVectorArrow,
|
||||
color, vectorArrowSize, vectorProgress, vectorArrowProgress, absVectorProgress, reverseVector);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
@@ -138,5 +167,20 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
||||
[MenuItem("GameObject/Xeric Library/UI/UILineRenderer", false, 10)]
|
||||
private static void CreateGameObject()
|
||||
{
|
||||
GameObject newObject = new GameObject(nameof(UILineRenderer), typeof(UILineRenderer));
|
||||
|
||||
if (Selection.activeGameObject != null)
|
||||
newObject.transform.SetParent(Selection.activeGameObject.transform);
|
||||
|
||||
Undo.RegisterCreatedObjectUndo(newObject, $"Create {nameof(UILineRenderer)}");
|
||||
Selection.activeObject = newObject;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,10 @@ using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
using XericLibrary.Runtime.Debuger;
|
||||
using XericLibrary.Runtime.MacroLibrary;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
#if ODIN_INSPECTOR
|
||||
using Sirenix.OdinInspector;
|
||||
#endif
|
||||
@@ -26,7 +30,7 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
[Header("多边形设置"), Range(3, 32)] public int sides = 6;
|
||||
|
||||
[SerializeField, Tooltip("多边形的大小 (相对于矩形区域的比例 0-1)")]
|
||||
#if ODIN_INSPECTOR
|
||||
#if ODIN_INSPECTOR
|
||||
[PropertyRange("ScaleMin", "GetMaxScale")]
|
||||
#else
|
||||
[Range(0f, 1f)]
|
||||
@@ -37,9 +41,13 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
[Tooltip("倒角细分")][Range(2f, 32f)] public int roundingTime = 3;
|
||||
[Tooltip("倒角形状")][Range(0f, 1f)] public float roundingPower = 1;
|
||||
public AngleSelectMode angleMode;
|
||||
#if ODIN_INSPECTOR
|
||||
[ShowIf("angleMode", optionalValue: AngleSelectMode.Angle)]
|
||||
#endif
|
||||
[Tooltip("起始角度")] public float startAngle = 90f;
|
||||
#if ODIN_INSPECTOR
|
||||
[ShowIf("angleMode", optionalValue: AngleSelectMode.Multiples)]
|
||||
#endif
|
||||
[Tooltip("起始角度(倍数对齐)")] public float startAngleTime = 1;
|
||||
[SerializeField, Tooltip("边框厚度")] [Range(0f, 1f)]
|
||||
private float borderThickness = .1f;
|
||||
@@ -311,6 +319,19 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
BorderColorLinear = borderColor2;
|
||||
FillColor = fillColor;
|
||||
}
|
||||
|
||||
|
||||
[MenuItem("GameObject/Xeric Library/UI/UIPatternRenderer", false, 10)]
|
||||
private static void CreateGameObject()
|
||||
{
|
||||
GameObject newObject = new GameObject(nameof(UIPatternRenderer), typeof(UIPatternRenderer));
|
||||
|
||||
if (Selection.activeGameObject != null)
|
||||
newObject.transform.SetParent(Selection.activeGameObject.transform);
|
||||
|
||||
Undo.RegisterCreatedObjectUndo(newObject, $"Create {nameof(UIPatternRenderer)}");
|
||||
Selection.activeObject = newObject;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Pool;
|
||||
using UnityEngine.UI;
|
||||
using XericLibrary.Runtime.MacroLibrary;
|
||||
|
||||
namespace XericLibrary.Runtime.UIGraph
|
||||
{
|
||||
@@ -21,6 +22,7 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
private readonly List<int> _indexList = new List<int>();
|
||||
// 阵列原点
|
||||
private List<Vector4> _arrayTransformList = new List<Vector4>();
|
||||
private List<Color32> _arrayColorList = new List<Color32>();
|
||||
// 中间数据
|
||||
private List<UIVertex> _temp_vertexList = new List<UIVertex>();
|
||||
private List<int> _temp_indexList = new List<int>();
|
||||
@@ -89,14 +91,26 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
/// </summary>
|
||||
/// <param name="offset">偏移</param>
|
||||
/// <param name="angle">角度</param>
|
||||
public int AddArrayModifier(Vector3 offset, float angle)
|
||||
public int AddArrayModifier(Vector2 offset, float angle, float size)
|
||||
{
|
||||
var index = _arrayTransformList.Count;
|
||||
_arrayTransformList.Add(new Vector4(offset.x, offset.y, offset.z, angle));
|
||||
_arrayTransformList.Add(new Vector4(offset.x, offset.y, angle, size));
|
||||
Refresh();
|
||||
return index;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置阵列节点
|
||||
/// </summary>
|
||||
/// <param name="trans"></param>
|
||||
public void SetArrayModifier(IList<Vector4> trans)
|
||||
{
|
||||
if (trans == null)
|
||||
return;
|
||||
_arrayTransformList.Clear();
|
||||
_arrayTransformList.AddRange(trans);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空阵列节点
|
||||
/// </summary>
|
||||
@@ -105,15 +119,62 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
_arrayTransformList.Clear();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public bool ModifyArrayModifier(int index, Vector3 offset, float angle)
|
||||
|
||||
/// <summary>
|
||||
/// 修改阵列节点
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="angle"></param>
|
||||
/// <param name="size"></param>
|
||||
/// <returns></returns>
|
||||
public bool ModifyArrayModifier(int index, Vector2 offset, float angle, float size)
|
||||
{
|
||||
if (index < 0 || index >= _arrayTransformList.Count)
|
||||
return false;
|
||||
_arrayTransformList[index] = new Vector4(offset.x, offset.y, offset.z, angle);
|
||||
_arrayTransformList[index] = new Vector4(offset.x, offset.y, angle, size);
|
||||
Refresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
public IList<Vector4> GetArrayModifier() => _arrayTransformList;
|
||||
|
||||
/// <summary>
|
||||
/// 添加颜色
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
public void AddColor(Color color) => _arrayColorList.Add(color);
|
||||
|
||||
/// <summary>
|
||||
/// 添加颜色
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
public void AddColor(Color32 color) => _arrayColorList.Add(color);
|
||||
|
||||
/// <summary>
|
||||
/// 设置颜色节点
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="color"></param>
|
||||
public void SetColor(int index, Color color) => _arrayColorList.SetAtIndex<Color32>(color, index);
|
||||
|
||||
/// <summary>
|
||||
/// 设置颜色节点
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="color"></param>
|
||||
public void SetColor(int index, Color32 color) => _arrayColorList.SetAtIndex<Color32>(color, index);
|
||||
|
||||
/// <summary>
|
||||
/// 清空颜色
|
||||
/// </summary>
|
||||
public void ClearArrayColor() => _arrayColorList.Clear();
|
||||
|
||||
/// <summary>
|
||||
/// 获取颜色列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IList<Color32> GetArrayColor() => _arrayColorList;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -147,19 +208,27 @@ namespace XericLibrary.Runtime.UIGraph
|
||||
{
|
||||
_temp_vertexList.AddRange(_vertexList.Select(a =>
|
||||
{
|
||||
var newPos = a.position;
|
||||
if (transform.w != 0)
|
||||
Vector2 newPos = a.position;
|
||||
if (transform.z != 0)
|
||||
{
|
||||
var rot = Quaternion.Euler(0, 0, transform.w);
|
||||
var rot = Quaternion.Euler(0, 0, transform.z);
|
||||
newPos = rot * newPos;
|
||||
}
|
||||
newPos += (Vector3)transform;
|
||||
if (transform.z > 0)
|
||||
newPos *= transform.w;
|
||||
newPos += (Vector2)transform;
|
||||
var newColor = a.color;
|
||||
if (index < _arrayColorList.Count && !default(Color32).Equals(_arrayColorList[index]))
|
||||
{
|
||||
newColor = _arrayColorList[index];
|
||||
}
|
||||
|
||||
return new UIVertex()
|
||||
{
|
||||
position = newPos,
|
||||
normal = a.normal,
|
||||
tangent = a.tangent,
|
||||
color = a.color,
|
||||
color = newColor,
|
||||
uv0 = a.uv0,
|
||||
uv1 = a.uv1,
|
||||
uv2 = a.uv2,
|
||||
|
||||
@@ -1,687 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 705507994}
|
||||
m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 12
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 500
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 2
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_LightingSettings: {fileID: 0}
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
maxJobWorkers: 0
|
||||
preserveTilesOutsideBounds: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &246206081
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 246206082}
|
||||
- component: {fileID: 246206084}
|
||||
- component: {fileID: 246206083}
|
||||
m_Layer: 5
|
||||
m_Name: LineRenderer
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &246206082
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 246206081}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children: []
|
||||
m_Father: {fileID: 387643621}
|
||||
m_RootOrder: -2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 1000, y: 300}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &246206083
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 246206081}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5b33b2e663e78774c9f0c9af55018725, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 2100000, guid: 13dbba63516e8bc469b99fae7247fd98, type: 2}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
points:
|
||||
- {x: 0, y: 0}
|
||||
- {x: 58.7, y: 138.4}
|
||||
- {x: 125.1, y: 80.6}
|
||||
- {x: 238.9, y: 300}
|
||||
- {x: 354, y: 100}
|
||||
- {x: 512.2, y: 70}
|
||||
- {x: 716.1, y: 192.5}
|
||||
- {x: 938.8, y: 3.85}
|
||||
- {x: 1000, y: 133}
|
||||
thickness: 20
|
||||
center: 0
|
||||
cycleLoop: 0
|
||||
a: 1
|
||||
useChamfer: 0
|
||||
chamferSegments: 4
|
||||
innerRadius: 0
|
||||
--- !u!222 &246206084
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 246206081}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &387643617
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 387643621}
|
||||
- component: {fileID: 387643620}
|
||||
- component: {fileID: 387643619}
|
||||
- component: {fileID: 387643618}
|
||||
m_Layer: 5
|
||||
m_Name: Canvas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &387643618
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 387643617}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreReversedGraphics: 1
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!114 &387643619
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 387643617}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 1
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 1920, y: 1080}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!223 &387643620
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 387643617}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 0
|
||||
m_Camera: {fileID: 0}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!224 &387643621
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 387643617}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1231462426}
|
||||
- {fileID: 246206082}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!1 &705507993
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 705507995}
|
||||
- component: {fileID: 705507994}
|
||||
- component: {fileID: 705507996}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!108 &705507994
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 705507993}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 10
|
||||
m_Type: 1
|
||||
m_Shape: 0
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 2
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_CullingMatrixOverride:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_UseCullingMatrixOverride: 0
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 1
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_UseBoundingSphereOverride: 0
|
||||
m_UseViewFrustumForShadowCasterCull: 1
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &705507995
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 705507993}
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!114 &705507996
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 705507993}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Version: 1
|
||||
m_UsePipelineSettings: 1
|
||||
m_AdditionalLightsShadowResolutionTier: 2
|
||||
m_LightLayerMask: 1
|
||||
m_CustomShadowLayers: 0
|
||||
m_ShadowLayerMask: 1
|
||||
m_LightCookieSize: {x: 1, y: 1}
|
||||
m_LightCookieOffset: {x: 0, y: 0}
|
||||
--- !u!1 &963194225
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 963194228}
|
||||
- component: {fileID: 963194227}
|
||||
- component: {fileID: 963194226}
|
||||
- component: {fileID: 963194229}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &963194226
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &963194227
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &963194228
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &963194229
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_RenderShadows: 1
|
||||
m_RequiresDepthTextureOption: 2
|
||||
m_RequiresOpaqueTextureOption: 2
|
||||
m_CameraType: 0
|
||||
m_Cameras: []
|
||||
m_RendererIndex: -1
|
||||
m_VolumeLayerMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 1
|
||||
m_VolumeTrigger: {fileID: 0}
|
||||
m_VolumeFrameworkUpdateModeOption: 2
|
||||
m_RenderPostProcessing: 0
|
||||
m_Antialiasing: 0
|
||||
m_AntialiasingQuality: 2
|
||||
m_StopNaN: 0
|
||||
m_Dithering: 0
|
||||
m_ClearDepth: 1
|
||||
m_AllowXRRendering: 1
|
||||
m_RequiresDepthTexture: 0
|
||||
m_RequiresColorTexture: 0
|
||||
m_Version: 2
|
||||
--- !u!1 &1231462425
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1231462426}
|
||||
- component: {fileID: 1231462428}
|
||||
- component: {fileID: 1231462427}
|
||||
m_Layer: 5
|
||||
m_Name: Background
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1231462426
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1231462425}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children: []
|
||||
m_Father: {fileID: 387643621}
|
||||
m_RootOrder: -2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1231462427
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1231462425}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 980e274b7ed2de945bdefcc1d0423472, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &1231462428
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1231462425}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1721653935
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1721653938}
|
||||
- component: {fileID: 1721653937}
|
||||
- component: {fileID: 1721653936}
|
||||
m_Layer: 0
|
||||
m_Name: EventSystem
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1721653936
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1721653935}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
m_CancelButton: Cancel
|
||||
m_InputActionsPerSecond: 10
|
||||
m_RepeatDelay: 0.5
|
||||
m_ForceModuleActive: 0
|
||||
--- !u!114 &1721653937
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1721653935}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_FirstSelected: {fileID: 0}
|
||||
m_sendNavigationEvents: 1
|
||||
m_DragThreshold: 10
|
||||
--- !u!4 &1721653938
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1721653935}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb52b66b1d2e63a41a60760e5830dabc
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user