breakpoint
before update unity version
This commit is contained in:
@@ -2,7 +2,9 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
@@ -22,7 +24,9 @@ namespace BITKit.GameEditor
|
||||
}
|
||||
|
||||
private Button _addButton;
|
||||
private Button _buildButton;
|
||||
private TextField _valueTextField;
|
||||
private Label reportLabel;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
@@ -37,6 +41,55 @@ namespace BITKit.GameEditor
|
||||
_addButton = rootVisualElement.Create<Button>();
|
||||
_addButton.text = "Add";
|
||||
_addButton.clicked += AddButtonOnClicked;
|
||||
|
||||
_buildButton = rootVisualElement.Create<Button>();
|
||||
_buildButton.clicked += BuildAssembliesReference;
|
||||
_buildButton.text = "构建引用";
|
||||
_buildButton.tooltip = $"从代码中构建包括{nameof(DictionaryReferenceConfigAttribute)}的引用";
|
||||
|
||||
reportLabel = rootVisualElement.Create<Label>();
|
||||
reportLabel.text = "等待操作中...";
|
||||
|
||||
}
|
||||
|
||||
private void BuildAssembliesReference()
|
||||
{
|
||||
var stringBuilder = new System.Text.StringBuilder();
|
||||
var types = AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes());
|
||||
|
||||
var list = new List<(FieldInfo,DictionaryReferenceConfigAttribute)>();
|
||||
foreach (var type in types)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var field in type.GetFields())
|
||||
{
|
||||
if (Attribute.IsDefined(field, typeof(DictionaryReferenceConfigAttribute)))
|
||||
{
|
||||
list.Add(new(field,field.GetCustomAttribute<DictionaryReferenceConfigAttribute>()));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
foreach (var (fieldInfo,att) in list)
|
||||
{
|
||||
stringBuilder.AppendLine($"{att.index}:{fieldInfo.Name}");
|
||||
//DictionaryReferenceScriptableObject.AddOrUpdate(fieldInfo.GetHashCode());
|
||||
DictionaryReferenceScriptableObject.AddOrUpdate(att.index,fieldInfo.Name);
|
||||
}
|
||||
|
||||
if (list.Count is 0)
|
||||
{
|
||||
reportLabel.text = "没有找到任何包含DictionaryReferenceConfigAttribute的类型";
|
||||
}
|
||||
else
|
||||
{
|
||||
reportLabel.text = stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void AddButtonOnClicked()
|
||||
|
Reference in New Issue
Block a user