2023-08-23 01:59:40 +08:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Globalization;
|
|
|
|
using UnityEditor;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UIElements;
|
|
|
|
|
|
|
|
namespace BITKit.Entities.Editor
|
|
|
|
{
|
|
|
|
public class UnityEntitiesServiceEditor : EditorWindow
|
|
|
|
{
|
|
|
|
[MenuItem("Tools/Entities/UnityEntitiesService")]
|
|
|
|
public static void Open()
|
|
|
|
{
|
|
|
|
var window = GetWindow<UnityEntitiesServiceEditor>();
|
|
|
|
window.Show();
|
|
|
|
}
|
|
|
|
private Label _timeLabel;
|
|
|
|
private VisualElement _container;
|
2023-11-15 23:54:54 +08:00
|
|
|
private VisualElement _idContainer;
|
|
|
|
private VisualElement _nameContainer;
|
2023-08-23 01:59:40 +08:00
|
|
|
private void OnEnable()
|
|
|
|
{
|
|
|
|
_timeLabel = rootVisualElement.Create<Label>();
|
|
|
|
_container = rootVisualElement.Create<VisualElement>();
|
|
|
|
rootVisualElement.styleSheets.Add(BITEditorUtils.InspectorStyleSheet);
|
|
|
|
rootVisualElement.styleSheets.Add(BITEditorUtils.Style);
|
|
|
|
rootVisualElement.AddToClassList("pa-8");
|
2023-11-15 23:54:54 +08:00
|
|
|
|
|
|
|
_idContainer = _container.Create<VisualElement>();
|
|
|
|
_nameContainer = _container.Create<VisualElement>();
|
|
|
|
|
|
|
|
_container.style.flexDirection = FlexDirection.Row;
|
|
|
|
_idContainer.style.flexDirection = FlexDirection.Column;
|
|
|
|
_nameContainer.style.flexDirection = FlexDirection.Column;
|
2023-08-23 01:59:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
{
|
|
|
|
_timeLabel.text = DateTime.Now.ToString(CultureInfo.InvariantCulture);
|
2023-11-15 23:54:54 +08:00
|
|
|
_nameContainer.Clear();
|
|
|
|
_idContainer.Clear();
|
2023-08-23 01:59:40 +08:00
|
|
|
foreach (var x in UnityEntitiesService.Entities)
|
|
|
|
{
|
2023-11-15 23:54:54 +08:00
|
|
|
//_container.Create<Label>().text = $"{x.Id}\t{x}";
|
|
|
|
_idContainer.Create<Label>().text = $"{x.Id}";
|
|
|
|
_nameContainer.Create<Label>().text = $"{x}";
|
2023-08-23 01:59:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|