看完了

顺手加了个element改名同步hierarchy
3D遮挡!!!
然后发现当track或者folder旋转时pathnode的法线(旋转)不会跟着
以上测试放在IceFlowerMaster项目中
还有 现在没中文字体
This commit is contained in:
2025-03-15 18:33:16 +08:00
parent 400bb39058
commit 7048bd21e6
20 changed files with 3796 additions and 145 deletions

View File

@@ -56,7 +56,7 @@ namespace Ichni.Editor
bool isActive = pointer.time >= leftSideSongTime && pointer.time <= rightSideSongTime;
pointer.gameObject.SetActive(isActive);
});
moveTabPoint.localPosition = new Vector3(timePointerArea.localPosition.x + OnePointer.transform.localPosition.x - timePointerInterval, -45f, 0);
if (OnePointer != null) moveTabPoint.localPosition = new Vector3(timePointerArea.localPosition.x + OnePointer.transform.localPosition.x - timePointerInterval, -45f, 0);
foreach (var i in moveTabPoint.transform.GetComponentsInChildren<SubTab>())
{

View File

@@ -16,7 +16,7 @@ namespace Ichni.Editor
public string backgroundSpriteName;
public Sprite backgroundSprite;
public static BackgroundSetter GenerateElement(string elementName, Guid id, List<string> tags,
public static BackgroundSetter GenerateElement(string elementName, Guid id, List<string> tags,
bool isFirstGenerated, GameElement parentElement, bool useSkybox, string skyboxThemeBundleName,
string skyboxMaterialName, string backgroundSpriteName)
{
@@ -29,16 +29,16 @@ namespace Ichni.Editor
backgroundSetter.backgroundSpriteName = backgroundSpriteName;
return backgroundSetter;
}
public void SetSkybox(string themeBundleName, string materialName)
{
skyboxThemeBundleName = themeBundleName;
skyboxMaterialName = materialName;
skyboxMaterial = ThemeBundleManager.instance.GetObject<Material>(themeBundleName, materialName);
if(skyboxMaterial == null) skyboxMaterial = EditorManager.instance.basePrefabs.defaultSkyboxMaterial;
if (skyboxMaterial == null) skyboxMaterial = EditorManager.instance.basePrefabs.defaultSkyboxMaterial;
EditorManager.instance.backgroundController.SetSkybox(skyboxMaterial);
}
public void SetBackgroundSprite(string backgroundSpriteName)
{
string path = EditorManager.instance.projectInformation.projectPath + "/Sprites/" + backgroundSpriteName + ".png";
@@ -48,7 +48,7 @@ namespace Ichni.Editor
protected override void SetDefaultSubmodules()
{
}
public override void SetUpInspector()
@@ -60,22 +60,23 @@ namespace Ichni.Editor
var skyboxMaterialNameField = inspector.GenerateInputField(this, container, "Skybox Material", nameof(skyboxMaterialName));
var backgroundSpriteField = inspector.GenerateInputField(this, container, "Background Sprite", nameof(backgroundSpriteName));
var applyButton = inspector.GenerateButton(this, container, "Apply", Refresh);
void SetFields(bool value)
{
skyboxThemeBundleField.inputField.interactable = value;
skyboxMaterialNameField.inputField.interactable = value;
backgroundSpriteField.inputField.interactable = !value;
}
SetFields(useSkybox);
useSkyboxToggle.AddListenerFunction(value => EditorManager.instance.backgroundController.EnableBackground(!value));
useSkyboxToggle.AddListenerFunction(SetFields);
}
public override void Refresh()
{
EditorManager.instance.backgroundController.EnableBackground(!useSkybox);
if (useSkybox)
{
@@ -94,7 +95,7 @@ namespace Ichni.Editor
{
public BackgroundSetter_BM()
{
}
public override void ExecuteBM()

View File

@@ -35,7 +35,7 @@ namespace Ichni.RhythmGame
//次级模块
public List<SubmoduleBase> submoduleList = new List<SubmoduleBase>();
//存档类
public BaseElement_BM matchedBM { get; set; }
@@ -43,7 +43,7 @@ namespace Ichni.RhythmGame
/// 首次初始化
/// </summary>
/// <param name="name">物体名</param>
public virtual void Initialize(string name, Guid elementGuid, List<string> tags,
public virtual void Initialize(string name, Guid elementGuid, List<string> tags,
bool isFirstGenerated, GameElement parentElement)
{
this.elementName = name;
@@ -65,7 +65,7 @@ namespace Ichni.RhythmGame
/// </summary>
protected virtual void SetDefaultSubmodules()
{
}
/// <summary>
@@ -73,7 +73,7 @@ namespace Ichni.RhythmGame
/// </summary>
public virtual void AfterInitialize()
{
}
/// <summary>
@@ -93,12 +93,12 @@ namespace Ichni.RhythmGame
public abstract partial class GameElement //存档,删除,复制,粘贴
{
public virtual void Refresh()
{
if (connectedTab != null) connectedTab.tabButtonText.text = this.elementName;
}
/// <summary>
/// 用于生成存档
/// </summary>
@@ -106,16 +106,16 @@ namespace Ichni.RhythmGame
{
throw new NotImplementedException();
}
/// <summary>
/// 当物体被删除时执行的方法
/// </summary>
public virtual void OnDelete()
{
}
/// <summary>
/// 删除物体,包括所有子物体
/// </summary>
@@ -130,11 +130,11 @@ namespace Ichni.RhythmGame
}
OnDelete();
//LogWindow.Log("Deleted element: " + elementName);
EditorManager.instance.beatmapContainer.gameElementList.Remove(this); //从保存列表中剔除
if (connectedTab != null)
{
Destroy(connectedTab.gameObject);
@@ -176,27 +176,27 @@ namespace Ichni.RhythmGame
GetAllChildrenRecursively(child, elements);
}
}
List<GameElement> gameElements = new List<GameElement> { this };
GetAllChildrenRecursively(this, gameElements);
if(!includeThis) gameElements.Remove(this);
if (!includeThis) gameElements.Remove(this);
return gameElements;
}
}
namespace Beatmap
{
[System.Serializable]
public abstract class GameElement_BM : BaseElement_BM
{
[System.NonSerialized]
[System.NonSerialized]
public static Dictionary<Guid, GameElement_BM> identifier = new(); //存档类的标识符
[System.NonSerialized]
[System.NonSerialized]
public GameElement matchedElement; //存档类对应的游戏物体
public string elementName;
public List<string> tags;
public Guid elementGuid;
@@ -223,17 +223,17 @@ namespace Ichni.RhythmGame
{
return element_BM;
}
return null;
}
public static GameElement GetElement(Guid id)
{
if(identifier.TryGetValue(id, out GameElement_BM element_BM))
if (identifier.TryGetValue(id, out GameElement_BM element_BM))
{
return element_BM.matchedElement;
}
return null;
}

View File

@@ -20,9 +20,10 @@ namespace Ichni.RhythmGame
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
public ColorSubmodule colorSubmodule { get; set; }
public bool haveEmission => false;
[Title("Editor独有参数")]
[SerializeField] [HideInPlayMode]
[SerializeField]
[HideInPlayMode]
private GameObject pathNodeSphere;
public bool isShowingSphere;
@@ -60,6 +61,7 @@ namespace Ichni.RhythmGame
{
public override void Refresh()
{
base.Refresh();
Vector3 position = transformSubmodule.currentPosition;
Vector3 normal = Quaternion.Euler(transformSubmodule.currentEulerAngles) * Vector3.up;
float size = transformSubmodule.currentScale.x;
@@ -80,7 +82,7 @@ namespace Ichni.RhythmGame
{
matchedBM = new Beatmap.PathNode_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM, isShowingSphere);
}
public void SetPathNodeSphere(bool isShowing)
{
isShowingSphere = isShowing;
@@ -92,7 +94,7 @@ namespace Ichni.RhythmGame
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
base.SetUpInspector();
var container = inspector.GenerateContainer("Path Node");
var indexText = inspector.GenerateHintText(this, container, "Index: " + index);
var isShowingSphereToggle = inspector.GenerateToggle(this, container, "Is Showing Sphere", nameof(isShowingSphere));
@@ -110,7 +112,7 @@ namespace Ichni.RhythmGame
}
public PathNode_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
public PathNode_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
bool isShowingSphere)
: base(elementName, elementGuid, tags, attachedElement)
{

View File

@@ -36,7 +36,7 @@ namespace Ichni.RhythmGame
trackTimeSubmodule = null;
trackRendererSubmodule = null;
}
private void Update()
{
if (timeDurationSubmodule.CheckTimeInDuration(EditorManager.instance.songInformation.songTime))
@@ -51,13 +51,14 @@ namespace Ichni.RhythmGame
{
trackPathSubmodule.ClosePath();
}
Refresh();
}
public override void Refresh()
{
base.Refresh();
trackPathSubmodule?.Refresh();
trackTimeSubmodule?.Refresh();
trackRendererSubmodule?.Refresh();
@@ -117,7 +118,7 @@ namespace Ichni.RhythmGame
trackRendererSubmodule = new TrackRendererSubmodulePathGenerator(this, false, 0);
inspectorMain.SetInspector(this);
});
var trackRendererSurfaceButton = inspector.GenerateButton(this, trackSubmodulesContainer, "Track Renderer Surface",
() =>
{
@@ -126,53 +127,53 @@ namespace Ichni.RhythmGame
});
var generateContainer = inspector.GenerateContainer("Generate Elements"); //物体生成
var pathNodeButton = inspector.GenerateButton(this, generateContainer, "Path Node",
() =>
{
PathNode.GenerateElement("New Path Node", Guid.NewGuid(), new List<string>(), true, this, true);
}); //路径点
var trackPercentPointButton = inspector.GenerateButton(this, generateContainer, "Track Percent Point",
() =>
{
TrackPercentPoint.GenerateElement("New Track Percent Point", Guid.NewGuid(), new List<string>(),
TrackPercentPoint.GenerateElement("New Track Percent Point", Guid.NewGuid(), new List<string>(),
true, this, new FlexibleFloat());
}); //百分比点
var trackHeadPointButton = inspector.GenerateButton(this, generateContainer, "Track Head Point",
() =>
{
TrackHeadPoint.GenerateElement("New Track Head Point", Guid.NewGuid(), new List<string>(),
TrackHeadPoint.GenerateElement("New Track Head Point", Guid.NewGuid(), new List<string>(),
true, this);
}); //头部点必须先有TrackTimeSubmoduleMovable
if (trackTimeSubmodule is not TrackTimeSubmoduleMovable) trackHeadPointButton.button.interactable = false;
var tapButton = inspector.GenerateButton(this, generateContainer, "Tap",
() =>
{
Tap.GenerateElement("New Tap", Guid.NewGuid(), new List<string>(), true, this, 0f);
}); //Note Tap
var stayButton = inspector.GenerateButton(this, generateContainer, "Stay",
() =>
{
Stay.GenerateElement("New Stay", Guid.NewGuid(), new List<string>(), true, this, 0f);
}); //Note Stay
// var holdButton = inspector.GenerateButton(this, generateContainer, "Hold",
// () =>
// {
// Hold.GenerateElement("New Hold", Guid.NewGuid(), new List<string>(), true, this, 0f);
// }); //Note Hold
var flickButton = inspector.GenerateButton(this, generateContainer, "Flick",
() =>
{
Flick.GenerateElement("New Flick", Guid.NewGuid(), new List<string>(), true, this, 0f,
new List<Vector2>());
}); //Note Flick
var displacementButton = inspector.GenerateButton(this, generateContainer, "Displacement",
() =>
{
@@ -207,8 +208,8 @@ namespace Ichni.RhythmGame
trackRendererAutoOrientButton.button.interactable = false;
trackRendererPathGeneratorButton.button.interactable = false;
}
var toolsContainerTrack = inspector.GenerateContainer("Track Tools"); //轨道(整体)快捷工具
var quickCopyButton = inspector.GenerateButton(this, toolsContainerTrack, "QuickCopy", () =>
{
@@ -229,7 +230,7 @@ namespace Ichni.RhythmGame
QuickCopy(positionOffset, timeOffset, includeAnimation, iteration);
});
}); //快速复制
var wholeTrackMoveButton = inspector.GenerateButton(this, toolsContainerTrack, "Whole Track Move", () =>
{
IHaveInspection wholeMoveWindow = inspectorMain.GenerateSecondaryWindow(this, elementName + "'s Whole Track Move");
@@ -243,7 +244,7 @@ namespace Ichni.RhythmGame
WholeTrackMove(positionOffset);
});
}); //整体移动
var wholeTrackSwirlButton = inspector.GenerateButton(this, toolsContainerTrack, "Whole Track Swirl", () =>
{
IHaveInspection wholeSwirlWindow = inspectorMain.GenerateSecondaryWindow(this, elementName + "'s Whole Track Swirl");
@@ -263,7 +264,7 @@ namespace Ichni.RhythmGame
WholeTrackSwirl(angle, center, axisDirection);
});
}); //整体旋转
// var wholeTrackFlipButton = inspector.GenerateButton(this, toolsContainerTrack, "Whole Track Flip", () =>
// {
// IHaveInspection wholeFlipWindow = inspectorMain.GenerateSecondaryWindow(this, elementName + "'s Whole Track Flip");
@@ -281,20 +282,20 @@ namespace Ichni.RhythmGame
// WholeTrackFlip(axisStart, axisEnd);
// });
// }); //整体翻转
var toolsContainerPathNode = inspector.GenerateContainer("Path Node Tools"); //路径点快捷工具
var setAllPathNodeSphereButton = inspector.GenerateButton(this, toolsContainerPathNode,
var setAllPathNodeSphereButton = inspector.GenerateButton(this, toolsContainerPathNode,
"Set All Path Node Sphere", () =>
{
bool firstPathNodeSphere = trackPathSubmodule.pathNodeList[0].isShowingSphere;
SetAllPathNodeSphere(!firstPathNodeSphere);
});
var setOnlyStartEndPathNodeSphereEnabledButton = inspector.GenerateButton(this, toolsContainerPathNode,
var setOnlyStartEndPathNodeSphereEnabledButton = inspector.GenerateButton(this, toolsContainerPathNode,
"Only Start & End Path Node's sphere enabled", SetOnlyStartEndPathNodeSphereEnabled);
}
}
public partial class Track
{
public enum TrackSpaceType
@@ -310,20 +311,20 @@ namespace Ichni.RhythmGame
DistanceDistributed = 1
}
}
namespace Beatmap
{
public class Track_BM : GameElement_BM
{
public Track_BM()
{
}
public Track_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement)
public Track_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement)
: base(elementName, elementGuid, tags, attachedElement)
{
}
public override void ExecuteBM()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3dc4cc866b44c8c438213497fcebce8f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e76bf4975867f5340a4647b3ec6e97a0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
{
"CommandScripts" : {
"__type" : "Ichni.RhythmGame.Beatmap.CommandScripts_BM,Assembly-CSharp",
"value" : {
"commandList" : [
],
"attachedElementGuid" : {
"value" : "00000000-0000-0000-0000-000000000000"
}
}
}
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 18ec11ca107878e44ad384567d32a6c1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
{
"ProjectInformation" : {
"__type" : "Ichni.RhythmGame.Beatmap.ProjectInformation_BM,Assembly-CSharp",
"value" : {
"projectName" : "IceFlowerMaster",
"creatorName" : "1",
"editorVersion" : "0.1.0",
"createTime" : "2025\/3\/15 16:40:48",
"lastSaveTime" : "2025\/3\/15 16:40:48",
"selectedThemeBundleList" : [
"basic","departure_to_multiverse"
],
"attachedElementGuid" : {
"value" : "00000000-0000-0000-0000-000000000000"
}
}
}
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bac1c7fb0bac170498210970c94fe100
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
{
"SongInformation" : {
"__type" : "Ichni.RhythmGame.Beatmap.SongInformation_BM,Assembly-CSharp",
"value" : {
"songName" : "icef [MASTER].wav",
"bpm" : 186,
"delay" : 0,
"attachedElementGuid" : {
"value" : "00000000-0000-0000-0000-000000000000"
}
}
}
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f36acbebf8fd3304694093c381a8b0eb
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5a78bac2dcd2ec74abcdfdc5a2143160
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View File

@@ -12,17 +12,17 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
{
[SerializeField]
private Light directionalLight;
public float intensity;
public bool castShadows;
public static DirectionalLight GenerateElement(string elementName, Guid id, List<string> tags,
bool isFirstGenerated, GameElement parentElement, string themeBundleName, string objectName,
bool isFirstGenerated, GameElement parentElement, string themeBundleName, string objectName,
bool isStatic, float intensity, bool castShadows)
{
DirectionalLight dirLight = EnvironmentObject.GenerateElement(elementName, id, tags,
isFirstGenerated, themeBundleName, objectName, parentElement, isStatic).GetComponent<DirectionalLight>();
dirLight.intensity = intensity;
dirLight.castShadows = castShadows;
return dirLight;
@@ -30,45 +30,46 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
public override void Refresh()
{
base.Refresh();
directionalLight.color = colorSubmodule.currentBaseColor;
directionalLight.intensity = intensity;
directionalLight.shadows = castShadows ? LightShadows.Soft : LightShadows.None;
}
}
public partial class DirectionalLight
{
public override void SaveBM()
{
matchedBM = new DirectionalLight_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
matchedBM = new DirectionalLight_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
themeBundleName, objectName, isStatic, intensity, castShadows);
}
public override void SetUpInspector()
{
base.SetUpInspector();
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
var container = inspector.GenerateContainer("Directional Light");
var intensityField = inspector.GenerateInputField(this, container, "Intensity", nameof(intensity));
intensityField.AddListenerFunction(_ => Refresh());
var castShadowsToggle = inspector.GenerateToggle(this, container, "Cast Shadows", nameof(castShadows));
castShadowsToggle.AddListenerFunction(_ => Refresh());
}
}
namespace Beatmap
{
public class DirectionalLight_BM : EnvironmentObject_BM
{
public float intensity;
public bool castShadows;
public DirectionalLight_BM()
{
}
public DirectionalLight_BM(string elementName, Guid id, List<string> tags,
@@ -81,14 +82,14 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
}
public override void ExecuteBM()
{
matchedElement = DirectionalLight.GenerateElement(elementName, elementGuid, tags, false,
{
matchedElement = DirectionalLight.GenerateElement(elementName, elementGuid, tags, false,
GetElement(attachedElementGuid), themeBundleName, objectName, isStatic, intensity, castShadows);
}
public override GameElement DuplicateBM(GameElement parent)
{
return DirectionalLight.GenerateElement(elementName, Guid.NewGuid(), tags, false,
return DirectionalLight.GenerateElement(elementName, Guid.NewGuid(), tags, false,
parent, themeBundleName, objectName, isStatic, intensity, castShadows);
}
}

View File

@@ -16,14 +16,14 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
public float intensity;
public float range;
public bool castShadows;
public static PointLight GenerateElement(string elementName, Guid id, List<string> tags,
bool isFirstGenerated, GameElement parentElement, string themeBundleName, string objectName,
bool isFirstGenerated, GameElement parentElement, string themeBundleName, string objectName,
bool isStatic, float intensity, float range, bool castShadows)
{
PointLight poLight = EnvironmentObject.GenerateElement(elementName, id, tags,
isFirstGenerated, themeBundleName, objectName, parentElement, isStatic).GetComponent<PointLight>();
poLight.intensity = intensity;
poLight.range = range;
poLight.castShadows = castShadows;
@@ -32,6 +32,7 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
public override void Refresh()
{
base.Refresh();
pointLight.color = colorSubmodule.currentBaseColor;
pointLight.intensity = intensity;
pointLight.range = range;
@@ -43,23 +44,23 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
{
public override void SaveBM()
{
matchedBM = new PointLight_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
matchedBM = new PointLight_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
themeBundleName, objectName, isStatic, intensity, range, castShadows);
}
public override void SetUpInspector()
{
base.SetUpInspector();
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
var container = inspector.GenerateContainer("Directional Light");
var intensityField = inspector.GenerateInputField(this, container, "Intensity", nameof(intensity));
intensityField.AddListenerFunction(_ => Refresh());
var rangeField = inspector.GenerateInputField(this, container, "Range", nameof(range));
rangeField.AddListenerFunction(_ => Refresh());
var castShadowsToggle = inspector.GenerateToggle(this, container, "Cast Shadows", nameof(castShadows));
castShadowsToggle.AddListenerFunction(_ => Refresh());
}
@@ -75,9 +76,9 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
public PointLight_BM()
{
}
public PointLight_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM parentElement,
string themeBundleName, string objectName, bool isStatic, float intensity, float range, bool castShadows)
: base(elementName, elementGuid, tags, parentElement, themeBundleName, objectName, isStatic)
@@ -86,16 +87,16 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
this.range = range;
this.castShadows = castShadows;
}
public override void ExecuteBM()
{
matchedElement = PointLight.GenerateElement(elementName, elementGuid, tags, false,
GetElement(attachedElementGuid), themeBundleName, objectName, isStatic, intensity, range, castShadows);
}
public override GameElement DuplicateBM(GameElement parent)
{
return PointLight.GenerateElement(elementName, Guid.NewGuid(), tags, false,
return PointLight.GenerateElement(elementName, Guid.NewGuid(), tags, false,
parent, themeBundleName, objectName, isStatic, intensity, range, castShadows);
}
}