毫无头绪!

This commit is contained in:
2025-02-28 20:08:00 +08:00
parent 5238cd0e5e
commit 07256af84b
26 changed files with 1115 additions and 485 deletions

View File

@@ -68,7 +68,7 @@ namespace Ichni.Editor
ConsoleUI.SetActive(isHide);
isHide = !isHide;
if (!isHide) StartCoroutine(WindowAnim.ShowPanel(InputCommand.gameObject));
if (!isHide) StartCoroutine(WindowAnim.ShowPanelOnScale(InputCommand.gameObject));
}
if (Keyboard.current.leftCtrlKey.isPressed && Keyboard.current.upArrowKey.wasPressedThisFrame)
{

View File

@@ -26,7 +26,7 @@ namespace Ichni.Editor
unitList = new List<DynamicUICompositeUnit>();
closeButton.onClick.AddListener(Quit);
StartCoroutine(WindowAnim.ShowPanel(gameObject));
StartCoroutine(WindowAnim.ShowPanelOnScale(gameObject));
}
public void RemoveUnit(DynamicUICompositeUnit unit)
@@ -72,7 +72,7 @@ namespace Ichni.Editor
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, stringList);
};
}
public void SetAsFloatList()
{
void GenerateUnit(float content)
@@ -81,7 +81,7 @@ namespace Ichni.Editor
unitList.Add(unit);
unit.SetUnit(this, content);
}
unitPrefab = EditorManager.instance.basePrefabs.inputFieldUnit;
List<float> list = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as List<float>;
foreach (float item in list)
@@ -89,13 +89,13 @@ namespace Ichni.Editor
GenerateUnit(item);
}
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
addNewUnitButton.onClick.AddListener(() =>
{
GenerateUnit(0);
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
});
ApplyParameters = () =>
{
List<float> floatList = unitList.Select(unit => (unit as DynamicUIInputFieldUnit).GetValue<float>()).ToList();
@@ -215,23 +215,23 @@ namespace Ichni.Editor
unitList.Add(unit);
unit.SetUnit(this, content);
}
unitPrefab = EditorManager.instance.basePrefabs.customCurveKeyframeUnit;
AnimationCurve curve = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as AnimationCurve;
List<Keyframe> keyframes = curve.keys.ToList();
WarpModes warpModes = new WarpModes(curve.preWrapMode, curve.postWrapMode);
//生成warpModes的Unit
DynamicUICustomCurveWrapModeUnit warpModesUnit =
DynamicUICustomCurveWrapModeUnit warpModesUnit =
Instantiate(EditorManager.instance.basePrefabs.customCurveWrapModeUnit, windowRect).GetComponent<DynamicUICustomCurveWrapModeUnit>();
unitList.Add(warpModesUnit);
warpModesUnit.SetUnit(this, warpModes);
foreach (Keyframe keyframe in keyframes)
{
GenerateUnit(keyframe);
}
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
addNewUnitButton.onClick.AddListener(() =>
@@ -239,14 +239,14 @@ namespace Ichni.Editor
GenerateUnit(new Keyframe(0, 0, 0, 0));
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
});
ApplyParameters = () =>
{
AnimationCurve newCurve = new AnimationCurve();
DynamicUICustomCurveWrapModeUnit warpModesUnit = unitList[0] as DynamicUICustomCurveWrapModeUnit;
newCurve.preWrapMode = warpModesUnit.GetValue().preWrapMode;
newCurve.postWrapMode = warpModesUnit.GetValue().postWrapMode;
for(int i = 1; i < unitList.Count; i++)
for (int i = 1; i < unitList.Count; i++)
{
DynamicUICustomCurveKeyframeUnit unit = unitList[i] as DynamicUICustomCurveKeyframeUnit;
newCurve.AddKey(unit.GetValue());

View File

@@ -13,7 +13,7 @@ namespace Ichni.Editor
public void Initialize(GameElement gameElement, string title)
{
StartCoroutine(WindowAnim.ShowPanel(gameObject));
StartCoroutine(WindowAnim.ShowPanelOnScale(gameObject));
WindowRect = windowRect;
Containers = new List<DynamicUIContainer>();

View File

@@ -24,7 +24,7 @@ namespace Ichni.Editor
enableButtonGroup.disableButton.gameObject.SetActive(true);
enableButtonGroup.enableButton.gameObject.SetActive(false);
}
public virtual void DisableWindow()
{
gameObject.SetActive(false);

View File

@@ -15,9 +15,9 @@ namespace Ichni.Editor
private void Start()
{
playButton.onClick.AddListener(EditorManager.instance.musicPlayer.PlayMusic);
pauseButton.onClick.AddListener(EditorManager.instance.musicPlayer.PauseMusic);
stopButton.onClick.AddListener(EditorManager.instance.musicPlayer.StopMusic);
// playButton.onClick.AddListener(EditorManager.instance.musicPlayer.PlayMusic);
// pauseButton.onClick.AddListener(EditorManager.instance.musicPlayer.PauseMusic);
// stopButton.onClick.AddListener(EditorManager.instance.musicPlayer.StopMusic);
}
}
}

View File

@@ -14,6 +14,7 @@ public class SubTab : MonoBehaviour
public Button button;
private SongInformation songInformation;
private TimePointerModule timePointerModule;
public TimelineTab timelineTab;
private Timeline timeline;
public float Time;
public void Set(GameElement Objs, float time)
@@ -25,7 +26,7 @@ public class SubTab : MonoBehaviour
connectObj.Add(Objs);
button.GetComponentInChildren<TMP_Text>().text = connectObj.Count().ToString();
transform.position = new Vector3(
Time / timeline.timePerBeat * timePointerModule.timePointerInterval + 165f - timePointerModule.delayDistanceOffset
timelineTab.MoveArea.position.x + (time / timeline.timePerBeat * timePointerModule.timePointerInterval)
, transform.position.y, 0
);
}

View File

@@ -131,7 +131,8 @@ namespace Ichni.Editor
if (!timelineTabList.ContainsKey(i.GetType()))
{
TimelineTab timelineTab = Instantiate(timelineTabPrefab, timelineTabRect.transform);
//timelineTab.timeline = this;
//timelineTab.MoveArea = timePointerModule.timePointerArea;
timelineTab.SetTab(i, i.GetType());
timelineTabList.Add(i.GetType(), timelineTab);

View File

@@ -17,6 +17,7 @@ public class TimelineTab : MonoBehaviour
public List<GameElement> GelementPointer;
public RectTransform MoveArea;
public RectTransform title;
public Dictionary<float, SubTab> SubTabs = new();
public Timeline timeline;
@@ -40,7 +41,7 @@ public class TimelineTab : MonoBehaviour
else
{
SubTab i = Instantiate(ElementPrefab, MoveArea.transform);
i.timelineTab = this;
i.Set(gameElement, Judgetime);
SubTabs.Add(Judgetime, i);
}
@@ -53,7 +54,7 @@ public class TimelineTab : MonoBehaviour
public void Update()
{
MoveArea.position = new Vector3(
timeline.timePointerModule.timePointerArea.position.x,
-(timeline.songTime / timeline.timePerBeat) * timeline.timePointerModule.timePointerInterval,
MoveArea.position.y,
MoveArea.position.z);
}

View File

@@ -4,7 +4,7 @@ using UnityEngine;
public static class WindowAnim
{
public static IEnumerator ShowPanel(GameObject gameObject)
public static IEnumerator ShowPanelOnScale(GameObject gameObject)
{
AnimationCurve animationCurve = new AnimationCurve(
new Keyframe(0, 0),
@@ -22,7 +22,7 @@ public static class WindowAnim
}
gameObject.transform.localScale = Vector3.one;
}
public static IEnumerator HidePanel(GameObject gameObject, bool DestoryOrNot = false)
public static IEnumerator HidePanelOnscale(GameObject gameObject, bool DestoryOrNot = false)
{
AnimationCurve animationCurve = new AnimationCurve(
new Keyframe(0, 0),
@@ -42,4 +42,5 @@ public static class WindowAnim
}
}

View File

@@ -9,7 +9,7 @@ namespace Ichni.RhythmGame
public abstract class SubstantialObject : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule, IHaveColorSubmodule
{
public string themeBundleName, objectName;
public TransformSubmodule transformSubmodule { get; set; }
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
public ColorSubmodule colorSubmodule { get; set; }
@@ -18,7 +18,11 @@ namespace Ichni.RhythmGame
public static SubstantialObject GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated,
string themeBundleName, string objectName, GameElement parentElement)
{
GameObject themeBundleObject = ThemeBundleManager.instance.GetObject<GameObject>(themeBundleName, objectName);
SubstantialObject substantialObject = Instantiate(themeBundleObject, parentElement.transform).GetComponent<SubstantialObject>();
substantialObject.Initialize(elementName, id, tags, isFirstGenerated, parentElement);
substantialObject.themeBundleName = themeBundleName;
@@ -34,7 +38,7 @@ namespace Ichni.RhythmGame
/// </summary>
public virtual void FirstSetUpObject(bool isFirstGenerated)
{
}
protected override void SetDefaultSubmodules()
@@ -42,7 +46,7 @@ namespace Ichni.RhythmGame
transformSubmodule = new TransformSubmodule(this);
timeDurationSubmodule = new TimeDurationSubmodule(this);
colorSubmodule = new ColorSubmodule(this);
submoduleList.Add(transformSubmodule);
submoduleList.Add(timeDurationSubmodule);
submoduleList.Add(colorSubmodule);
@@ -58,7 +62,7 @@ namespace Ichni.RhythmGame
public SubstantialObject_BM()
{
}
public SubstantialObject_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Dreamteck.Splines.Primitives;
using Ichni.Editor;
using Ichni.RhythmGame;
using Ichni.RhythmGame.Beatmap;
@@ -13,7 +14,7 @@ namespace Ichni
public class EditorManager : GameElement
{
public static EditorManager instance;
public ProjectManager projectManager;
public MusicPlayer musicPlayer;
public EditorUIManager uiManager;
@@ -22,14 +23,14 @@ namespace Ichni
public BackgroundController backgroundController;
public CameraManager cameraManager;
public PostProcessingManager postProcessingManager;
public Timeline timeline;
public ProjectInformation projectInformation;
public SongInformation songInformation;
public BeatmapContainer beatmapContainer;
public CommandScripts commandScripts;
public NoteBase.NoteJudgeType currentJudgeType;
public BasePrefabsCollection basePrefabs;
@@ -38,7 +39,7 @@ namespace Ichni
instance = this;
projectManager = new ProjectManager();
operationManager = new OperationManager();
if (!ES3.FileExists(Application.streamingAssetsPath + "/EditorSettings.es3"))
{
editorSettings = new EditorSettings(300, 100, 100);
@@ -55,8 +56,8 @@ namespace Ichni
this.elementName = "EditorManager";
this.elementGuid = Guid.Empty;
uiManager.hierarchy.GenerateTab(this, null);
projectManager.loadManager.Load("TestProject");
StartCoroutine(projectManager.loadManager.Load("TestProject"));
musicPlayer.audioSource.clip = songInformation.song;
beatmapContainer.gameElementList.ForEach(gameElement =>
@@ -69,14 +70,14 @@ namespace Ichni
public override void SetUpInspector()
{
IHaveInspection inspector = uiManager.inspector;
var container = inspector.GenerateContainer("Editor Manager");
var judgeTypeDropdown = inspector.GenerateDropdown(this, container, "Judge Type",
typeof(NoteBase.NoteJudgeType), nameof(currentJudgeType));
var generateFolderButton =
inspector.GenerateButton(this, container, "Generate Folder",
() => ElementFolder.GenerateElement("Folder", Guid.NewGuid(),
() => ElementFolder.GenerateElement("Folder", Guid.NewGuid(),
new List<string>(), true, null));
var generateBackgroundSetterButton =
@@ -84,7 +85,7 @@ namespace Ichni
() => BackgroundSetter.GenerateElement("Background Setter", Guid.NewGuid(),
new List<string>(), true, null, false,
"basic", "Skybox", "Background"));
projectInformation.SetUpInspector();
songInformation.SetUpInspector();
cameraManager.SetUpInspector();

View File

@@ -21,13 +21,14 @@ namespace Ichni.Editor
public void PlayMusic()
{
isPlaying = !isPlaying;
Trail.SetAllTrails(true, false);
EditorManager.instance.songInformation.songTime = audioSource.time;
if(isPlaying)audioSource.Play();
else audioSource.Pause();
if (isPlaying) audioSource.Play();
else audioSource.Pause();
}
public void PauseMusic()
{
isPlaying = false;
@@ -35,7 +36,7 @@ namespace Ichni.Editor
EditorManager.instance.songInformation.songTime = audioSource.time;
audioSource.Pause();
}
public void StopMusic()
{
isPlaying = false;

View File

@@ -24,11 +24,11 @@ namespace Ichni
encryptionPassword = "Soullies515",
format = ES3.Format.JSON,
};
public SaveManager saveManager;
public LoadManager loadManager;
public ExportManager exportManager;
public ProjectManager()
{
saveManager = new SaveManager();
@@ -38,12 +38,12 @@ namespace Ichni
public void GenerateProject(string projectName)
{
EditorManager.instance.projectInformation = new ProjectInformation(projectName, "Soullies",
EditorManager.instance.projectInformation = new ProjectInformation(projectName, "Soullies",
"2.0", "2025-02-08", "2025-02-08", new List<string>());
EditorManager.instance.songInformation = new SongInformation("TestSong", 120, 0);
EditorManager.instance.beatmapContainer = new BeatmapContainer();
EditorManager.instance.commandScripts = new CommandScripts(new List<string>());
//Create project folder
if (!System.IO.Directory.Exists(EditorManager.instance.projectInformation.projectPath))
{
@@ -64,12 +64,12 @@ namespace Ichni
string commandScriptsPath = exportPath + "/CommandScripts.bytes";
LogWindow.Log("Start Exporting...");
ExportProjectInfo(projectInfoPath);
ExportSongInfo(songInfoPath);
ExportBeatMap(beatmapPath);
ExportCommandScripts(commandScriptsPath);
LogWindow.Log("Export Complete", Color.green);
}
@@ -107,12 +107,12 @@ namespace Ichni
public void Save()
{
LogWindow.Log("Start Saving...");
SaveProjectInfo();
SaveSongInfo();
SaveBeatMap();
SaveCommandScripts();
LogWindow.Log("Save Complete", Color.green);
}
@@ -147,16 +147,19 @@ namespace Ichni
public class LoadManager
{
public void Load(string projectName)
public IEnumerator Load(string projectName)
{
LoadProjectInfo(projectName);
LoadSongInfo();
LoadBeatMap();
LoadCommandScripts();
while (ThemeBundleManager.instance.waitingBundleAmount != 0)
{
yield return new WaitForEndOfFrame();
}
LoadBeatMap();
LogWindow.Log("Load Complete", Color.green);
}
private void LoadProjectInfo(string projectName)
{
string projectInfoPath = Application.streamingAssetsPath + "/Projects/" + projectName + "/ProjectInfo.json";

View File

@@ -16,29 +16,51 @@ namespace Ichni
public List<ThemeBundle> loadedThemeBundleList;
public int waitingBundleAmount;
private void Awake()
{
instance = this;
loadedThemeBundleList = new List<ThemeBundle>();
AssetBundle.UnloadAllAssetBundles(true);
LoadAllThemeBundlesAbstract();
//DontDestroyOnLoad(gameObject);
LoadThemeBundle("basic");
LoadThemeBundle("departure_to_multiverse");
LoadThemeBundle("basic");
}
public bool TryGetThemeBundle(string themeBundleName, out ThemeBundle themeBundle)
{
themeBundle = loadedThemeBundleList.Find(bundle => bundle.themeBundleName == themeBundleName);
return themeBundle != null;
}
public T GetObject<T>(string themeBundleName, string objectName) where T : class
private IEnumerator WaitAndLoad()
{
return loadedThemeBundleList.Find(bundle => bundle.themeBundleName == themeBundleName)?.GetObject<T>(objectName);
while (waitingBundleAmount != 0)
{
yield return null;
}
}
public T GetObject<T>(string themeBundleName, string objectName) where T : class//?
{
print(themeBundleName + " " + objectName);
var i = loadedThemeBundleList.Find(bundle => bundle.themeBundleName == themeBundleName)?.GetObject<T>(objectName);
if (i == null)
{
Debug.LogError("Object not found");
return loadedThemeBundleList.Find(bundle => bundle.themeBundleName == "basic")?.GetObject<T>("BasicNoteTap3D");
}
else
return i;
}
public void LoadThemeBundles(List<string> list)
@@ -77,22 +99,23 @@ namespace Ichni
waitingBundleAmount++;
StartCoroutine(LoadThemeBundleCoroutine(themeBundleName));
}
IEnumerator LoadThemeBundleCoroutine(string themeBundleName)
{
string uri = "";
if (Application.platform == RuntimePlatform.WindowsEditor ||
Application.platform == RuntimePlatform.WindowsPlayer)
{
uri = Application.streamingAssetsPath + "/ThemeBundles/Windows64/" + themeBundleName;
}else if (Application.platform == RuntimePlatform.OSXEditor ||
}
else if (Application.platform == RuntimePlatform.OSXEditor ||
Application.platform == RuntimePlatform.OSXPlayer)
{
uri = Application.streamingAssetsPath + "/ThemeBundles/OSX/" + themeBundleName;
}
UnityWebRequest request = UnityWebRequestAssetBundle.GetAssetBundle(uri, 0);
yield return request.SendWebRequest();
AssetBundle bundle = AssetBundle.LoadFromFile(uri);
@@ -120,6 +143,7 @@ namespace Ichni
yield return new WaitForEndOfFrame();
waitingBundleAmount--;
print(themeBundleName + " Done!");
}
}
@@ -231,7 +255,7 @@ namespace Ichni
}
}
}
return default(T);
}
}