StartMenu!
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
@@ -53,8 +54,8 @@ namespace Ichni.RhythmGame
|
||||
colorA.returnType is FlexibleReturnType.MiddleExecuting)
|
||||
{
|
||||
animationReturnType = FlexibleReturnType.MiddleExecuting;
|
||||
Color colorOffset = new Color(colorR.value, colorG.value, colorB.value, colorA.value);
|
||||
targetColorSubmodule.baseColorOffset.Add(colorOffset);
|
||||
|
||||
targetColorSubmodule.currentBaseColor = new Color(colorR.value, colorG.value, colorB.value, colorA.value);
|
||||
targetColorSubmodule.baseColorDirtyMark = true;
|
||||
}
|
||||
else
|
||||
@@ -71,6 +72,34 @@ namespace Ichni.RhythmGame
|
||||
colorB.animations.ForEach(anim => anim.ApplyTimeOffset(offset));
|
||||
colorA.animations.ForEach(anim => anim.ApplyTimeOffset(offset));
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
base.SetUpInspector();
|
||||
var container = inspector.GenerateContainer("Base Color Change");
|
||||
var colorRButton = inspector.GenerateButton(this, container, "Color R",
|
||||
() =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Color R", nameof(colorR)).SetAsFlexibleFloat();
|
||||
});
|
||||
var colorGButton = inspector.GenerateButton(this, container, "Color G",
|
||||
() =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Color G", nameof(colorG)).SetAsFlexibleFloat();
|
||||
});
|
||||
var colorBButton = inspector.GenerateButton(this, container, "Color B",
|
||||
() =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Color B", nameof(colorB)).SetAsFlexibleFloat();
|
||||
});
|
||||
var colorAButton = inspector.GenerateButton(this, container, "Color A",
|
||||
() =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Color A", nameof(colorA)).SetAsFlexibleFloat();
|
||||
});
|
||||
container.SetDeviver(1);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class BaseColorChange
|
||||
|
||||
@@ -53,11 +53,9 @@ namespace Ichni.RhythmGame
|
||||
colorI.returnType is FlexibleReturnType.MiddleExecuting)
|
||||
{
|
||||
animationReturnType = FlexibleReturnType.MiddleExecuting;
|
||||
Color colorOffset = new Color(colorR.value, colorG.value, colorB.value);
|
||||
float intensityOffset = colorI.value;
|
||||
|
||||
targetColorSubmodule.emissionColorOffset.Add(colorOffset);
|
||||
targetColorSubmodule.emissionIntensityOffset.Add(intensityOffset);
|
||||
|
||||
targetColorSubmodule.currentEmissionColor = new Color(colorR.value, colorG.value, colorB.value, 1);
|
||||
targetColorSubmodule.currentEmissionIntensity = colorI.value;
|
||||
targetColorSubmodule.emissionColorDirtyMark = true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Position Z", nameof(positionZ)).SetAsFlexibleFloat();
|
||||
});
|
||||
var GraphicEditor = inspector.GenerateButton(this, container, "GraphicEditor",
|
||||
var graphicEditor = inspector.GenerateButton(this, container, "GraphicEditor",
|
||||
() =>
|
||||
{
|
||||
inspector.GenerateGraphicalFlexibleFloatWindow(this, "Displacement",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -75,6 +76,41 @@ namespace Ichni.RhythmGame
|
||||
matchedBM = new Scale_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
scaleX.ConvertToBM(), scaleY.ConvertToBM(), scaleZ.ConvertToBM());
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
base.SetUpInspector();
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Scale");
|
||||
|
||||
var scaleXButton = inspector.GenerateButton(this, container, "Scale X",
|
||||
() =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Scale X", nameof(scaleX)).SetAsFlexibleFloat();
|
||||
});
|
||||
|
||||
var scaleYButton = inspector.GenerateButton(this, container, "Scale Y",
|
||||
() =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Scale Y", nameof(scaleY)).SetAsFlexibleFloat();
|
||||
});
|
||||
|
||||
var scaleZButton = inspector.GenerateButton(this, container, "Scale Z",
|
||||
() =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Scale Z", nameof(scaleZ)).SetAsFlexibleFloat();
|
||||
});
|
||||
|
||||
var graphicEditor = inspector.GenerateButton(this, container, "GraphicEditor",
|
||||
() =>
|
||||
{
|
||||
inspector.GenerateGraphicalFlexibleFloatWindow(this, "Displacement",
|
||||
new FlexibleFloat[] { scaleX, scaleY, scaleZ },
|
||||
new string[] { "ScaleX", "ScaleY", "ScaleZ" });
|
||||
});
|
||||
|
||||
container.SetDeviver(1);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
@@ -77,6 +78,40 @@ namespace Ichni.RhythmGame
|
||||
matchedBM = new Swirl_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
eulerAngleX.ConvertToBM(), eulerAngleY.ConvertToBM(), eulerAngleZ.ConvertToBM());
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
base.SetUpInspector();
|
||||
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Swirl");
|
||||
|
||||
var eulerAngleXButton = inspector.GenerateButton(this, container, "Euler Angle X",
|
||||
() =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Euler Angle X", nameof(eulerAngleX)).SetAsFlexibleFloat();
|
||||
});
|
||||
var eulerAngleYButton = inspector.GenerateButton(this, container, "Euler Angle Y",
|
||||
() =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Euler Angle Y", nameof(eulerAngleY)).SetAsFlexibleFloat();
|
||||
});
|
||||
var eulerAngleZButton = inspector.GenerateButton(this, container, "Euler Angle Z",
|
||||
() =>
|
||||
{
|
||||
inspector.GenerateCompositeParameterWindow(this, "Euler Angle Z", nameof(eulerAngleZ)).SetAsFlexibleFloat();
|
||||
});
|
||||
|
||||
var graphicEditor = inspector.GenerateButton(this, container, "GraphicEditor",
|
||||
() =>
|
||||
{
|
||||
inspector.GenerateGraphicalFlexibleFloatWindow(this, "Displacement",
|
||||
new FlexibleFloat[] { eulerAngleX, eulerAngleY, eulerAngleZ },
|
||||
new string[] { "EulerX", "EulerY", "EulerZ" });
|
||||
});
|
||||
|
||||
container.SetDeviver(1);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
@@ -16,10 +17,6 @@ namespace Ichni.RhythmGame
|
||||
public Color originalEmissionColor;
|
||||
public float originalEmissionIntensity;
|
||||
|
||||
public List<Color> baseColorOffset = new List<Color>();
|
||||
public List<Color> emissionColorOffset = new List<Color>();
|
||||
public List<float> emissionIntensityOffset = new List<float>();
|
||||
|
||||
public Color currentBaseColor;
|
||||
public Color currentEmissionColor;
|
||||
public float currentEmissionIntensity;
|
||||
@@ -40,6 +37,9 @@ namespace Ichni.RhythmGame
|
||||
|
||||
this.baseColorDirtyMark = false;
|
||||
this.emissionColorDirtyMark = false;
|
||||
|
||||
(attachedGameElement as IHaveColorSubmodule).colorSubmodule = this;
|
||||
(attachedGameElement as IHaveColorSubmodule).SetColorObserver();
|
||||
}
|
||||
|
||||
public ColorSubmodule(GameElement attachedGameElement, Color originalBaseColor) : base(attachedGameElement)
|
||||
@@ -57,6 +57,7 @@ namespace Ichni.RhythmGame
|
||||
this.emissionColorDirtyMark = false;
|
||||
|
||||
(attachedGameElement as IHaveColorSubmodule).colorSubmodule = this;
|
||||
(attachedGameElement as IHaveColorSubmodule).SetColorObserver();
|
||||
}
|
||||
|
||||
public ColorSubmodule(GameElement attachedGameElement, Color originalBaseColor, bool emissionEnabled,
|
||||
@@ -75,6 +76,7 @@ namespace Ichni.RhythmGame
|
||||
this.emissionColorDirtyMark = false;
|
||||
|
||||
(attachedGameElement as IHaveColorSubmodule).colorSubmodule = this;
|
||||
(attachedGameElement as IHaveColorSubmodule).SetColorObserver();
|
||||
}
|
||||
|
||||
public override void SaveBM()
|
||||
@@ -86,20 +88,78 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Color");
|
||||
|
||||
var baseColor = inspector.GenerateBaseColorPicker(this, container, "Base Color", nameof(originalBaseColor));
|
||||
baseColor.AddListenerFunction(Refresh);
|
||||
if (attachedGameElement.childElementList.Exists(x => x is BaseColorChange))
|
||||
{
|
||||
baseColor.title.text += " (Occupied by Animation)";
|
||||
baseColor.canvasGroup.interactable = false;
|
||||
}
|
||||
|
||||
if ((attachedGameElement as IHaveColorSubmodule).haveEmission)
|
||||
{
|
||||
var emissionColor = inspector.GenerateEmissionColorPicker(this, container, "Emission Color",
|
||||
nameof(emissionEnabled), nameof(originalEmissionColor), nameof(originalEmissionIntensity));
|
||||
emissionColor.AddListenerFunction(Refresh);
|
||||
|
||||
if (attachedGameElement.childElementList.Exists(x => x is EmissionColorChange))
|
||||
{
|
||||
emissionColor.title.text += " (Occupied by Animation)";
|
||||
emissionColor.canvasGroup.interactable = false;
|
||||
}
|
||||
}
|
||||
|
||||
container.SetDeviver(1);
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
currentBaseColor = originalBaseColor;
|
||||
currentEmissionColor = originalEmissionColor;
|
||||
baseColorDirtyMark = true;
|
||||
emissionColorDirtyMark = true;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHaveColorSubmodule
|
||||
{
|
||||
public ColorSubmodule colorSubmodule { get; set; }
|
||||
public bool haveEmission { get; }
|
||||
|
||||
public void SetColorObserver()
|
||||
{
|
||||
GameElement attachedGameElement = colorSubmodule.attachedGameElement;
|
||||
|
||||
Observable.EveryUpdate().Subscribe(_ =>
|
||||
{
|
||||
if (colorSubmodule == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool willRefresh = false;
|
||||
|
||||
if (colorSubmodule.baseColorDirtyMark)
|
||||
{
|
||||
//在动画物体中改变currentColor
|
||||
colorSubmodule.baseColorDirtyMark = false;
|
||||
willRefresh = true;
|
||||
}
|
||||
|
||||
if (colorSubmodule.emissionColorDirtyMark)
|
||||
{
|
||||
//在动画物体中改变currentColor
|
||||
colorSubmodule.emissionColorDirtyMark = false;
|
||||
willRefresh = true;
|
||||
}
|
||||
|
||||
if (willRefresh)
|
||||
{
|
||||
attachedGameElement.Refresh();
|
||||
}
|
||||
}).AddTo(attachedGameElement);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Ichni.RhythmGame
|
||||
this.songName = songName;
|
||||
this.bpm = bpm;
|
||||
this.delay = delay;
|
||||
songLocation = EditorManager.instance.projectInformation.projectPath + "/" + songName + ".wav";
|
||||
songLocation = EditorManager.instance.projectInformation.projectPath + "/" + songName;
|
||||
Debug.Log("Loading song from " + songLocation + " " + ES3.FileExists(songLocation));
|
||||
song = ES3.LoadAudio(songLocation, AudioType.WAV);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
@@ -11,15 +12,16 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public bool isStatic;
|
||||
|
||||
public static SubstantialObject GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated, GameElement parentElement, string themeBundleName, string objectName, bool isStatic)
|
||||
public static EnvironmentObject GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated, string themeBundleName, string objectName, GameElement parentElement, bool isStatic)
|
||||
{
|
||||
EnvironmentObject themeBundleObject =
|
||||
ThemeBundleManager.instance.GetObject<EnvironmentObject>(themeBundleName, objectName);
|
||||
EnvironmentObject environmentObject =
|
||||
Instantiate(themeBundleObject, parentElement.transform).GetComponent<EnvironmentObject>();
|
||||
environmentObject.Initialize(elementName, id, tags, isFirstGenerated, parentElement);
|
||||
EnvironmentObject environmentObject =
|
||||
SubstantialObject.GenerateElement(elementName, id, tags, isFirstGenerated, themeBundleName, objectName, parentElement)
|
||||
.GetComponent<EnvironmentObject>();
|
||||
|
||||
environmentObject.isStatic = isStatic;
|
||||
environmentObject.gameObject.isStatic = isStatic;
|
||||
|
||||
return environmentObject;
|
||||
}
|
||||
}
|
||||
@@ -31,6 +33,38 @@ namespace Ichni.RhythmGame
|
||||
matchedBM = new EnvironmentObject_BM(elementName, elementGuid, tags,
|
||||
parentElement.matchedBM as GameElement_BM, themeBundleName, objectName, isStatic);
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
base.SetUpInspector();
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Generate");
|
||||
var environmentObjectButton = inspector.GenerateButton(this, container, "Environment Object",
|
||||
() => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
|
||||
true, this));
|
||||
var isStaticToggle = inspector.GenerateToggle(this, container, "Is Static", nameof(isStatic));
|
||||
isStaticToggle.AddListenerFunction(_ => gameObject.isStatic = isStatic);
|
||||
|
||||
var generateContainer = inspector.GenerateContainer("Generate");
|
||||
var generateDisplacementButton = inspector.GenerateButton(this, generateContainer, "Displacement",
|
||||
() => Displacement.GenerateElement("New Displacement", Guid.NewGuid(), new List<string>(), true,
|
||||
this, new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat()));
|
||||
var generateSwirlButton = inspector.GenerateButton(this, generateContainer, "Swirl",
|
||||
() => Swirl.GenerateElement("New Swirl", Guid.NewGuid(), new List<string>(), true,
|
||||
this, new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat()));
|
||||
var generateScaleButton = inspector.GenerateButton(this, generateContainer, "Scale",
|
||||
() => Scale.GenerateElement("New Scale", Guid.NewGuid(), new List<string>(), true,
|
||||
this, new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat()));
|
||||
var generateBaseColorChangeButton = inspector.GenerateButton(this, generateContainer, "Base Color Change",
|
||||
() => BaseColorChange.GenerateElement("New Base Color Change", Guid.NewGuid(), new List<string>(), true,
|
||||
this, new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat()));
|
||||
if (haveEmission)
|
||||
{
|
||||
var generateEmissionColorChangeButton = inspector.GenerateButton(this, generateContainer, "Emission Color Change",
|
||||
() => EmissionColorChange.GenerateElement("New Emission Color Change", Guid.NewGuid(), new List<string>(), true,
|
||||
this, new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat(), new FlexibleFloat()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
@@ -54,13 +88,13 @@ namespace Ichni.RhythmGame
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = EnvironmentObject.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid), themeBundleName, objectName, isStatic);
|
||||
themeBundleName, objectName,GetElement(attachedElementGuid), isStatic);
|
||||
}
|
||||
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return EnvironmentObject.GenerateElement(elementName, Guid.NewGuid(), tags, false,
|
||||
parent, themeBundleName, objectName, isStatic);
|
||||
themeBundleName, objectName, parent, isStatic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,16 +13,13 @@ namespace Ichni.RhythmGame
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
public ColorSubmodule colorSubmodule { get; set; }
|
||||
public bool haveEmission { get; }
|
||||
public bool haveEmission => false;
|
||||
|
||||
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;
|
||||
|
||||
@@ -65,8 +65,8 @@ namespace Ichni.RhythmGame
|
||||
float size = transformSubmodule.currentScale.x;
|
||||
Color color = colorSubmodule.currentBaseColor;
|
||||
|
||||
transform.position = position;
|
||||
transform.rotation = Quaternion.LookRotation(normal);
|
||||
transform.localPosition = position;
|
||||
transform.localRotation = Quaternion.LookRotation(normal);
|
||||
transform.localScale = Vector3.one * size;
|
||||
|
||||
node = new SplinePoint(position, Vector3.up, normal, size, color);
|
||||
|
||||
@@ -50,6 +50,8 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
trackPathSubmodule.ClosePath();
|
||||
}
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -76,11 +76,18 @@ namespace Ichni.RhythmGame
|
||||
var container = inspector.GenerateContainer("Track Time Movable");
|
||||
var startTimeInputField =
|
||||
inspector.GenerateInputField(this, container, "Start Time", nameof(trackStartTime));
|
||||
startTimeInputField.AddListenerFunction(_ => RefreshChildren());
|
||||
|
||||
var endTimeInputField = inspector.GenerateInputField(this, container, "End Time", nameof(trackEndTime));
|
||||
endTimeInputField.AddListenerFunction(_ => RefreshChildren());
|
||||
|
||||
var visibleTimeInputField =
|
||||
inspector.GenerateInputField(this, container, "Visible Time Length", nameof(visibleTrackTimeLength));
|
||||
|
||||
var animationCurveDropdown = inspector.GenerateDropdown(this, container, "Animation Curve",
|
||||
typeof(AnimationCurveType), nameof(animationCurveType));
|
||||
animationCurveDropdown.AddListenerFunction(_ => RefreshChildren());
|
||||
|
||||
var deleteButton = inspector.GenerateButton(this, container, "Delete",
|
||||
() =>
|
||||
{
|
||||
@@ -90,6 +97,17 @@ namespace Ichni.RhythmGame
|
||||
track.Refresh();
|
||||
});
|
||||
}
|
||||
|
||||
private void RefreshChildren()
|
||||
{
|
||||
track.childElementList.ForEach(child =>
|
||||
{
|
||||
if (child is NoteBase note)
|
||||
{
|
||||
note.UpdateNoteInTrack();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
|
||||
Reference in New Issue
Block a user