某些优化

This commit is contained in:
2025-05-11 14:12:47 +08:00
parent 002bb875a0
commit fe46514e73
11 changed files with 134 additions and 36 deletions

View File

@@ -147,8 +147,8 @@ namespace Dreamteck.Splines
private Spline[] _splines = new Spline[0];
[SerializeField]
[HideInInspector]
private bool _initializedInEditor = false;
//private bool _initializedInEditor = false;
//不把这些warning消掉就难受
private int iterations => _subdivisions * _otherComputers.Length;
protected override void Awake()
@@ -177,7 +177,7 @@ namespace Dreamteck.Splines
{
switch (mode)
{
case SubdivisionMode.BSpline: return Spline.Type.BSpline;
case SubdivisionMode.BSpline: return Spline.Type.BSpline;
case SubdivisionMode.Linear: return Spline.Type.Linear;
default: return Spline.Type.CatmullRom;
}
@@ -199,7 +199,8 @@ namespace Dreamteck.Splines
{
_splines[i] = new Spline(ModeToSplineType(_subdivisionMode));
}
} else
}
else
{
for (int i = 0; i < _splines.Length; i++)
{
@@ -208,7 +209,7 @@ namespace Dreamteck.Splines
}
base.BuildMesh();
AllocateMesh(sampleCount * (iterations + 1), iterations * (sampleCount-1) * 6);
AllocateMesh(sampleCount * (iterations + 1), iterations * (sampleCount - 1) * 6);
_tsMesh.triangles = MeshUtility.GeneratePlaneTriangles(sampleCount - 1, iterations + 1, false);
GenerateVertices();
_tsMesh.subMeshes.Clear();
@@ -251,7 +252,7 @@ namespace Dreamteck.Splines
{
_splines[j].points = new SplinePoint[_otherComputers.Length + 1];
}
double xPercent = DMath.Lerp(clipFrom, clipTo, (double)j / (sampleCount - 1));
if (i > 0)
{
@@ -275,7 +276,8 @@ namespace Dreamteck.Splines
if (uvMode == UVMode.UniformClamp || uvMode == UVMode.UniformClip)
{
AddUVDistance(x);
} else
}
else
{
GetSample(x, ref sample2);
}
@@ -292,11 +294,12 @@ namespace Dreamteck.Splines
ydist += Vector3.Distance(lastPos, sample.position);
}
lastPos = sample.position;
if (uvMode == UVMode.UniformClamp )
if (uvMode == UVMode.UniformClamp)
{
__uvs.x = CalculateUVUniformClamp(_vDist);
__uvs.y = CalculateUVUniformClamp(ydist);
} else if(uvMode == UVMode.UniformClip)
}
else if (uvMode == UVMode.UniformClip)
{
__uvs.x = CalculateUVUniformClip(_vDist);
__uvs.y = CalculateUVUniformClip(ydist);

View File

@@ -6034,6 +6034,81 @@ MonoBehaviour:
m_Calls: []
sliderAnimator: {fileID: 0}
saveValue: 0
--- !u!1 &1625893329
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1625893330}
- component: {fileID: 1625893332}
- component: {fileID: 1625893331}
m_Layer: 5
m_Name: Mask
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &1625893330
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1625893329}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4337614254416964847}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -0.0025024, y: -0.0025024}
m_SizeDelta: {x: 1440, y: 900}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1625893331
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1625893329}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.21960784, g: 1, b: 0, a: 0}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1625893332
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1625893329}
m_CullTransparentMesh: 1
--- !u!1 &1727811628
GameObject:
m_ObjectHideFlags: 0
@@ -9986,6 +10061,7 @@ MonoBehaviour:
type: 3}
loadTabList: {fileID: 4337614255290428456}
projectFileList: []
MemuMask: {fileID: 1625893331}
--- !u!224 &4337614253782299621
RectTransform:
m_ObjectHideFlags: 0
@@ -12198,6 +12274,7 @@ RectTransform:
- {fileID: 4337614255172217536}
- {fileID: 4337614253295634652}
- {fileID: 961677074}
- {fileID: 1625893330}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@@ -14457,7 +14534,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 4337614255116277774}
m_HandleRect: {fileID: 4337614255116277775}
m_Direction: 2
m_Value: 0
m_Value: 1
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:

View File

@@ -32,6 +32,8 @@ namespace Ichni.Editor
return tab;
}
public ScrollRect scrollRect;
public Vector2 vector2;
public void FindTab(GameElement targetElement, bool findparent = false)
{
if (findparent && targetElement.connectedTab != null)
@@ -47,8 +49,18 @@ namespace Ichni.Editor
FindTab(targetElement.parentElement, true);
targetElement.connectedTab.tabButton.onClick.Invoke();
}
GameElement gameElement = targetElement;
HierarchyTab tab = targetElement.connectedTab;
while (tab is null)
{
gameElement = gameElement.parentElement;
if (gameElement is null) return;
tab = gameElement.connectedTab;
}
float Tablocalpos = (-tab.transform.localPosition.y) - (tabContainer.sizeDelta.y / 4f);
float pct = Tablocalpos / tabContainer.sizeDelta.y;
scrollRect.verticalNormalizedPosition = 1f - pct;
}
}
}

View File

@@ -121,7 +121,7 @@ namespace Ichni.Editor
}
EditorManager.instance.uiManager.inspector.SetInspector(connectedGameElement);
EditorManager.instance.timeline.SetTimeLine(connectedGameElement); // TODO: Error
EditorManager.instance.timeline.SetTimeLine(connectedGameElement);
}
private void ExpandOrFold()

View File

@@ -8,20 +8,21 @@ namespace Ichni.RhythmGame
public class SelectSubmodule : SubmoduleBase
{
private GameElement elementToSelect;
public SelectSubmodule(GameElement attachedGameElement, GameElement elementToSelect = null) : base(attachedGameElement)
{
(attachedGameElement as IHaveSelectSubmodule).selectSubmodule = this;
(attachedGameElement).gameObject.layer = LayerMask.NameToLayer("Selectable");
this.elementToSelect = elementToSelect == null ? attachedGameElement : elementToSelect;
}
public void SelectGameElement()
{
EditorManager.instance.operationManager.ClearSelectedElements();
EditorManager.instance.operationManager.AddSelectElement(elementToSelect);
EditorManager.instance.uiManager.inspector.SetInspector(elementToSelect);
EditorManager.instance.timeline.SetTimeLine(elementToSelect);
EditorManager.instance.uiManager.hierarchy.FindTab(elementToSelect);
// EditorManager.instance.operationManager.ClearSelectedElements();
// EditorManager.instance.operationManager.AddSelectElement(elementToSelect);
// EditorManager.instance.uiManager.inspector.SetInspector(elementToSelect);
// EditorManager.instance.timeline.SetTimeLine(elementToSelect);
}
public override void SaveBM()

View File

@@ -30,7 +30,7 @@ namespace Ichni.Editor
gameElement.connectedTab.isSelected = true;
if (gameElement.connectedTab.BgImage != null)
{
gameElement.connectedTab.BgImage.color = new Color(0.5f, 0.5f, 0.5f, 0.2f);
gameElement.connectedTab.BgImage.color = new Color(0f, 0f, 0f, 0.8f);
}
}

View File

@@ -53,6 +53,7 @@ namespace Ichni
public void LoadThemeBundles(List<string> list)
{
LogWindow.text += "Loading ThemeBundles, Please wait...\n";
waitingBundleAmount = new IntReactiveProperty(list.Count);
Debug.Log("Waiting for " + list.Count + " AssetBundles to load.");
LogWindow.text += "Waiting for " + list.Count + " AssetBundles to load.\n";

View File

@@ -156,7 +156,7 @@ public class SampleWindow : MovableWindow//该window高度为300横的要在1
}//服了之后整合到controler里头去
}
public GameObject selectedGameObject = EventSystem.current.currentSelectedGameObject;
public GameObject selectedGameObject;
void Update()
{
selectedGameObject = EventSystem.current.currentSelectedGameObject;
@@ -254,22 +254,22 @@ public class SampleWindow : MovableWindow//该window高度为300横的要在1
switch (NoteCode)
{
case 0:
Tap a = Tap.GenerateElement("New Tap", Guid.NewGuid(), new List<string>(), true, gameElement, time);
Tap a = Tap.GenerateElement("New Tap", Guid.NewGuid(), new List<string>(), false, gameElement, time);
noteBases.Add(a);
SpawnNote(a);
break;
case 3:
Hold b = Hold.GenerateElement("New Hold", Guid.NewGuid(), new List<string>(), true, gameElement, time, time + 0.5f);
Hold b = Hold.GenerateElement("New Hold", Guid.NewGuid(), new List<string>(), false, gameElement, time, time + 0.5f);
noteBases.Add(b);
SpawnNote(b);
break;
case 1:
Stay c = Stay.GenerateElement("New Stay", Guid.NewGuid(), new List<string>(), true, gameElement, time);
Stay c = Stay.GenerateElement("New Stay", Guid.NewGuid(), new List<string>(), false, gameElement, time);
noteBases.Add(c);
SpawnNote(c);
break;
case 2:
Flick d = Flick.GenerateElement("New Flick", Guid.NewGuid(), new List<string>(), true, gameElement, time, new List<Vector2>());
Flick d = Flick.GenerateElement("New Flick", Guid.NewGuid(), new List<string>(), false, gameElement, time, new List<Vector2>());
noteBases.Add(d);
SpawnNote(d);
break;

View File

@@ -5,9 +5,10 @@ using System.Linq;
using Ichni.RhythmGame.Beatmap;
using Lean.Pool;
using UnityEngine;
using UnityEngine.UI;
namespace Ichni.StartMenu
{
{
public class LoadProjectModule : MonoBehaviour
{
public GameObject LoadProjectTab;
@@ -17,6 +18,7 @@ namespace Ichni.StartMenu
public List<string> projectFileList;
public List<ProjectInformation_BM> projectInformationList;
public List<SongInformation_BM> songInformationList;
public Image MemuMask;
private void Start()
{
@@ -39,7 +41,7 @@ namespace Ichni.StartMenu
projectInformationList.Add(ES3.Load<ProjectInformation_BM>("ProjectInformation", projectInformationPath));
songInformationList.Add(ES3.Load<SongInformation_BM>("SongInformation", songInformationPath));
}
for (int i = 0; i < projectInformationList.Count; i++)
{
var currentProject = projectInformationList[i];
@@ -50,6 +52,7 @@ namespace Ichni.StartMenu
LoadProjectTab tab = LeanPool.Spawn(LoadProjectTab, loadTabList).GetComponent<LoadProjectTab>();
tab.SetUpTab(projectName, lastSavedTime, songName);
tab.MemuMask = MemuMask;
}
}
}

View File

@@ -14,11 +14,11 @@ namespace Ichni.StartMenu
public string projectName;
public TMP_Text projectNameText, lastSavedTimeText, songNameText;
public Button loadButton;
public Image MemuMask;
public void SetUpTab(string projectName, string lastSavedTime, string songName)
{
this.projectName = projectName;
projectNameText.text = projectName;
lastSavedTimeText.text = lastSavedTime;
songNameText.text = songName;
@@ -28,9 +28,10 @@ namespace Ichni.StartMenu
private void LoadProject()
{
MemuMask.gameObject.SetActive(true);
InformationTransistor.instance.isLoadedProject = true;
InformationTransistor.instance.loadedProjectName = projectName;
string projectPath = Application.streamingAssetsPath + "/Projects/" + projectName;
InformationTransistor.instance.projectInfo_BM = ES3.Load<ProjectInformation_BM>("ProjectInformation", projectPath + "/ProjectInfo.json");
InformationTransistor.instance.songInfo_BM = ES3.Load<SongInformation_BM>("SongInformation", projectPath + "/SongInfo.json");

View File

@@ -18,7 +18,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
this.generateTime = generateTime;
this.effectTime = effectTime;
}
public sealed override void Recover()
{
noteVisual.noteMain.SetActive(false);
@@ -40,7 +40,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
noteVisual.noteMain.transform.localScale = Vector3.one;
}
public override EffectBase_BM ConvertToBM()
{
return new Beatmap.DTMNoteGenerateExpand_BM(effectTime, generateTime);
@@ -60,18 +60,18 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
public class DTMNoteGenerateExpand_BM : NoteGenerateEffect_BM
{
public float effectTime;
public float generateTime;
public new float effectTime;
public new float generateTime;
public DTMNoteGenerateExpand_BM()
{
}
public DTMNoteGenerateExpand_BM(float effectTime, float generateTime) :
base(effectTime, generateTime)
{
}
public override EffectBase ConvertToGameType(GameElement attachedGameElement)