初始化项目

This commit is contained in:
MuHua-123
2024-12-02 17:16:44 +08:00
parent 698464b9d7
commit 0ff284b795
327 changed files with 87 additions and 21751 deletions
-33
View File
@@ -1,33 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class DataSideTool {
public static void SetBezierPositionA(this DataPlateSide side, Vector3 position) {
if (side.bezier == Bezier.) { return; }
if (side.bezier == Bezier.) { side.bBezier = position; }
side.aBezier = position;
}
public static void SetBezierPositionB(this DataPlateSide side, Vector3 position) {
if (side.bezier == Bezier.) { return; }
if (side.bezier == Bezier.) { side.aBezier = position; }
side.bBezier = position;
}
public static void OneRankBezier(this DataPlateSide side) {
side.bezier = Bezier.;
}
public static void TwoRankBezier(this DataPlateSide side) {
side.bezier = Bezier.;
DataPlatePoint a = side.aPoint;
DataPlatePoint b = side.bPoint;
side.aBezier = a.position + (b.position - a.position) * 0.5f;
side.bBezier = a.position + (b.position - a.position) * 0.5f;
}
public static void ThreeRankBezier(this DataPlateSide side) {
side.bezier = Bezier.;
DataPlatePoint a = side.aPoint;
DataPlatePoint b = side.bPoint;
side.aBezier = a.position + (b.position - a.position) * 0.3f;
side.bBezier = a.position + (b.position - a.position) * 0.7f;
}
}
-11
View File
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d2976a2951aeed54fab8d29f912822f4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-12
View File
@@ -1,12 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class DataSutureTool {
//public static float SutureLength(this DataSuture suture) {
// if (suture.a.MaxLength < suture.b.MaxLength) {
// return suture.a.MaxLength;
// }
// else { return suture.b.MaxLength; }
//}
}
-11
View File
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 37c96b1f560cfb14caa5c758ce900239
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-48
View File
@@ -1,48 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GridTool<Data> {
public Data[,] array;
public readonly int wide;
public readonly int high;
/// <summary> 初始化网格 </summary>
public GridTool(int wide, int high, Func<int, int, Data> generate) {
this.wide = wide;
this.high = high;
array = new Data[wide, high];
Loop((x, y) => { array[x, y] = generate(x, y); });
}
/// <summary> 循环网格获取x和y </summary>
public void Loop(Action<int, int> action) {
for (int y = 0; y < high; y++) {
for (int x = 0; x < wide; x++) { action?.Invoke(x, y); }
}
}
/// <summary> 校验xy是否超限 </summary>
public bool TryXY(int x, int y) {
return x >= 0 && x < wide && y >= 0 && y < high;
}
/// <summary> 强制写入数据,超过边界时写在边界 </summary>
public Data Get(int x, int y) {
x = Mathf.Clamp(x, 0, wide - 1);
y = Mathf.Clamp(y, 0, high - 1);
return array[x, y];
}
/// <summary> 强制读取数据,超过边界时读取边界 </summary>
public void Set(int x, int y, Data data) {
x = Mathf.Clamp(x, 0, wide - 1);
y = Mathf.Clamp(y, 0, high - 1);
array[x, y] = data;
}
/// <summary> 校验xy是否超限 读取正确范围内的数据 </summary>
public bool TryGet(int x, int y, out Data data) {
data = Get(x, y); return TryXY(x, y);
}
/// <summary> 校验xy是否超限 写入正确范围内的数据 </summary>
public bool TrySet(int x, int y, Data data) {
if (TryXY(x, y)) { array[x, y] = data; return true; }
else { return false; }
}
}
-11
View File
@@ -1,11 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 图层遮罩工具
/// </summary>
public static class LayerMaskTool {
/// <summary> 安排点图层遮罩 </summary>
public static readonly LayerMask Arrange = 1 << LayerMask.NameToLayer("Arrange");
}
-11
View File
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f6c7eea6439008142b8aaeae1445a351
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-21
View File
@@ -1,21 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class LoopIndexTool {
/// <summary> 头尾循环标准化索引 </summary>
public static Data LoopIndex<Data>(this List<Data> list, int index) {
return list[LoopIndex(index, list.Count)];
}
/// <summary> 头尾循环标准化索引 </summary>
public static Data LoopIndex<Data>(this Data[] array, int index) {
return array[LoopIndex(index, array.Length)];
}
/// <summary> 头尾循环标准化索引 </summary>
public static int LoopIndex(int index, int maxIndex) {
if (maxIndex == 0) { Debug.LogError("错误索引:maxIndex = 0"); return 0; }
if (index < 0) { return LoopIndex(index + maxIndex, maxIndex); }
if (index >= maxIndex) { return LoopIndex(index - maxIndex, maxIndex); }
return index;
}
}
-11
View File
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 6c9df3d905e1531439a43a695934de29
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+15
View File
@@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 模块基类
/// </summary>
/// <typeparam name="ModuleCore"></typeparam>
public class Module<ModuleCore> where ModuleCore : Module<ModuleCore>, new() {
/// <summary> 模块单例 </summary>
public static ModuleCore I => Instantiate();
private static ModuleCore core;
private static ModuleCore Instantiate() => core == null ? core = new ModuleCore() : core;
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0d586f3bf8d81b64da59700b2f31c48a
guid: 86acb6fd9f576cc458df7bcc1581c098
MonoImporter:
externalObjects: {}
serializedVersion: 2
-10
View File
@@ -1,10 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class VectorTool {
/// <summary> 向量的xyz和 </summary>
public static float VectorSum(this Vector3 v) {
return v.x + v.y + v.z;
}
}
-11
View File
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 3909cc8b21b91e740b86bb3a8ffcda0e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: