某些优化

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

@@ -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");