DTM Flick,编辑界面网格
This commit is contained in:
50
Assets/Scripts/EditorGame/Grids/GridController.cs
Normal file
50
Assets/Scripts/EditorGame/Grids/GridController.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
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;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
yPlaneEnabled = true;
|
||||
xPlaneEnabled = false;
|
||||
zPlaneEnabled = false;
|
||||
RefreshPlanes();
|
||||
}
|
||||
|
||||
public void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
|
||||
var container = inspector.GenerateContainer("Grid Controller");
|
||||
var yPlaneToggle = inspector.GenerateToggle(this, container, "Y Plane", nameof(yPlaneEnabled));
|
||||
yPlaneToggle.AddListenerFunction(RefreshPlanes);
|
||||
var xPlaneToggle = inspector.GenerateToggle(this, container, "X Plane", nameof(xPlaneEnabled));
|
||||
xPlaneToggle.AddListenerFunction(RefreshPlanes);
|
||||
var zPlaneToggle = inspector.GenerateToggle(this, container, "Z Plane", nameof(zPlaneEnabled));
|
||||
zPlaneToggle.AddListenerFunction(RefreshPlanes);
|
||||
}
|
||||
|
||||
private void RefreshPlanes()
|
||||
{
|
||||
yPlaneGrid.gameObject.SetActive(yPlaneEnabled);
|
||||
xPlaneGrid.gameObject.SetActive(xPlaneEnabled);
|
||||
zPlaneGrid.gameObject.SetActive(zPlaneEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user