Note Prefab功能

This commit is contained in:
SoulliesOfficial
2025-03-24 13:41:50 -04:00
parent 54de98b0fa
commit 188f05182b
22 changed files with 756 additions and 33 deletions

View File

@@ -250,6 +250,22 @@ namespace Ichni.RhythmGame
/// </summary>
/// <param name="attached">父物体</param>
public abstract GameElement DuplicateBM(GameElement attached);
public static List<BaseElement_BM> GetAllAttachedBaseElements(GameElement_BM gameElement, List<BaseElement_BM> clip)
{
Guid elementGuid = gameElement.elementGuid;
List<BaseElement_BM> result = new List<BaseElement_BM>();
foreach (BaseElement_BM element in clip)
{
if (element.attachedElementGuid == elementGuid)
{
result.Add(element);
}
}
return result;
}
}
}
}

View File

@@ -43,6 +43,11 @@ namespace Ichni.RhythmGame
flick.track = null;
flick.isOnTrack = false;
}
if (EditorManager.instance.useNotePrefab)
{
EditorManager.instance.projectManager.notePrefabManager.LoadNotePrefab(flick,GetNoteTypeName(flick) + "_Prefab");
}
return flick;
}
@@ -66,6 +71,11 @@ namespace Ichni.RhythmGame
{
TemporaryObject.GenerateElement("New Note Visual", Guid.NewGuid(), new List<string>(), true, this);
});
if (noteVisual != null)
{
generateNoteVisualButton.button.interactable = false;
}
}
}

View File

@@ -47,6 +47,11 @@ namespace Ichni.RhythmGame
hold.track = null;
hold.isOnTrack = false;
}
if (EditorManager.instance.useNotePrefab)
{
EditorManager.instance.projectManager.notePrefabManager.LoadNotePrefab(hold,GetNoteTypeName(hold) + "_Prefab");
}
return hold;
}
@@ -112,6 +117,11 @@ namespace Ichni.RhythmGame
{
TemporaryObject.GenerateElement("New Note Visual", Guid.NewGuid(), new List<string>(), true, this);
});
if (noteVisual != null)
{
generateNoteVisualButton.button.interactable = false;
}
}
}

View File

@@ -159,6 +159,12 @@ namespace Ichni.RhythmGame
exactJudgeTimeInputField.AddListenerFunction(UpdateNoteInTrack);
exactJudgeTimeInputField.Mark(inspector, "ExactJudgeTime");
var saveNotePrefabButton =
inspector.GenerateButton(this, container, "Save Note Prefab", () =>
{
EditorManager.instance.projectManager.notePrefabManager.SaveNotePrefab(this, GetNoteTypeName(this) + "_Prefab");
});
var noteScreenPositionText = inspector.GenerateHintText(this, container, () => "Note Screen Position: " + noteScreenPosition);
}
}
@@ -173,6 +179,18 @@ namespace Ichni.RhythmGame
Miss
}
public static string GetNoteTypeName(NoteBase note)
{
return note switch
{
Tap => "Tap",
Stay => "Stay",
Hold => "Hold",
Flick => "Flick",
_ => throw new NotImplementedException("Note type not recognized")
};
}
}
namespace Beatmap

View File

@@ -39,6 +39,11 @@ namespace Ichni.RhythmGame
stay.track = null;
stay.isOnTrack = false;
}
if (EditorManager.instance.useNotePrefab)
{
EditorManager.instance.projectManager.notePrefabManager.LoadNotePrefab(stay,GetNoteTypeName(stay) + "_Prefab");
}
return stay;
}
@@ -61,6 +66,11 @@ namespace Ichni.RhythmGame
{
TemporaryObject.GenerateElement("New Note Visual", Guid.NewGuid(), new List<string>(), true, this);
});
if (noteVisual != null)
{
generateNoteVisualButton.button.interactable = false;
}
}
}

View File

@@ -41,6 +41,11 @@ namespace Ichni.RhythmGame
tap.isOnTrack = false;
}
if (EditorManager.instance.useNotePrefab)
{
EditorManager.instance.projectManager.notePrefabManager.LoadNotePrefab(tap,GetNoteTypeName(tap) + "_Prefab");
}
return tap;
}
}
@@ -62,6 +67,11 @@ namespace Ichni.RhythmGame
{
TemporaryObject.GenerateElement("New Note Visual", Guid.NewGuid(), new List<string>(), true, this);
});
if (noteVisual != null)
{
generateNoteVisualButton.button.interactable = false;
}
}
}

View File

@@ -19,7 +19,7 @@ namespace Ichni.RhythmGame
string themeBundleName, string objectName, GameElement parentElement)
{
GameObject themeBundleObject = ThemeBundleManager.instance.GetObject<GameObject>(themeBundleName, objectName);
Debug.Log(parentElement.elementName);
SubstantialObject substantialObject = Instantiate(themeBundleObject, parentElement.transform).GetComponent<SubstantialObject>();
substantialObject.Initialize(elementName, id, tags, isFirstGenerated, parentElement);
substantialObject.themeBundleName = themeBundleName;