75 lines
2.5 KiB
C#
75 lines
2.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Ichni.RhythmGame;
|
|
using Ichni.RhythmGame.Beatmap;
|
|
using Lean.Pool;
|
|
using UnityEngine;
|
|
|
|
namespace Ichni.Editor
|
|
{
|
|
public class GridController : MonoBehaviour, IBaseElement
|
|
{
|
|
public BaseElement_BM matchedBM { get; set; }
|
|
|
|
public EditorGrid yPlaneGrid;
|
|
public EditorGrid xPlaneGrid;
|
|
public EditorGrid zPlaneGrid;
|
|
|
|
public bool yPlaneEnabled;
|
|
public bool xPlaneEnabled;
|
|
public bool zPlaneEnabled;
|
|
|
|
public bool isYPlaneShowingPositionText;
|
|
|
|
private void Start()
|
|
{
|
|
yPlaneEnabled = true;
|
|
xPlaneEnabled = false;
|
|
zPlaneEnabled = false;
|
|
isYPlaneShowingPositionText = true;
|
|
RefreshPlanes();
|
|
}
|
|
|
|
public void SetUpInspector()
|
|
{
|
|
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
|
|
|
var container = inspector.GenerateContainer("Grid Controller");
|
|
|
|
//网格设置
|
|
var gridSettings = container.GenerateSubcontainer(3);
|
|
var yPlaneToggle =
|
|
inspector.GenerateToggle(this, gridSettings, "Y Plane", nameof(yPlaneEnabled))
|
|
.AddListenerFunction(RefreshPlanes);
|
|
var xPlaneToggle =
|
|
inspector.GenerateToggle(this, gridSettings, "X Plane", nameof(xPlaneEnabled))
|
|
.AddListenerFunction(RefreshPlanes);
|
|
var zPlaneToggle =
|
|
inspector.GenerateToggle(this, gridSettings, "Z Plane", nameof(zPlaneEnabled))
|
|
.AddListenerFunction(RefreshPlanes);
|
|
|
|
var yPlaneShowPositionToggle =
|
|
inspector.GenerateToggle(this, gridSettings, "Show Y Plane Position", nameof(isYPlaneShowingPositionText))
|
|
.AddListenerFunction(RefreshPlanes);
|
|
}
|
|
|
|
private void RefreshPlanes()
|
|
{
|
|
yPlaneGrid.gameObject.SetActive(yPlaneEnabled);
|
|
xPlaneGrid.gameObject.SetActive(xPlaneEnabled);
|
|
zPlaneGrid.gameObject.SetActive(zPlaneEnabled);
|
|
yPlaneGrid.isShowingPositionText = isYPlaneShowingPositionText;
|
|
|
|
if (!yPlaneGrid.isShowingPositionText)
|
|
{
|
|
foreach (KeyValuePair<GameObject, Vector3> positionText in yPlaneGrid.positionTexts)
|
|
{
|
|
LeanPool.Despawn(positionText.Key);
|
|
}
|
|
|
|
yPlaneGrid.positionTexts.Clear();
|
|
}
|
|
}
|
|
}
|
|
} |