breakpoint

before update unity version
This commit is contained in:
CortexCore
2024-03-04 18:45:21 +08:00
parent e2fbb14dd5
commit 9ad58a2ff4
5423 changed files with 14757 additions and 653 deletions

View File

@@ -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()