初始化项目
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 算法:中心角度排序法
|
||||
/// 依据:???
|
||||
/// </summary>
|
||||
public class AlgorithmEdge : ModuleAlgorithm<DataPlate> {
|
||||
/// <summary> 算法:中心角度排序法 </summary>
|
||||
public AlgorithmEdge() { }
|
||||
|
||||
public class EdgeAngle {
|
||||
public float angle;
|
||||
public Vector3 position;
|
||||
}
|
||||
|
||||
public override void Compute(DataPlate data) {
|
||||
//List<Vector2> edgePoints = data.edgePoints;
|
||||
////计算多边形中心点
|
||||
//float x = edgePoints.Average((v3) => v3.x);
|
||||
//float y = edgePoints.Average((v3) => v3.y);
|
||||
//Vector2 center = new Vector2(x, y);
|
||||
////计算所有点的夹角
|
||||
//Vector3 direction = edgePoints[0] - center;
|
||||
//List<EdgeAngle> angleList = new List<EdgeAngle>();
|
||||
//for (int i = 0; i < edgePoints.Count; i++) {
|
||||
// Vector3 normal = edgePoints[i] - center;
|
||||
// EdgeAngle edgeAngle = new EdgeAngle();
|
||||
// edgeAngle.angle = Angle(direction, normal);
|
||||
// edgeAngle.position = normal;
|
||||
// angleList.Add(edgeAngle);
|
||||
//}
|
||||
//data.centerOffset = center;
|
||||
////排序
|
||||
//angleList.Sort((x, y) => x.angle.CompareTo(y.angle));
|
||||
////把排序好的边缘点重新添加
|
||||
//data.edgePoints = new List<Vector2>();
|
||||
//for (int i = 0; i < angleList.Count; i++) {
|
||||
// data.edgePoints.Add(angleList[i].position);
|
||||
//}
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算两点夹角
|
||||
/// </summary>
|
||||
/// <param name="direction">0度点位置</param>
|
||||
/// <param name="position">目标点</param>
|
||||
/// <returns></returns>
|
||||
private float Angle(Vector3 direction, Vector3 position) {
|
||||
float angle = Vector2.SignedAngle(direction, position);
|
||||
return angle;
|
||||
}
|
||||
|
||||
protected override void Awake() {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d17cdf61cce7657489b657640646a786
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,45 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 计算位置到边上最近的点
|
||||
/// </summary>
|
||||
//public class AlgorithmSidePoint : ModuleAlgorithm<DataIntersect> {
|
||||
|
||||
// protected override void Awake() => ModuleCore.AlgorithmSidePoint = this;
|
||||
|
||||
// public override void Compute(DataIntersect data) {
|
||||
// Vector3 position = data.position - data.side.plate.designPosition;
|
||||
// for (int i = 0; i < data.side.lines.Length; i++) {
|
||||
// DataLine line = data.side.lines[i];
|
||||
// if (!Compute(line, position, out Vector3 intersectPoint)) { continue; }
|
||||
// data.isIntersect = true;
|
||||
// data.intersectPoint = intersectPoint + data.side.plate.designPosition;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary> 查询匹配的边 </summary>
|
||||
// private bool Compute(DataLine line, Vector3 position, out Vector3 intersectPoint) {
|
||||
// return ProjectDistance(line.a, line.b, position, out intersectPoint);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// 向量投影法
|
||||
// /// 计算点c到线段ab最近的点
|
||||
// /// </summary>
|
||||
// /// <param name="a"></param>
|
||||
// /// <param name="b"></param>
|
||||
// /// <param name="c"></param>
|
||||
// /// <returns>如果不在线段上返回 false</returns>
|
||||
// public static bool ProjectDistance(Vector3 a, Vector3 b, Vector3 c, out Vector3 intersectPoint) {
|
||||
// Vector3 ab = b - a;
|
||||
// Vector3 ac = c - a;
|
||||
// Vector3 p = Vector3.Project(ac, ab.normalized);
|
||||
// intersectPoint = p + a;
|
||||
// if (ab.normalized != p.normalized) { return false; }
|
||||
// if (ab.magnitude < p.magnitude) { return false; }
|
||||
// return true;
|
||||
// }
|
||||
//}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 散列点生成简单多边形算法
|
||||
/// </summary>
|
||||
public class AlgorithmSimplePolygon : ModuleAlgorithm<DataPlate> {
|
||||
private UnitAlgorithm<DataPlateDesign> AlgorithmSideSubdivision = new UnitAlgorithmJobsSideSubdivision();
|
||||
private UnitAlgorithm<DataPlateDesign> AlgorithmTriangle = new UnitAlgorithmEarCutting();
|
||||
private UnitAlgorithm<DataPlateDesign> AlgorithmMergeTriangle = new UnitAlgorithmMergeTriangle();
|
||||
|
||||
protected override void Awake() => ModuleCore.AlgorithmSimplePolygon = this;
|
||||
|
||||
public override void Compute(DataPlate plate) {
|
||||
//遍历计算边(DataSide)上的细分点(positions)和线(lines)
|
||||
AlgorithmSideSubdivision.Compute(plate.dataDesign);
|
||||
//计算三角面
|
||||
AlgorithmTriangle.Compute(plate.dataDesign);
|
||||
//三角面列表转换网格
|
||||
AlgorithmMergeTriangle.Compute(plate.dataDesign);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef8ce839dfa79ff4d825f55925c48e7c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,53 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 缝合边算法模块
|
||||
/// </summary>
|
||||
public class AlgorithmSuture : ModuleAlgorithm<DataSuture> {
|
||||
/// <summary> 设计的缝合线 </summary>
|
||||
public UnitAlgorithm<DataSutureSide> SutureDesign = new UnitAlgorithmSutureDesign();
|
||||
/// <summary> 烘焙的缝合线 </summary>
|
||||
public UnitAlgorithm<DataSutureSide> SutureBaking = new UnitAlgorithmSutureBaking();
|
||||
|
||||
protected override void Awake() => ModuleCore.AlgorithmSuture = this;
|
||||
|
||||
public override void Compute(DataSuture suture) {
|
||||
//缝合边长
|
||||
float aLength = suture.a.plateSide.dataDesign.length;
|
||||
float bLength = suture.b.plateSide.dataDesign.length;
|
||||
suture.length = aLength < bLength ? aLength : bLength;
|
||||
//设计缝合顶点
|
||||
SutureDesign.Compute(suture.a);
|
||||
SutureDesign.Compute(suture.b);
|
||||
//烘焙缝合顶点
|
||||
SutureBaking.Compute(suture.a);
|
||||
SutureBaking.Compute(suture.b);
|
||||
//缝合锚点
|
||||
suture.points = new List<DataSuturePoint>();
|
||||
suture.points.AddRange(Compute(suture.a, suture.b));
|
||||
suture.points.AddRange(Compute(suture.b, suture.a));
|
||||
}
|
||||
private List<DataSuturePoint> Compute(DataSutureSide a, DataSutureSide b) {
|
||||
DataSutureSideVertex[] vertexs = a.dataBaking.vertexs;
|
||||
DataSutureSideVertex[] allVertexs = b.dataBaking.allVertexs;
|
||||
List<DataSuturePoint> suturePoints = new List<DataSuturePoint>();
|
||||
for (int i = 0; i < vertexs.Length; i++) {
|
||||
DataSutureSideVertex vertex = vertexs[i];
|
||||
for (int j = 0; j < allVertexs.Length; j++) {
|
||||
DataSutureSideVertex anchor = allVertexs[j];
|
||||
if (anchor.MaxDistance < vertex.origin) { continue; }
|
||||
DataSuturePoint suturePoint = new DataSuturePoint();
|
||||
suturePoint.distance = vertex.origin - anchor.origin;
|
||||
suturePoint.vertex = vertex.a;
|
||||
suturePoint.aAnchor = anchor.a;
|
||||
suturePoint.bAnchor = anchor.b;
|
||||
suturePoints.Add(suturePoint);
|
||||
}
|
||||
}
|
||||
return suturePoints;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc0a831375a5abe418c790ae74a19376
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,67 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 缝合边算法模块
|
||||
/// </summary>
|
||||
//public class AlgorithmSutureSide : ModuleAlgorithm<DataSutureSide> {
|
||||
// public class VertexPosition : IComparable<VertexPosition> {
|
||||
// public Vector3 designPosition;
|
||||
// public Vector3 bakingPosition;
|
||||
// public float distance;
|
||||
// public int CompareTo(VertexPosition other) {
|
||||
// return other.distance >= distance ? 1 : -1;
|
||||
// }
|
||||
// }
|
||||
|
||||
// protected override void Awake() => ModuleCore.AlgorithmSutureSide = this;
|
||||
|
||||
// public override void Compute(DataSutureSide data) {
|
||||
// //List<VertexPosition> vertexPositions = VertexPositions(data);
|
||||
// data.designPositions = VertexToDesignPositions(data).ToArray();
|
||||
// data.bakingPositions = VertexToBakingPositions(data).ToArray();
|
||||
// }
|
||||
|
||||
// private List<VertexPosition> VertexPositions(DataSutureSide sutureSide) {
|
||||
// List<VertexPosition> vertexPositions = new List<VertexPosition>();
|
||||
// for (int i = 0; i < sutureSide.Vertices.Length; i++) {
|
||||
// Vector3 design = sutureSide.Vertices[i].design;
|
||||
// Quaternion quaternion = Quaternion.Euler(sutureSide.PlateBakingEulerAngles);
|
||||
// Vector3 baking = quaternion * sutureSide.Vertices[i].design;
|
||||
// VertexPosition vertexPosition = new VertexPosition();
|
||||
// vertexPosition.designPosition = design + sutureSide.PlateDesignPosition;
|
||||
// vertexPosition.bakingPosition = baking + sutureSide.PlateBakingPosition;
|
||||
// vertexPosition.distance = Vector3.Distance(design, sutureSide.side.aPoint.position);
|
||||
// vertexPositions.Add(vertexPosition);
|
||||
// }
|
||||
// //按距离从小到大排序
|
||||
// vertexPositions.Sort();
|
||||
// //是否颠倒
|
||||
// if (sutureSide.isReversal) { vertexPositions.Reverse(); }
|
||||
// return vertexPositions;
|
||||
// }
|
||||
// private List<Vector3> VertexToDesignPositions(DataSutureSide data) {
|
||||
// //转换列表
|
||||
// List<Vector3> positions = new List<Vector3>();
|
||||
// for (int i = 0; i < data.Vertices.Length; i++) {
|
||||
// Vector3 position = data.Vertices[i].design + data.PlateDesignPosition;
|
||||
// positions.Add(position);
|
||||
// }
|
||||
// if (data.isReversal) { positions.Reverse(); }
|
||||
// return positions;
|
||||
// }
|
||||
// private List<Vector3> VertexToBakingPositions(DataSutureSide data) {
|
||||
// //转换列表
|
||||
// List<Vector3> positions = new List<Vector3>();
|
||||
// for (int i = 0; i < data.Vertices.Length; i++) {
|
||||
// Quaternion quaternion = Quaternion.Euler(data.PlateBakingEulerAngles);
|
||||
// Vector3 baking = quaternion * data.Vertices[i].design;
|
||||
// Vector3 position = baking + data.PlateBakingPosition;
|
||||
// positions.Add(position);
|
||||
// }
|
||||
// if (data.isReversal) { positions.Reverse(); }
|
||||
// return positions;
|
||||
// }
|
||||
//}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2883f9190b57bdc41a4458a5c9e16f53
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,17 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 算法模块
|
||||
/// </summary>
|
||||
/// <typeparam name="Data"></typeparam>
|
||||
public abstract class ModuleAlgorithm<Data> : MonoBehaviour {
|
||||
/// <summary> 必须要初始化 </summary>
|
||||
protected abstract void Awake();
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
/// <summary> 执行算法 </summary>
|
||||
public abstract void Compute(Data data);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 080083324a409f24788f08ea7c670304
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,18 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ResetBakingPolygon : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f24a4f73b9925a9478f58b089059ef1e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 485602713f4e17344b5dc7f627ed1a81
|
||||
guid: 66fc15151bdec0642aa0d9f313f50e72
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
/// <summary>
|
||||
/// 轮廓渲染资源模块
|
||||
/// </summary>
|
||||
public class AssetsOutline : ModuleAssets<Transform> {
|
||||
public UniversalRendererData rendererData;
|
||||
private OutlineRendererFeature rendererFeature;
|
||||
|
||||
public override int Count => rendererFeature.settings.RenderObjs.Count;
|
||||
public override List<Transform> Datas => rendererFeature.settings.RenderObjs;
|
||||
|
||||
protected override void Awake() {
|
||||
ModuleCore.AssetsOutline = this;
|
||||
rendererFeature = rendererData.rendererFeatures.OfType<OutlineRendererFeature>().FirstOrDefault();
|
||||
}
|
||||
|
||||
public override void Add(Transform data) {
|
||||
if (Datas.Contains(data)) { return; }
|
||||
Datas.Add(data);
|
||||
}
|
||||
public override void Remove(Transform data) {
|
||||
if (!Datas.Contains(data)) { return; }
|
||||
Datas.Remove(data);
|
||||
}
|
||||
public override Transform Find(int index) {
|
||||
return Datas.LoopIndex(index);
|
||||
}
|
||||
public override void ForEach(Action<Transform> action) {
|
||||
Datas.ForEach(action);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe3a6923b67b64741aab806825b12c16
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,39 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 板片管理模块
|
||||
/// </summary>
|
||||
public class AssetsPlate : ModuleAssets<DataPlate> {
|
||||
private List<DataPlate> dataPlates = new List<DataPlate>();
|
||||
|
||||
/// <summary> 视图相机模块 </summary>
|
||||
private ModuleViewCamera ViewCameraDesign => ModuleCore.ViewCameraDesign;
|
||||
|
||||
public override int Count => dataPlates.Count;
|
||||
public override List<DataPlate> Datas => dataPlates;
|
||||
|
||||
protected override void Awake() => ModuleCore.AssetsPlate = this;
|
||||
|
||||
public override void Add(DataPlate plate) {
|
||||
if (dataPlates.Contains(plate)) { return; }
|
||||
dataPlates.Add(plate);
|
||||
//初始化参数
|
||||
plate.dataDesign.position = ViewCameraDesign.CameraPosition;
|
||||
plate.dataBaking.position = ViewCameraDesign.CameraPosition;
|
||||
//生成可视化内容
|
||||
plate.UpdateVisual();
|
||||
}
|
||||
public override void Remove(DataPlate data) {
|
||||
if (!dataPlates.Contains(data)) { return; }
|
||||
dataPlates.Remove(data);
|
||||
}
|
||||
public override DataPlate Find(int index) {
|
||||
return dataPlates.LoopIndex(index);
|
||||
}
|
||||
public override void ForEach(Action<DataPlate> action) {
|
||||
dataPlates.ForEach(action);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1f4341af37c4904b8274f65dd58e837
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AssetsPlatePresets : ModuleAssets<DataPlatePresets> {
|
||||
[SerializeField] private List<DataPlatePresets> assets;
|
||||
|
||||
public override int Count => assets.Count;
|
||||
public override List<DataPlatePresets> Datas => assets;
|
||||
|
||||
protected override void Awake() => ModuleCore.AssetsPlatePresets = this;
|
||||
|
||||
public override void Add(DataPlatePresets data) => assets.Add(data);
|
||||
public override void Remove(DataPlatePresets data) => assets.Remove(data);
|
||||
public override DataPlatePresets Find(int index) => assets.LoopIndex(index);
|
||||
public override void ForEach(Action<DataPlatePresets> action) => assets.ForEach(action);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8198c73995924524d985c3beb338f033
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -17,7 +17,7 @@ public abstract class ModuleAssets<Data> : MonoBehaviour {
|
||||
public abstract int Count { get; }
|
||||
/// <summary> 数据列表 </summary>
|
||||
public abstract List<Data> Datas { get; }
|
||||
|
||||
|
||||
/// <summary> 添加数据 </summary>
|
||||
public abstract void Add(Data data);
|
||||
/// <summary> 删除数据 </summary>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 424b00686a91cd64989e546f204155a5
|
||||
guid: 96fa067856f57984e975772061a248ca
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 插入点(DataInsertPoint) 转换 点(DataPoint)
|
||||
/// </summary>
|
||||
//public class BuilderInsertPointToPoint : ModuleBuilder<DataInsertPoint, DataPoint> {
|
||||
|
||||
// protected override void Awake() => ModuleCore.InsertPointToPoint = this;
|
||||
|
||||
// public override DataPoint To(DataInsertPoint insertPoint) {
|
||||
// DataPlate plate = insertPoint.plate;
|
||||
// Vector3 position = insertPoint.position;
|
||||
// //创建新的点
|
||||
// DataPoint point = new DataPoint(insertPoint.plate);
|
||||
// point.position = position;
|
||||
// //改变关联的边B点,重置贝塞尔曲线
|
||||
// insertPoint.side.bPoint = point;
|
||||
// insertPoint.side.OneRankBezier();
|
||||
// //创建新的边
|
||||
// DataSide side = CreateDataSide(plate, point, insertPoint.bPoint);
|
||||
// //插入边
|
||||
// int sideIndex = plate.sides.IndexOf(insertPoint.side);
|
||||
// plate.sides.Insert(sideIndex + 1, side);
|
||||
// //插入点
|
||||
// int pointIndex = plate.points.IndexOf(insertPoint.aPoint);
|
||||
// plate.points.Insert(pointIndex + 1, point);
|
||||
// //更新数据
|
||||
// plate.UpdateVisual();
|
||||
// return point;
|
||||
// }
|
||||
|
||||
// private DataSide CreateDataSide(DataPlate plate, DataPoint a, DataPoint b) {
|
||||
// DataSide side = new DataSide(plate);
|
||||
// side.aPoint = a;
|
||||
// side.bPoint = b;
|
||||
// side.OneRankBezier();
|
||||
// return side;
|
||||
// }
|
||||
//}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 992dfa55aae34c040a024d7743bb1a8c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,39 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 板片预设数据(DataPlatePresets) 转换 板片数据(DataPlate)
|
||||
/// </summary>
|
||||
public class BuilderPlatePresetsToPlate : ModuleBuilder<DataPlatePresets, DataPlate> {
|
||||
|
||||
protected override void Awake() => ModuleCore.PlatePresetsToPlate = this;
|
||||
|
||||
public override DataPlate To(DataPlatePresets origin) {
|
||||
DataPlate dataPlate = new DataPlate();
|
||||
dataPlate.platePoints = ToDataPoint(dataPlate, origin.designPoints);
|
||||
dataPlate.plateSides = ToDataSide(dataPlate, dataPlate.platePoints);
|
||||
return dataPlate;
|
||||
}
|
||||
|
||||
private List<DataPlatePoint> ToDataPoint(DataPlate dataPlate, List<Vector3> list) {
|
||||
List<DataPlatePoint> points = new List<DataPlatePoint>();
|
||||
for (int i = 0; i < list.Count; i++) {
|
||||
DataPlatePoint point = new DataPlatePoint(dataPlate);
|
||||
point.position = list[i];
|
||||
points.Add(point);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
private List<DataPlateSide> ToDataSide(DataPlate dataPlate, List<DataPlatePoint> list) {
|
||||
List<DataPlateSide> sides = new List<DataPlateSide>();
|
||||
for (int i = 0; i < list.Count; i++) {
|
||||
DataPlateSide side = new DataPlateSide(dataPlate);
|
||||
side.aPoint = list.LoopIndex(i + 0);
|
||||
side.bPoint = list.LoopIndex(i + 1);
|
||||
side.OneRankBezier();
|
||||
sides.Add(side);
|
||||
}
|
||||
return sides;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 476a9d6720db7284fae46d62e046095d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 构造器
|
||||
/// 根据原型构造数据
|
||||
/// </summary>
|
||||
/// <typeparam name="Origin"></typeparam>
|
||||
/// <typeparam name="Data"></typeparam>
|
||||
public abstract class ModuleBuilder<Origin, Data> : MonoBehaviour {
|
||||
/// <summary> 必须要初始化 </summary>
|
||||
protected abstract void Awake();
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
/// <summary> 根据原型构造数据 </summary>
|
||||
public abstract Data To(Origin origin);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37fd3673cacd6294f8a1de0ddc48768a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eda56199f140e8e41bde06c79efd4b8e
|
||||
guid: e145339febf0e6f469eb3a650e52f3d9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
+6
-22
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 视图相机,把内容渲染到渲染纹理上
|
||||
/// 相机模块
|
||||
/// </summary>
|
||||
public abstract class ModuleViewCamera : MonoBehaviour {
|
||||
public abstract class ModuleCamera : MonoBehaviour {
|
||||
/// <summary> 默认图层遮罩 </summary>
|
||||
public static readonly LayerMask DefaultLayerMask = ~(1 << 0) | 1 << 0;
|
||||
/// <summary> 必须要初始化 </summary>
|
||||
@@ -13,20 +13,12 @@ public abstract class ModuleViewCamera : MonoBehaviour {
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
/// <summary> 视图位置 </summary>
|
||||
/// <summary> 相机位置 </summary>
|
||||
public abstract Vector3 Position { get; set; }
|
||||
/// <summary> 视图旋转 </summary>
|
||||
/// <summary> 相机旋转 </summary>
|
||||
public abstract Vector3 EulerAngles { get; set; }
|
||||
/// <summary> 视图缩放 </summary>
|
||||
public abstract float Scale { get; set; }
|
||||
/// <summary> 视图绿轴 </summary>
|
||||
public abstract Vector3 Up { get; }
|
||||
/// <summary> 视图红轴 </summary>
|
||||
public abstract Vector3 Right { get; }
|
||||
/// <summary> 视图蓝轴 </summary>
|
||||
public abstract Vector3 Forward { get; }
|
||||
/// <summary> 当前相机位置 </summary>
|
||||
public abstract Vector3 CameraPosition { get; }
|
||||
/// <summary> 相机视野 </summary>
|
||||
public abstract float VisualField { get; set; }
|
||||
/// <summary> 渲染纹理 </summary>
|
||||
public abstract RenderTexture RenderTexture { get; }
|
||||
|
||||
@@ -36,14 +28,6 @@ public abstract class ModuleViewCamera : MonoBehaviour {
|
||||
public abstract Vector3 ScreenToViewPosition(Vector3 screenPosition);
|
||||
/// <summary> 屏幕坐标转换世界坐标 </summary>
|
||||
public abstract Vector3 ScreenToWorldPosition(Vector3 screenPosition);
|
||||
/// <summary> 视图坐标(0-1)转换屏幕坐标 </summary>
|
||||
//public abstract Vector3 ViewToScreenPosition(Vector3 screenPosition);
|
||||
///// <summary> 视图坐标(0-1)转换世界坐标 </summary>
|
||||
//public abstract Vector3 ViewToWorldPosition(Vector3 screenPosition);
|
||||
///// <summary> 世界坐标转换屏幕坐标 </summary>
|
||||
//public abstract Vector3 WorldToScreenPosition(Vector3 screenPosition);
|
||||
///// <summary> 世界坐标转换视图坐标(0-1) </summary>
|
||||
//public abstract Vector3 WorldToViewPosition(Vector3 screenPosition);
|
||||
|
||||
/// <summary> 屏幕坐标获取世界对象 </summary>
|
||||
public abstract bool ScreenToWorldObject<T>(Vector3 screenPosition, out T value) where T : Object;
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2414983cb247d574fad8f47f71c42fdb
|
||||
guid: 8f795d0a53fb35641be9b8bc9aab0f58
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,95 +1,10 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// 核心模块,实现业务逻辑
|
||||
/// </summary>
|
||||
public class ModuleCore : Module<ModuleCore> {
|
||||
|
||||
#region 资产模块
|
||||
/// <summary> 板片资源管理模块 </summary>
|
||||
public ModuleAssets<DataPlate> AssetsPlate;
|
||||
/// <summary> 预设板片资产 </summary>
|
||||
public ModuleAssets<DataPlatePresets> AssetsPlatePresets;
|
||||
/// <summary> 轮廓渲染资源模块 </summary>
|
||||
public ModuleAssets<Transform> AssetsOutline;
|
||||
#endregion
|
||||
|
||||
#region 页面模块
|
||||
/// <summary> 不会被销毁的全局唯一页面模块 (UIDocument) </summary>
|
||||
public ModuleUIPage GlobalPage;
|
||||
/// <summary> 当前的主要页面模块 (UIDocument) </summary>
|
||||
public ModuleUIPage CurrentPage;
|
||||
/// <summary> 预设模板窗口 (回调Action) </summary>
|
||||
public ModuleUIWindow<Action> PresetsPlateWindow;
|
||||
#endregion
|
||||
|
||||
#region 视图模块
|
||||
/// <summary> 设计视图相机模块 </summary>
|
||||
public ModuleViewCamera ViewCameraDesign;
|
||||
/// <summary> 板片烘焙相机视图 </summary>
|
||||
public ModuleViewCamera ViewCameraBaking;
|
||||
#endregion
|
||||
|
||||
#region 输入模块
|
||||
/// <summary> 设计UI输入模块 </summary>
|
||||
public ModuleUIInput<UnitMouseInput> UIInputDesign;
|
||||
/// <summary> 烘焙UI输入模块 </summary>
|
||||
public ModuleUIInput<UnitMouseInput> UIInputBaking;
|
||||
#endregion
|
||||
|
||||
#region 转换模块
|
||||
/// <summary> 板片预设数据(DataPlatePresets) 转换 板片数据(DataPlate) </summary>
|
||||
public ModuleBuilder<DataPlatePresets, DataPlate> PlatePresetsToPlate;
|
||||
/// <summary> 板片数据(DataPlate) 转换 多边形数据(DataPolygon) </summary>
|
||||
public ModuleBuilder<DataPlate, DataPolygon> PlateToPolygon;
|
||||
#endregion
|
||||
|
||||
#region 可视模块
|
||||
/// <summary> 板片设计 可视化内容生成模块 </summary>
|
||||
public ModuleVisual<DataPlate> VisualPlateDesign;
|
||||
/// <summary> 板片烘焙 可视化内容生成模块 </summary>
|
||||
public ModuleVisual<DataPlate> VisualPlateBaking;
|
||||
/// <summary> 缝合设计 可视化内容生成模块 </summary>
|
||||
public ModuleVisual<DataSuture> VisualSutureDesign;
|
||||
/// <summary> 缝合烘焙 可视化内容生成模块 </summary>
|
||||
public ModuleVisual<DataSuture> VisualSutureBaking;
|
||||
/// <summary> 连接器 可视化内容生成模块 </summary>
|
||||
public ModuleVisual<DataConnector> VisualConnector;
|
||||
#endregion
|
||||
|
||||
#region 查询模块
|
||||
/// <summary> 查询点模块 </summary>
|
||||
public ModuleFind<DataPlatePoint> FindPoint;
|
||||
/// <summary> 查询边模块 </summary>
|
||||
public ModuleFind<DataPlateSide> FindSide;
|
||||
/// <summary> 查询贝塞尔点模块 </summary>
|
||||
public ModuleFind<DataBezier> FindBezier;
|
||||
#endregion
|
||||
|
||||
#region 算法模块
|
||||
/// <summary> 简单多边形算法模块 </summary>
|
||||
public ModuleAlgorithm<DataPlate> AlgorithmSimplePolygon;
|
||||
/// <summary> 细分多边形算法模块 </summary>
|
||||
public ModuleAlgorithm<DataPlate> AlgorithmSubdivisionPolygon;
|
||||
/// <summary> 缝合边算法模块 </summary>
|
||||
public ModuleAlgorithm<DataSuture> AlgorithmSuture;
|
||||
#endregion
|
||||
|
||||
#region 事件定义
|
||||
/// <summary> 标记数据Event </summary>
|
||||
public event Action<DataMark> OnMark;
|
||||
/// <summary> 移动烘焙视图的板片Event </summary>
|
||||
public event Action<DataPlate> OnBakingMobilePlate;
|
||||
#endregion
|
||||
|
||||
#region 事件触发
|
||||
/// <summary> 触发标记数据Event </summary>
|
||||
public void Mark(DataMark data) => OnMark?.Invoke(data);
|
||||
/// <summary> 触发移动烘焙视图的板片Event </summary>
|
||||
public void BakingMobilePlate(DataPlate data) => OnBakingMobilePlate?.Invoke(data);
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b523f207d584d649bb29f4a06b5428d
|
||||
guid: 831967c83916dda4a9cc48e672e4599c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0d7dc4e6e513e34abe150338292b7d9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,42 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 查询贝塞尔点
|
||||
/// </summary>
|
||||
public class FindBezier : ModuleFind<DataBezier> {
|
||||
public readonly float FindRange = 0.02f;
|
||||
/// <summary> 板片资产 </summary>
|
||||
public ModuleAssets<DataPlate> AssetsPlate => ModuleCore.AssetsPlate;
|
||||
|
||||
protected override void Awake() => ModuleCore.FindBezier = this;
|
||||
|
||||
public override bool Find(Vector3 position, out DataBezier bezier) {
|
||||
List<DataPlate> plates = AssetsPlate.Datas;
|
||||
for (int i = 0; i < plates.Count; i++) {
|
||||
Vector3 localPosition = position - plates[i].dataDesign.position;
|
||||
bezier = Find(plates[i], localPosition);
|
||||
if (bezier != null) { return true; }
|
||||
}
|
||||
bezier = null; return false;
|
||||
}
|
||||
|
||||
/// <summary> 查询匹配的边 </summary>
|
||||
private DataBezier Find(DataPlate plate, Vector3 localPosition) {
|
||||
for (int i = 0; i < plate.plateSides.Count; i++) {
|
||||
DataBezier bezier = Find(plate.plateSides[i], localPosition);
|
||||
if (bezier != null) { return bezier; }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/// <summary> 查询匹配的边 </summary>
|
||||
private DataBezier Find(DataPlateSide side, Vector3 localPosition) {
|
||||
if (side.bezier == Bezier.一阶) { return null; }
|
||||
float aDis = Vector3.Distance(side.aBezier, localPosition);
|
||||
if (aDis < FindRange) { return new DataBezier() { isA = true, side = side }; }
|
||||
float bDis = Vector3.Distance(side.bBezier, localPosition);
|
||||
if (bDis < FindRange) { return new DataBezier() { isA = false, side = side }; }
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ea40ae623c1a974fa852f60e22f5a37
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,35 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 查找点
|
||||
/// </summary>
|
||||
public class FindPoint : ModuleFind<DataPlatePoint> {
|
||||
public readonly float FindRange = 0.01f;
|
||||
/// <summary> 板片资产 </summary>
|
||||
public ModuleAssets<DataPlate> AssetsPlate => ModuleCore.AssetsPlate;
|
||||
|
||||
protected override void Awake() => ModuleCore.FindPoint = this;
|
||||
|
||||
public override bool Find(Vector3 position, out DataPlatePoint point) {
|
||||
List<DataPlate> plates = AssetsPlate.Datas;
|
||||
for (int i = 0; i < plates.Count; i++) {
|
||||
Vector3 localPosition = position - plates[i].dataDesign.position;
|
||||
point = Find(plates[i], localPosition);
|
||||
if (point != null) { return true; }
|
||||
}
|
||||
point = null; return false;
|
||||
}
|
||||
|
||||
/// <summary> 查询匹配的点 </summary>
|
||||
private DataPlatePoint Find(DataPlate plate, Vector3 localPosition) {
|
||||
List<DataPlatePoint> points = plate.platePoints;
|
||||
for (int i = 0; i < points.Count; i++) {
|
||||
float distance = Vector3.Distance(points[i].position, localPosition);
|
||||
if (distance > FindRange) { continue; }
|
||||
return points[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1da1d6857fa49af4dbe4dd67998f54f1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,61 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 查找边
|
||||
/// </summary>
|
||||
public class FindSide : ModuleFind<DataPlateSide> {
|
||||
public readonly float FindRange = 0.01f;
|
||||
/// <summary> 板片资产 </summary>
|
||||
public ModuleAssets<DataPlate> AssetsPlate => ModuleCore.AssetsPlate;
|
||||
|
||||
protected override void Awake() => ModuleCore.FindSide = this;
|
||||
|
||||
public override bool Find(Vector3 position, out DataPlateSide side) {
|
||||
List<DataPlate> plates = AssetsPlate.Datas;
|
||||
for (int i = 0; i < plates.Count; i++) {
|
||||
Vector3 localPosition = position - plates[i].dataDesign.position;
|
||||
side = Find(plates[i], localPosition);
|
||||
if (side != null) { return true; }
|
||||
}
|
||||
side = null; return false;
|
||||
}
|
||||
|
||||
/// <summary> 查询匹配的边 </summary>
|
||||
private DataPlateSide Find(DataPlate plate, Vector3 localPosition) {
|
||||
for (int i = 0; i < plate.plateSides.Count; i++) {
|
||||
DataPlateSide side = Find(plate.plateSides[i], localPosition);
|
||||
if (side != null) { return side; }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/// <summary> 查询匹配的边 </summary>
|
||||
private DataPlateSide Find(DataPlateSide side, Vector3 localPosition) {
|
||||
DataPlateSideDesign design = side.dataDesign;
|
||||
for (int i = 0; i < design.lines.Length; i++) {
|
||||
Vector3 a = design.lines[i].a;
|
||||
Vector3 b = design.lines[i].b;
|
||||
float distance = ProjectDistance(a, b, localPosition);
|
||||
if (distance < FindRange) { return side; }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 向量投影法
|
||||
/// 计算点c到线段ab最近的点
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <returns>如果不在线段上返回 float.MaxValue</returns>
|
||||
public static float ProjectDistance(Vector3 a, Vector3 b, Vector3 c) {
|
||||
Vector3 ab = b - a;
|
||||
Vector3 ac = c - a;
|
||||
Vector3 p = Vector3.Project(ac, ab);
|
||||
if (ab.normalized != p.normalized) { return float.MaxValue; }
|
||||
if (ab.magnitude < p.magnitude) { return float.MaxValue; }
|
||||
return Vector3.Distance(c, p + a);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9b522b1c221a4643b94ce865ac8ecaa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,16 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 查找模块
|
||||
/// </summary>
|
||||
public abstract class ModuleFind<Data> : MonoBehaviour {
|
||||
/// <summary> 必须要初始化 </summary>
|
||||
protected abstract void Awake();
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
/// <summary> 查询 </summary>
|
||||
public abstract bool Find(Vector3 position, out Data data);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7a6d69ae9d8c86438ea713a619b8afe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 930f92d77ec6d97418874f1951013093
|
||||
guid: 9939a58498acfda448d6f494f52e8da4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -2,17 +2,14 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ModuleInput : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 输入模块
|
||||
/// </summary>
|
||||
public abstract class ModuleInput : MonoBehaviour {
|
||||
/// <summary> 必须要初始化 </summary>
|
||||
protected abstract void Awake();
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
public abstract Vector2 MousePosition { get; }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 890a3e1c641efcb418cc76bfb893d22e
|
||||
guid: 4661df0b8dac9f640a09daa01cac9ea1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f005f421868c2084baf399dc6a42a60b
|
||||
guid: b6ef7cc76b1474a498a5995587aeac6f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 单个独立模块
|
||||
/// </summary>
|
||||
public abstract class ModuleSingle<Data> : MonoBehaviour {
|
||||
/// <summary> 必须要初始化 </summary>
|
||||
protected abstract void Awake();
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
/// <summary> 打开 </summary>
|
||||
public abstract void Open(Data data);
|
||||
/// <summary> 完成 </summary>
|
||||
public abstract void Complete();
|
||||
/// <summary> 关闭 </summary>
|
||||
public abstract void Close();
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a76476370cd578b489a2b37297d054f9
|
||||
guid: 121ca341c2100df4b94d707ed24452f5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db1ffe2c1120fec4c9509e838aebb89c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
/// <summary>
|
||||
/// UI输入模块
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public abstract class ModuleUIInput<T> : MonoBehaviour {
|
||||
/// <summary> 必须要初始化 </summary>
|
||||
protected abstract void Awake();
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
/// <summary> 当前输入单元 </summary>
|
||||
public abstract T Current { get; }
|
||||
/// <summary> 改变输入单元时触发 </summary>
|
||||
public abstract event Action<T> OnChangeInput;
|
||||
/// <summary> 改变输入单元 </summary>
|
||||
public abstract void ChangeInput(T input);
|
||||
|
||||
/// <summary> 绑定UI </summary>
|
||||
public abstract void Binding(VisualElement element);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41107ff888d44274e9593642528ccdd6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,76 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
/// <summary>
|
||||
/// 烘焙输入模块
|
||||
/// </summary>
|
||||
public class UIInputBaking : ModuleUIInput<UnitMouseInput> {
|
||||
private bool isDownMouseLeft;
|
||||
private bool isDownMouseRight;
|
||||
private UnitMouseInput leftInputUnit;
|
||||
private UnitMouseInput rightInputUnit;
|
||||
|
||||
/// <summary> 设计视图相机模块 </summary>
|
||||
protected ModuleViewCamera ViewCamera => ModuleCore.ViewCameraBaking;
|
||||
|
||||
public override UnitMouseInput Current => leftInputUnit;
|
||||
public override event Action<UnitMouseInput> OnChangeInput;
|
||||
public override void ChangeInput(UnitMouseInput input) {
|
||||
leftInputUnit = input;
|
||||
OnChangeInput?.Invoke(input);
|
||||
}
|
||||
|
||||
protected override void Awake() {
|
||||
ModuleCore.UIInputBaking = this;
|
||||
rightInputUnit = new BakingRotate();
|
||||
}
|
||||
|
||||
public override void Binding(VisualElement element) {
|
||||
element.RegisterCallback<MouseDownEvent>(MouseDown);
|
||||
element.RegisterCallback<MouseMoveEvent>(MouseMove);
|
||||
element.RegisterCallback<MouseUpEvent>(MouseRelease);
|
||||
element.RegisterCallback<MouseOutEvent>(MouseRelease);
|
||||
element.RegisterCallback<WheelEvent>(ScrollWheel);
|
||||
}
|
||||
|
||||
private void MouseDown(MouseDownEvent evt) {
|
||||
DataMouseInput data = CreateData(evt.localMousePosition, 0);
|
||||
if (evt.button == 0) { leftInputUnit.MouseDown(data); isDownMouseLeft = true; }
|
||||
if (evt.button == 1) { rightInputUnit.MouseDown(data); isDownMouseRight = true; }
|
||||
}
|
||||
private void MouseMove(MouseMoveEvent evt) {
|
||||
DataMouseInput data = CreateData(evt.localMousePosition, 0);
|
||||
if (isDownMouseLeft) { leftInputUnit.MouseDrag(data); }
|
||||
if (isDownMouseRight) { rightInputUnit.MouseDrag(data); }
|
||||
if (evt.button == 0) { leftInputUnit.MouseMove(data); }
|
||||
if (evt.button == 1) { rightInputUnit.MouseMove(data); }
|
||||
}
|
||||
private void MouseRelease(MouseUpEvent evt) {
|
||||
DataMouseInput data = CreateData(evt.localMousePosition, 0);
|
||||
leftInputUnit.MouseRelease(data); isDownMouseLeft = false;
|
||||
rightInputUnit.MouseRelease(data); isDownMouseRight = false;
|
||||
}
|
||||
private void MouseRelease(MouseOutEvent evt) {
|
||||
DataMouseInput data = CreateData(evt.localMousePosition, 0);
|
||||
leftInputUnit.MouseRelease(data); isDownMouseLeft = false;
|
||||
rightInputUnit.MouseRelease(data); isDownMouseRight = false;
|
||||
}
|
||||
private void ScrollWheel(WheelEvent evt) {
|
||||
DataMouseInput data = CreateData(evt.localMousePosition, evt.delta.y);
|
||||
float size = ViewCamera.Scale + data.ScrollWheel;
|
||||
size = Mathf.Clamp(size, -10f, -1f);
|
||||
ViewCamera.Scale = Mathf.Lerp(ViewCamera.Scale, size, Time.deltaTime * 50);
|
||||
}
|
||||
|
||||
private DataMouseInput CreateData(Vector2 localMousePosition, float scrollWheel) {
|
||||
DataMouseInput data = new DataMouseInput();
|
||||
data.ScrollWheel = scrollWheel;
|
||||
data.ViewPosition = ViewCamera.ScreenToViewPosition(localMousePosition);
|
||||
data.WorldPosition = ViewCamera.ScreenToWorldPosition(localMousePosition);
|
||||
data.ScreenPosition = localMousePosition;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f4e648fd2afac64eb1a2a9fa2f82246
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,76 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
/// <summary>
|
||||
/// 设计输入模块
|
||||
/// </summary>
|
||||
public class UIInputDesign : ModuleUIInput<UnitMouseInput> {
|
||||
private bool isDownMouseLeft;
|
||||
private bool isDownMouseRight;
|
||||
private UnitMouseInput leftInputUnit;
|
||||
private UnitMouseInput rightInputUnit;
|
||||
|
||||
/// <summary> 设计视图相机模块 </summary>
|
||||
protected ModuleViewCamera ViewCamera => ModuleCore.ViewCameraDesign;
|
||||
|
||||
public override UnitMouseInput Current => leftInputUnit;
|
||||
public override event Action<UnitMouseInput> OnChangeInput;
|
||||
public override void ChangeInput(UnitMouseInput input) {
|
||||
leftInputUnit = input;
|
||||
OnChangeInput?.Invoke(input);
|
||||
}
|
||||
|
||||
protected override void Awake() {
|
||||
ModuleCore.UIInputDesign = this;
|
||||
rightInputUnit = new DesignMobile();
|
||||
}
|
||||
|
||||
public override void Binding(VisualElement element) {
|
||||
element.RegisterCallback<MouseDownEvent>(MouseDown);
|
||||
element.RegisterCallback<MouseMoveEvent>(MouseMove);
|
||||
element.RegisterCallback<MouseUpEvent>(MouseRelease);
|
||||
element.RegisterCallback<MouseOutEvent>(MouseRelease);
|
||||
element.RegisterCallback<WheelEvent>(ScrollWheel);
|
||||
}
|
||||
|
||||
private void MouseDown(MouseDownEvent evt) {
|
||||
DataMouseInput data = CreateData(evt.localMousePosition, 0);
|
||||
if (evt.button == 0) { leftInputUnit.MouseDown(data); isDownMouseLeft = true; }
|
||||
if (evt.button == 1) { rightInputUnit.MouseDown(data); isDownMouseRight = true; }
|
||||
}
|
||||
private void MouseMove(MouseMoveEvent evt) {
|
||||
DataMouseInput data = CreateData(evt.localMousePosition, 0);
|
||||
if (isDownMouseLeft) { leftInputUnit.MouseDrag(data); }
|
||||
if (isDownMouseRight) { rightInputUnit.MouseDrag(data); }
|
||||
leftInputUnit.MouseMove(data);
|
||||
rightInputUnit.MouseMove(data);
|
||||
}
|
||||
private void MouseRelease(MouseUpEvent evt) {
|
||||
DataMouseInput data = CreateData(evt.localMousePosition, 0);
|
||||
leftInputUnit.MouseRelease(data); isDownMouseLeft = false;
|
||||
rightInputUnit.MouseRelease(data); isDownMouseRight = false;
|
||||
}
|
||||
private void MouseRelease(MouseOutEvent evt) {
|
||||
DataMouseInput data = CreateData(evt.localMousePosition, 0);
|
||||
leftInputUnit.MouseRelease(data); isDownMouseLeft = false;
|
||||
rightInputUnit.MouseRelease(data); isDownMouseRight = false;
|
||||
}
|
||||
private void ScrollWheel(WheelEvent evt) {
|
||||
DataMouseInput data = CreateData(evt.localMousePosition, evt.delta.y);
|
||||
float size = ViewCamera.Scale + data.ScrollWheel;
|
||||
size = Mathf.Clamp(size, 0.1f, 4);
|
||||
ViewCamera.Scale = Mathf.Lerp(ViewCamera.Scale, size, Time.deltaTime * 20);
|
||||
}
|
||||
|
||||
private DataMouseInput CreateData(Vector2 localMousePosition, float scrollWheel) {
|
||||
DataMouseInput data = new DataMouseInput();
|
||||
data.ScrollWheel = scrollWheel;
|
||||
data.ViewPosition = ViewCamera.ScreenToViewPosition(localMousePosition);
|
||||
data.WorldPosition = ViewCamera.ScreenToWorldPosition(localMousePosition);
|
||||
data.ScreenPosition = localMousePosition;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9cf538c2c848fc4ca95d1f860f11acc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aea30e84af7b7ad4ab623d28e7668fcb
|
||||
guid: 1dd7861df30473e4380411dd72fc32c3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a81cd0646bee3624b941f3d0b2c272f4
|
||||
guid: 1fbdc8f1003e52b42b71c1679a3b8e3c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class UIPageGarmentSewing : ModuleUIPage {
|
||||
private TopMenu topMenu;
|
||||
private VisualElement TopMenuElement => Q<VisualElement>("TopMenu");
|
||||
protected override void Awake() => ModuleCore.CurrentPage = this;
|
||||
|
||||
private void Start() {
|
||||
topMenu = new TopMenu(TopMenuElement);
|
||||
topMenu.ClickTopMenu1 = () => { };
|
||||
topMenu.ClickTopMenu2 = () => { ModuleCore.PresetsPlateWindow.Open(null); };
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d436e806ac6755d4fb29cdb0f7208615
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,7 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIPageGlobal : ModuleUIPage {
|
||||
protected override void Awake() => ModuleCore.GlobalPage = this;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b8b1855b5fed0e041878548696f2afbe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9083014378a5c3e4caaddd160ff79450
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// UI窗口
|
||||
/// </summary>
|
||||
/// <typeparam name="Data">窗口需要的数据类型</typeparam>
|
||||
public abstract class ModuleUIWindow<Data> : MonoBehaviour {
|
||||
/// <summary> 绑定的页面 </summary>
|
||||
public ModuleUIPage ModuleUIPage;
|
||||
/// <summary> 必须初始化 </summary>
|
||||
public abstract void Awake();
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
/// <summary> 打开模块,并且传进参数 </summary>
|
||||
public abstract void Open(Data data);
|
||||
/// <summary> 关闭模块 </summary>
|
||||
public abstract void Close();
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 928a5dbb2497f0145b1da8645720ac89
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,45 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class UIWindowPresetsPlate : ModuleUIWindow<Action> {
|
||||
public VisualTreeAsset PresetsPlateUnitAsset;
|
||||
private UIPresetsPlate presetsPlate;
|
||||
private VisualElement element => ModuleUIPage.Q<VisualElement>("PresetsPlate");
|
||||
|
||||
/// <summary> 资源模块 </summary>
|
||||
private ModuleAssets<DataPlate> AssetsPlate => ModuleCore.AssetsPlate;
|
||||
/// <summary> 预设资源模块 </summary>
|
||||
private ModuleAssets<DataPlatePresets> AssetsPlatePresets => ModuleCore.AssetsPlatePresets;
|
||||
/// <summary> 转换模块 </summary>
|
||||
private ModuleBuilder<DataPlatePresets, DataPlate> PlatePresetsToPlate => ModuleCore.PlatePresetsToPlate;
|
||||
|
||||
public override void Awake() {
|
||||
ModuleCore.PresetsPlateWindow = this;
|
||||
presetsPlate = new UIPresetsPlate(element);
|
||||
|
||||
presetsPlate.ClickClose = Close;
|
||||
}
|
||||
public override void Open(Action data) {
|
||||
element.style.display = DisplayStyle.Flex;
|
||||
presetsPlate.Clear();
|
||||
AssetsPlatePresets.ForEach(Create);
|
||||
}
|
||||
public override void Close() {
|
||||
presetsPlate.Clear();
|
||||
element.style.display = DisplayStyle.None;
|
||||
}
|
||||
private void Create(DataPlatePresets data) {
|
||||
VisualElement temp = PresetsPlateUnitAsset.Instantiate();
|
||||
UIPresetsPlateUnit unit = new UIPresetsPlateUnit(temp, data);
|
||||
unit.Click = () => { CreateTemplate(data); };
|
||||
presetsPlate.Add(unit);
|
||||
}
|
||||
private void CreateTemplate(DataPlatePresets data) {
|
||||
DataPlate dataPlate = PlatePresetsToPlate.To(data);
|
||||
AssetsPlate.Add(dataPlate);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a930d912222858846a23606c170a59d8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c1f6f992590ee740829401bdf9c7486
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93bd8c351a140654da540f55d0d7091f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,92 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ViewCameraBaking : ModuleViewCamera {
|
||||
public readonly Vector3 CameraOffset = new Vector3(0, 0, -1.5f);
|
||||
public Camera viewCamera;
|
||||
public Transform viewOrigin;
|
||||
public Transform viewSpace;
|
||||
private RaycastHit hitInfo;
|
||||
private RenderTexture renderTexture;
|
||||
|
||||
protected override void Awake() => ModuleCore.ViewCameraBaking = this;
|
||||
|
||||
public override Vector3 Position {
|
||||
get => viewOrigin.localPosition;
|
||||
set => viewOrigin.localPosition = value;
|
||||
}
|
||||
public override Vector3 EulerAngles {
|
||||
get => viewOrigin.eulerAngles;
|
||||
set => viewOrigin.eulerAngles = value;
|
||||
}
|
||||
public override float Scale {
|
||||
get => viewCamera.transform.localPosition.z;
|
||||
set => viewCamera.transform.localPosition = new Vector3(0, 0, value);
|
||||
}
|
||||
public override Vector3 Up {
|
||||
get => viewOrigin.up;
|
||||
}
|
||||
public override Vector3 Right {
|
||||
get => viewOrigin.right;
|
||||
}
|
||||
public override Vector3 Forward {
|
||||
get => viewOrigin.forward;
|
||||
}
|
||||
public override Vector3 CameraPosition {
|
||||
get => viewOrigin.localPosition;
|
||||
}
|
||||
public override RenderTexture RenderTexture {
|
||||
get => renderTexture;
|
||||
}
|
||||
|
||||
public override void UpdateRenderTexture(int x, int y) {
|
||||
renderTexture = new RenderTexture(x, y, 0);
|
||||
viewCamera.targetTexture = renderTexture;
|
||||
}
|
||||
public override Vector3 ScreenToViewPosition(Vector3 screenPosition) {
|
||||
float x = screenPosition.x / viewCamera.pixelWidth;
|
||||
float y = 1 - screenPosition.y / viewCamera.pixelHeight;
|
||||
Vector3 viewPosition = new Vector3(x, y);
|
||||
return viewPosition;
|
||||
}
|
||||
public override Vector3 ScreenToWorldPosition(Vector3 screenPosition) {
|
||||
Vector3 viewPosition = ScreenToViewPosition(screenPosition);
|
||||
float aspectRatio = (float)viewCamera.pixelWidth / viewCamera.pixelHeight;
|
||||
Vector3 ratio = viewPosition - new Vector3(0.5f, 0.5f);
|
||||
return new Vector3(ratio.x * aspectRatio, ratio.y) * Scale + viewOrigin.position;
|
||||
}
|
||||
//public override Vector3 ViewToScreenPosition(Vector3 screenPosition) {
|
||||
// throw new System.NotImplementedException();
|
||||
//}
|
||||
//public override Vector3 ViewToWorldPosition(Vector3 screenPosition) {
|
||||
// throw new System.NotImplementedException();
|
||||
//}
|
||||
//public override Vector3 WorldToScreenPosition(Vector3 screenPosition) {
|
||||
// throw new System.NotImplementedException();
|
||||
//}
|
||||
//public override Vector3 WorldToViewPosition(Vector3 screenPosition) {
|
||||
// throw new System.NotImplementedException();
|
||||
//}
|
||||
|
||||
public override bool ScreenToWorldObject<T>(Vector3 screenPosition, out T value) {
|
||||
return ScreenToWorldObject(screenPosition, out value, DefaultLayerMask);
|
||||
}
|
||||
public override bool ScreenToWorldObject<T>(Vector3 screenPosition, out T value, LayerMask planeLayerMask) {
|
||||
Vector3 viewPosition = ScreenToViewPosition(screenPosition);
|
||||
Ray ray = viewCamera.ViewportPointToRay(viewPosition);
|
||||
Physics.Raycast(ray, out hitInfo, 200, planeLayerMask);
|
||||
value = hitInfo.transform?.GetComponent<T>();
|
||||
return value != null;
|
||||
}
|
||||
public override bool ScreenToWorldObjectParent<T>(Vector3 screenPosition, out T value) {
|
||||
return ScreenToWorldObjectParent(screenPosition, out value, DefaultLayerMask);
|
||||
}
|
||||
public override bool ScreenToWorldObjectParent<T>(Vector3 screenPosition, out T value, LayerMask planeLayerMask) {
|
||||
Vector3 viewPosition = ScreenToViewPosition(screenPosition);
|
||||
Ray ray = viewCamera.ViewportPointToRay(viewPosition);
|
||||
Physics.Raycast(ray, out hitInfo, 200, planeLayerMask);
|
||||
value = hitInfo.transform?.GetComponentInParent<T>();
|
||||
return value != null;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 802326651d2bc7442aa201a7859a30e2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,91 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ViewCameraDesign : ModuleViewCamera {
|
||||
public Camera viewCamera;
|
||||
public Transform viewSpace;
|
||||
private RaycastHit hitInfo;
|
||||
private RenderTexture renderTexture;
|
||||
private readonly Vector3 CameraOffset = new Vector3(0, 0, -1.5f);
|
||||
|
||||
protected override void Awake() => ModuleCore.ViewCameraDesign = this;
|
||||
|
||||
public override Vector3 Position {
|
||||
get => viewCamera.transform.localPosition - CameraOffset;
|
||||
set => viewCamera.transform.localPosition = value + CameraOffset;
|
||||
}
|
||||
public override Vector3 EulerAngles {
|
||||
get => viewCamera.transform.eulerAngles;
|
||||
set => viewCamera.transform.eulerAngles = value;
|
||||
}
|
||||
public override float Scale {
|
||||
get => viewCamera.orthographicSize;
|
||||
set => viewCamera.orthographicSize = value;
|
||||
}
|
||||
public override Vector3 Up {
|
||||
get => viewCamera.transform.up;
|
||||
}
|
||||
public override Vector3 Right {
|
||||
get => viewCamera.transform.right;
|
||||
}
|
||||
public override Vector3 Forward {
|
||||
get => viewCamera.transform.forward;
|
||||
}
|
||||
public override Vector3 CameraPosition {
|
||||
get => viewCamera.transform.localPosition - CameraOffset;
|
||||
}
|
||||
public override RenderTexture RenderTexture {
|
||||
get => renderTexture;
|
||||
}
|
||||
|
||||
public override void UpdateRenderTexture(int x, int y) {
|
||||
renderTexture = new RenderTexture(x, y, 0);
|
||||
viewCamera.targetTexture = renderTexture;
|
||||
}
|
||||
public override Vector3 ScreenToViewPosition(Vector3 screenPosition) {
|
||||
float x = screenPosition.x / viewCamera.pixelWidth;
|
||||
float y = 1 - screenPosition.y / viewCamera.pixelHeight;
|
||||
Vector3 mouseRatio = new Vector3(x - 0.5f, y - 0.5f);
|
||||
float aspectRatio = (float)viewCamera.pixelWidth / viewCamera.pixelHeight;
|
||||
return new Vector3(mouseRatio.x * aspectRatio, mouseRatio.y) * 2;
|
||||
}
|
||||
public override Vector3 ScreenToWorldPosition(Vector3 screenPosition) {
|
||||
return ScreenToViewPosition(screenPosition) * Scale + Position;
|
||||
}
|
||||
|
||||
public override bool ScreenToWorldObject<T>(Vector3 screenPosition, out T value) {
|
||||
return ScreenToWorldObject(screenPosition, out value, DefaultLayerMask);
|
||||
}
|
||||
public override bool ScreenToWorldObject<T>(Vector3 screenPosition, out T value, LayerMask planeLayerMask) {
|
||||
Vector3 viewPosition = ScreenToViewPosition(screenPosition);
|
||||
Vector3 worldPosition = viewPosition * Scale + viewCamera.transform.position;
|
||||
Ray ray = new Ray(worldPosition, viewCamera.transform.forward);
|
||||
Physics.Raycast(ray, out hitInfo, 200, planeLayerMask);
|
||||
value = hitInfo.transform?.GetComponent<T>();
|
||||
return value != null;
|
||||
}
|
||||
public override bool ScreenToWorldObjectParent<T>(Vector3 screenPosition, out T value) {
|
||||
return ScreenToWorldObjectParent(screenPosition, out value, DefaultLayerMask);
|
||||
}
|
||||
public override bool ScreenToWorldObjectParent<T>(Vector3 screenPosition, out T value, LayerMask planeLayerMask) {
|
||||
Vector3 viewPosition = ScreenToViewPosition(screenPosition);
|
||||
Vector3 worldPosition = viewPosition * Scale + viewCamera.transform.position;
|
||||
Ray ray = new Ray(worldPosition, viewCamera.transform.forward);
|
||||
Physics.Raycast(ray, out hitInfo, 200, planeLayerMask);
|
||||
value = hitInfo.transform?.GetComponentInParent<T>();
|
||||
return value != null;
|
||||
}
|
||||
//public override Vector3 ViewToScreenPosition(Vector3 screenPosition) {
|
||||
// throw new System.NotImplementedException();
|
||||
//}
|
||||
//public override Vector3 ViewToWorldPosition(Vector3 screenPosition) {
|
||||
// throw new System.NotImplementedException();
|
||||
//}
|
||||
//public override Vector3 WorldToScreenPosition(Vector3 screenPosition) {
|
||||
// throw new System.NotImplementedException();
|
||||
//}
|
||||
//public override Vector3 WorldToViewPosition(Vector3 screenPosition) {
|
||||
// throw new System.NotImplementedException();
|
||||
//}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c639043240fd73545af704b1a6b52895
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f8f76170dafc9549adcb43c6b78e751
|
||||
guid: 6f35188dbbe4cee4b823e88d78deef5a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 生成可视化内容模块
|
||||
/// 可视化内容生成模块
|
||||
/// </summary>
|
||||
public abstract class ModuleVisual<Data> : MonoBehaviour {
|
||||
/// <summary> 必须要初始化 </summary>
|
||||
@@ -11,7 +11,7 @@ public abstract class ModuleVisual<Data> : MonoBehaviour {
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
|
||||
/// <summary> 更新可视化内容 </summary>
|
||||
/// <summary> 更新可视化 </summary>
|
||||
public abstract void UpdateVisual(Data data);
|
||||
/// <summary> 释放可视化内容 </summary>
|
||||
public abstract void ReleaseVisual(Data data);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32a3e92bdd9f12a4dbaeadda30a66075
|
||||
guid: 1681bcfa66dacbd4e810d15939fa7e04
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
//public class VisualBaking : ModuleVisual<DataPlate> {
|
||||
// public Transform viewSpace;
|
||||
// public Transform platePrefab;//板片
|
||||
// public Transform suturePrefab;//缝合
|
||||
// public Transform sutureSidePrefab;//缝合边
|
||||
|
||||
// protected override void Awake() => ModuleCore.VisualBaking = this;
|
||||
|
||||
// public override void UpdateVisual(DataPlate plate) {
|
||||
// //更新板片
|
||||
// Create(ref plate.baking, platePrefab, viewSpace);
|
||||
// plate.baking.UpdateVisual(plate);
|
||||
// //子数据父对象
|
||||
// Transform parent = plate.design.transform;
|
||||
// //更新线段
|
||||
// plate.sides.ForEach(obj => UpdateVisual(obj, parent));
|
||||
// }
|
||||
// public override void ReleaseVisual(DataPlate data) {
|
||||
// throw new System.NotImplementedException();
|
||||
// }
|
||||
|
||||
// private void UpdateVisual(DataSide side, Transform parent) {
|
||||
// //Create(ref side.design, sidePrefab, parent);
|
||||
// //side.design.UpdateVisual(side);
|
||||
// //更新缝合线
|
||||
// if (side.suture == null) { return; }
|
||||
// //side.suture.Update();
|
||||
// UpdateVisual(side.suture, viewSpace);
|
||||
// }
|
||||
// /// <summary> 更新缝合数据 </summary>
|
||||
// private void UpdateVisual(DataSuture suture, Transform parent) {
|
||||
// Create(ref suture.baking, suturePrefab, parent);
|
||||
// UpdateVisual(suture.a, suture.baking.transform);
|
||||
// UpdateVisual(suture.b, suture.baking.transform);
|
||||
// suture.baking.UpdateVisual(suture);
|
||||
// }
|
||||
// /// <summary> 更新缝合边 </summary>
|
||||
// private void UpdateVisual(DataSutureSide sutureSide, Transform parent) {
|
||||
// Create(ref sutureSide.baking, sutureSidePrefab, parent);
|
||||
// sutureSide.baking.UpdateVisual(sutureSide);
|
||||
// }
|
||||
//}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 545b7804867d268448f7089215e20f39
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 连接可视化模块
|
||||
/// </summary>
|
||||
public class VisualConnector : ModuleVisual<DataConnector> {
|
||||
public Transform viewSpace;
|
||||
public Transform connectorPrefab;//板片
|
||||
|
||||
protected override void Awake() => ModuleCore.VisualConnector = this;
|
||||
|
||||
public override void UpdateVisual(DataConnector data) {
|
||||
//更新板片
|
||||
Create(ref data.visual, connectorPrefab, viewSpace);
|
||||
data.visual.UpdateVisual(data);
|
||||
}
|
||||
public override void ReleaseVisual(DataConnector data) {
|
||||
if (data.visual != null) {
|
||||
Destroy(data.visual.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea4effe5ac0300348b249f05af7bf201
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,57 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 版片可视化模块
|
||||
/// </summary>
|
||||
//public class VisualDesign : ModuleVisual<DataPlate> {
|
||||
// public Transform viewSpace;
|
||||
// public Transform platePrefab;//板片
|
||||
// public Transform pointPrefab;//点
|
||||
// public Transform sidePrefab;//边
|
||||
// public Transform suturePrefab;//缝合
|
||||
// public Transform sutureSidePrefab;//缝合边
|
||||
|
||||
// protected override void Awake() => ModuleCore.VisualDesign = this;
|
||||
|
||||
// public override void UpdateVisual(DataPlate plate) {
|
||||
// //更新板片
|
||||
// Create(ref plate.design, platePrefab, viewSpace);
|
||||
// plate.design.UpdateVisual(plate);
|
||||
// //子数据父对象
|
||||
// Transform parent = plate.design.transform;
|
||||
// //更新点
|
||||
// plate.points.ForEach(obj => UpdateVisual(obj, parent));
|
||||
// //更新线段
|
||||
// plate.sides.ForEach(obj => UpdateVisual(obj, parent));
|
||||
// }
|
||||
// public override void ReleaseVisual(DataPlate data) {
|
||||
// throw new System.NotImplementedException();
|
||||
// }
|
||||
|
||||
// private void UpdateVisual(DataPoint point, Transform parent) {
|
||||
// Create(ref point.visual, pointPrefab, parent);
|
||||
// point.visual.UpdateVisual(point);
|
||||
// }
|
||||
// private void UpdateVisual(DataSide side, Transform parent) {
|
||||
// Create(ref side.design, sidePrefab, parent);
|
||||
// side.design.UpdateVisual(side);
|
||||
// //更新缝合线
|
||||
// if (side.suture == null) { return; }
|
||||
// side.suture.Update();
|
||||
// UpdateVisual(side.suture, viewSpace);
|
||||
// }
|
||||
// /// <summary> 更新缝合数据 </summary>
|
||||
// private void UpdateVisual(DataSuture suture, Transform parent) {
|
||||
// Create(ref suture.design, suturePrefab, parent);
|
||||
// UpdateVisual(suture.a, suture.design.transform);
|
||||
// UpdateVisual(suture.b, suture.design.transform);
|
||||
// suture.design.UpdateVisual(suture);
|
||||
// }
|
||||
// /// <summary> 更新缝合边 </summary>
|
||||
// private void UpdateVisual(DataSutureSide sutureSide, Transform parent) {
|
||||
// Create(ref sutureSide.design, sutureSidePrefab, parent);
|
||||
// sutureSide.design.UpdateVisual(sutureSide);
|
||||
// }
|
||||
//}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce128d679e2869147a5b5306cef090e3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,46 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class VisualPlateBaking : ModuleVisual<DataPlate> {
|
||||
public Transform viewSpace;
|
||||
public Transform platePrefab;//板片
|
||||
public Transform suturePrefab;//缝合
|
||||
public Transform sutureSidePrefab;//缝合边
|
||||
|
||||
protected override void Awake() => ModuleCore.VisualPlateBaking = this;
|
||||
|
||||
public override void UpdateVisual(DataPlate plate) {
|
||||
//更新板片
|
||||
Create(ref plate.bakingPrefab, platePrefab, viewSpace);
|
||||
plate.bakingPrefab.UpdateVisual(plate);
|
||||
//子数据父对象
|
||||
Transform parent = plate.designPrefab.transform;
|
||||
//更新线段
|
||||
plate.plateSides.ForEach(obj => UpdateVisual(obj, parent));
|
||||
}
|
||||
public override void ReleaseVisual(DataPlate data) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
private void UpdateVisual(DataPlateSide side, Transform parent) {
|
||||
//Create(ref side.design, sidePrefab, parent);
|
||||
//side.design.UpdateVisual(side);
|
||||
//更新缝合线
|
||||
//if (side.suture == null) { return; }
|
||||
//side.suture.Update();
|
||||
//UpdateVisual(side.suture, viewSpace);
|
||||
}
|
||||
/// <summary> 更新缝合数据 </summary>
|
||||
private void UpdateVisual(DataSuture suture, Transform parent) {
|
||||
Create(ref suture.baking, suturePrefab, parent);
|
||||
UpdateVisual(suture.a, suture.baking.transform);
|
||||
UpdateVisual(suture.b, suture.baking.transform);
|
||||
suture.baking.UpdateVisual(suture);
|
||||
}
|
||||
/// <summary> 更新缝合边 </summary>
|
||||
private void UpdateVisual(DataSutureSide sutureSide, Transform parent) {
|
||||
Create(ref sutureSide.baking, sutureSidePrefab, parent);
|
||||
sutureSide.baking.UpdateVisual(sutureSide);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef4a839345dfb344382e257d374ca3ed
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,41 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 版片可视化模块
|
||||
/// </summary>
|
||||
public class VisualPlateDesign : ModuleVisual<DataPlate> {
|
||||
public Transform viewSpace;
|
||||
public Transform platePrefab;//板片
|
||||
public Transform pointPrefab;//点
|
||||
public Transform sidePrefab;//边
|
||||
|
||||
protected override void Awake() => ModuleCore.VisualPlateDesign = this;
|
||||
|
||||
public override void UpdateVisual(DataPlate plate) {
|
||||
//更新板片
|
||||
Create(ref plate.designPrefab, platePrefab, viewSpace);
|
||||
plate.designPrefab.UpdateVisual(plate);
|
||||
//子数据父对象
|
||||
Transform parent = plate.designPrefab.transform;
|
||||
//更新点
|
||||
plate.platePoints.ForEach(obj => UpdateVisual(obj, parent));
|
||||
//更新线段
|
||||
plate.plateSides.ForEach(obj => UpdateVisual(obj, parent));
|
||||
}
|
||||
public override void ReleaseVisual(DataPlate data) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
private void UpdateVisual(DataPlatePoint point, Transform parent) {
|
||||
Create(ref point.visual, pointPrefab, parent);
|
||||
point.visual.UpdateVisual(point);
|
||||
}
|
||||
private void UpdateVisual(DataPlateSide side, Transform parent) {
|
||||
Create(ref side.designPrefab, sidePrefab, parent);
|
||||
side.designPrefab.UpdateVisual(side);
|
||||
//更新缝合线
|
||||
if (side.suture != null) { side.suture.UpdateVisual(); }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9827f83f79c2af42b2a06bdc3c80719
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,31 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 缝合烘焙可视化模块
|
||||
/// </summary>
|
||||
public class VisualSutureBaking : ModuleVisual<DataSuture> {
|
||||
public Transform viewSpace;
|
||||
public Transform suturePrefab;//缝合
|
||||
public Transform sutureSidePrefab;//缝合边
|
||||
|
||||
protected override void Awake() => ModuleCore.VisualSutureBaking = this;
|
||||
|
||||
public override void UpdateVisual(DataSuture suture) {
|
||||
Create(ref suture.baking, suturePrefab, viewSpace);
|
||||
suture.baking.UpdateVisual(suture);
|
||||
|
||||
UpdateVisual(suture.a, suture.baking.transform);
|
||||
UpdateVisual(suture.b, suture.baking.transform);
|
||||
}
|
||||
public override void ReleaseVisual(DataSuture data) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary> 更新缝合边 </summary>
|
||||
private void UpdateVisual(DataSutureSide sutureSide, Transform parent) {
|
||||
Create(ref sutureSide.baking, sutureSidePrefab, parent);
|
||||
sutureSide.baking.UpdateVisual(sutureSide);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06ff2a0f351be2d41aa7c8dfc23798e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,31 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 缝合设计可视化模块
|
||||
/// </summary>
|
||||
public class VisualSutureDesign : ModuleVisual<DataSuture> {
|
||||
public Transform viewSpace;
|
||||
public Transform suturePrefab;//缝合
|
||||
public Transform sutureSidePrefab;//缝合边
|
||||
|
||||
protected override void Awake() => ModuleCore.VisualSutureDesign = this;
|
||||
|
||||
public override void UpdateVisual(DataSuture suture) {
|
||||
Create(ref suture.design, suturePrefab, viewSpace);
|
||||
suture.design.UpdateVisual(suture);
|
||||
|
||||
UpdateVisual(suture.a, suture.design.transform);
|
||||
UpdateVisual(suture.b, suture.design.transform);
|
||||
}
|
||||
public override void ReleaseVisual(DataSuture data) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary> 更新缝合边 </summary>
|
||||
private void UpdateVisual(DataSutureSide sutureSide, Transform parent) {
|
||||
Create(ref sutureSide.design, sutureSidePrefab, parent);
|
||||
sutureSide.design.UpdateVisual(sutureSide);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a43eabbe6a52df943b5157da8933dd33
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user