Vector3 inputfield 改进
This commit is contained in:
@@ -43,17 +43,8 @@ namespace Ichni.RhythmGame
|
||||
positionX.UpdateFlexibleFloat(songTime);
|
||||
positionY.UpdateFlexibleFloat(songTime);
|
||||
positionZ.UpdateFlexibleFloat(songTime);
|
||||
|
||||
if (positionX.returnType is FlexibleReturnType.After or FlexibleReturnType.Before
|
||||
or FlexibleReturnType.MiddleInterval or FlexibleReturnType.None &&
|
||||
positionY.returnType is FlexibleReturnType.After or FlexibleReturnType.Before
|
||||
or FlexibleReturnType.MiddleInterval or FlexibleReturnType.None &&
|
||||
positionZ.returnType is FlexibleReturnType.After or FlexibleReturnType.Before
|
||||
or FlexibleReturnType.MiddleInterval or FlexibleReturnType.None)
|
||||
{
|
||||
// Out of range, do nothing
|
||||
}
|
||||
else if (positionX.returnType is FlexibleReturnType.MiddleExecuting or FlexibleReturnType.After or FlexibleReturnType.Before ||
|
||||
|
||||
if (positionX.returnType is FlexibleReturnType.MiddleExecuting or FlexibleReturnType.After or FlexibleReturnType.Before ||
|
||||
positionY.returnType is FlexibleReturnType.MiddleExecuting or FlexibleReturnType.After or FlexibleReturnType.Before ||
|
||||
positionZ.returnType is FlexibleReturnType.MiddleExecuting or FlexibleReturnType.After or FlexibleReturnType.Before)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Sirenix.OdinInspector;
|
||||
using UniRx;
|
||||
@@ -18,6 +19,11 @@ namespace Ichni.RhythmGame
|
||||
/// </summary>
|
||||
public void SaveBM();
|
||||
|
||||
/// <summary>
|
||||
/// 刷新物体的状态
|
||||
/// </summary>
|
||||
public void Refresh();
|
||||
|
||||
/// <summary>
|
||||
/// 当物体被删除时执行的方法
|
||||
/// </summary>
|
||||
@@ -33,6 +39,8 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetUpInspector();
|
||||
}
|
||||
|
||||
// public virtual void SetTimeDuration()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -33,6 +34,18 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
attachedGameElement.submoduleList.Remove(this);
|
||||
}
|
||||
|
||||
public Inspector inspector => EditorManager.instance.uiManager.inspector;
|
||||
|
||||
public virtual void SetUpInspector()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void Refresh()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
|
||||
@@ -82,6 +82,30 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
matchedBM = new TransformSubmodule_BM(attachedGameElement);
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
var container = inspector.GenerateContainer("Transform");
|
||||
var originalPosInputField =
|
||||
inspector.GenerateVec3InputField(this, container, "Start Position", nameof(originalPosition));
|
||||
var originalRotInputField =
|
||||
inspector.GenerateVec3InputField(this, container, "Start Rotation", nameof(originalEulerAngles));
|
||||
var originalScaleInputField =
|
||||
inspector.GenerateVec3InputField(this, container, "Start Scale", nameof(originalScale));
|
||||
var currentPosText =
|
||||
inspector.GenerateText(this, container, "Current Position", nameof(currentPosition), true);
|
||||
var currentRotText =
|
||||
inspector.GenerateText(this, container, "Current Rotation", nameof(currentEulerAngles), true);
|
||||
var currentScaleText =
|
||||
inspector.GenerateText(this, container, "Current Scale", nameof(currentScale), true);
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
positionDirtyMark = true;
|
||||
eulerAnglesDirtyMark = true;
|
||||
scaleDirtyMark = true;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHaveTransformSubmodule
|
||||
|
||||
@@ -6,22 +6,18 @@ using UnityEngine;
|
||||
[CreateAssetMenu(fileName = "BasePrefabsCollection", menuName = "Ichni/BasePrefabsCollection", order = 0)]
|
||||
public class BasePrefabsCollection : SerializedScriptableObject
|
||||
{
|
||||
[Title("基础预制体")]
|
||||
public GameObject emptyObject;
|
||||
[Title("基础预制体")] public GameObject emptyObject;
|
||||
public GameObject elementFolder;
|
||||
public GameObject gameCamera;
|
||||
|
||||
[Title("Track相关")]
|
||||
public GameObject track;
|
||||
|
||||
[Title("Track相关")] public GameObject track;
|
||||
public GameObject pathNode;
|
||||
public Material defaultTrackMaterial;
|
||||
|
||||
[Title("Trail相关")]
|
||||
public GameObject trail;
|
||||
|
||||
[Title("Trail相关")] public GameObject trail;
|
||||
public Material defaultTrailMaterial;
|
||||
|
||||
[Title("Note 相关")]
|
||||
public GameObject tapNote;
|
||||
[Title("Note 相关")] public GameObject tapNote;
|
||||
public GameObject stayNote;
|
||||
public GameObject holdNote;
|
||||
public GameObject flickNote;
|
||||
@@ -32,12 +28,15 @@ public class BasePrefabsCollection : SerializedScriptableObject
|
||||
public AudioClip holdNoteEndSound;
|
||||
public AudioClip flickNoteSound;
|
||||
|
||||
[Title("Effect相关")]
|
||||
public GameObject bloomShake;
|
||||
|
||||
[Title("DynamicUI相关")]
|
||||
public GameObject dynamicUIContainer;
|
||||
[Title("Effect相关")] public GameObject bloomShake;
|
||||
|
||||
[Title("DynamicUI相关")] public GameObject dynamicUIContainer;
|
||||
public GameObject inputField;
|
||||
public GameObject Vec3inputField;
|
||||
public GameObject text;
|
||||
public GameObject button;
|
||||
public GameObject toggle;
|
||||
public GameObject dropdown;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -50,6 +50,9 @@ namespace Ichni
|
||||
gameElement.AfterInitialize();
|
||||
gameElement.Refresh();
|
||||
});
|
||||
|
||||
// projectManager.saveManager.Save();
|
||||
// projectManager.exportManager.Export();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -66,6 +69,17 @@ namespace Ichni
|
||||
new FlexibleFloat(),
|
||||
new FlexibleFloat(new List<AnimatedFloat>(){new (0,2,0,10, AnimationCurveType.Linear)}),
|
||||
new FlexibleFloat());
|
||||
var dis1 = Displacement.GenerateElement("Displacement-1", Guid.NewGuid(), new List<string>(), true, f0,
|
||||
new FlexibleFloat(new List<AnimatedFloat>()
|
||||
{
|
||||
new(0, 0.5f, 0, -4, AnimationCurveType.OutQuad),
|
||||
new(0.5f, 1, -4, 0, AnimationCurveType.InQuad),
|
||||
new(1, 1.5f, 0, 4, AnimationCurveType.OutQuad),
|
||||
new(1.5f, 2, 4, 0, AnimationCurveType.InQuad),
|
||||
}),
|
||||
new FlexibleFloat(new List<AnimatedFloat>(){new (0,2,0,-10, AnimationCurveType.Linear)}),
|
||||
new FlexibleFloat());
|
||||
|
||||
var t0 = Track.GenerateElement("Track", Guid.NewGuid(), new List<string>(), true, f0);
|
||||
t0.trackPathSubmodule = new TrackPathSubmodule(t0, Track.TrackSpaceType.Linear, Track.TrackSamplingType.TimeDistributed, false);
|
||||
t0.submoduleList.Add(t0.trackPathSubmodule);
|
||||
@@ -84,15 +98,6 @@ namespace Ichni
|
||||
var n0 = Tap.GenerateElement("Note-0", Guid.NewGuid(), new List<string>(), true, t0, 1f);
|
||||
var n0v = BasicNoteVisual.GenerateElement("Note-0-V", Guid.NewGuid(), new List<string>(), true, n0,
|
||||
"basic", "BasicNoteTap3D");
|
||||
|
||||
beatmapContainer.gameElementList.ForEach(e =>
|
||||
{
|
||||
e.AfterInitialize();
|
||||
e.Refresh();
|
||||
});
|
||||
|
||||
projectManager.saveManager.Save();
|
||||
projectManager.exportManager.Export();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,16 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
matchedBM = new BeatmapContainer_BM(gameElementList);
|
||||
}
|
||||
|
||||
public void SetUpInspector()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
|
||||
@@ -20,6 +20,16 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
matchedBM = new CommandScripts_BM(commandList);
|
||||
}
|
||||
|
||||
public void SetUpInspector()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
|
||||
@@ -41,6 +41,16 @@ namespace Ichni.RhythmGame
|
||||
matchedBM = new ProjectInformation_BM(projectName, creatorName, editorVersion,
|
||||
createTime, lastSaveTime, selectedThemeBundleList);
|
||||
}
|
||||
|
||||
public void SetUpInspector()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
|
||||
@@ -29,6 +29,16 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
matchedBM = new SongInformation_BM(songName, bpm, delay);
|
||||
}
|
||||
|
||||
public void SetUpInspector()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
|
||||
@@ -13,9 +13,5 @@ namespace Ichni.Editor
|
||||
public GridLayoutGroup gridLayoutGroup;
|
||||
public List<DynamicUIElement> dynamicUIElements = new List<DynamicUIElement>();
|
||||
[FormerlySerializedAs("container")] public RectTransform rect;
|
||||
|
||||
public void setVoH(bool VoH){
|
||||
if(VoH)gridLayoutGroup.cellSize=new Vector2(250,100);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ichni.RhythmGame;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class DynamicUIDropdown : DynamicUIElement
|
||||
{
|
||||
public TMP_Dropdown dropdown;
|
||||
|
||||
public override void Initialize(IBaseElement baseElement, string title, string parameterName)
|
||||
{
|
||||
base.Initialize(baseElement, title, parameterName);
|
||||
dropdown.value = (int)connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement); //获取对应变量的值
|
||||
dropdown.onValueChanged.AddListener(ApplyParameters);
|
||||
}
|
||||
|
||||
public void SetUpEnum(Type enumType)
|
||||
{
|
||||
dropdown.options.Clear();
|
||||
List<string> enumNameList = System.Enum.GetNames(enumType).ToList();
|
||||
dropdown.AddOptions(enumNameList);
|
||||
}
|
||||
|
||||
private void ApplyParameters(int value)
|
||||
{
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, value);
|
||||
connectedBaseElement.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 264384f5bd48a41acb9b80fac4ed4544
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -9,7 +9,7 @@ namespace Ichni.Editor
|
||||
public abstract class DynamicUIElement : MonoBehaviour
|
||||
{
|
||||
public TMP_Text title;
|
||||
protected GameElement connectedGameElement => EditorManager.instance.uiManager.inspector.connectedGameElement;
|
||||
public IBaseElement connectedBaseElement;
|
||||
|
||||
/// <summary>
|
||||
/// 参数名,通过反射获取饿修改对应变量的值
|
||||
@@ -21,8 +21,9 @@ namespace Ichni.Editor
|
||||
/// </summary>
|
||||
public bool isAlwaysUpdated;
|
||||
|
||||
public virtual void Initialize(string title, string parameterName)
|
||||
public virtual void Initialize(IBaseElement baseElement, string title, string parameterName)
|
||||
{
|
||||
this.connectedBaseElement = baseElement;
|
||||
this.parameterName = parameterName;
|
||||
this.title.text = title;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -9,17 +10,18 @@ namespace Ichni.Editor
|
||||
{
|
||||
public TMP_InputField inputField;
|
||||
|
||||
public override void Initialize(string title, string parameterName)
|
||||
public override void Initialize(IBaseElement baseElement, string title, string parameterName)
|
||||
{
|
||||
base.Initialize(title, parameterName);
|
||||
inputField.text = connectedGameElement.GetType().GetField(parameterName).GetValue(connectedGameElement).ToString(); //获取对应变量的值
|
||||
base.Initialize(baseElement, title, parameterName);
|
||||
inputField.text = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement).ToString(); //获取对应变量的值
|
||||
|
||||
inputField.onEndEdit.AddListener(ApplyParameters); //输入结束后修改变量
|
||||
inputField.onEndEdit.AddListener(ApplyParameters);
|
||||
}
|
||||
|
||||
private void ApplyParameters(string text)
|
||||
{
|
||||
connectedGameElement.GetType().GetField(parameterName).SetValue(connectedGameElement, text);
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, text);
|
||||
connectedBaseElement.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -10,17 +11,17 @@ namespace Ichni.Editor
|
||||
{
|
||||
public TMP_Text text;
|
||||
|
||||
public override void Initialize(string title, string parameterName)
|
||||
public override void Initialize(IBaseElement baseElement, string title, string parameterName)
|
||||
{
|
||||
base.Initialize(title, parameterName);
|
||||
text.text = connectedGameElement.GetType().GetField(parameterName).GetValue(connectedGameElement).ToString();
|
||||
base.Initialize(baseElement, title, parameterName);
|
||||
text.text = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement).ToString();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isAlwaysUpdated)
|
||||
{
|
||||
text.text = connectedGameElement.GetType().GetField(parameterName).GetValue(connectedGameElement).ToString();
|
||||
text.text = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using JetBrains.Annotations;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements.Experimental;
|
||||
namespace Ichni.Editor{
|
||||
public class DynamicUIVec3InputField : DynamicUIElement
|
||||
{
|
||||
public TMP_InputField inputFieldx;
|
||||
public TMP_InputField inputFieldy;
|
||||
public TMP_InputField inputFieldz;
|
||||
|
||||
public TransformSubmodule e=null;
|
||||
public override void Initialize(string title, string parameterName)
|
||||
{
|
||||
|
||||
foreach(var i in connectedGameElement.submoduleList){
|
||||
if(i.GetType()==typeof(TransformSubmodule)){
|
||||
e= (TransformSubmodule)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (e == null)Destroy(gameObject);
|
||||
base.Initialize(title, parameterName);
|
||||
|
||||
Vector3 pos = (Vector3)e.GetType().GetField(parameterName).GetValue(e); //获取对应变量的值
|
||||
|
||||
|
||||
inputFieldx.text =pos.x.ToString();
|
||||
|
||||
inputFieldy.text =pos.y.ToString();
|
||||
|
||||
inputFieldz.text =pos.z.ToString();
|
||||
|
||||
}//我不应该用这种复制大法的(
|
||||
|
||||
public void ApplyParametersx(string text)
|
||||
{
|
||||
|
||||
Vector3 newpos=totramsf(text,0);
|
||||
e.GetType().GetField(parameterName).SetValue(e, newpos);
|
||||
|
||||
}
|
||||
public void ApplyParametersy(string text)
|
||||
{
|
||||
|
||||
Vector3 newpos=totramsf(text,1);
|
||||
e.GetType().GetField(parameterName).SetValue(e, newpos);
|
||||
}
|
||||
public void ApplyParametersz(string text)
|
||||
{
|
||||
|
||||
Vector3 newpos=totramsf(text,2);
|
||||
e.GetType().GetField(parameterName).SetValue(e, newpos);
|
||||
}
|
||||
|
||||
Vector3 totramsf(string value,int queue){
|
||||
float avalue;
|
||||
if(!float.TryParse(value,out avalue)){
|
||||
avalue=0f;
|
||||
}
|
||||
Vector3 a= (Vector3)e.GetType().GetField(parameterName).GetValue(e); //获取对应变量的值
|
||||
a[queue]=avalue;
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using JetBrains.Annotations;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UIElements.Experimental;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class DynamicUIVector3InputField : DynamicUIElement
|
||||
{
|
||||
public TMP_InputField inputFieldX;
|
||||
public TMP_InputField inputFieldY;
|
||||
public TMP_InputField inputFieldZ;
|
||||
|
||||
public override void Initialize(IBaseElement baseElement, string title, string parameterName)
|
||||
{
|
||||
base.Initialize(baseElement, title, parameterName);
|
||||
Vector3 pos = (Vector3)connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement); //获取对应变量的值
|
||||
inputFieldX.text = pos.x.ToString();
|
||||
inputFieldY.text = pos.y.ToString();
|
||||
inputFieldZ.text = pos.z.ToString();
|
||||
|
||||
inputFieldX.onEndEdit.AddListener(_ => ApplyParameters());
|
||||
inputFieldY.onEndEdit.AddListener(_ => ApplyParameters());
|
||||
inputFieldZ.onEndEdit.AddListener(_ => ApplyParameters());
|
||||
}
|
||||
|
||||
public void ApplyParameters()
|
||||
{
|
||||
Vector3 newValue = new Vector3(float.Parse(inputFieldX.text), float.Parse(inputFieldY.text), float.Parse(inputFieldZ.text));
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, newValue);
|
||||
connectedBaseElement.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
@@ -22,51 +23,73 @@ namespace Ichni.Editor
|
||||
containers.Clear();
|
||||
connectedGameElement = gameElement;
|
||||
connectedGameElement.SetUpInspector();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Inspector
|
||||
public partial class Inspector
|
||||
{
|
||||
public DynamicUIContainer GenerateContainer(string title)
|
||||
{
|
||||
DynamicUIContainer container = Instantiate(EditorManager.instance.basePrefabs.dynamicUIContainer, inspectorRect).GetComponent<DynamicUIContainer>();
|
||||
DynamicUIContainer container =
|
||||
Instantiate(EditorManager.instance.basePrefabs.dynamicUIContainer, inspectorRect)
|
||||
.GetComponent<DynamicUIContainer>();
|
||||
container.title.text = title;
|
||||
containers.Add(container);
|
||||
return container;
|
||||
}
|
||||
|
||||
|
||||
public DynamicUIContainer GenerateContainer()
|
||||
{
|
||||
DynamicUIContainer container = Instantiate(EditorManager.instance.basePrefabs.dynamicUIContainer, inspectorRect).GetComponent<DynamicUIContainer>();
|
||||
DynamicUIContainer container =
|
||||
Instantiate(EditorManager.instance.basePrefabs.dynamicUIContainer, inspectorRect)
|
||||
.GetComponent<DynamicUIContainer>();
|
||||
Destroy(container.title.gameObject);
|
||||
containers.Add(container);
|
||||
return container;
|
||||
}
|
||||
|
||||
public DynamicUIInputField GenerateInputField(DynamicUIContainer container, string title, string parameterName)
|
||||
|
||||
public DynamicUIInputField GenerateInputField(IBaseElement baseElement, DynamicUIContainer container,
|
||||
string title, string parameterName)
|
||||
{
|
||||
DynamicUIInputField inputField = Instantiate(EditorManager.instance.basePrefabs.inputField, container.rect).GetComponent<DynamicUIInputField>();
|
||||
inputField.Initialize(title, parameterName);
|
||||
DynamicUIInputField inputField = Instantiate(EditorManager.instance.basePrefabs.inputField, container.rect)
|
||||
.GetComponent<DynamicUIInputField>();
|
||||
inputField.Initialize(baseElement, title, parameterName);
|
||||
container.dynamicUIElements.Add(inputField);
|
||||
return inputField;
|
||||
}
|
||||
public DynamicUIVec3InputField GenerateVec3InputField(DynamicUIContainer container, string title, string parameterName){
|
||||
DynamicUIVec3InputField a=Instantiate(EditorManager.instance.basePrefabs.Vec3inputField,container.rect).GetComponent<DynamicUIVec3InputField>();
|
||||
a.Initialize(title, parameterName);
|
||||
container.dynamicUIElements.Add(a);
|
||||
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
public DynamicUIText GenerateText(DynamicUIContainer container, string title, string parameterName, bool isAlwaysUpdate = false)
|
||||
public DynamicUIVector3InputField GenerateVec3InputField(IBaseElement baseElement, DynamicUIContainer container,
|
||||
string title, string parameterName)
|
||||
{
|
||||
DynamicUIText text = Instantiate(EditorManager.instance.basePrefabs.text, container.rect).GetComponent<DynamicUIText>();
|
||||
text.Initialize(title, parameterName);
|
||||
DynamicUIVector3InputField vector3InputField =
|
||||
Instantiate(EditorManager.instance.basePrefabs.Vec3inputField, container.rect)
|
||||
.GetComponent<DynamicUIVector3InputField>();
|
||||
vector3InputField.Initialize(baseElement, title, parameterName);
|
||||
container.dynamicUIElements.Add(vector3InputField);
|
||||
return vector3InputField;
|
||||
}
|
||||
|
||||
public DynamicUIText GenerateText(IBaseElement baseElement, DynamicUIContainer container, string title,
|
||||
string parameterName, bool isAlwaysUpdate = false)
|
||||
{
|
||||
DynamicUIText text = Instantiate(EditorManager.instance.basePrefabs.text, container.rect)
|
||||
.GetComponent<DynamicUIText>();
|
||||
text.Initialize(baseElement, title, parameterName);
|
||||
text.isAlwaysUpdated = isAlwaysUpdate;
|
||||
container.dynamicUIElements.Add(text);
|
||||
return text;
|
||||
}
|
||||
|
||||
public DynamicUIDropdown GenerateDropdown(IBaseElement baseElement, DynamicUIContainer container, string title,
|
||||
Type enumType, string parameterName)
|
||||
{
|
||||
DynamicUIDropdown dropdown = Instantiate(EditorManager.instance.basePrefabs.dropdown, container.rect)
|
||||
.GetComponent<DynamicUIDropdown>();
|
||||
dropdown.SetUpEnum(enumType);
|
||||
dropdown.Initialize(baseElement, title, parameterName);
|
||||
container.dynamicUIElements.Add(dropdown);
|
||||
return dropdown;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
using Inspector = Ichni.Editor.Inspector;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
@@ -38,8 +39,6 @@ namespace Ichni.RhythmGame
|
||||
//存档类
|
||||
public BaseElement_BM matchedBM { get; set; }
|
||||
|
||||
public Editor.Inspector inspector;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 首次初始化
|
||||
@@ -48,7 +47,6 @@ namespace Ichni.RhythmGame
|
||||
public virtual void Initialize(string name, Guid elementGuid, List<string> tags,
|
||||
bool isFirstGenerated, GameElement parentElement)
|
||||
{
|
||||
inspector=EditorManager.instance.uiManager.inspector;
|
||||
this.elementName = name;
|
||||
this.elementGuid = elementGuid;
|
||||
this.tags = tags;
|
||||
@@ -75,14 +73,6 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新物体的状态
|
||||
/// </summary>
|
||||
public virtual void Refresh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置父物体
|
||||
/// </summary>
|
||||
@@ -100,6 +90,12 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public abstract partial class GameElement //存档,删除,复制,粘贴
|
||||
{
|
||||
|
||||
public virtual void Refresh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用于生成存档
|
||||
/// </summary>
|
||||
@@ -143,30 +139,18 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public abstract partial class GameElement
|
||||
{
|
||||
public virtual void SetUpInspector()//被点击时设置第一层Inspector
|
||||
public Inspector inspector => EditorManager.instance.uiManager.inspector;
|
||||
|
||||
public void SetUpInspector() //被点击时设置第一层Inspector
|
||||
{
|
||||
var container = inspector.GenerateContainer("Element Info");
|
||||
var nameInputField = inspector.GenerateInputField(container, GetType().Name+"'s Name", nameof(elementName));
|
||||
var guidText = inspector.GenerateText(container, "Element GUID", nameof(elementGuid), true);
|
||||
foreach(var i in submoduleList){
|
||||
if(i.GetType()==typeof(TransformSubmodule)){
|
||||
SetUpSecondInspector((TransformSubmodule)i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var nameInputField = inspector.GenerateInputField(this, container, GetType().Name + "'s Name", nameof(elementName));
|
||||
var guidText = inspector.GenerateText(this, container, "Element GUID", nameof(elementGuid), true);
|
||||
foreach (var submodule in submoduleList)
|
||||
{
|
||||
submodule.SetUpInspector();
|
||||
}
|
||||
}
|
||||
public virtual void SetUpSecondInspector(TransformSubmodule i){
|
||||
var container2 = inspector.GenerateContainer("Element Property");
|
||||
container2.setVoH(true);
|
||||
var posInputField=inspector.GenerateVec3InputField(container2,"Start Position",nameof(i.originalPosition));
|
||||
var rotInputField=inspector.GenerateVec3InputField(container2,"Start Rotation",nameof(i.originalEulerAngles));
|
||||
var scaleInputField=inspector.GenerateVec3InputField(container2,"Start Scale",nameof(i.originalScale));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
|
||||
Reference in New Issue
Block a user