This commit is contained in:
2025-06-29 21:28:49 +08:00
parent b85e29c540
commit 0f77ad6ad3
12 changed files with 16156 additions and 16017 deletions

View File

@@ -68,7 +68,7 @@ namespace Dreamteck.Splines
{
float last = _spline.knotParametrization;
_spline.knotParametrization = value;
if(last != _spline.knotParametrization)
if (last != _spline.knotParametrization)
{
Rebuild(true);
}
@@ -217,7 +217,7 @@ namespace Dreamteck.Splines
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public SplineSample this [int index]
public SplineSample this[int index]
{
get
{
@@ -239,7 +239,8 @@ namespace Dreamteck.Splines
/// </summary>
public Vector3 position
{
get {
get
{
#if UNITY_EDITOR
if (!_editorIsPlaying) return transform.position;
#endif
@@ -251,7 +252,8 @@ namespace Dreamteck.Splines
/// </summary>
public Quaternion rotation
{
get {
get
{
#if UNITY_EDITOR
if (!_editorIsPlaying) return transform.rotation;
#endif
@@ -263,7 +265,8 @@ namespace Dreamteck.Splines
/// </summary>
public Vector3 scale
{
get {
get
{
#if UNITY_EDITOR
if (!_editorIsPlaying) return transform.lossyScale;
#endif
@@ -419,7 +422,7 @@ namespace Dreamteck.Splines
private void RunUpdate(bool immediate = false)
{
bool transformChanged = ResampleTransformIfNeeded();
if(_sampleCollection.samples.Length != _rawSamples.Length)
if (_sampleCollection.samples.Length != _rawSamples.Length)
{
transformChanged = true;
}
@@ -440,7 +443,8 @@ namespace Dreamteck.Splines
if (transformChanged)
{
SplineThreading.Run(CalculateWithoutTransform);
} else
}
else
{
SplineThreading.Run(CalculateWithTransform);
}
@@ -732,7 +736,7 @@ namespace Dreamteck.Splines
for (int i = 0; i < points.Length; i++)
{
SplinePoint newPoint = points[i];
if(_spline.points.Length > i)
if (_spline.points.Length > i)
{
newPoint.isDirty = _spline.points[i].isDirty;
}
@@ -966,7 +970,7 @@ namespace Dreamteck.Splines
if (_originalSamplePercents[i] < percent)
{
double inverseLerp = DMath.InverseLerp(_originalSamplePercents[i], _originalSamplePercents[i + 1], percent);
return DMath.Lerp(_rawSamples[i].percent, _rawSamples[i+1].percent, inverseLerp);
return DMath.Lerp(_rawSamples[i].percent, _rawSamples[i + 1].percent, inverseLerp);
}
}
return 0.0;
@@ -1098,7 +1102,8 @@ namespace Dreamteck.Splines
{
_spline.Evaluate(percent, ref result);
TransformSample(ref result);
} else
}
else
{
UpdateSampleCollection();
_sampleCollection.Evaluate(percent, ref result);
@@ -1446,7 +1451,8 @@ namespace Dreamteck.Splines
if (_sampleMode == SampleMode.Optimized && _rawSamples.Length > 2)
{
OptimizeSamples(_space == Space.Local);
} else
}
else
{
for (int i = 0; i < _rawSamples.Length; i++)
{
@@ -1468,7 +1474,7 @@ namespace Dreamteck.Splines
int from = currentPoint - 1;
int to = currentPoint + 2;
if(_spline.type == Spline.Type.Bezier || _spline.type == Spline.Type.Linear)
if (_spline.type == Spline.Type.Bezier || _spline.type == Spline.Type.Linear)
{
from = currentPoint;
to = currentPoint + 1;
@@ -1487,7 +1493,7 @@ namespace Dreamteck.Splines
if (_spline.isClosed)
{
if(from < 0)
if (from < 0)
{
for (int i = from + _spline.points.Length; i < _spline.points.Length; i++)
{
@@ -1498,7 +1504,7 @@ namespace Dreamteck.Splines
}
}
if(to >= _spline.points.Length)
if (to >= _spline.points.Length)
{
for (int i = 0; i <= to - _spline.points.Length; i++)
{
@@ -1519,7 +1525,7 @@ namespace Dreamteck.Splines
}
double currentPointPercent = (double)currentPoint / count;
if(Mathf.Abs((float)(currentPointPercent - percent)) <= 0.00001f)
if (Mathf.Abs((float)(currentPointPercent - percent)) <= 0.00001f)
{
return _spline.points[currentPoint - 1].isDirty;
}
@@ -1557,14 +1563,16 @@ namespace Dreamteck.Splines
{
if (!_spline.isClosed)
{
if(_spline.points.Length >= 3)
if (_spline.points.Length >= 3)
{
_spline.Close();
SetAllDirty();
Rebuild();
} else
}
else
{
Debug.LogError("Spline " + name + " needs at least 3 points before it can be closed. Current points: " + _spline.points.Length);
this.name = "Error:Spline " + name + " needs at least 3 points before it can be closed.";
//Debug.LogError("Spline " + name + " needs at least 3 points before it can be closed. Current points: " + _spline.points.Length);
}
}
@@ -1591,7 +1599,7 @@ namespace Dreamteck.Splines
/// <param name="hitTriggers">Should hit triggers? (not supported in 5.1)</param>
/// <param name="address">Node address of junctions</param>
/// <returns></returns>
public bool Raycast(out RaycastHit hit, out double hitPercent, LayerMask layerMask, double resolution = 1.0, double from = 0.0, double to = 1.0 , QueryTriggerInteraction hitTriggers = QueryTriggerInteraction.UseGlobal)
public bool Raycast(out RaycastHit hit, out double hitPercent, LayerMask layerMask, double resolution = 1.0, double from = 0.0, double to = 1.0, QueryTriggerInteraction hitTriggers = QueryTriggerInteraction.UseGlobal)
{
resolution = DMath.Clamp01(resolution);
Spline.FormatFromTo(ref from, ref to, false);
@@ -1680,7 +1688,7 @@ namespace Dreamteck.Splines
public void RemoveTrigger(int triggerGroup, int triggerIndex)
{
if(triggerGroups.Length <= triggerGroup || triggerGroup < 0)
if (triggerGroups.Length <= triggerGroup || triggerGroup < 0)
{
Debug.LogError("Cannot delete trigger - trigger group " + triggerIndex + " does not exist");
return;
@@ -1733,7 +1741,7 @@ namespace Dreamteck.Splines
{
for (int i = 0; i < _nodes.Length; i++)
{
if(_nodes[i].pointIndex == pointIndex) return _nodes[i].GetConnections(this);
if (_nodes[i].pointIndex == pointIndex) return _nodes[i].GetConnections(this);
}
return new List<Node.Connection>();
}
@@ -1862,7 +1870,7 @@ namespace Dreamteck.Splines
public void TransferNode(int pointIndex, int newPointIndex)
{
if(newPointIndex < 0 || newPointIndex >= _spline.points.Length)
if (newPointIndex < 0 || newPointIndex >= _spline.points.Length)
{
Debug.LogError("Invalid new point index " + newPointIndex);
return;
@@ -1873,7 +1881,7 @@ namespace Dreamteck.Splines
return;
}
Node node = GetNode(pointIndex);
if(node == null)
if (node == null)
{
Debug.LogError("No node connected to point " + pointIndex);
return;
@@ -1889,7 +1897,7 @@ namespace Dreamteck.Splines
{
int from = endIndex;
int to = startIndex;
if(startIndex > endIndex)
if (startIndex > endIndex)
{
from = startIndex;
to = endIndex;
@@ -1930,7 +1938,8 @@ namespace Dreamteck.Splines
{
if (direction == Spline.Direction.Forward) condition = _nodes[i].pointIndex >= pointValue;
else condition = _nodes[i].pointIndex <= pointValue;
} else
}
else
{
}
@@ -1939,7 +1948,8 @@ namespace Dreamteck.Splines
Node.Connection[] connections = _nodes[i].node.GetConnections();
for (int j = 0; j < connections.Length; j++)
{
if (connections[j].spline != this) {
if (connections[j].spline != this)
{
computers.Add(connections[j].spline);
connectionIndices.Add(_nodes[i].pointIndex);
connectedIndices.Add(connections[j].pointIndex);
@@ -2035,9 +2045,9 @@ namespace Dreamteck.Splines
continue;
}
bool found = false;
foreach(Node.Connection connection in _nodes[i].node.GetConnections())
foreach (Node.Connection connection in _nodes[i].node.GetConnections())
{
if(connection.spline == this)
if (connection.spline == this)
{
found = true;
break;
@@ -2071,7 +2081,7 @@ namespace Dreamteck.Splines
Node.Connection[] connections = _nodes[i].node.GetConnections();
for (int j = 0; j < connections.Length; j++)
{
if(connections[j].spline == this && connections[j].pointIndex == _nodes[i].pointIndex)
if (connections[j].spline == this && connections[j].pointIndex == _nodes[i].pointIndex)
{
found = true;
break;
@@ -2080,7 +2090,8 @@ namespace Dreamteck.Splines
if (found)
{
_nodes[i].node.UpdatePoint(this, _nodes[i].pointIndex, GetPoint(_nodes[i].pointIndex));
} else
}
else
{
RemoveNodeLinkAt(i);
Rebuild();

View File

@@ -25,10 +25,10 @@ public class BuildAssetBundle
{
Directory.CreateDirectory(strABOutPAthDir);
}
return strABOutPAthDir;
}
private static void GenerateAbstracts(AssetBundleManifest manifest)
{
List<string> themeBundles = manifest.GetAllAssetBundles().ToList();
@@ -43,7 +43,7 @@ public class BuildAssetBundle
}
}
}
[MenuItem("AssetBundleTools/BuildToWindows64")]
public static void BuildToWindows64()
{
@@ -51,7 +51,7 @@ public class BuildAssetBundle
AssetBundleManifest manifestWin64 = BuildPipeline.BuildAssetBundles(uri, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);
GenerateAbstracts(manifestWin64);
}
[MenuItem("AssetBundleTools/BuildToOSX")]
public static void BuildToOSX()
{
@@ -59,4 +59,16 @@ public class BuildAssetBundle
AssetBundleManifest manifestOSX = BuildPipeline.BuildAssetBundles(uri, BuildAssetBundleOptions.None, BuildTarget.StandaloneOSX);
GenerateAbstracts(manifestOSX);
}
[MenuItem("Tools/移除丢失的脚本")]
public static void RemoveMissingScript()
{
foreach (GameObject gameObject in Resources.FindObjectsOfTypeAll(typeof(GameObject)))
{
GameObjectUtility.RemoveMonoBehavioursWithMissingScript(gameObject);
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -46,6 +46,7 @@ namespace Ichni.Editor
{
UpdateUIScale();
}
public void UpdateUIScale()
{
Canvas.ForceUpdateCanvases();
@@ -59,7 +60,7 @@ namespace Ichni.Editor
hierarchy.GetComponent<RectTransform>().sizeDelta = new Vector2(hierarchy.GetComponent<RectTransform>().sizeDelta.x,
HierarchyTopLocatedPoint.transform.localPosition.y - HierarchyBottomLocatedPoint.transform.localPosition.y);
hierarchy.transform.localPosition = new Vector3(hierarchy.transform.localPosition.x, HierarchyTopLocatedPoint.transform.localPosition.y - (hierarchy.GetComponent<RectTransform>().sizeDelta.y / 2f), 0);
hierarchy.addFolderButton.transform.position = new Vector3(hierarchy.addFolderButton.transform.position.x, HierarchyBottomLocatedPoint.transform.position.y + 30, 0);
hierarchy.addFolderButton.transform.position = new Vector3(hierarchy.addFolderButton.transform.position.x, HierarchyBottomLocatedPoint.transform.position.y + hierarchy.addFolderButton.GetComponent<RectTransform>().sizeDelta.y / 2f, 0);

View File

@@ -34,25 +34,25 @@ namespace Ichni.Editor
public ScrollRect scrollRect;
public Vector2 vector2;
public void FindTab(GameElement targetElement, bool findparent = false)
public void FindTab(GameElement targetElement)
{
//targetElement.SetUpInspector();
StartCoroutine(TryGetTab(targetElement));
targetElement.ScanAndAddEnableTypes();
if (!EditorManager.instance.ExpandWhileClick)
{
var tab = EditorManager.instance.uiManager.hierarchy.GenerateTab(targetElement, null);
tab.SelectGameElement();
Destroy(tab.gameObject);
EditorManager.instance.uiManager.hierarchy.tabList.Remove(tab);
}
else
{
StartCoroutine(TryGetTab(targetElement));
}
}
public IEnumerator TryGetTab(GameElement targetElement)
{
// targetElement.ScanAndAddEnableTypes();
// if (!targetElement.GetChildrenByTypes().Contains(targetElement))
// {
// var tab = EditorManager.instance.uiManager.hierarchy.GenerateTab(targetElement, null);
// tab.SelectGameElement();
// Destroy(tab.gameObject);
// EditorManager.instance.uiManager.hierarchy.tabList.Remove(tab);
// yield break;
// }
// EditorManager.instance.uiManager.inspector.ClearInspector();
// EditorManager.instance.uiManager.inspector.SetInspector(targetElement);
//StandardInspectionElement.GenerateForLoading();
// 1. 向上找到最近的有Tab的祖先
Stack<GameElement> stack = new Stack<GameElement>();
GameElement current = targetElement;
@@ -74,11 +74,15 @@ namespace Ichni.Editor
{
elem.parentElement.connectedTab.ExpandOrFold(true);
}
else
else if (elem.parentElement.connectedTab.ienumerator is null)
{
elem.parentElement.connectedTab.ExpandOrFold();
elem.parentElement.connectedTab.ExpandOrFold(true);//合上再展开,这思路也是没谁了
}
else
{
//他就在展开了,等下就好了
}
yield return null;
}
// 等待当前elem的Tab生成
@@ -122,5 +126,6 @@ namespace Ichni.Editor
scrollRect.verticalNormalizedPosition = normalized;
finalTab.SelectGameElement();
}
}
}

View File

@@ -125,7 +125,7 @@ namespace Ichni.Editor
EditorManager.instance.uiManager.inspector.SetInspector(connectedGameElement);
EditorManager.instance.timeline.SetTimeLine(connectedGameElement);
}
private IEnumerator ienumerator = null;
public IEnumerator ienumerator = null;
public void ExpandOrFold()
{
ExpandOrFold(false);
@@ -182,12 +182,12 @@ namespace Ichni.Editor
}
private IEnumerator ExpandOverTime(List<GameElement> FixedList)//帧率过低的时候等一下再实例化
{
float StrandTimeWhileStartUp = EditorManager.instance.CurrentFrameRate;
float startTime = Time.realtimeSinceStartup;
for (var index = 0; index < FixedList.Count; index++)
{
int hasYield = 0;
while (Time.realtimeSinceStartup - startTime > 1f / EditorManager.instance.editorSettings.frameRate * 3f && hasYield <= 2)
while (Time.realtimeSinceStartup - startTime > 1f / StrandTimeWhileStartUp * 3f && hasYield <= 2)
{
yield return null;
hasYield += 1;

View File

@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Ichni.Editor;
using Ichni.RhythmGame.Beatmap;
using Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse;
@@ -94,6 +95,7 @@ namespace Ichni.RhythmGame
{
var container = inspector.GenerateContainer(effect.Key);
var subcontainer = container.GenerateSubcontainer(3);
//都有dictonary了想个办法做Dropdown
var effectNameInputField = inspector.GenerateInputField(subcontainer, "Effect Name");
var addEffectButton = inspector.GenerateButton(this, subcontainer, "Add Effect", () =>
{
@@ -325,13 +327,13 @@ namespace Ichni.RhythmGame
}
/// <summary>
/// 如果效果被打断主要对于Holding Effect则触发这个方法
/// </summary>
public virtual void Disrupt()
{
}
/// <summary>

View File

@@ -225,7 +225,7 @@ namespace Ichni.RhythmGame
// 只用反射方式生成enableTypes的UI
if (enableTypes != null && enableTypes.Count > 0)
{
var elcontainer = inspector.GenerateContainer("Enable Children DisPlay");
var elcontainer = inspector.GenerateContainer("Enable Children Display");
var enableTypeContainer = elcontainer.GenerateSubcontainer(3);
var type = enableTypes.GetType().GetGenericArguments()[0];
int elcount = 0;

View File

@@ -63,7 +63,7 @@ namespace Ichni.RhythmGame
public void ClosePath()
{
if (isClosed)
if (isClosed && pathNodeList.Count > 2)
{
path.Close();
}

View File

@@ -7,6 +7,7 @@ using Ichni.RhythmGame;
using Ichni.RhythmGame.Beatmap;
using Ichni.RhythmGame.ThemeBundles.Basic;
using Sirenix.OdinInspector;
using TMPro;
using UnityEngine;
namespace Ichni
@@ -37,7 +38,8 @@ namespace Ichni
public CommandScripts commandScripts;
public NoteBase.NoteJudgeType currentJudgeType;
public bool useNotePrefab;
public bool useNotePrefab = true;
public bool ExpandWhileClick = false;
public BasePrefabsCollection basePrefabs;
public Dictionary<string, CustomPrefabsCollection> customPrefabs;
public NoteAudioCollection noteAudioCollection;
@@ -68,6 +70,8 @@ namespace Ichni
private void Start()
{
StartCoroutine(StartFrameRate());
this.elementName = "EditorManager";
this.elementGuid = Guid.Empty;
uiManager.hierarchy.GenerateTab(this, null);
@@ -85,7 +89,23 @@ namespace Ichni
isLoaded = true;
}
public float CurrentFrameRate;
public TMP_Text FPStext;
private IEnumerator StartFrameRate()
{
int frameCount = 0;
while (true)
{
CurrentFrameRate = 1f / Time.deltaTime;
if (frameCount == 2)
{
frameCount = 0;
FPStext.text = string.Format("{0:N2}", CurrentFrameRate);
}
frameCount++;
yield return null;
}
}
private void Update()
{
if (isLoaded) projectManager.autoSaveManager.UpdateAutoSave();
@@ -124,6 +144,9 @@ namespace Ichni
var useNotePrefabToggle =
inspector.GenerateToggle(this, inGameSettings, "Use Note Prefab", nameof(useNotePrefab));
var ExpandWhileClickToggle =
inspector.GenerateToggle(this, inGameSettings, "Expand Tab While Click", nameof(ExpandWhileClick));
var generation = container.GenerateSubcontainer(3);
var generateFolderButton =
inspector.GenerateButton(this, generation, "Generate Folder",