Skip to content

Commit

Permalink
Add inspector for NeighborManager
Browse files Browse the repository at this point in the history
  • Loading branch information
LazyDuchess committed Jul 10, 2024
1 parent 0b13887 commit fb19042
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Assets/Editor/OpenTS2/NeighborManagerEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using OpenTS2.Content;
using OpenTS2.Game;
using OpenTS2.SimAntics;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;

namespace OpenTS2
{
[CustomEditor(typeof(NeighborManager))]
public class NeighborManagerEditor : Editor
{
private bool _showNeighbors = false;
public override void OnInspectorGUI()
{
DrawDefaultInspector();
var neighborManager = target as NeighborManager;
_showNeighbors = EditorGUILayout.Foldout(_showNeighbors, "Neighbors");
if (_showNeighbors)
{
var neighbors = neighborManager.Neighbors;
EditorGUI.indentLevel++;
foreach(var neighbor in neighbors)
{
GUILayout.BeginVertical("box");
GUILayout.Label($"{neighbor.ObjectDefinition.FileName}");
GUILayout.Label($"Neighbor ID {neighbor.Id}");
GUILayout.Label($"Object GUID 0x{neighbor.GUID:X8}");
GUILayout.EndVertical();
}
EditorGUI.indentLevel--;
}
}
}
}
11 changes: 11 additions & 0 deletions Assets/Editor/OpenTS2/NeighborManagerEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fb19042

Please sign in to comment.