新Head
This commit is contained in:
@@ -57,60 +57,64 @@ namespace Ichni
|
||||
#region [编辑器界面] Inspector
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
|
||||
var container = inspector.GenerateContainer("Editor Manager");
|
||||
|
||||
var inGameSettings = container.GenerateSubcontainer(3);
|
||||
inspector.GenerateDropdown(this, inGameSettings, "Judge Type",
|
||||
typeof(NoteBase.NoteJudgeType), nameof(currentJudgeType))
|
||||
.AddListenerFunction(() =>
|
||||
{
|
||||
foreach (GameElement gameElement in beatmapContainer.gameElementList)
|
||||
{
|
||||
if (gameElement is NoteVisualBase noteVisual)
|
||||
InspectorBuilder.For(this)
|
||||
.Section("Editor Manager")
|
||||
.Dropdown(nameof(currentJudgeType), typeof(NoteBase.NoteJudgeType), "Judge Type")
|
||||
.OnChanged(() =>
|
||||
{
|
||||
noteVisual.Recover();
|
||||
}
|
||||
}
|
||||
});
|
||||
inspector.GenerateToggle(this, inGameSettings, "Use Note Prefab", nameof(useNotePrefab));
|
||||
inspector.GenerateToggle(this, inGameSettings, "Use Click Select", nameof(useClickSelect));
|
||||
inspector.GenerateToggle(this, inGameSettings, "Use Quick Move", nameof(useQuickMove));
|
||||
|
||||
var generation = container.GenerateSubcontainer(3);
|
||||
inspector.GenerateButton(this, generation, "Generate Folder",
|
||||
() => ElementFolder.GenerateElement("Folder", Guid.NewGuid(), new List<string>(), true, null));
|
||||
inspector.GenerateButton(this, generation, "Generate Background Setter",
|
||||
() => BackgroundSetter.GenerateElement("Background Setter", Guid.NewGuid(),
|
||||
new List<string>(), true, null, false, "basic", "Skybox", "Background"));
|
||||
inspector.GenerateButton(this, generation, "Generate Variables Container",
|
||||
() => VariablesContainer.GenerateElement("Variables Container", Guid.NewGuid(),
|
||||
new List<string>(), true, null, new Dictionary<string, int>()));
|
||||
foreach (GameElement gameElement in beatmapContainer.gameElementList)
|
||||
{
|
||||
if (gameElement is NoteVisualBase noteVisual)
|
||||
noteVisual.Recover();
|
||||
}
|
||||
})
|
||||
.Toggle(nameof(useNotePrefab), "Use Note Prefab")
|
||||
.Toggle(nameof(useClickSelect), "Use Click Select")
|
||||
.Toggle(nameof(useQuickMove), "Use Quick Move")
|
||||
.Button("Generate Folder", () =>
|
||||
ElementFolder.GenerateElement("Folder", Guid.NewGuid(), new List<string>(), true, null))
|
||||
.Button("Generate Background Setter", () =>
|
||||
BackgroundSetter.GenerateElement("Background Setter", Guid.NewGuid(),
|
||||
new List<string>(), true, null, false, "basic", "Skybox", "Background"))
|
||||
.Button("Generate Variables Container", () =>
|
||||
VariablesContainer.GenerateElement("Variables Container", Guid.NewGuid(),
|
||||
new List<string>(), true, null, new Dictionary<string, int>()))
|
||||
.Build();
|
||||
|
||||
projectInformation.SetUpInspector();
|
||||
songInformation.SetUpInspector();
|
||||
EditorManager.instance.cameraManager.SetUpInspector();
|
||||
|
||||
var oo = inspector.GenerateContainer("Grid");
|
||||
var p = oo.GenerateSubcontainer(3);
|
||||
var po = inspector.GenerateToggle(this, p, "Enable Grid");
|
||||
po.AddListenerFunction(() =>
|
||||
{
|
||||
EditorManager.instance.gridController.gameObject.SetActive(po.toggle.isOn);
|
||||
});
|
||||
var o = inspector.GenerateInputField(p, "Grid Size",
|
||||
(EditorManager.instance.gridController.baseGridSize * 10).ToString());
|
||||
o.AddListenerFunction(() =>
|
||||
{
|
||||
EditorManager.instance.gridController.baseGridSize = float.Parse(o.inputField.text) / 10;
|
||||
});
|
||||
var sc = inspector.GenerateToggle(this, p, "Show Coordinates");
|
||||
sc.toggle.isOn = EditorManager.instance.gridController.showCoordinates;
|
||||
sc.AddListenerFunction(() =>
|
||||
{
|
||||
EditorManager.instance.gridController.showCoordinates = sc.toggle.isOn;
|
||||
});
|
||||
// Grid 设置使用 RawSection 处理无绑定 Toggle/InputField 交互
|
||||
var gridToggleRef = new ElementRef<DynamicUIToggle>();
|
||||
var gridSizeRef = new ElementRef<DynamicUIInputField>();
|
||||
var showCoordsRef = new ElementRef<DynamicUIToggle>();
|
||||
|
||||
InspectorBuilder.For(this)
|
||||
.RawSection("Grid", int.MaxValue, (insp, container) =>
|
||||
{
|
||||
var p = container.GenerateSubcontainer(3);
|
||||
var gridToggle = insp.GenerateToggle(this, p, "Enable Grid");
|
||||
gridToggle.AddListenerFunction(() =>
|
||||
{
|
||||
EditorManager.instance.gridController.gameObject.SetActive(gridToggle.toggle.isOn);
|
||||
});
|
||||
|
||||
var gridSizeInput = insp.GenerateInputField(p, "Grid Size",
|
||||
(EditorManager.instance.gridController.baseGridSize * 10).ToString());
|
||||
gridSizeInput.AddListenerFunction(() =>
|
||||
{
|
||||
EditorManager.instance.gridController.baseGridSize = float.Parse(gridSizeInput.inputField.text) / 10;
|
||||
});
|
||||
|
||||
var showCoords = insp.GenerateToggle(this, p, "Show Coordinates");
|
||||
showCoords.toggle.isOn = EditorManager.instance.gridController.showCoordinates;
|
||||
showCoords.AddListenerFunction(() =>
|
||||
{
|
||||
EditorManager.instance.gridController.showCoordinates = showCoords.toggle.isOn;
|
||||
});
|
||||
})
|
||||
.Build();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user