mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2026-04-22 04:35:55 +08:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e38cecf19 | ||
|
|
da16b02fe9 | ||
|
|
1efdce2c70 | ||
|
|
dd1748efaa | ||
|
|
7e0343f8d1 | ||
|
|
951213e339 | ||
|
|
3509552c89 | ||
|
|
c21cce34b1 | ||
|
|
8ea93f4405 | ||
|
|
1d2e2b4a3f | ||
|
|
43b2e0e43a | ||
|
|
de198b5b83 | ||
|
|
fee2623cd5 | ||
|
|
374324325c | ||
|
|
e863fdc8e6 | ||
|
|
a21811ffc5 | ||
|
|
d281b50d74 | ||
|
|
771b4b8cdb | ||
|
|
498a1dc681 | ||
|
|
77f9e1e844 | ||
|
|
f1f4158623 | ||
|
|
04dba8e334 | ||
|
|
22e8d41b4c | ||
|
|
46a921bbce | ||
|
|
f8b414d926 | ||
|
|
edc1190a40 | ||
|
|
535e88f041 | ||
|
|
5549e71ac4 | ||
|
|
7ac04c71b6 | ||
|
|
cd578c7096 | ||
|
|
2d8b985cf0 | ||
|
|
fe80484e8c | ||
|
|
5230bcdc1d | ||
|
|
8f7b8e0c2f | ||
|
|
fe3163ab3d | ||
|
|
224a689ab6 | ||
|
|
716df5e9c1 | ||
|
|
10185a6525 | ||
|
|
4ddcbb9d56 | ||
|
|
2c5461fca1 |
183
README-RU.md
183
README-RU.md
@ -49,16 +49,17 @@
|
||||
- [Установка](#установка)
|
||||
- [Debug](#debug)
|
||||
- [Debug Сервис](#debug-сервис)
|
||||
- [Debug Модуль](#debug-модуль)
|
||||
- [Визуальная отладка](#визуальная-отладка)
|
||||
- [Шаблоны](#шаблоны)
|
||||
- [Связь с GameObject](#связь-с-gameobject)
|
||||
- [World Provider](#world-provider)
|
||||
- [Шаблон Пайплайна](#шаблон-пайплайна)
|
||||
- [FixedUpdate LateUpdate](#fixedupdate-lateupdate)
|
||||
- [FixedUpdate и LateUpdate](#fixedupdate-и-lateupdate)
|
||||
- [Кастомизация инспектора](#Кастомизация-инспектора)
|
||||
- [Поддержка Jobs](#Поддержка-Jobs)
|
||||
- [Документация проекта](#документация-проекта)
|
||||
- [Окно настроек](#окно-настроек)
|
||||
- [Reference Repairer](#Reference-Repairer)
|
||||
- [Reference Repairer](#reference-repairer)
|
||||
- [FAQ](#faq)
|
||||
|
||||
</br>
|
||||
@ -67,7 +68,7 @@
|
||||
Семантика версионирования - [Открыть](https://gist.github.com/DCFApixels/af79284955bf40e9476cdcac79d7b098#file-dcfapixels_versioning-md)
|
||||
## Окружение
|
||||
Обязательные требования:
|
||||
+ Зависимость: [DragonECS](https://github.com/DCFApixels/DragonECS)
|
||||
+ Зависимость: [DragonECS](https://github.com/DCFApixels/DragonECS) `[1.0.0]`;
|
||||
+ Минимальная версия C# 8.0;
|
||||
+ Минимальная версия Unity 2021.2.0;
|
||||
|
||||
@ -147,7 +148,16 @@ _pipeline = EcsPipeline.New()
|
||||
Показывает состояние `EcsWorld`. На каждый мир, переданный в `AddUnityDebug(...)`, создается отдельный монитор.
|
||||
|
||||
<p align="center">
|
||||
<img src="https://github.com/DCFApixels/DragonECS-Unity/assets/99481254/7b6455fc-9211-425c-b0b8-288077e61543">
|
||||
<img src="https://github.com/user-attachments/assets/83905e7a-a5d1-4470-883a-c3b318cb4726">
|
||||
</p>
|
||||
|
||||
-----
|
||||
|
||||
* ### `WorldQueriesMonitor`
|
||||
Расположен вместе с `WorldMonitor`, показывает список всех Where запросов которые выполняли системы. Вверху есть поле для поиска запросов по именам компонентам. Поисковую строку можно разделять символом `/` для одновременного поиска нескольких компонентов. Рядом с каждым Where запросом есть кнопка `Snapshot`, по нажатию откроется окно со списоком всех сущностей которые на данный момент удовлетворяют маске запроса.
|
||||
|
||||
<p align="center">
|
||||
<img width="400px" src="https://github.com/user-attachments/assets/e6edf718-5c73-437e-abeb-c192ace9f927" />
|
||||
</p>
|
||||
|
||||
-----
|
||||
@ -156,7 +166,7 @@ _pipeline = EcsPipeline.New()
|
||||
Показывает состояние сущности мира, позволяет добавлять/изменять/удалять компоненты по время Play Mode. На каждую сущность в мире создается отдельный монитор. Все мониторы сущностей помещаются в монитор мира.
|
||||
|
||||
<p align="center">
|
||||
<img src="https://github.com/DCFApixels/DragonECS-Unity/assets/99481254/509ff472-05b5-4fd8-a0e6-739d7fa81ab1">
|
||||
<img src="https://github.com/user-attachments/assets/fc7ac96d-a9a4-45bd-9695-e80f790495ef">
|
||||
</p>
|
||||
|
||||
-----
|
||||
@ -269,48 +279,9 @@ class SomeComponentTemplate : IComponentTemplate
|
||||
```
|
||||
|
||||
</details>
|
||||
</br>
|
||||
|
||||
### Кастомизация отображения типов
|
||||
В раскрывающемся при нажатии `Add Component` меню выбора компонента поддерживается иерархическое группирование. Производится группирование на основе мета-атрибута `[MetaGroup]`.
|
||||
|
||||
Компоненты в инспекторе по умолчанию отображаются со случайным цветом, зависящим от его имени, выбрать другой режим окраски можно в [окне настроек](#окно-настроек) фреймворка. Задать конкретный цвет можно при помощи мета-атрибута `[MetaColor]`.
|
||||
|
||||
Если интеграции удается найти соответствующий скрипт (по совпадению имени типа и файла, либо при наличии `[MetaID]`), рядом с крестиком удаления появляется иконка файла — клик выделяет скрипт в проекте, двойной клик открывает его.
|
||||
|
||||
При наличии атрибута `[MetaDescription]` показывается иконка подсказки с текстом из него.
|
||||
|
||||
</br>
|
||||
|
||||
### Применение шаблонов компонентов вне стандартных шаблонов сущностей
|
||||
Шаблоны компонентов можно использовать не только внутри стандартных `MonoEntityTemplate` и `ScriptableEntityTemplate`, но и в любых пользовательских классах. Для этого предусмотрены два способа:
|
||||
|
||||
Атрибут `[ComponentTemplateField]`:
|
||||
```c#
|
||||
// Отображение поля как компонента, настраиваемая мета атрибутами.
|
||||
// Аналогично компонентам в MonoEntityTemplate или ScriptableEntityTemplate.
|
||||
[SerializeField, ComponentTemplateField]
|
||||
private SomeComponent _someComponent1;
|
||||
```
|
||||
```c#
|
||||
// Для SerializeReference добавляет кнопку выбора доступной реализации ITemplateNode
|
||||
[SerializeReference, ComponentTemplateField]
|
||||
private ITemplateNode _someComponent1;
|
||||
```
|
||||
|
||||
Обертка `ComponentTemplateProperty`:
|
||||
```c#
|
||||
// Обертка над ITemplateNode, аналогично примеру с атрибутом ComponentTemplateField.
|
||||
private ComponentTemplateProperty _someComponent2;
|
||||
```
|
||||
|
||||
Оба подхода работают и для массивов:
|
||||
```c#
|
||||
[SerializeReference, ComponentTemplateField]
|
||||
private IComponentTemplate[] _components;
|
||||
// или
|
||||
private ComponentTemplateProperty[] _components;
|
||||
```
|
||||
> В разделе [Кастомизация инспектора](#Кастомизация-инспектора) описана кастомизация отображения компонентов и использование вне шаблонов сущьностей.
|
||||
|
||||
</br>
|
||||
|
||||
@ -496,6 +467,124 @@ public class EcsRoot : MonoBehaviour
|
||||
|
||||
</br>
|
||||
|
||||
# Кастомизация инспектора
|
||||
|
||||
## Атрибуты инспектора
|
||||
+ **[ReferenceDropDown]** -
|
||||
Применяется к полю с `[SerializeReference]`. Добавляет кнопку выбора типа из списка. Можно ограничить набор доступных типов, передав список в конструктор.
|
||||
+ **[ReferenceDropDownWithout]** -
|
||||
Используется вместе с `[ReferenceDropDown]`, чтобы исключить указанные типы (и их наследников) из списка выбора.
|
||||
+ **[DragonMetaBlock]** -
|
||||
Отображает значение в инспекторе так же, как компоненты в шаблонах сущности. Учитывает meta-атрибуты (`MetaGroup`, `MetaColor`, `MetaDescription`, `MetaID` и др.).
|
||||
|
||||
|
||||
## Поведение Meta-атрибутов
|
||||
+ Иерархическая группировка элементов в меню `Add Component` или `[ReferenceDropDown]` задаётся через `[MetaGroup]`.
|
||||
+ Цвет компонента в инспекторе по умолчанию определяется именем типа. Режим окраски можно изменить в окне настроек. Явный цвет задаётся через `[MetaColor]`.
|
||||
+ При совпадении имени типа и файла (или при наличии `[MetaID]`) рядом с кнопкой удаления появляется иконка файла: один клик — выделение скрипта в проекте, двойной клик — открытие.
|
||||
+ Если указан `[MetaDescription]`, рядом отображается иконка подсказки с текстом описания.
|
||||
+ При восстановлении **Missing Reference** с помощью [**Reference Repairer**](#Reference-Repairer), инструмент ищет соответствие старого и нового имени типа по атрибуту `[MetaID(id)]`.
|
||||
|
||||
|
||||
## Примеры:
|
||||
|
||||
Атрибут `DragonMetaBlock`:
|
||||
```c#
|
||||
// Отображение поля настраиваемое мета-атрибутами.
|
||||
// Аналогично компонентам в MonoEntityTemplate или ScriptableEntityTemplate.
|
||||
[DragonMetaBlock]
|
||||
public SomeComponent Component;
|
||||
|
||||
// Можно применять к любому полю любого типа.
|
||||
[DragonMetaBlock]
|
||||
public Foo Foo;
|
||||
```
|
||||
|
||||
`ReferenceDropDown` и `ReferenceDropDownWithout`:
|
||||
```c#
|
||||
// Добавляет кнопку выбора реализации ITemplateNode из выпадающего списка.
|
||||
[SerializeReference]
|
||||
[ReferenceDropDown]
|
||||
public ITemplateNode Template;
|
||||
```
|
||||
|
||||
```c#
|
||||
// Так же можно применять к любому полю любого типа.
|
||||
// В списке будут только тип Foo и его наследники, исключая FooExc и его наследников.
|
||||
[SerializeReference]
|
||||
[ReferenceDropDown(typeof(Foo))]
|
||||
[ReferenceDropDownWithout(typeof(FooExc))]
|
||||
public object Template;
|
||||
```
|
||||
|
||||
Комбинирование и другие варианты использования:
|
||||
```c#
|
||||
// Атрибуты можно комбинировать.
|
||||
[DragonMetaBlock]
|
||||
[ReferenceDropDown]
|
||||
public ITemplateNode Template;
|
||||
|
||||
// Обертка над ITemplateNode, аналогично примеру выше.
|
||||
public ComponentTemplateProperty Template;
|
||||
|
||||
// Атрибуты корректно работают с массивами и листами.
|
||||
[DragonMetaBlock]
|
||||
[ReferenceDropDown]
|
||||
public ITemplateNode[] Template;
|
||||
```
|
||||
|
||||
</br>
|
||||
|
||||
# Поддержка Jobs
|
||||
|
||||
DragonECS по умолчанию совместим с Job системой Unity. Пример:
|
||||
```c#
|
||||
EcsWorld _world;
|
||||
class Aspect : EcsAspect
|
||||
{
|
||||
// Пул для unmanaged компонентов.
|
||||
public EcsValuePool<Cmp> Cmps = Inc;
|
||||
}
|
||||
public void Run()
|
||||
{
|
||||
var job = new Job()
|
||||
{
|
||||
// Идентично Where, но возвращает unmanaged список сущностей.
|
||||
Entities = _world.WhereUnsafe(out Aspect a),
|
||||
// Конвертация пула в unmanaged версию
|
||||
Cmps = a.Cmps.AsNative(),
|
||||
X = 10f,
|
||||
};
|
||||
JobHandle jobHandle = job.Schedule(job.Entities.Count, 64);
|
||||
jobHandle.Complete();
|
||||
}
|
||||
```
|
||||
```c#
|
||||
// Unmanaged компонент.
|
||||
public struct Cmp : IEcsValueComponent
|
||||
{
|
||||
public float A;
|
||||
}
|
||||
private struct Job : IJobParallelFor
|
||||
{
|
||||
public EcsUnsafeSpan Entities;
|
||||
public NativeEcsValuePool<Cmp> Cmps;
|
||||
public float X;
|
||||
public Job(EcsUnsafeSpan entities, float x)
|
||||
{
|
||||
Entities = entities;
|
||||
X = x;
|
||||
}
|
||||
public void Execute(int index)
|
||||
{
|
||||
var e = Entities[index];
|
||||
Cmps[e].A += X;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</br>
|
||||
|
||||
# Документация проекта
|
||||
В интеграции также есть окно документации проекта на основе мета-атрибутов. Открыть документацию: `Tools > DragonECS > Documentation`. Документация формируется при первом открытии окна и при нажатии кнопки `Update`.
|
||||
|
||||
@ -509,7 +598,7 @@ public class EcsRoot : MonoBehaviour
|
||||
В окне настроек доступно несколько опций, включая режимы отображения компонентов в инспекторе. Внизу находятся переключатели для define-переменных, используемых в фреймворке. Открыть окно настроек: `Tools > DragonECS > Settings`.
|
||||
|
||||
<p align="center">
|
||||
<img src="https://github.com/DCFApixels/DragonECS-Unity/assets/99481254/c794be8d-6884-4415-b24a-0a1a28f577a6">
|
||||
<img src="https://github.com/user-attachments/assets/905c03dd-d277-48b9-9963-455a09c4ceda">
|
||||
</p>
|
||||
|
||||
</br>
|
||||
|
||||
159
README.md
159
README.md
@ -48,16 +48,17 @@ This package integrates DragonECS with the Unity editor and runtime. It provides
|
||||
- [Installation](#installation)
|
||||
- [Debug](#debug)
|
||||
- [Debug service](#debug-service)
|
||||
- [Debug module](#debug-module)
|
||||
- [Visual debugging](#Visual-debugging)
|
||||
- [Templates](#Templates)
|
||||
- [Binding to GameObjects](#Binding-to-GameObjects)
|
||||
- [Visual debugging](#visual-debugging)
|
||||
- [Templates](#templates)
|
||||
- [Binding to GameObjects](#binding-to-gameobjects)
|
||||
- [World Provider](#world-provider)
|
||||
- [Pipeline template](#Pipeline-template)
|
||||
- [FixedUpdate LateUpdate](#fixedupdate-lateupdate)
|
||||
- [Project documentation](#Project-documentation)
|
||||
- [Settings window](#Settings-window)
|
||||
- [Reference Repairer](#Reference-Repairer)
|
||||
- [Pipeline template](#pipeline-template)
|
||||
- [FixedUpdate and LateUpdate](#fixedupdate-and-lateupdate)
|
||||
- [Inspector Customization](#inspector-customization)
|
||||
- [Jobs Support](#jobs-support)
|
||||
- [Project documentation](#project-documentation)
|
||||
- [Settings window](#settings-window)
|
||||
- [Reference Repairer](#reference-repairer)
|
||||
- [FAQ](#faq)
|
||||
|
||||
</br>
|
||||
@ -67,7 +68,7 @@ Versioning semantics - [Open](https://gist.github.com/DCFApixels/af79284955bf40e
|
||||
|
||||
## Environment
|
||||
Requirements:
|
||||
- Dependency: [DragonECS](https://github.com/DCFApixels/DragonECS)
|
||||
- Dependency: [DragonECS](https://github.com/DCFApixels/DragonECS) `[1.0.0]`;
|
||||
- Minimum C# version: 8.0
|
||||
- Minimum Unity version: 2021.2.0
|
||||
|
||||
@ -147,7 +148,16 @@ Displays processes and systems in a matrix layout. Systems are shown in executio
|
||||
Displays `EcsWorld` state. A separate monitor is created for each world passed to `AddUnityDebug(...)`.
|
||||
|
||||
<p align="center">
|
||||
<img src="https://github.com/DCFApixels/DragonECS-Unity/assets/99481254/7b6455fc-9211-425c-b0b8-288077e61543">
|
||||
<img src="https://github.com/user-attachments/assets/83905e7a-a5d1-4470-883a-c3b318cb4726">
|
||||
</p>
|
||||
|
||||
-----
|
||||
|
||||
* ### `WorldQueriesMonitor`
|
||||
Located together with `WorldMonitor`, shows a list of all Where queries that systems have executed. At the top there is a search field for filtering queries by component names. The search string can be split with a `/` character to search for multiple components at once. Next to each Where query there is a `Snapshot` button; clicking it opens a window showing a list of all entities that currently match the query mask.
|
||||
|
||||
<p align="center">
|
||||
<img width="400px" src="https://github.com/user-attachments/assets/e6edf718-5c73-437e-abeb-c192ace9f927" />
|
||||
</p>
|
||||
|
||||
-----
|
||||
@ -156,7 +166,7 @@ Displays `EcsWorld` state. A separate monitor is created for each world passed t
|
||||
Displays entity state and allows adding, modifying or removing components at runtime (Play Mode). One monitor is created per entity; entity monitors are grouped under the corresponding world monitor.
|
||||
|
||||
<p align="center">
|
||||
<img src="https://github.com/DCFApixels/DragonECS-Unity/assets/99481254/509ff472-05b5-4fd8-a0e6-739d7fa81ab1">
|
||||
<img src="https://github.com/user-attachments/assets/fc7ac96d-a9a4-45bd-9695-e80f790495ef">
|
||||
</p>
|
||||
|
||||
-----
|
||||
@ -244,6 +254,8 @@ public struct Health : IEcsComponent, ITemplateNode
|
||||
}
|
||||
```
|
||||
|
||||
> The section [Inspector Customization](#Inspector-Customization) describes customization of component display and usage outside of entity templates.
|
||||
|
||||
#### Custom template implementation
|
||||
|
||||
If built-in `ComponentTemplate<T>` or `TagComponentTemplate<T>` do not fit the requirements, implement a custom template by implementing `IComponentTemplate`. This can be useful for custom pools. In most cases the built-in templates are sufficient.
|
||||
@ -435,7 +447,7 @@ public class EcsMyWorldSingletonProvider : EcsWorldProvider<EcsMyWorld>
|
||||
|
||||
</br>
|
||||
|
||||
# Pipeline templates
|
||||
# Pipeline template
|
||||
Pipelines and entities can be assembled from templates. Pipeline templates are modules implementing the `IEcsModule` interface.
|
||||
|
||||
The package provides two pipeline template types by default: `ScriptablePipelineTemplate` and `MonoPipelineTemplate`.
|
||||
@ -496,6 +508,125 @@ public class EcsRoot : MonoBehaviour
|
||||
|
||||
</br>
|
||||
|
||||
# Inspector Customization
|
||||
|
||||
## Inspector Attributes
|
||||
+ **[ReferenceDropDown]** -
|
||||
Applied to a field with `[SerializeReference]`. Adds a type selection button from a list. The set of available types can be restricted by passing a list to the constructor.
|
||||
|
||||
+ **[ReferenceDropDownWithout]** -
|
||||
Used together with `[ReferenceDropDown]` to exclude the specified types (and their descendants) from the selection list.
|
||||
|
||||
+ **[DragonMetaBlock]** -
|
||||
Displays the value in the inspector similarly to how components are displayed in entity templates. Takes meta-attributes into account (`MetaGroup`, `MetaColor`, `MetaDescription`, `MetaID`, etc.).
|
||||
|
||||
## Behavior of Meta‑Attributes
|
||||
+ Hierarchical grouping of items in the `Add Component` menu or `[ReferenceDropDown]` is defined via `[MetaGroup]`.
|
||||
+ The component color in the inspector is determined by the type name by default. The coloring mode can be changed in the settings window. An explicit color is set via `[MetaColor]`.
|
||||
+ When the type name matches the file name (or when `[MetaID]` is present), a file icon appears next to the delete button: a single click selects the script in the project, a double click opens it.
|
||||
+ If `[MetaDescription]` is specified, a tooltip icon with the description text is displayed next to it.
|
||||
+ When restoring a Missing Reference using Reference Repairer, the tool searches for a match between the old and new type names by the `[MetaID(id)]` attribute.
|
||||
|
||||
|
||||
## Examples:
|
||||
|
||||
`DragonMetaBlock` attribute:
|
||||
```c#
|
||||
// Display of the field customizable via meta-attributes.
|
||||
// Similar to components in MonoEntityTemplate or ScriptableEntityTemplate.
|
||||
[DragonMetaBlock]
|
||||
public SomeComponent Component;
|
||||
|
||||
// Can be applied to any field of any type.
|
||||
[DragonMetaBlock]
|
||||
public Foo Foo;
|
||||
```
|
||||
|
||||
`ReferenceDropDown` and `ReferenceDropDownWithout`:
|
||||
```c#
|
||||
// Adds a button to select an implementation of ITemplateNode from a drop-down list.
|
||||
[SerializeReference]
|
||||
[ReferenceDropDown]
|
||||
public ITemplateNode Template;
|
||||
```
|
||||
|
||||
```c#
|
||||
// Also applicable to any field of any type.
|
||||
// The list will contain only type Foo and its descendants, excluding FooExc and its descendants.
|
||||
[SerializeReference]
|
||||
[ReferenceDropDown(typeof(Foo))]
|
||||
[ReferenceDropDownWithout(typeof(FooExc))]
|
||||
public object Template;
|
||||
```
|
||||
|
||||
Combination and other use cases:
|
||||
```c#
|
||||
// Attributes can be combined.
|
||||
[DragonMetaBlock]
|
||||
[ReferenceDropDown]
|
||||
public ITemplateNode Template;
|
||||
|
||||
// A wrapper over ITemplateNode, similar to the example above.
|
||||
public ComponentTemplateProperty Template;
|
||||
|
||||
// Attributes work correctly with arrays and lists.
|
||||
[DragonMetaBlock]
|
||||
[ReferenceDropDown]
|
||||
public ITemplateNode[] Template;
|
||||
```
|
||||
|
||||
</br>
|
||||
|
||||
# Jobs Support
|
||||
|
||||
DragonECS is compatible with Unity's Job system by default. Example:
|
||||
```c#
|
||||
EcsWorld _world;
|
||||
class Aspect : EcsAspect
|
||||
{
|
||||
// Pool for unmanaged components.
|
||||
public EcsValuePool<Cmp> Cmps = Inc;
|
||||
}
|
||||
public void Run()
|
||||
{
|
||||
var job = new Job()
|
||||
{
|
||||
// Same as Where, but returns an unmanaged entity list.
|
||||
Entities = _world.WhereUnsafe(out Aspect a),
|
||||
// Convert the pool to its unmanaged version
|
||||
Cmps = a.Cmps.AsNative(),
|
||||
X = 10f,
|
||||
};
|
||||
JobHandle jobHandle = job.Schedule(job.Entities.Count, 64);
|
||||
jobHandle.Complete();
|
||||
}
|
||||
```
|
||||
```c#
|
||||
// Unmanaged component.
|
||||
public struct Cmp : IEcsValueComponent
|
||||
{
|
||||
public float A;
|
||||
}
|
||||
private struct Job : IJobParallelFor
|
||||
{
|
||||
public EcsUnsafeSpan Entities;
|
||||
public NativeEcsValuePool<Cmp> Cmps;
|
||||
public float X;
|
||||
public Job(EcsUnsafeSpan entities, float x)
|
||||
{
|
||||
Entities = entities;
|
||||
X = x;
|
||||
}
|
||||
public void Execute(int index)
|
||||
{
|
||||
var e = Entities[index];
|
||||
Cmps[e].A += X;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</br>
|
||||
|
||||
# Project documentation
|
||||
A documentation window based on meta-attributes is available via `Tools > DragonECS > Documentation`. Documentation is generated on first open and when the `Update` button is pressed.
|
||||
|
||||
@ -509,7 +640,7 @@ A documentation window based on meta-attributes is available via `Tools > Dragon
|
||||
The settings window exposes several options, including component display modes in the Inspector. At the bottom, toggles for framework define symbols are available. Open via `Tools > DragonECS > Settings`.
|
||||
|
||||
<p align="center">
|
||||
<img src="https://github.com/DCFApixels/DragonECS-Unity/assets/99481254/c794be8d-6884-4415-b24a-0a1a28f577a6">
|
||||
<img src="https://github.com/user-attachments/assets/905c03dd-d277-48b9-9963-455a09c4ceda">
|
||||
</p>
|
||||
|
||||
</br>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
"displayName": "DragonECS-Unity",
|
||||
"description": "Integration with Unity for DragonECS",
|
||||
"unity": "2021.2",
|
||||
"version": "0.5.18",
|
||||
"version": "0.6.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DCFApixels/DragonECS-Unity.git"
|
||||
|
||||
@ -83,7 +83,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
private void DrawTemplates()
|
||||
{
|
||||
using (EcsGUI.CheckChanged())
|
||||
using (DragonGUI.CheckChanged())
|
||||
{
|
||||
var iterator = serializedObject.GetIterator();
|
||||
iterator.NextVisible(true);
|
||||
@ -92,7 +92,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
EditorGUILayout.PropertyField(iterator, true);
|
||||
}
|
||||
|
||||
if (EcsGUI.Changed)
|
||||
if (DragonGUI.Changed)
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
@ -102,12 +102,12 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
private void DrawControlButtons()
|
||||
{
|
||||
float height = EcsGUI.EntityBarHeight;
|
||||
float height = DragonGUI.EntityBarHeight;
|
||||
Rect rect = GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, height);
|
||||
EditorGUI.DrawRect(rect, new Color(0f, 0f, 0f, 0.1f));
|
||||
rect = rect.AddPadding(2f, 0f);
|
||||
var (_, buttonRect) = rect.HorizontalSliceRight(height);
|
||||
if (EcsGUI.ValidateButton(buttonRect))
|
||||
if (DragonGUI.ValidateButton(buttonRect))
|
||||
{
|
||||
foreach (var target in Targets)
|
||||
{
|
||||
@ -115,7 +115,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
buttonRect = RectUtility.Move(buttonRect, -height, 0);
|
||||
if (EcsGUI.AutosetButton(buttonRect))
|
||||
if (DragonGUI.AutosetButton(buttonRect))
|
||||
{
|
||||
foreach (var target in Targets)
|
||||
{
|
||||
|
||||
@ -15,6 +15,7 @@ namespace DCFApixels.DragonECS
|
||||
[MetaDescription(AUTHOR, "Component-reference to Unity object for EcsPool.")]
|
||||
[MetaID("DragonECS_734F667C9201B80F1913388C2A8BB689")]
|
||||
[MetaTags(MetaTags.ENGINE_MEMBER)]
|
||||
[MetaProxy(typeof(UnityComponent<>.MetaProxy))]
|
||||
public struct UnityComponent<T> : IEcsComponent, IEnumerable<T>//IntelliSense hack
|
||||
where T : Component
|
||||
{
|
||||
@ -34,6 +35,16 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
return $"UnityComponent<{typeof(T).GetMeta().TypeName}>";
|
||||
}
|
||||
private class MetaProxy : MetaProxyBase
|
||||
{
|
||||
protected TypeMeta Meta = typeof(T).GetMeta();
|
||||
public override string Name { get { return Meta?.Name; } }
|
||||
public override MetaColor? Color { get { return Meta != null && Meta.IsCustomColor ? Meta.Color : null; } }
|
||||
public override MetaGroup Group { get { return Meta?.Group; } }
|
||||
public override MetaDescription Description { get { return Meta?.Description; } }
|
||||
public override IEnumerable<string> Tags { get { return Meta?.Tags; } }
|
||||
public MetaProxy(Type type) : base(type) { }
|
||||
}
|
||||
}
|
||||
|
||||
internal static class UnityComponentConsts
|
||||
@ -45,16 +56,9 @@ namespace DCFApixels.DragonECS
|
||||
[MetaGroup(EcsUnityConsts.PACK_GROUP, OTHER_GROUP)]
|
||||
[MetaDescription(AUTHOR, "Template for UnityComponent<T>")]
|
||||
[MetaID("DragonECS_13DAACF9910155DD27F822442987E0AE")]
|
||||
[MetaProxy(typeof(UnityComponentTemplate<>.UnityComponentMetaProxy))]
|
||||
public abstract class UnityComponentTemplate<T> : ComponentTemplateBase<UnityComponent<T>> where T : Component
|
||||
{
|
||||
public override string Name
|
||||
{
|
||||
get { return typeof(T).Name; }
|
||||
}
|
||||
public override MetaGroup Group
|
||||
{
|
||||
get { return UnityComponentConsts.BaseGroup; }
|
||||
}
|
||||
public sealed override void Apply(short worldID, int entityID)
|
||||
{
|
||||
EcsWorld.GetPoolInstance<EcsPool<UnityComponent<T>>>(worldID).TryAddOrGet(entityID) = component;
|
||||
@ -69,5 +73,13 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
}
|
||||
}
|
||||
protected class UnityComponentMetaProxy : ComponentTemplateMetaProxy
|
||||
{
|
||||
public override string Name { get { return typeof(T).GetMeta().Name; } }
|
||||
public override MetaGroup Group { get { return UnityComponentConsts.BaseGroup; } }
|
||||
public override MetaColor? Color { get { return MetaColor.DragonCyan; } }
|
||||
public override MetaDescription Description { get { return new MetaDescription(AUTHOR, $"Template for IEcsComponent component. Holds a reference to a Unity {Name} component."); } }
|
||||
public UnityComponentMetaProxy(Type type) : base(type) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
using DCFApixels.DragonECS.RunnersCore;
|
||||
using DCFApixels.DragonECS.Core;
|
||||
using DCFApixels.DragonECS.Unity;
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
|
||||
@ -52,7 +52,6 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
||||
{
|
||||
[MetaColor(MetaColor.DragonRose)]
|
||||
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
|
||||
[MetaDescription(EcsConsts.AUTHOR, "...")]
|
||||
[MetaTags(MetaTags.HIDDEN)]
|
||||
[MetaID("DragonECS_2DD8BC809201633E2761D5AEF65B7090")]
|
||||
public class EcsLateGizmosRunner : EcsRunner<IEcsGizmos>, IEcsGizmos
|
||||
@ -70,7 +69,6 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
||||
|
||||
[MetaColor(MetaColor.DragonRose)]
|
||||
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
|
||||
[MetaDescription(EcsConsts.AUTHOR, "...")]
|
||||
[MetaTags(MetaTags.HIDDEN)]
|
||||
[MetaID("DragonECS_EDE8BC809201603B47C3A9D1EFD4EE95")]
|
||||
public class EcsLateRunRunner : EcsRunner<IEcsLateRun>, IEcsLateRun
|
||||
@ -88,7 +86,6 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
||||
|
||||
[MetaColor(MetaColor.DragonRose)]
|
||||
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
|
||||
[MetaDescription(EcsConsts.AUTHOR, "...")]
|
||||
[MetaTags(MetaTags.HIDDEN)]
|
||||
[MetaID("DragonECS_45F7BC809201866AA05F6DC096A47F01")]
|
||||
public class EcsFixedRunRunner : EcsRunner<IEcsFixedRun>, IEcsFixedRun
|
||||
|
||||
@ -137,7 +137,7 @@ namespace DCFApixels.DragonECS
|
||||
_entity = entity;
|
||||
_world = world;
|
||||
#if UNITY_EDITOR
|
||||
world.Get<EcsGUI.EntityLinksComponent>().SetConnectLink(entity.GetIDUnchecked(), this);
|
||||
world.Get<DragonGUI.EntityLinksComponent>().SetConnectLink(entity.GetIDUnchecked(), this);
|
||||
#endif
|
||||
_connectedEntities.Add(GetInstanceID(), this);
|
||||
var goConnects = world.GetPool<GameObjectConnect>();
|
||||
|
||||
@ -17,7 +17,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
EditorGUILayout.PropertyField(iterator, true);
|
||||
}
|
||||
if (EcsGUI.Changed)
|
||||
if (DragonGUI.Changed)
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
@ -27,7 +27,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
private void DrawControlButtons()
|
||||
{
|
||||
float height = EcsGUI.EntityBarHeight;
|
||||
float height = DragonGUI.EntityBarHeight;
|
||||
Rect rect = GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, height);
|
||||
EditorGUI.DrawRect(rect, new Color(0f, 0f, 0f, 0.1f));
|
||||
rect = rect.AddPadding(2f, 0f);
|
||||
@ -36,7 +36,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
//var (left, autosetCascadeRect) = rect.HorizontalSliceRight(height);
|
||||
//var (_, autosetRect) = rect.HorizontalSliceRight(height);
|
||||
|
||||
if (EcsGUI.AutosetCascadeButton(buttonRect))
|
||||
if (DragonGUI.AutosetCascadeButton(buttonRect))
|
||||
{
|
||||
foreach (AutoEntityCreator target in targets)
|
||||
{
|
||||
@ -44,17 +44,17 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
buttonRect = buttonRect.Move(-height, 0);
|
||||
if (EcsGUI.AutosetButton(buttonRect))
|
||||
if (DragonGUI.AutosetButton(buttonRect))
|
||||
{
|
||||
foreach (AutoEntityCreator target in targets)
|
||||
{
|
||||
target.Autoset_Editor();
|
||||
}
|
||||
}
|
||||
using (EcsGUI.SetEnable(Application.isPlaying))
|
||||
using (DragonGUI.SetEnable(Application.isPlaying))
|
||||
{
|
||||
buttonRect = buttonRect.Move(-height, 0);
|
||||
if (EcsGUI.NewEntityButton(buttonRect))
|
||||
if (DragonGUI.NewEntityButton(buttonRect))
|
||||
{
|
||||
foreach (AutoEntityCreator target in targets)
|
||||
{
|
||||
|
||||
@ -9,6 +9,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
[CanEditMultipleObjects]
|
||||
internal class EcsEntityConnectEditor : ExtendedEditor<EcsEntityConnect>
|
||||
{
|
||||
public override bool RequiresConstantRepaint()
|
||||
{
|
||||
return UserSettingsPrefs.instance.RuntimeDrawMode == RuntimeDrawMode.Live ? true : base.RequiresConstantRepaint();
|
||||
}
|
||||
protected override void DrawCustom()
|
||||
{
|
||||
DrawEntityInfo();
|
||||
@ -24,12 +28,12 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
//bool isConnected = Target.Entity.TryUnpackForUnityEditor(out int id, out short gen, out short worldID, out EcsWorld world);
|
||||
//EcsGUI.EntityStatus status = IsMultipleTargets ? EcsGUI.EntityStatus.Undefined : isConnected ? EcsGUI.EntityStatus.Alive : EcsGUI.EntityStatus.NotAlive;
|
||||
//EcsGUI.Layout.EntityField(status, id, gen, worldID);
|
||||
EcsGUI.Layout.EntityField(Target.Entity);
|
||||
DragonGUI.Layout.EntityField(Target.Entity);
|
||||
}
|
||||
|
||||
private void DrawTemplates()
|
||||
{
|
||||
using (EcsGUI.CheckChanged())
|
||||
using (DragonGUI.CheckChanged())
|
||||
{
|
||||
var iterator = serializedObject.GetIterator();
|
||||
iterator.NextVisible(true);
|
||||
@ -38,7 +42,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
EditorGUILayout.PropertyField(iterator, true);
|
||||
}
|
||||
|
||||
if (EcsGUI.Changed)
|
||||
if (DragonGUI.Changed)
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
@ -47,12 +51,12 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
private void DrawControlButtons()
|
||||
{
|
||||
float height = EcsGUI.EntityBarHeight;
|
||||
float height = DragonGUI.EntityBarHeight;
|
||||
Rect rect = GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, height);
|
||||
EditorGUI.DrawRect(rect, new Color(0f, 0f, 0f, 0.1f));
|
||||
rect = rect.AddPadding(2f, 0f);
|
||||
var (_, buttonRect) = rect.HorizontalSliceRight(height);
|
||||
if (EcsGUI.AutosetCascadeButton(buttonRect))
|
||||
if (DragonGUI.AutosetCascadeButton(buttonRect))
|
||||
{
|
||||
foreach (var target in Targets)
|
||||
{
|
||||
@ -60,17 +64,17 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
buttonRect = RectUtility.Move(buttonRect, -height, 0);
|
||||
if (EcsGUI.AutosetButton(buttonRect))
|
||||
if (DragonGUI.AutosetButton(buttonRect))
|
||||
{
|
||||
foreach (var target in Targets)
|
||||
{
|
||||
target.Autoset_Editor();
|
||||
}
|
||||
}
|
||||
using (EcsGUI.SetEnable(Application.isPlaying))
|
||||
using (DragonGUI.SetEnable(Application.isPlaying))
|
||||
{
|
||||
buttonRect = buttonRect.Move(-height, 0);
|
||||
if (EcsGUI.DelEntityButton(buttonRect))
|
||||
if (DragonGUI.DelEntityButton(buttonRect))
|
||||
{
|
||||
foreach (var target in Targets)
|
||||
{
|
||||
@ -78,7 +82,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
buttonRect = buttonRect.Move(-height, 0);
|
||||
if (EcsGUI.UnlinkButton(buttonRect))
|
||||
if (DragonGUI.UnlinkButton(buttonRect))
|
||||
{
|
||||
foreach (var target in Targets)
|
||||
{
|
||||
@ -105,7 +109,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
if (world.IsNullOrDetroyed() == false)
|
||||
{
|
||||
EcsGUI.Layout.DrawRuntimeComponents(entityID, world, true, true);
|
||||
DragonGUI.Layout.DrawRuntimeComponents(entityID, world, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,12 +40,12 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
|
||||
using (EcsGUI.SetBackgroundColor(labelBackColor))
|
||||
using (DragonGUI.SetBackgroundColor(labelBackColor))
|
||||
{
|
||||
GUILayout.Box("Is Empty", UnityEditorUtility.GetWhiteStyle(), GUILayout.ExpandWidth(true));
|
||||
GUILayout.Box("Is Empty", UnityEditorUtility.GetWhiteStyleWithPadding(), GUILayout.ExpandWidth(true));
|
||||
}
|
||||
|
||||
EcsGUI.Layout.DrawWorldBaseInfo(Target.GetCurrentWorldRaw());
|
||||
DragonGUI.Layout.DrawWorldBaseInfo(Target.GetCurrentWorldRaw());
|
||||
|
||||
base.OnInspectorGUI();
|
||||
|
||||
@ -67,7 +67,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
EditorGUI.DrawRect(r, c);
|
||||
GUILayout.Space(10);
|
||||
|
||||
EcsGUI.Layout.DrawWorldComponents(Target.GetCurrentWorldRaw());
|
||||
DragonGUI.Layout.DrawWorldComponents(Target.GetCurrentWorldRaw());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,11 +55,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
if (drawFoldout && isExpanded)
|
||||
{
|
||||
using (EcsGUI.UpIndentLevel())
|
||||
using (DragonGUI.UpIndentLevel())
|
||||
{
|
||||
if (world != null && world.IsAlive(entity.id, entity.gen))
|
||||
{
|
||||
EcsGUI.Layout.DrawRuntimeComponents(entity.id, world, false, false);
|
||||
DragonGUI.Layout.DrawRuntimeComponents(entity.id, world, false, false);
|
||||
if (Event.current.type == EventType.Layout)
|
||||
{
|
||||
heightCache = GUILayoutUtility.GetLastRect().height;
|
||||
@ -67,10 +67,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
}
|
||||
EcsGUI.EntityField(position, property);
|
||||
using (EcsGUI.SetEnable(world != null))
|
||||
DragonGUI.EntityField(position, property);
|
||||
using (DragonGUI.SetEnable(world != null))
|
||||
{
|
||||
EcsGUI.EntityHyperlinkButton(hyperlinkButtonRect, world, entity.id);
|
||||
DragonGUI.EntityHyperlinkButton(hyperlinkButtonRect, world, entity.id);
|
||||
}
|
||||
|
||||
|
||||
@ -146,7 +146,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
|
||||
|
||||
EcsGUI.Changed = true;
|
||||
DragonGUI.Changed = true;
|
||||
DragAndDrop.AcceptDrag();
|
||||
DragAndDrop.activeControlID = 0;
|
||||
}
|
||||
@ -186,7 +186,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
return false;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
protected override float GetCustomHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
const float UNITY_HEIGHT_CONSTANT = 18f;
|
||||
if (property.hasMultipleDifferentValues)
|
||||
|
||||
@ -27,49 +27,40 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
private void OnGUI()
|
||||
{
|
||||
var prefs = UserSettingsPrefs.instance;
|
||||
float labelWidth = EditorGUIUtility.labelWidth;
|
||||
EditorGUIUtility.labelWidth = 0f;
|
||||
|
||||
//float checkBoxWidth = 20f;
|
||||
|
||||
GUILayout.Space(20f);
|
||||
using (new EcsGUI.ColorScope(Color.white * 0.5f))
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
using (new DragonGUI.ColorScope(Color.white * 0.5f)) GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
//using (new EcsGUI.ColorScope(Color.white * 1.2f))
|
||||
GUILayout.Label("", EditorStyles.toolbar, GUILayout.ExpandWidth(true), GUILayout.Height(22f));
|
||||
Rect rect = GUILayoutUtility.GetLastRect();
|
||||
rect.xMin += 9f;
|
||||
GUI.Label(rect, "User Settings", EditorStyles.whiteLargeLabel);
|
||||
|
||||
//using (prefs.DisableAutoSave())
|
||||
{
|
||||
prefs.IsShowHidden = EditorGUILayout.ToggleLeft(
|
||||
UnityEditorUtility.TransformFieldName(nameof(UserSettingsPrefs.IsShowHidden)),
|
||||
prefs.IsShowHidden);
|
||||
prefs.IsShowHidden = EditorGUILayout.ToggleLeft(
|
||||
UnityEditorUtility.TransformFieldName(nameof(UserSettingsPrefs.IsShowHidden)),
|
||||
prefs.IsShowHidden);
|
||||
|
||||
prefs.IsShowInterfaces = EditorGUILayout.ToggleLeft(
|
||||
UnityEditorUtility.TransformFieldName(nameof(UserSettingsPrefs.IsShowInterfaces)),
|
||||
prefs.IsShowInterfaces);
|
||||
prefs.IsShowInterfaces = EditorGUILayout.ToggleLeft(
|
||||
UnityEditorUtility.TransformFieldName(nameof(UserSettingsPrefs.IsShowInterfaces)),
|
||||
prefs.IsShowInterfaces);
|
||||
|
||||
prefs.IsShowRuntimeComponents = EditorGUILayout.ToggleLeft(
|
||||
UnityEditorUtility.TransformFieldName(nameof(UserSettingsPrefs.IsShowRuntimeComponents)),
|
||||
prefs.IsShowRuntimeComponents);
|
||||
prefs.IsShowRuntimeComponents = EditorGUILayout.ToggleLeft(
|
||||
UnityEditorUtility.TransformFieldName(nameof(UserSettingsPrefs.IsShowRuntimeComponents)),
|
||||
prefs.IsShowRuntimeComponents);
|
||||
|
||||
prefs.IsUseCustomNames = EditorGUILayout.ToggleLeft(
|
||||
UnityEditorUtility.TransformFieldName(nameof(UserSettingsPrefs.IsUseCustomNames)),
|
||||
prefs.IsUseCustomNames);
|
||||
prefs.IsUseCustomNames = EditorGUILayout.ToggleLeft(
|
||||
UnityEditorUtility.TransformFieldName(nameof(UserSettingsPrefs.IsUseCustomNames)),
|
||||
prefs.IsUseCustomNames);
|
||||
|
||||
//prefs.IsFastModeRuntimeComponents = EditorGUILayout.ToggleLeft(
|
||||
// UnityEditorUtility.TransformFieldName(nameof(UserSettingsPrefs.IsFastModeRuntimeComponents)),
|
||||
// prefs.IsFastModeRuntimeComponents);
|
||||
prefs.RuntimeDrawMode = (RuntimeDrawMode)EditorGUILayout.EnumPopup(UnityEditorUtility.TransformFieldName(nameof(UserSettingsPrefs.RuntimeDrawMode)), prefs.RuntimeDrawMode);
|
||||
prefs.MetaBlockRectStyle = (MetaBlockRectStyle)EditorGUILayout.EnumPopup(UnityEditorUtility.TransformFieldName(nameof(UserSettingsPrefs.MetaBlockRectStyle)), prefs.MetaBlockRectStyle);
|
||||
prefs.MetaBlockColorMode = (MetaBlockColorMode)EditorGUILayout.EnumPopup(UnityEditorUtility.TransformFieldName(nameof(UserSettingsPrefs.MetaBlockColorMode)), prefs.MetaBlockColorMode);
|
||||
|
||||
prefs.ComponentColorMode = (ComponentColorMode)EditorGUILayout.EnumPopup(UnityEditorUtility.TransformFieldName(nameof(UserSettingsPrefs.ComponentColorMode)), prefs.ComponentColorMode);
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.Space(20f);
|
||||
using (EcsGUI.SetColor(Color.white * 0.5f))
|
||||
using (DragonGUI.SetColor(Color.white * 0.5f))
|
||||
{
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
}
|
||||
@ -94,8 +85,6 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
InitDefines();
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
|
||||
EditorGUIUtility.labelWidth = labelWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,18 @@ using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
internal enum ComponentColorMode
|
||||
internal enum RuntimeDrawMode
|
||||
{
|
||||
Lazy = 0,
|
||||
Live = 1,
|
||||
}
|
||||
internal enum MetaBlockRectStyle
|
||||
{
|
||||
Clean = 0,
|
||||
Edge = 1,
|
||||
Fill = 2,
|
||||
}
|
||||
internal enum MetaBlockColorMode
|
||||
{
|
||||
Generic = 0,
|
||||
Auto = 1,
|
||||
@ -83,31 +94,61 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
}
|
||||
//[SerializeField]
|
||||
//private bool _isFastModeRuntimeComponents = false;
|
||||
//public bool IsFastModeRuntimeComponents
|
||||
//{
|
||||
// get => _isFastModeRuntimeComponents;
|
||||
// set
|
||||
// {
|
||||
// if (_isFastModeRuntimeComponents != value)
|
||||
// {
|
||||
// _isFastModeRuntimeComponents = value;
|
||||
// AutoSave();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
[SerializeField]
|
||||
private ComponentColorMode _componentColorMode = ComponentColorMode.Auto;
|
||||
public ComponentColorMode ComponentColorMode
|
||||
private bool _isPauseOnSnapshot = true;
|
||||
public bool IsPauseOnSnapshot
|
||||
{
|
||||
get => _componentColorMode;
|
||||
get => _isPauseOnSnapshot;
|
||||
set
|
||||
{
|
||||
if (_componentColorMode != value)
|
||||
if (_isPauseOnSnapshot != value)
|
||||
{
|
||||
_componentColorMode = value;
|
||||
_isPauseOnSnapshot = value;
|
||||
AutoSave();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private RuntimeDrawMode _runtimeDrawMode = RuntimeDrawMode.Live;
|
||||
public RuntimeDrawMode RuntimeDrawMode
|
||||
{
|
||||
get => _runtimeDrawMode;
|
||||
set
|
||||
{
|
||||
if (_runtimeDrawMode != value)
|
||||
{
|
||||
_runtimeDrawMode = value;
|
||||
AutoSave();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[SerializeField]
|
||||
private MetaBlockRectStyle _metaBlockRectStyle = MetaBlockRectStyle.Fill;
|
||||
public MetaBlockRectStyle MetaBlockRectStyle
|
||||
{
|
||||
get => _metaBlockRectStyle;
|
||||
set
|
||||
{
|
||||
if (_metaBlockRectStyle != value)
|
||||
{
|
||||
_metaBlockRectStyle = value;
|
||||
AutoSave();
|
||||
}
|
||||
}
|
||||
}
|
||||
[SerializeField]
|
||||
private MetaBlockColorMode _metaBlockColorMode = MetaBlockColorMode.Auto;
|
||||
public MetaBlockColorMode MetaBlockColorMode
|
||||
{
|
||||
get => _metaBlockColorMode;
|
||||
set
|
||||
{
|
||||
if (_metaBlockColorMode != value)
|
||||
{
|
||||
_metaBlockColorMode = value;
|
||||
AutoSave();
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,11 +8,15 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
[CustomEditor(typeof(EntityMonitor))]
|
||||
internal class EntityMonitorEditor : ExtendedEditor<EntityMonitor>
|
||||
{
|
||||
public override bool RequiresConstantRepaint()
|
||||
{
|
||||
return UserSettingsPrefs.instance.RuntimeDrawMode == RuntimeDrawMode.Live ? true : base.RequiresConstantRepaint();
|
||||
}
|
||||
protected override void DrawCustom()
|
||||
{
|
||||
var entity = Target.Entity;
|
||||
bool isAlive = entity.TryUnpackForUnityEditor(out int id, out short gen, out short worldID, out EcsWorld world);
|
||||
using (EcsGUI.SetEnable(isAlive))
|
||||
using (DragonGUI.SetEnable(isAlive))
|
||||
{
|
||||
if (GUILayout.Button("Delete Entity", GUILayout.Height(36f)))
|
||||
{
|
||||
@ -20,18 +24,18 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
//EcsGUI.Layout.EntityBarForAlive(isAlive ? EcsGUI.EntityStatus.Alive : EcsGUI.EntityStatus.NotAlive, id, gen, worldID);
|
||||
EcsGUI.Layout.EntityField(entity);
|
||||
DragonGUI.Layout.EntityField(entity);
|
||||
|
||||
var drawers = UnityEditorUtility._entityEditorBlockDrawers;
|
||||
if (drawers.Length > 0)
|
||||
{
|
||||
using (EcsGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
||||
using (DragonGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
||||
{
|
||||
bool isExpand = false;
|
||||
using (EcsGUI.CheckChanged())
|
||||
using (DragonGUI.CheckChanged())
|
||||
{
|
||||
isExpand = EditorGUILayout.Foldout(UserSettingsPrefs.instance.IsShowEntityOtherData, "Other data");
|
||||
if (EcsGUI.Changed)
|
||||
if (DragonGUI.Changed)
|
||||
{
|
||||
UserSettingsPrefs.instance.IsShowEntityOtherData = isExpand;
|
||||
}
|
||||
@ -48,7 +52,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
}
|
||||
|
||||
EcsGUI.Layout.DrawRuntimeComponents(entity, false);
|
||||
DragonGUI.Layout.DrawRuntimeComponents(entity, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#if UNITY_EDITOR
|
||||
using DCFApixels.DragonECS.RunnersCore;
|
||||
using DCFApixels.DragonECS.Core;
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
using System;
|
||||
using System.Linq;
|
||||
@ -41,7 +41,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
else
|
||||
{
|
||||
color = EcsGUI.SelectPanelColor(meta, i, -1).ToMetaColor();
|
||||
color = DragonGUI.SelectPanelColor(meta, i, -1).ToMetaColor();
|
||||
}
|
||||
name = $"{meta.Name}{SEPARATOR}{meta.TypeName}{SEPARATOR}{meta.MetaID}{SEPARATOR}{color.colorCode:X8}";
|
||||
}
|
||||
@ -71,7 +71,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
_headerStyle.fontSize = 28;
|
||||
}
|
||||
|
||||
using (EcsGUI.Layout.BeginHorizontal())
|
||||
using (DragonGUI.Layout.BeginHorizontal())
|
||||
{
|
||||
GUILayout.Label("[Systems]", _headerStyle, GUILayout.ExpandWidth(true));
|
||||
if (GUILayout.Button("Copy to Clipboard", GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
||||
@ -83,7 +83,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
IsShowInterfaces = EditorGUILayout.Toggle("Show Interfaces", IsShowInterfaces);
|
||||
IsShowHidden = EditorGUILayout.Toggle("Show Hidden", IsShowHidden);
|
||||
|
||||
using (EcsGUI.Layout.BeginVertical())
|
||||
using (DragonGUI.Layout.BeginVertical())
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var item in Target.Pipeline.AllSystems)
|
||||
@ -95,7 +95,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
GUILayout.Label("[Runners]", _headerStyle);
|
||||
|
||||
using (EcsGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
||||
using (DragonGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var item in Target.Pipeline.AllRunners)
|
||||
@ -114,13 +114,13 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle());
|
||||
|
||||
using (EcsGUI.Layout.BeginHorizontal()) using (var scope = EcsGUI.SetAlignment(GUI.skin.label))
|
||||
using (DragonGUI.Layout.BeginHorizontal()) using (var scope = DragonGUI.SetAlignment(GUI.skin.label))
|
||||
{
|
||||
|
||||
scope.Target.alignment = TextAnchor.UpperLeft;
|
||||
GUILayout.Label("<", GUILayout.ExpandWidth(true));
|
||||
scope.Target.alignment = TextAnchor.UpperRight;
|
||||
using (EcsGUI.SetAlpha(0.64f))
|
||||
using (DragonGUI.SetAlpha(0.64f))
|
||||
{
|
||||
GUILayout.Label($"{markerSystem.layerNameSpace}", GUILayout.ExpandWidth(false));
|
||||
}
|
||||
@ -128,7 +128,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * -4f);
|
||||
|
||||
scope.Target.alignment = TextAnchor.UpperLeft;
|
||||
using (EcsGUI.SetFontStyle(scope.Target, FontStyle.Bold))
|
||||
using (DragonGUI.SetFontStyle(scope.Target, FontStyle.Bold))
|
||||
{
|
||||
GUILayout.Label($"{markerSystem.layerName}", GUILayout.ExpandWidth(false));
|
||||
}
|
||||
@ -147,10 +147,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
|
||||
string name = meta.Name;
|
||||
Color color = EcsGUI.SelectPanelColor(meta, index, -1);
|
||||
Color color = DragonGUI.SelectPanelColor(meta, index, -1);
|
||||
|
||||
|
||||
using (EcsGUI.Layout.BeginVertical(color.SetAlpha(0.2f)))
|
||||
using (DragonGUI.Layout.BeginVertical(color.SetAlpha(0.2f)))
|
||||
{
|
||||
if (IsShowInterfaces)
|
||||
{
|
||||
@ -168,9 +168,9 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
return;
|
||||
}
|
||||
Color color = EcsGUI.SelectPanelColor(meta, index, -1);
|
||||
Color color = DragonGUI.SelectPanelColor(meta, index, -1);
|
||||
|
||||
using (EcsGUI.Layout.BeginVertical(color.SetAlpha(0.2f)))
|
||||
using (DragonGUI.Layout.BeginVertical(color.SetAlpha(0.2f)))
|
||||
{
|
||||
GUILayout.Label(meta.Name, EditorStyles.boldLabel);
|
||||
GUILayout.Label(string.Join(", ", runner.ProcessRaw.Cast<object>().Select(o => o.GetType().Name)), systemsListStyle);
|
||||
|
||||
@ -61,10 +61,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
protected override void DrawCustom()
|
||||
{
|
||||
using (EcsGUI.CheckChanged())
|
||||
using (DragonGUI.CheckChanged())
|
||||
{
|
||||
IsShowHidden = EditorGUILayout.Toggle("Show Hidden", IsShowHidden);
|
||||
if (EcsGUI.Changed)
|
||||
if (DragonGUI.Changed)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
@ -104,7 +104,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
color = NormalizeGridColor(i, color);
|
||||
EditorGUI.DrawRect(lineRect, color);
|
||||
|
||||
if (EcsGUI.HitTest(lineRect))
|
||||
if (DragonGUI.HitTest(lineRect))
|
||||
{
|
||||
GUI.Button(lineRect, "", EditorStyles.selectionRect);
|
||||
_selectedPointMeta.process = meta;
|
||||
@ -135,7 +135,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
color = NormalizeGridColor(i, color);
|
||||
EditorGUI.DrawRect(lineRect, color);
|
||||
|
||||
if (EcsGUI.HitTest(lineRect))
|
||||
if (DragonGUI.HitTest(lineRect))
|
||||
{
|
||||
GUI.Button(lineRect, "", EditorStyles.selectionRect);
|
||||
_selectedPointMeta.system = meta;
|
||||
|
||||
234
src/DebugUtils/Monitors/Editor/QuerySnapshotWindow.cs
Normal file
234
src/DebugUtils/Monitors/Editor/QuerySnapshotWindow.cs
Normal file
@ -0,0 +1,234 @@
|
||||
#if UNITY_EDITOR
|
||||
using DCFApixels.DragonECS.Core.Unchecked;
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using static DCFApixels.DragonECS.Unity.Editors.DragonGUI;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
internal class QuerySnapshotWindow : EditorWindow
|
||||
{
|
||||
private EcsWorld _world;
|
||||
private StructList<entlong> _list;
|
||||
|
||||
private readonly Color _selectionColor = new Color(0.12f, 0.5f, 1f, 0.40f);
|
||||
private readonly Color _isAliveColor = new Color(0.2f, 0.6f, 1f);
|
||||
private readonly Color _hoverColor = new Color(1f, 1f, 1f, 0.12f);
|
||||
|
||||
public static void ShowNew(EcsSpan entites)
|
||||
{
|
||||
var newWin = CreateWindow<QuerySnapshotWindow>("Query Snapshot");
|
||||
newWin.Setup(entites);
|
||||
newWin.ShowUtility();
|
||||
|
||||
if (UserSettingsPrefs.instance.IsPauseOnSnapshot)
|
||||
{
|
||||
Debug.Break();
|
||||
}
|
||||
}
|
||||
private void Setup(EcsSpan entites)
|
||||
{
|
||||
_world = entites.World;
|
||||
_list = new StructList<entlong>(entites.Count);
|
||||
_list._count = entites.Longs.ToArray(ref _list._items);
|
||||
}
|
||||
private Vector2 _scrollState;
|
||||
private void OnGUI()
|
||||
{
|
||||
if (_world.IsDestroyed) { _world = null; }
|
||||
if (_world == null)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
int selectedEntity = -1;
|
||||
var selectedGO = Selection.activeGameObject;
|
||||
if (selectedGO != null &&
|
||||
selectedGO.TryGetComponent<EntityMonitor>(out var selectedMonitor) &&
|
||||
selectedMonitor.Entity.TryUnpack(_world, out selectedEntity) == false)
|
||||
{
|
||||
selectedEntity = -1;
|
||||
}
|
||||
SelectEvent selectEvent = default;
|
||||
|
||||
|
||||
var line = EditorGUIUtility.singleLineHeight;
|
||||
var space = EditorGUIUtility.standardVerticalSpacing;
|
||||
var step = line + space;
|
||||
Event current = Event.current;
|
||||
|
||||
if (hasFocus && current.type == EventType.KeyUp && current.isKey)
|
||||
{
|
||||
if (current.keyCode == KeyCode.DownArrow)
|
||||
{
|
||||
selectEvent.Type = SelectEventType.Down;
|
||||
}
|
||||
if (current.keyCode == KeyCode.UpArrow)
|
||||
{
|
||||
selectEvent.Type = SelectEventType.Up;
|
||||
}
|
||||
}
|
||||
|
||||
var rect = position;
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
|
||||
Rect hyperlinkButtonRect;
|
||||
Rect topLineRect;
|
||||
(topLineRect, rect) = rect.VerticalSliceTop(line + space);
|
||||
topLineRect = topLineRect.AddPadding(0, 0, 0, space);
|
||||
(topLineRect, hyperlinkButtonRect) = topLineRect.HorizontalSliceRight(18f);
|
||||
EditorGUI.IntField(topLineRect, "World: ", _world.ID);
|
||||
using (DragonGUI.SetEnable(_world != null))
|
||||
{
|
||||
DragonGUI.WorldHyperlinkButton(hyperlinkButtonRect, _world);
|
||||
}
|
||||
|
||||
(topLineRect, rect) = rect.VerticalSliceTop(line + space);
|
||||
UserSettingsPrefs.instance.IsPauseOnSnapshot = EditorGUI.ToggleLeft(topLineRect, "Pause On Snapshot", UserSettingsPrefs.instance.IsPauseOnSnapshot);
|
||||
|
||||
var viewRect = rect;
|
||||
viewRect.x = 0;
|
||||
viewRect.y = 0;
|
||||
viewRect.height = (line + space) * _list.Count;
|
||||
viewRect.xMax -= GUI.skin.verticalScrollbar.fixedWidth;
|
||||
|
||||
|
||||
var lineRect = viewRect;
|
||||
lineRect.height = line;
|
||||
Rect statusR;
|
||||
(statusR, lineRect) = lineRect.HorizontalSliceLeft(3f);
|
||||
|
||||
_scrollState = GUI.BeginScrollView(rect, _scrollState, viewRect, false, true);
|
||||
var checkRect = rect;
|
||||
checkRect.position = Vector2.zero;
|
||||
|
||||
bool foundSelected = false;
|
||||
for (int i = 0; i < _list.Count; i++)
|
||||
{
|
||||
EntitySlotInfo entity = (EntitySlotInfo)_list[i];
|
||||
bool isAlive = _world.IsAlive(entity.id, entity.gen);
|
||||
bool selected = selectedEntity == entity.id && isAlive;
|
||||
foundSelected |= selected;
|
||||
bool isClick = false;
|
||||
|
||||
|
||||
bool visible = lineRect.Overlaps(checkRect.AddOffset(_scrollState));
|
||||
if (visible)
|
||||
{
|
||||
using (DragonGUI.SetAlpha(0)) { GUI.Label(lineRect, string.Empty, GUI.skin.button); }
|
||||
if (DragonGUI.HitTest(lineRect))
|
||||
{
|
||||
EditorGUI.DrawRect(lineRect, _hoverColor);
|
||||
if (current.type == EventType.MouseUp)
|
||||
{
|
||||
isClick = true;
|
||||
}
|
||||
}
|
||||
if (selected)
|
||||
{
|
||||
DragonGUI.DrawRect(lineRect, _selectionColor);
|
||||
}
|
||||
if (isAlive)
|
||||
{
|
||||
DragonGUI.DrawRect(statusR, _isAliveColor);
|
||||
}
|
||||
var (labelR, infoR) = lineRect.HorizontalSliceLeft(45f);
|
||||
infoR.width = Mathf.Min(infoR.width, 200f);
|
||||
var (lR, rR) = infoR.HorizontalSliceLerp(0.5f);
|
||||
GUI.Label(labelR, "Entity", GUI.skin.label);
|
||||
EditorGUI.IntField(lR, entity.id, GUI.skin.label);
|
||||
EditorGUI.IntField(rR, entity.gen, GUI.skin.label);
|
||||
|
||||
if (isClick && isAlive)
|
||||
{
|
||||
selectEvent.Type = SelectEventType.Click;
|
||||
selectEvent.EntityID = entity.id;
|
||||
selectEvent.Index = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (isAlive)
|
||||
{
|
||||
switch (selectEvent.Type)
|
||||
{
|
||||
case SelectEventType.Up:
|
||||
{
|
||||
if (foundSelected == false)
|
||||
{
|
||||
selectEvent.EntityID = entity.id;
|
||||
selectEvent.Index = i;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SelectEventType.Down:
|
||||
{
|
||||
if (foundSelected && selected == false && selectEvent.EntityID == 0)
|
||||
{
|
||||
selectEvent.EntityID = entity.id;
|
||||
selectEvent.Index = i;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lineRect.y += step;
|
||||
statusR.y += step;
|
||||
}
|
||||
GUI.EndScrollView();
|
||||
|
||||
|
||||
if (selectEvent.IsSelected && selectedEntity != selectEvent.EntityID)
|
||||
{
|
||||
float top = selectEvent.Index * step;
|
||||
float bottom = top + step;
|
||||
|
||||
if (top < _scrollState.y)
|
||||
{
|
||||
_scrollState.y = top;
|
||||
}
|
||||
else if (bottom > _scrollState.y + checkRect.height)
|
||||
{
|
||||
_scrollState.y = bottom - checkRect.height;
|
||||
}
|
||||
GUIUtility.keyboardControl = 0;
|
||||
|
||||
SelectEntity(selectEvent.EntityID);
|
||||
}
|
||||
|
||||
|
||||
if (selectEvent.IsSelected)
|
||||
{
|
||||
Repaint();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectEntity(int entityID)
|
||||
{
|
||||
var monitor = _world.Get<EntityLinksComponent>().GetMonitorLink(entityID);
|
||||
EditorGUIUtility.PingObject(monitor);
|
||||
Selection.activeObject = monitor;
|
||||
}
|
||||
private void OnDestroy() { }
|
||||
|
||||
|
||||
private struct SelectEvent
|
||||
{
|
||||
public SelectEventType Type;
|
||||
public int EntityID;
|
||||
public int Index;
|
||||
public bool IsSelected { get { return Type != SelectEventType.None && EntityID != 0; } }
|
||||
}
|
||||
private enum SelectEventType
|
||||
{
|
||||
None,
|
||||
Click,
|
||||
Up,
|
||||
Down,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69a86e40de1b68a448f49be1e83a1ed5
|
||||
guid: 09884db6f09e654498c72416a199e357
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@ -1,5 +1,5 @@
|
||||
#if UNITY_EDITOR
|
||||
using DCFApixels.DragonECS.UncheckedCore;
|
||||
using DCFApixels.DragonECS.Core.Unchecked;
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
@ -107,7 +107,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
_headerStyle.fontSize = 28;
|
||||
}
|
||||
|
||||
using (EcsGUI.Layout.BeginHorizontal())
|
||||
using (DragonGUI.Layout.BeginHorizontal())
|
||||
{
|
||||
GUILayout.Label("[World]", _headerStyle, GUILayout.ExpandWidth(true));
|
||||
if (GUILayout.Button("Copy to Clipboard", GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
||||
@ -117,9 +117,9 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
|
||||
|
||||
EcsGUI.Layout.DrawWorldBaseInfo(Target.World);
|
||||
DragonGUI.Layout.DrawWorldBaseInfo(Target.World);
|
||||
|
||||
EcsGUI.Layout.DrawWorldComponents(Target.World);
|
||||
DragonGUI.Layout.DrawWorldComponents(Target.World);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,73 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
internal class WorldQueriesMonitorEditor : ExtendedEditor<WorldQueriesMonitor>
|
||||
{
|
||||
private GUIStyle _headerStyle;
|
||||
private const char _searchPatternSeparator = '/';
|
||||
|
||||
public readonly struct SearchPattern
|
||||
{
|
||||
private readonly string _pattern;
|
||||
private readonly char _separator;
|
||||
public SearchPattern(string pattern, char separator)
|
||||
{
|
||||
_pattern = pattern ?? throw new ArgumentNullException(nameof(pattern));
|
||||
_separator = separator;
|
||||
}
|
||||
public Enumerator GetEnumerator() { return new Enumerator(_pattern, _separator); }
|
||||
public ref struct Enumerator
|
||||
{
|
||||
private readonly string _pattern;
|
||||
private readonly char _separator;
|
||||
private int _start;
|
||||
private int _currentStart;
|
||||
private int _currentLength;
|
||||
|
||||
public Enumerator(string pattern, char separator)
|
||||
{
|
||||
_pattern = pattern;
|
||||
_separator = separator;
|
||||
_start = 0;
|
||||
_currentStart = -1;
|
||||
_currentLength = 0;
|
||||
}
|
||||
|
||||
public ReadOnlySpan<char> Current
|
||||
{
|
||||
get { return _pattern.AsSpan(_currentStart, _currentLength); }
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
if (_pattern == null || _start > _pattern.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int len = _pattern.Length;
|
||||
while (_start <= len)
|
||||
{
|
||||
int i = _start;
|
||||
while (i < len && _pattern[i] != _separator)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
||||
int subLen = i - _start;
|
||||
if (subLen > 0) // возвращаем только непустые подстроки
|
||||
{
|
||||
_currentStart = _start;
|
||||
_currentLength = subLen;
|
||||
_start = i + 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
// пустая подстрока — пропускаем разделитель и продолжаем
|
||||
_start = i + 1;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CopyToClipboard()
|
||||
{
|
||||
@ -75,8 +142,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
var incs = query.Mask.Incs;
|
||||
var excs = query.Mask.Excs;
|
||||
var anys = query.Mask.Anys;
|
||||
var incsI = 0;
|
||||
var excsI = 0;
|
||||
var anysI = 0;
|
||||
for (int j = 0; j < allpools.Length; j++)
|
||||
{
|
||||
var pool = allpools[j];
|
||||
@ -97,6 +166,13 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
excsI++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (anysI < anys.Length && anys[anysI] == j)
|
||||
{
|
||||
sb.Append($"~");
|
||||
anysI++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
sb.Append("\r\n");
|
||||
@ -117,7 +193,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
var executors = Target.MaskQueryExecutors;
|
||||
|
||||
using (EcsGUI.Layout.BeginHorizontal())
|
||||
using (DragonGUI.Layout.BeginHorizontal())
|
||||
{
|
||||
GUILayout.Label("[Queries]", _headerStyle, GUILayout.ExpandWidth(true));
|
||||
if (GUILayout.Button("Copy to Clipboard", GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
|
||||
@ -126,8 +202,9 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.IntField("Count: ", executors.Count);
|
||||
GUILayout.Space(10f);
|
||||
|
||||
EditorGUILayout.IntField("Total Count: ", executors.Count);
|
||||
|
||||
HasSearchPattern = true;
|
||||
if (string.IsNullOrEmpty(Target.SearchPattern))
|
||||
@ -135,34 +212,57 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
Target.SearchPattern = string.Empty;
|
||||
HasSearchPattern = false;
|
||||
}
|
||||
GUILayout.Space(10f);
|
||||
|
||||
Target.SearchPattern = EditorGUILayout.TextField("Search: ", Target.SearchPattern);
|
||||
|
||||
|
||||
Target.SearchPattern = EditorGUILayout.TextField(Target.SearchPattern, EditorStyles.toolbarSearchField);
|
||||
string searchPattern = Target.SearchPattern;
|
||||
|
||||
GUILayout.Space(20);
|
||||
var r = GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, 3f);
|
||||
DragonGUI.DrawRect(r, Color.white.SetAlpha(0.5f));
|
||||
GUILayout.Space(10f);
|
||||
|
||||
|
||||
//using (EcsGUI.Layout.BeginVertical(UnityEditorUtility.GetStyle(Color.black, 0.2f)))
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var executor in executors)
|
||||
{
|
||||
bool cheack(ReadOnlySpan<Type> types, string searchPattern)
|
||||
bool cheack(ReadOnlySpan<Type> types, ReadOnlySpan<char> searchPatternRaw)
|
||||
{
|
||||
foreach (var type in types)
|
||||
{
|
||||
if(type.Name.Contains(searchPattern, StringComparison.OrdinalIgnoreCase))
|
||||
if(type.Name.AsSpan().Contains(searchPatternRaw, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!HasSearchPattern ||
|
||||
cheack(executor.Mask.GetIncTypes_Debug(), searchPattern) ||
|
||||
cheack(executor.Mask.GetExcTypes_Debug(), searchPattern) ||
|
||||
cheack(executor.Mask.GetAnyTypes_Debug(), searchPattern))
|
||||
|
||||
bool isDraw = false;
|
||||
if (HasSearchPattern)
|
||||
{
|
||||
int subPuttornsCount = 0;
|
||||
int checkPassesCount = 0;
|
||||
foreach (var subPattern in new SearchPattern(searchPattern, _searchPatternSeparator))
|
||||
{
|
||||
subPuttornsCount++;
|
||||
if (cheack(executor.Mask.GetIncTypes_Debug(), subPattern) ||
|
||||
cheack(executor.Mask.GetExcTypes_Debug(), subPattern) ||
|
||||
cheack(executor.Mask.GetAnyTypes_Debug(), subPattern))
|
||||
{
|
||||
checkPassesCount++;
|
||||
}
|
||||
}
|
||||
isDraw = subPuttornsCount <= checkPassesCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
isDraw = true;
|
||||
}
|
||||
|
||||
|
||||
if(isDraw)
|
||||
{
|
||||
DrawQueryInfo(executor, i++);
|
||||
}
|
||||
@ -179,15 +279,20 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
|
||||
//using (EcsGUI.Layout.BeginVertical(UnityEditorUtility.GetStyle(GetGenericPanelColor(index))))
|
||||
using (EcsGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
||||
using (DragonGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
||||
{
|
||||
var mask = executor.Mask;
|
||||
DrawConstraint("+", mask.Incs);
|
||||
DrawConstraint("-", mask.Excs);
|
||||
DrawConstraint("~", mask.Anys);
|
||||
}
|
||||
|
||||
EditorGUILayout.LongField("Version: ", executor.Version);
|
||||
EditorGUILayout.IntField("Entites Count: ", executor.LastCachedCount);
|
||||
if (GUILayout.Button("Snapshot"))
|
||||
{
|
||||
QuerySnapshotWindow.ShowNew(executor.Snapshot());
|
||||
}
|
||||
|
||||
//var rect = GUILayoutUtility.GetLastRect();
|
||||
//
|
||||
@ -205,24 +310,24 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
return;
|
||||
}
|
||||
|
||||
using (EcsGUI.Layout.BeginHorizontal())
|
||||
using (DragonGUI.Layout.BeginHorizontal())
|
||||
{
|
||||
using (EcsGUI.SetAlignment(value: TextAnchor.MiddleCenter))
|
||||
using (EcsGUI.SetFontStyle(value: FontStyle.Bold))
|
||||
using (EcsGUI.SetFontSize(value: 18))
|
||||
using (EcsGUI.SetColor(Color.white, 0.3f))
|
||||
using (DragonGUI.SetAlignment(value: TextAnchor.MiddleCenter))
|
||||
using (DragonGUI.SetFontStyle(value: FontStyle.Bold))
|
||||
using (DragonGUI.SetFontSize(value: 18))
|
||||
using (DragonGUI.SetColor(Color.white, 0.3f))
|
||||
GUILayout.Label(title, GUILayout.Width(12));
|
||||
|
||||
using (EcsGUI.Layout.BeginVertical())
|
||||
using (DragonGUI.Layout.BeginVertical())
|
||||
{
|
||||
foreach (var inc in ids)
|
||||
{
|
||||
Type type = Target.World.GetComponentType(inc);
|
||||
TypeMeta meta = type.GetMeta();
|
||||
|
||||
Color color = EcsGUI.SelectPanelColor(meta, i, 9);
|
||||
Color color = DragonGUI.SelectPanelColor(meta, i, 9);
|
||||
|
||||
using (EcsGUI.Layout.BeginVertical(color.SetAlpha(0.2f)))
|
||||
using (DragonGUI.Layout.BeginVertical(color.SetAlpha(0.2f)))
|
||||
{
|
||||
GUILayout.Label(meta.TypeName);
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
||||
_entity = entity;
|
||||
#if UNITY_EDITOR
|
||||
var world = entity.GetWorldUnchecked();
|
||||
world.Get<EcsGUI.EntityLinksComponent>().SetMonitorLink(entity.GetIDUnchecked(), this);
|
||||
world.Get<DragonGUI.EntityLinksComponent>().SetMonitorLink(entity.GetIDUnchecked(), this);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,6 +19,9 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
||||
public void Set(EcsWorld world)
|
||||
{
|
||||
_world = world;
|
||||
#if UNITY_EDITOR
|
||||
world.Get<DragonGUI.EntityLinksComponent>().SetWorldMonitor(this);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,5 +133,7 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
||||
_entityMonitorRef.Set(_world.GetEntityLong(entityID));
|
||||
}
|
||||
}
|
||||
|
||||
public void OnMigrateEntity(int entityID) { }
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,8 +29,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{ (byte)AddParamsFlags.NoImport | 7, "NoImport, Layer, Order, IsUnique" },
|
||||
{ byte.MaxValue, "NoImport, Layer, Order, IsUnique" },
|
||||
};
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
protected override float GetCustomHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
//return !property.isExpanded ?
|
||||
// EditorGUIUtility.singleLineHeight + Spacing :
|
||||
@ -52,11 +51,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
(foldoutRect, labelField) = foldoutRect.HorizontalSliceLeft(EditorGUIUtility.labelWidth);
|
||||
|
||||
|
||||
using (EcsGUI.CheckChanged())
|
||||
using (DragonGUI.CheckChanged())
|
||||
{
|
||||
property.isExpanded = EditorGUI.Foldout(foldoutRect, property.isExpanded, label);
|
||||
|
||||
using (EcsGUI.SetAlignment(EditorStyles.miniLabel, TextAnchor.MiddleRight))
|
||||
using (DragonGUI.SetAlignment(EditorStyles.miniLabel, TextAnchor.MiddleRight))
|
||||
{
|
||||
if (_labelCache.TryGetValue((byte)(flags.Normalize()), out string str) == false)
|
||||
{
|
||||
@ -71,7 +70,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
|
||||
//property.isExpanded = true;
|
||||
using (EcsGUI.UpIndentLevel())
|
||||
using (DragonGUI.UpIndentLevel())
|
||||
{
|
||||
checkboxRects = checkboxRects.Move(EditorGUIUtility.standardVerticalSpacing, 0);
|
||||
|
||||
@ -82,11 +81,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
//LayerName
|
||||
property.Next(true);
|
||||
using (EcsGUI.SetIndentLevel(0))
|
||||
using (DragonGUI.SetIndentLevel(0))
|
||||
{
|
||||
flags = flags.SetOverwriteLayerName(EditorGUI.Toggle(checkboxRect, flags.IsOverwriteLayerName()));
|
||||
}
|
||||
using (EcsGUI.SetEnable(flags.IsOverwriteLayerName()))
|
||||
using (DragonGUI.SetEnable(flags.IsOverwriteLayerName()))
|
||||
{
|
||||
EditorGUI.PropertyField(fieldRect, property, UnityEditorUtility.GetLabel(property.displayName), true);
|
||||
}
|
||||
@ -96,11 +95,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
//SortOrder
|
||||
property.Next(false);
|
||||
using (EcsGUI.SetIndentLevel(0))
|
||||
using (DragonGUI.SetIndentLevel(0))
|
||||
{
|
||||
flags = flags.SetOverwriteSortOrder(EditorGUI.Toggle(checkboxRect, flags.IsOverwriteSortOrder()));
|
||||
}
|
||||
using (EcsGUI.SetEnable(flags.IsOverwriteSortOrder()))
|
||||
using (DragonGUI.SetEnable(flags.IsOverwriteSortOrder()))
|
||||
{
|
||||
EditorGUI.PropertyField(fieldRect, property, UnityEditorUtility.GetLabel(property.displayName), true);
|
||||
}
|
||||
@ -110,16 +109,16 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
//IsUnique
|
||||
property.Next(false);
|
||||
using (EcsGUI.SetIndentLevel(0))
|
||||
using (DragonGUI.SetIndentLevel(0))
|
||||
{
|
||||
flags = flags.SetOverwriteIsUnique(EditorGUI.Toggle(checkboxRect, flags.IsOverwriteIsUnique()));
|
||||
}
|
||||
using (EcsGUI.SetEnable(flags.IsOverwriteIsUnique()))
|
||||
using (DragonGUI.SetEnable(flags.IsOverwriteIsUnique()))
|
||||
{
|
||||
EditorGUI.PropertyField(fieldRect, property, UnityEditorUtility.GetLabel(property.displayName), true);
|
||||
}
|
||||
|
||||
if (EcsGUI.Changed)
|
||||
if (DragonGUI.Changed)
|
||||
{
|
||||
flagsProp.enumValueFlag = (int)flags;
|
||||
}
|
||||
@ -134,7 +133,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
exti:;
|
||||
|
||||
//EcsGUI.Changed = Event.current.type == EventType.MouseUp;
|
||||
if (EcsGUI.Changed)
|
||||
if (DragonGUI.Changed)
|
||||
{
|
||||
property.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
@ -18,6 +18,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
[CustomPropertyDrawer(typeof(CustomToggleAttribute))]
|
||||
internal class LeftToggleAttributeDrawer : ExtendedPropertyDrawer<CustomToggleAttribute>
|
||||
{
|
||||
protected override float GetCustomHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return OneLineHeight + Spacing;
|
||||
}
|
||||
protected override void DrawCustom(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
if (property.propertyType != SerializedPropertyType.Boolean)
|
||||
|
||||
@ -10,7 +10,7 @@ using UnityObject = UnityEngine.Object;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
internal static partial class EcsGUI
|
||||
internal static partial class DragonGUI
|
||||
{
|
||||
public static partial class Layout
|
||||
{
|
||||
@ -38,7 +38,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
public static void ScriptAssetButton(MonoScript script, params GUILayoutOption[] options)
|
||||
{
|
||||
EcsGUI.ScriptAssetButton(GUILayoutUtility.GetRect(UnityEditorUtility.GetLabelTemp(), EditorStyles.miniButton, options), script);
|
||||
DragonGUI.ScriptAssetButton(GUILayoutUtility.GetRect(UnityEditorUtility.GetLabelTemp(), EditorStyles.miniButton, options), script);
|
||||
}
|
||||
|
||||
|
||||
@ -85,11 +85,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
public static void DrawEmptyComponentProperty(SerializedProperty property, string name, bool isDisplayEmpty)
|
||||
{
|
||||
EcsGUI.DrawEmptyComponentProperty(GUILayoutUtility.GetRect(UnityEditorUtility.GetLabel(name), EditorStyles.label), property, name, isDisplayEmpty);
|
||||
DragonGUI.DrawEmptyComponentProperty(GUILayoutUtility.GetRect(UnityEditorUtility.GetLabel(name), EditorStyles.label), property, name, isDisplayEmpty);
|
||||
}
|
||||
public static void DrawEmptyComponentProperty(SerializedProperty property, GUIContent label, bool isDisplayEmpty)
|
||||
{
|
||||
EcsGUI.DrawEmptyComponentProperty(GUILayoutUtility.GetRect(label, EditorStyles.label), property, label, isDisplayEmpty);
|
||||
DragonGUI.DrawEmptyComponentProperty(GUILayoutUtility.GetRect(label, EditorStyles.label), property, label, isDisplayEmpty);
|
||||
}
|
||||
public static void DrawWorldBaseInfo(EcsWorld world)
|
||||
{
|
||||
@ -121,11 +121,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
EntityField(UnityEditorUtility.GetLabel(label), entity);
|
||||
}
|
||||
public static unsafe void EntityField(GUIContent label, entlong entity)
|
||||
public static void EntityField(GUIContent label, entlong entity)
|
||||
{
|
||||
float width = EditorGUIUtility.currentViewWidth;
|
||||
float height = EntityBarHeight;
|
||||
EcsGUI.EntityField(GUILayoutUtility.GetRect(width, height), label, entity);
|
||||
DragonGUI.EntityField(GUILayoutUtility.GetRect(width, height), label, entity);
|
||||
}
|
||||
public static void EntityField(EntitySlotInfo entity)
|
||||
{
|
||||
@ -139,7 +139,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
float width = EditorGUIUtility.currentViewWidth;
|
||||
float height = EntityBarHeight;
|
||||
EcsGUI.EntityField(GUILayoutUtility.GetRect(width, height), label, entity);
|
||||
DragonGUI.EntityField(GUILayoutUtility.GetRect(width, height), label, entity);
|
||||
}
|
||||
public static void EntityField(SerializedProperty property)
|
||||
{
|
||||
@ -153,21 +153,21 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
float width = EditorGUIUtility.currentViewWidth;
|
||||
float height = EntityBarHeight;
|
||||
EcsGUI.EntityField(GUILayoutUtility.GetRect(width, height), property, label);
|
||||
DragonGUI.EntityField(GUILayoutUtility.GetRect(width, height), property, label);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static bool AddComponentButtons(out Rect dropDownRect)
|
||||
{
|
||||
return EcsGUI.AddComponentButton(GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, 24f), out dropDownRect);
|
||||
return DragonGUI.AddComponentButton(GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, 24f), out dropDownRect);
|
||||
}
|
||||
public static AddClearButton AddClearComponentButtons(out Rect dropDownRect)
|
||||
{
|
||||
return EcsGUI.AddClearComponentButtons(GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, 24f), out dropDownRect);
|
||||
return DragonGUI.AddClearComponentButtons(GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, 24f), out dropDownRect);
|
||||
}
|
||||
public static AddClearButton AddClearSystemButtons(out Rect dropDownRect)
|
||||
{
|
||||
return EcsGUI.AddClearSystemButtons(GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, 24f), out dropDownRect);
|
||||
return DragonGUI.AddClearSystemButtons(GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, 24f), out dropDownRect);
|
||||
}
|
||||
public static void DrawRuntimeComponents(entlong entity, bool isWithFoldout, bool isRoot = true)
|
||||
{
|
||||
@ -8,11 +8,12 @@ using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using Color = UnityEngine.Color;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
internal static partial class EcsGUI
|
||||
internal static partial class DragonGUI
|
||||
{
|
||||
#region Scores
|
||||
private static int _changedCounter = 0;
|
||||
@ -72,6 +73,20 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
}
|
||||
public static SerializedProperty CurrentTrackedArrayProperty;
|
||||
public readonly struct TrackArrayPropertyScope : IDisposable
|
||||
{
|
||||
private readonly SerializedProperty _sp;
|
||||
public TrackArrayPropertyScope(SerializedProperty sp)
|
||||
{
|
||||
_sp = sp;
|
||||
CurrentTrackedArrayProperty = null;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
CurrentTrackedArrayProperty = _sp;
|
||||
}
|
||||
}
|
||||
public readonly struct CheckChangedScopeWithAutoApply : IDisposable
|
||||
{
|
||||
private readonly CheckChangedScope _scope;
|
||||
@ -207,11 +222,18 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
public VerticalScope(GUILayoutOption[] options) { GUILayout.BeginVertical(options); }
|
||||
public VerticalScope(GUIStyle style, GUILayoutOption[] options) { GUILayout.BeginVertical(style, options); }
|
||||
public VerticalScope(GUIStyle style, Color backgroundColor, GUILayoutOption[] options)
|
||||
{
|
||||
using (SetColor(backgroundColor))
|
||||
{
|
||||
GUILayout.BeginVertical(style, options);
|
||||
}
|
||||
}
|
||||
public VerticalScope(Color backgroundColor, GUILayoutOption[] options)
|
||||
{
|
||||
using (SetColor(backgroundColor))
|
||||
{
|
||||
GUILayout.BeginVertical(UnityEditorUtility.GetWhiteStyle(), options);
|
||||
GUILayout.BeginVertical(UnityEditorUtility.GetWhiteStyleWithPadding(), options);
|
||||
}
|
||||
}
|
||||
public void Dispose() { GUILayout.EndVertical(); }
|
||||
@ -224,7 +246,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
using (SetColor(backgroundColor))
|
||||
{
|
||||
GUILayout.BeginHorizontal(UnityEditorUtility.GetWhiteStyle(), options);
|
||||
GUILayout.BeginHorizontal(UnityEditorUtility.GetWhiteStyleWithPadding(), options);
|
||||
}
|
||||
}
|
||||
public void Dispose() { GUILayout.EndHorizontal(); }
|
||||
@ -247,6 +269,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
public static VerticalScope BeginVertical(params GUILayoutOption[] options) => new VerticalScope(options);
|
||||
public static VerticalScope BeginVertical(GUIStyle style, params GUILayoutOption[] options) => new VerticalScope(style, options);
|
||||
public static VerticalScope BeginVertical(Color backgroundColor, params GUILayoutOption[] options) => new VerticalScope(backgroundColor, options);
|
||||
public static VerticalScope BeginVertical(GUIStyle style, Color backgroundColor, params GUILayoutOption[] options) => new VerticalScope(style, backgroundColor, options);
|
||||
}
|
||||
public static CheckChangedScope CheckChanged() => CheckChangedScope.New();
|
||||
public static CheckChangedScopeWithAutoApply CheckChanged(SerializedObject serializedObject) => new CheckChangedScopeWithAutoApply(serializedObject);
|
||||
@ -308,10 +331,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
get => EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
private static ComponentColorMode AutoColorMode
|
||||
private static MetaBlockColorMode MetaBlockColorMode
|
||||
{
|
||||
get { return UserSettingsPrefs.instance.ComponentColorMode; }
|
||||
set { UserSettingsPrefs.instance.ComponentColorMode = value; }
|
||||
get { return UserSettingsPrefs.instance.MetaBlockColorMode; }
|
||||
set { UserSettingsPrefs.instance.MetaBlockColorMode = value; }
|
||||
}
|
||||
private static bool IsShowHidden
|
||||
{
|
||||
@ -375,35 +398,33 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
#endregion
|
||||
|
||||
#region small elems
|
||||
public static void DrawTextureSoftColor(Rect position, Texture texture)
|
||||
{
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
Graphics.DrawTexture(position, texture, new Rect(0f, 0f, 1f, 1f), 0, 0, 0, 0, GUI.color * 0.5f, null);
|
||||
}
|
||||
}
|
||||
public static void DrawTexture(Rect position, Texture texture)
|
||||
{
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
Graphics.DrawTexture(position, texture, new Rect(0f, 0f, 1f, 1f), 0, 0, 0, 0, GUI.color, null);
|
||||
}
|
||||
}
|
||||
public static void DrawRectSoftColor(Rect position, Color color)
|
||||
{
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
Texture texture = UnityEditorUtility.GetWhiteTexture();
|
||||
Graphics.DrawTexture(position, texture, new Rect(0f, 0f, 1f, 1f), 0, 0, 0, 0, GUI.color * color * 0.5f, null);
|
||||
}
|
||||
DrawTex(position, texture, GUI.color);
|
||||
}
|
||||
public static void DrawRect(Rect position, Color color)
|
||||
{
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
Texture texture = UnityEditorUtility.GetWhiteTexture();
|
||||
DrawTex(position, texture, GUI.color * color);
|
||||
}
|
||||
private static void DrawTex(Rect position, Texture texture, Color color)
|
||||
{
|
||||
//GUI.DrawTexture(position, texture, ScaleMode.StretchToFill, true, 0, color, 0, 0);
|
||||
using (SetColor(color))
|
||||
{
|
||||
Texture texture = UnityEditorUtility.GetWhiteTexture();
|
||||
Graphics.DrawTexture(position, texture, new Rect(0f, 0f, 1f, 1f), 0, 0, 0, 0, GUI.color * color, null);
|
||||
GUI.DrawTexture(position, texture, ScaleMode.StretchToFill);
|
||||
}
|
||||
|
||||
//if (Event.current.type == EventType.Repaint)
|
||||
//{
|
||||
// Graphics.DrawTexture(position, texture, new Rect(0f, 0f, 1f, 1f), 0, 0, 0, 0, GUI.color * color, null);
|
||||
//}
|
||||
|
||||
//var x = GUIClip.visibleRect;
|
||||
//Rect visibleRect = new Rect(0, 0, scrollViewWidth, scrollViewHeight); // свой прямоугольник обрезки
|
||||
//GUI.BeginClip(visibleRect);
|
||||
//Graphics.DrawTexture(new Rect(position.x - visibleRect.x, position.y - visibleRect.y, position.width, position.height), texture);
|
||||
//GUI.EndClip();
|
||||
}
|
||||
public static void DrawIcon(Rect position, Texture icon, float iconPadding, string tooltip)
|
||||
{
|
||||
@ -418,7 +439,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
using (SetColor(GUI.enabled ? GUI.color : GUI.color * new Color(1f, 1f, 1f, 0.4f)))
|
||||
{
|
||||
GUI.Label(position, UnityEditorUtility.GetLabel(string.Empty, tooltip));
|
||||
DrawTextureSoftColor(RectUtility.AddPadding(position, iconPadding), icon);
|
||||
DrawTexture(RectUtility.AddPadding(position, iconPadding), icon);
|
||||
}
|
||||
}
|
||||
public static (bool, bool) IconButtonGeneric(Rect position)
|
||||
@ -426,8 +447,8 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
using (SetAlpha(0))
|
||||
{
|
||||
bool result = GUI.Button(position, string.Empty, EditorStyles.miniButtonMid);
|
||||
var current = Event.current;
|
||||
return (GUI.enabled && HitTest(position, current), result);
|
||||
var currentEvent = Event.current;
|
||||
return (GUI.enabled && HitTest(position, currentEvent), result);
|
||||
}
|
||||
}
|
||||
public static bool IconHoverScan(Rect position, Event current)
|
||||
@ -451,7 +472,25 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
DrawIcon(position, Icons.Instance.HelpIcon, 0, description);
|
||||
}
|
||||
}
|
||||
public static void WorldHyperlinkButton(Rect position, EcsWorld world)
|
||||
{
|
||||
var current = Event.current;
|
||||
var hover = IconHoverScan(position, current);
|
||||
|
||||
var click = IconButton(position, Icons.Instance.HyperlinkIcon, 2f, string.Empty);
|
||||
if (GUI.enabled)
|
||||
{
|
||||
if (click)
|
||||
{
|
||||
var monitor = world.Get<EntityLinksComponent>().GetWorldMonitor();
|
||||
if (monitor != null)
|
||||
{
|
||||
EditorGUIUtility.PingObject(monitor);
|
||||
Selection.activeObject = monitor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void EntityHyperlinkButton(Rect position, EcsWorld world, int entityID)
|
||||
{
|
||||
var current = Event.current;
|
||||
@ -486,11 +525,13 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
if (current.type == EventType.MouseUp)
|
||||
{
|
||||
EditorGUIUtility.PingObject(script);
|
||||
Event.current.Use();
|
||||
}
|
||||
else if (current.type == EventType.MouseDown && current.clickCount >= 2)
|
||||
{
|
||||
//UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(); //TODO
|
||||
AssetDatabase.OpenAsset(script);
|
||||
Event.current.Use();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -550,13 +591,15 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
private readonly Storage _storage;
|
||||
private EntityLinksComponent(Storage storage) { _storage = storage; }
|
||||
public void SetConnectLink(int entityID, EcsEntityConnect link) { _storage.links[entityID].connect = link; }
|
||||
public void SetMonitorLink(int entityID, EntityMonitor link) { _storage.links[entityID].monitor = link; }
|
||||
public EcsEntityConnect GetConnectLink(int entityID) { return _storage.links[entityID].connect; }
|
||||
public EntityMonitor GetMonitorLink(int entityID) { return _storage.links[entityID].monitor; }
|
||||
public void SetWorldMonitor(WorldMonitor monitor) { _storage.WorldMonitor = monitor; }
|
||||
public WorldMonitor GetWorldMonitor() { return _storage.WorldMonitor; }
|
||||
public void SetConnectLink(int entityID, EcsEntityConnect link) { _storage.Links[entityID].connect = link; }
|
||||
public void SetMonitorLink(int entityID, EntityMonitor link) { _storage.Links[entityID].monitor = link; }
|
||||
public EcsEntityConnect GetConnectLink(int entityID) { return _storage.Links[entityID].connect; }
|
||||
public EntityMonitor GetMonitorLink(int entityID) { return _storage.Links[entityID].monitor; }
|
||||
public UnityEngine.Object GetLink(int entityID)
|
||||
{
|
||||
ref var links = ref _storage.links[entityID];
|
||||
ref var links = ref _storage.Links[entityID];
|
||||
if (links.connect != null)
|
||||
{
|
||||
return links.connect;
|
||||
@ -573,15 +616,16 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
private class Storage : IEcsWorldEventListener
|
||||
{
|
||||
private readonly EcsWorld _world;
|
||||
public (EcsEntityConnect connect, EntityMonitor monitor)[] links;
|
||||
public readonly EcsWorld World;
|
||||
public WorldMonitor WorldMonitor;
|
||||
public (EcsEntityConnect connect, EntityMonitor monitor)[] Links;
|
||||
public Storage(EcsWorld world)
|
||||
{
|
||||
_world = world;
|
||||
_world.AddListener(this);
|
||||
links = new (EcsEntityConnect, EntityMonitor)[_world.Capacity];
|
||||
World = world;
|
||||
World.AddListener(this);
|
||||
Links = new (EcsEntityConnect, EntityMonitor)[World.Capacity];
|
||||
}
|
||||
public void OnWorldResize(int newSize) { Array.Resize(ref links, newSize); }
|
||||
public void OnWorldResize(int newSize) { Array.Resize(ref Links, newSize); }
|
||||
public void OnReleaseDelEntityBuffer(ReadOnlySpan<int> buffer) { }
|
||||
public void OnWorldDestroy() { }
|
||||
}
|
||||
@ -590,7 +634,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
EntityField(position, DragonGUIContent.Empty, entity);
|
||||
}
|
||||
public static unsafe void EntityField(Rect position, DragonGUIContent label, entlong entity)
|
||||
public static void EntityField(Rect position, DragonGUIContent label, entlong entity)
|
||||
{
|
||||
EntityField(position, label, (EntitySlotInfo)entity);
|
||||
}
|
||||
@ -671,7 +715,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
w.a = 0.6f;
|
||||
Color b = Color.black;
|
||||
b.a = 0.55f;
|
||||
DrawRectSoftColor(position, w);
|
||||
DrawRect(position, w);
|
||||
|
||||
var (idRect, genWorldRect) = RectUtility.HorizontalSliceLerp(position, 0.4f);
|
||||
var (genRect, worldRect) = RectUtility.HorizontalSliceLerp(genWorldRect, 0.5f);
|
||||
@ -679,9 +723,9 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
idRect = RectUtility.AddPadding(idRect, 2, 1, 0, 0);
|
||||
genRect = RectUtility.AddPadding(genRect, 1, 1, 0, 0);
|
||||
worldRect = RectUtility.AddPadding(worldRect, 1, 2, 0, 0);
|
||||
DrawRectSoftColor(idRect, b);
|
||||
DrawRectSoftColor(genRect, b);
|
||||
DrawRectSoftColor(worldRect, b);
|
||||
DrawRect(idRect, b);
|
||||
DrawRect(genRect, b);
|
||||
DrawRect(worldRect, b);
|
||||
|
||||
GUIStyle style = UnityEditorUtility.GetInputFieldCenterAnhor();
|
||||
|
||||
@ -715,23 +759,24 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
return DrawTypeMetaBlockPadding * 2 + contentHeight;
|
||||
}
|
||||
|
||||
public static bool DrawTypeMetaElementBlock(ref Rect rect, SerializedProperty arrayProperty, int elementIndex, SerializedProperty elementRootProperty, ITypeMeta meta)
|
||||
public static (bool skip, float optionsWidth) DrawTypeMetaElementBlock(ref Rect rect, SerializedProperty arrayProperty, int elementIndex, SerializedProperty elementRootProperty, ITypeMeta meta)
|
||||
{
|
||||
var result = DrawTypeMetaBlock_Internal(ref rect, elementRootProperty, meta, elementIndex, arrayProperty.arraySize);
|
||||
if (result.HasFlag(DrawTypeMetaBlockResultFlags.CloseButtonClicked))
|
||||
if (result.flags.HasFlag(DrawTypeMetaBlockResultFlags.CloseButtonClicked))
|
||||
{
|
||||
arrayProperty.DeleteArrayElementAtIndex(elementIndex);
|
||||
}
|
||||
return result != DrawTypeMetaBlockResultFlags.None;
|
||||
return (result.flags != DrawTypeMetaBlockResultFlags.None, result.optionsWidth);
|
||||
}
|
||||
public static bool DrawTypeMetaBlock(ref Rect rect, SerializedProperty rootProperty, ITypeMeta meta, int index = -1, int total = -1)
|
||||
public static (bool skip, float optionsWidth) DrawTypeMetaBlock(ref Rect rect, SerializedProperty rootProperty, ITypeMeta meta, int index = -1, int total = -1)
|
||||
{
|
||||
var result = DrawTypeMetaBlock_Internal(ref rect, rootProperty, meta, index, total);
|
||||
if (result.HasFlag(DrawTypeMetaBlockResultFlags.CloseButtonClicked))
|
||||
if (result.flags.HasFlag(DrawTypeMetaBlockResultFlags.CloseButtonClicked))
|
||||
{
|
||||
rootProperty.ResetValues();
|
||||
rootProperty.DeleteCommand();
|
||||
}
|
||||
return result.HasFlag(DrawTypeMetaBlockResultFlags.DropExpanded);
|
||||
return (result.flags.HasFlag(DrawTypeMetaBlockResultFlags.DropExpanded), result.optionsWidth);
|
||||
}
|
||||
|
||||
[Flags]
|
||||
@ -741,14 +786,14 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
DropExpanded = 1 << 0,
|
||||
CloseButtonClicked = 1 << 1,
|
||||
}
|
||||
|
||||
|
||||
private static DrawTypeMetaBlockResultFlags DrawTypeMetaBlock_Internal(ref Rect rect, SerializedProperty rootProperty, ITypeMeta meta, int index = -1, int total = -1)
|
||||
|
||||
private static (DrawTypeMetaBlockResultFlags flags, float optionsWidth) DrawTypeMetaBlock_Internal(ref Rect rect, SerializedProperty rootProperty, ITypeMeta meta, int index = -1, int total = -1)
|
||||
{
|
||||
if (meta == null)
|
||||
{
|
||||
EditorGUI.DrawRect(rect, Color.black.SetAlpha(EscEditorConsts.COMPONENT_DRAWER_ALPHA));
|
||||
return DrawTypeMetaBlockResultFlags.None;
|
||||
EditorGUI.DrawRect(rect, Color.black.SetAlpha(EscEditorConsts.MetaBlockFillStyle_Alpha));
|
||||
return (DrawTypeMetaBlockResultFlags.None, 0f);
|
||||
}
|
||||
|
||||
//string name = meta.Name;
|
||||
@ -766,12 +811,36 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
|
||||
Color panelColor = SelectPanelColor(meta, positionIndex, total)
|
||||
.Desaturate(EscEditorConsts.COMPONENT_DRAWER_DESATURATE)
|
||||
.SetAlpha(EscEditorConsts.COMPONENT_DRAWER_ALPHA);
|
||||
|
||||
EditorGUI.DrawRect(rect, panelColor);
|
||||
if(Event.current.type == EventType.Repaint)
|
||||
{
|
||||
switch (UserSettingsPrefs.instance.MetaBlockRectStyle)
|
||||
{
|
||||
default:
|
||||
case MetaBlockRectStyle.Clean:
|
||||
{
|
||||
EditorGUI.DrawRect(rect, Color.white.SetAlpha(EscEditorConsts.MetaBlockCleanStyle_Alpha));
|
||||
}
|
||||
break;
|
||||
case MetaBlockRectStyle.Edge:
|
||||
{
|
||||
EditorGUI.DrawRect(rect, Color.white.SetAlpha(EscEditorConsts.MetaBlockCleanStyle_Alpha));
|
||||
Color panelColor = SelectPanelColor(meta, positionIndex, total)
|
||||
.SetAlpha(EscEditorConsts.MetaBlockEdgeStyle_Alpha);
|
||||
EditorGUI.DrawRect(rect.HorizontalGetLeft(4f), panelColor);
|
||||
}
|
||||
break;
|
||||
case MetaBlockRectStyle.Fill:
|
||||
{
|
||||
Color panelColor = SelectPanelColor(meta, positionIndex, total)
|
||||
.Desaturate(EscEditorConsts.COMPONENT_DRAWER_DESATURATE)
|
||||
.SetAlpha(EscEditorConsts.MetaBlockFillStyle_Alpha);
|
||||
EditorGUI.DrawRect(rect, panelColor);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float optionsWidth = 0f;
|
||||
Rect optionRect = rect;
|
||||
rect = rect.AddPadding(DrawTypeMetaBlockPadding * 2f);
|
||||
|
||||
@ -781,38 +850,37 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
optionRect.xMin = optionRect.xMax - 64;
|
||||
optionRect.center += Vector2.up * DrawTypeMetaBlockPadding;
|
||||
|
||||
|
||||
DrawTypeMetaBlockResultFlags result = DrawTypeMetaBlockResultFlags.None;
|
||||
using (CheckChanged())
|
||||
{
|
||||
//Canceling isExpanded
|
||||
bool oldIsExpanded = rootProperty.isExpanded;
|
||||
if (ClickTest(optionRect))
|
||||
{
|
||||
rootProperty.isExpanded = oldIsExpanded;
|
||||
result |= DrawTypeMetaBlockResultFlags.DropExpanded;
|
||||
}
|
||||
|
||||
//Close button
|
||||
optionRect.xMin = optionRect.xMax - HeadIconsRect.width;
|
||||
optionsWidth += optionRect.width;
|
||||
|
||||
if (CloseButton(optionRect))
|
||||
{
|
||||
result |= DrawTypeMetaBlockResultFlags.CloseButtonClicked;
|
||||
return result;
|
||||
return (result, optionsWidth);
|
||||
}
|
||||
//Edit script button
|
||||
if (ScriptsCache.TryGetScriptAsset(meta.FindRootTypeMeta(), out MonoScript script))
|
||||
{
|
||||
optionRect = HeadIconsRect.MoveTo(optionRect.center - (Vector2.right * optionRect.width));
|
||||
optionsWidth += optionRect.width;
|
||||
|
||||
ScriptAssetButton(optionRect, script);
|
||||
}
|
||||
//Description icon
|
||||
if (string.IsNullOrEmpty(description) == false)
|
||||
{
|
||||
optionRect = HeadIconsRect.MoveTo(optionRect.center - (Vector2.right * optionRect.width));
|
||||
optionsWidth += optionRect.width;
|
||||
|
||||
DescriptionIcon(optionRect, description);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return (result, optionsWidth);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -834,6 +902,14 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
return property.Next(child) && property.depth >= depth;
|
||||
}
|
||||
internal static bool IsNullManagedReference(this SerializedProperty property)
|
||||
{
|
||||
#if UNITY_2021_3_OR_NEWER
|
||||
return property.managedReferenceId == ManagedReferenceUtility.RefIdNull;
|
||||
#else
|
||||
return property.managedReferenceId == SerializationUtility.RefIdNull;
|
||||
#endif
|
||||
}
|
||||
internal static int GetChildPropertiesCount(this SerializedProperty property, Type type, out bool isEmpty)
|
||||
{
|
||||
int result = GetChildPropertiesCount(property);
|
||||
@ -860,7 +936,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
bool next = propsCounter.Next(true) && lastDepth < propsCounter.depth;
|
||||
while (next)
|
||||
{
|
||||
if(propsCounter.propertyType != SerializedPropertyType.Generic)
|
||||
if (propsCounter.propertyType != SerializedPropertyType.Generic)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -885,13 +961,13 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (AutoColorMode)
|
||||
switch (MetaBlockColorMode)
|
||||
{
|
||||
case ComponentColorMode.Auto:
|
||||
case MetaBlockColorMode.Auto:
|
||||
{
|
||||
return color.ToUnityColor().Desaturate(0.48f) / 1.18f; //.Desaturate(0.48f) / 1.18f;
|
||||
}
|
||||
case ComponentColorMode.Rainbow:
|
||||
case MetaBlockColorMode.Rainbow:
|
||||
{
|
||||
int localTotal = Mathf.Max(total, EscEditorConsts.AUTO_COLOR_RAINBOW_MIN_RANGE);
|
||||
Color hsv = Color.HSVToRGB(1f / localTotal * (index % localTotal), 1, 1);
|
||||
@ -978,11 +1054,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
#region Init
|
||||
private static ReferenceDropDown GetReferenceDropDown(Type[] predicatTypes, Type[] sortedWithOutTypes)
|
||||
{
|
||||
if (_predicatTypesMenus.TryGetValue((predicatTypes, sortedWithOutTypes), out ReferenceDropDown menu) == false)
|
||||
if (_predicatTypesMenus.TryGetValue(new PredicateTypesKey(predicatTypes[0], predicatTypes, sortedWithOutTypes), out ReferenceDropDown menu) == false)
|
||||
{
|
||||
menu = new ReferenceDropDown(predicatTypes, sortedWithOutTypes);
|
||||
menu.OnSelected += SelectComponent;
|
||||
_predicatTypesMenus.Add((predicatTypes, sortedWithOutTypes), menu);
|
||||
_predicatTypesMenus.Add(new PredicateTypesKey(predicatTypes[0], predicatTypes, sortedWithOutTypes), menu);
|
||||
}
|
||||
|
||||
return menu;
|
||||
@ -4,16 +4,16 @@ using System.Collections.Generic;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
internal class ExpandMatrix
|
||||
internal class ExpandStack
|
||||
{
|
||||
private const bool TOP_DEFAULT = true;
|
||||
private const bool DEFAULT = false;
|
||||
private static Dictionary<Type, ExpandMatrix> _instances = new Dictionary<Type, ExpandMatrix>();
|
||||
public static ExpandMatrix Take(Type type)
|
||||
private static Dictionary<Type, ExpandStack> _instances = new Dictionary<Type, ExpandStack>();
|
||||
public static ExpandStack Take(Type type)
|
||||
{
|
||||
if (_instances.TryGetValue(type, out ExpandMatrix result) == false)
|
||||
if (_instances.TryGetValue(type, out ExpandStack result) == false)
|
||||
{
|
||||
result = new ExpandMatrix();
|
||||
result = new ExpandStack();
|
||||
_instances.Add(type, result);
|
||||
}
|
||||
return result;
|
||||
@ -9,11 +9,9 @@
|
||||
#if UNITY_EDITOR
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
using global::Unity.Collections.LowLevel.Unsafe;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
@ -49,10 +47,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
get { return UserSettingsPrefs.instance.IsShowRuntimeComponents; }
|
||||
set { UserSettingsPrefs.instance.IsShowRuntimeComponents = value; }
|
||||
}
|
||||
protected static ComponentColorMode ComponentColorMode
|
||||
protected static MetaBlockColorMode ComponentColorMode
|
||||
{
|
||||
get { return UserSettingsPrefs.instance.ComponentColorMode; }
|
||||
set { UserSettingsPrefs.instance.ComponentColorMode = value; }
|
||||
get { return UserSettingsPrefs.instance.MetaBlockColorMode; }
|
||||
set { UserSettingsPrefs.instance.MetaBlockColorMode = value; }
|
||||
}
|
||||
|
||||
protected bool IsMultipleTargets => targets.Length > 1;
|
||||
@ -78,7 +76,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
if (AutoChechChanges)
|
||||
{
|
||||
using (EcsGUI.CheckChanged(serializedObject))
|
||||
using (DragonGUI.CheckChanged(serializedObject))
|
||||
{
|
||||
StaticInit();
|
||||
Init();
|
||||
@ -153,16 +151,28 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
private IEnumerable<Attribute> _attributes = null;
|
||||
|
||||
private bool? _isArrayElement = null;
|
||||
private Type _propertyType = null;
|
||||
private bool _isArrayElement;
|
||||
private SerializedProperty _trackedArrayProperty = null;
|
||||
protected bool IsArrayElement
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_isArrayElement == null)
|
||||
{
|
||||
_isArrayElement = Attributes.Any(o => o is ArrayElementAttribute);
|
||||
}
|
||||
return _isArrayElement.Value;
|
||||
return _isArrayElement;
|
||||
}
|
||||
}
|
||||
protected Type PropertyType
|
||||
{
|
||||
get
|
||||
{
|
||||
return _propertyType;
|
||||
}
|
||||
}
|
||||
protected SerializedProperty TrackedArrayProperty
|
||||
{
|
||||
get
|
||||
{
|
||||
return _trackedArrayProperty;
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,10 +210,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
get { return UserSettingsPrefs.instance.IsShowRuntimeComponents; }
|
||||
set { UserSettingsPrefs.instance.IsShowRuntimeComponents = value; }
|
||||
}
|
||||
protected static ComponentColorMode ComponentColorMode
|
||||
protected static MetaBlockColorMode ComponentColorMode
|
||||
{
|
||||
get { return UserSettingsPrefs.instance.ComponentColorMode; }
|
||||
set { UserSettingsPrefs.instance.ComponentColorMode = value; }
|
||||
get { return UserSettingsPrefs.instance.MetaBlockColorMode; }
|
||||
set { UserSettingsPrefs.instance.MetaBlockColorMode = value; }
|
||||
}
|
||||
protected virtual bool IsStaticInit { get { return _isStaticInit; } }
|
||||
protected virtual bool IsInit { get { return _isInit; } }
|
||||
@ -213,21 +223,52 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
_isStaticInit = true;
|
||||
OnStaticInit();
|
||||
}
|
||||
public void Init()
|
||||
public void Init(SerializedProperty property)
|
||||
{
|
||||
if (IsInit) { return; }
|
||||
_isInit = true;
|
||||
OnInit();
|
||||
|
||||
_isArrayElement = false;
|
||||
if (fieldInfo != null)
|
||||
{
|
||||
_propertyType = fieldInfo.FieldType;
|
||||
if (_propertyType.IsArray)
|
||||
{
|
||||
_propertyType = _propertyType.GetElementType();
|
||||
_isArrayElement = true;
|
||||
}
|
||||
if (_propertyType.IsGenericType && _propertyType.GetGenericTypeDefinition() == typeof(List<>))
|
||||
{
|
||||
_propertyType = _propertyType.GetGenericArguments()[0];
|
||||
_isArrayElement = true;
|
||||
}
|
||||
}
|
||||
|
||||
OnInit(property);
|
||||
}
|
||||
protected virtual void OnStaticInit() { }
|
||||
protected virtual void OnInit() { }
|
||||
protected virtual void OnInit(SerializedProperty property) { }
|
||||
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
_trackedArrayProperty = DragonGUI.CurrentTrackedArrayProperty;
|
||||
using (new DragonGUI.TrackArrayPropertyScope(null))
|
||||
{
|
||||
StaticInit();
|
||||
Init(property);
|
||||
return GetCustomHeight(property, label);
|
||||
}
|
||||
}
|
||||
protected abstract float GetCustomHeight(SerializedProperty property, GUIContent label);
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
using (EcsGUI.CheckChanged(property.serializedObject))
|
||||
_trackedArrayProperty = DragonGUI.CurrentTrackedArrayProperty;
|
||||
using (new DragonGUI.TrackArrayPropertyScope(null)) using (DragonGUI.CheckChanged(property.serializedObject))
|
||||
{
|
||||
StaticInit();
|
||||
Init();
|
||||
Init(property);
|
||||
DrawCustom(position, property, label);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,253 @@
|
||||
#if UNITY_EDITOR
|
||||
using DCFApixels.DragonECS.RunnersCore;
|
||||
using DCFApixels.DragonECS.Core;
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
internal class DragonFieldDropDown : MetaObjectsDropDown<DragonFieldCahce>
|
||||
{
|
||||
private DragonFieldDropDown() { }
|
||||
|
||||
private bool _isCheckUnique;
|
||||
private SerializedProperty _arrayProperty;
|
||||
private SerializedProperty _fieldProperty;
|
||||
|
||||
public static Dictionary<PredicateTypesKey, DragonFieldDropDown> _dropDownsCache = new Dictionary<PredicateTypesKey, DragonFieldDropDown>(32);
|
||||
public static DragonFieldDropDown Get(PredicateTypesKey key)
|
||||
{
|
||||
if (_dropDownsCache.TryGetValue(key, out var result) == false)
|
||||
{
|
||||
result = new DragonFieldDropDown();
|
||||
IEnumerable<(DragonFieldCahce template, ITypeMeta meta)> itemMetaPairs = DragonFieldCahce.All.ToArray()
|
||||
.Where(o =>
|
||||
{
|
||||
return key.Check(o);
|
||||
})
|
||||
.Select(o =>
|
||||
{
|
||||
var info = DragonFieldCahce.GetInfoFor(o);
|
||||
return (info, (ITypeMeta)info.Meta);
|
||||
});
|
||||
|
||||
//TODO оптимизировать или вырезать
|
||||
itemMetaPairs = itemMetaPairs.OrderBy(o => o.meta.Group.Name);
|
||||
result.Setup(itemMetaPairs);
|
||||
_dropDownsCache[key] = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void OpenForArray(Rect position, SerializedProperty arrayProperty, bool isCheckUnique)
|
||||
{
|
||||
_isCheckUnique = isCheckUnique;
|
||||
_arrayProperty = arrayProperty;
|
||||
_fieldProperty = null;
|
||||
Show(position);
|
||||
}
|
||||
public void OpenForField(Rect position, SerializedProperty fieldProperty)
|
||||
{
|
||||
_isCheckUnique = false;
|
||||
_arrayProperty = null;
|
||||
_fieldProperty = fieldProperty;
|
||||
Show(position);
|
||||
}
|
||||
|
||||
protected override void ItemSelected(Item item)
|
||||
{
|
||||
if (item.Obj == null)
|
||||
{
|
||||
_fieldProperty.managedReferenceValue = null;
|
||||
_fieldProperty.serializedObject.ApplyModifiedProperties();
|
||||
return;
|
||||
}
|
||||
|
||||
Type componentType = item.Obj.GetType();
|
||||
var data = item.Obj;
|
||||
|
||||
if (_arrayProperty != null && data != null)
|
||||
{
|
||||
int index = _arrayProperty.arraySize;
|
||||
if (_isCheckUnique)
|
||||
{
|
||||
if (data.IsUnique)
|
||||
{
|
||||
for (int i = 0, iMax = _arrayProperty.arraySize; i < iMax; i++)
|
||||
{
|
||||
if (_arrayProperty.GetArrayElementAtIndex(i).managedReferenceValue.GetType() == componentType)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_arrayProperty.arraySize += 1;
|
||||
_fieldProperty = _arrayProperty.GetArrayElementAtIndex(index);
|
||||
}
|
||||
|
||||
if (_fieldProperty != null)
|
||||
{
|
||||
_fieldProperty.managedReferenceValue = data.CreateInstance();
|
||||
_fieldProperty.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
//Event.current.Use();
|
||||
}
|
||||
}
|
||||
|
||||
internal class DragonFieldCahce : ITypeMeta
|
||||
{
|
||||
Type ITypeMeta.Type => Meta.Type;
|
||||
string ITypeMeta.Name => Meta.Name;
|
||||
MetaColor ITypeMeta.Color => Meta.Color;
|
||||
MetaDescription ITypeMeta.Description => Meta.Description;
|
||||
MetaGroup ITypeMeta.Group => Meta.Group;
|
||||
IReadOnlyList<string> ITypeMeta.Tags => Meta.Tags;
|
||||
ITypeMeta ITypeMeta.BaseMeta => Meta;
|
||||
|
||||
internal static Type[] All => UnityEditorUtility._serializableTypes;
|
||||
internal static HashSet<Type> AllDict;
|
||||
internal static Dictionary<Type, DragonFieldCahce> RuntimeDict;
|
||||
|
||||
static DragonFieldCahce() { StaticInit(); }
|
||||
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void StaticInit()
|
||||
{
|
||||
AllDict = new HashSet<Type>(All);
|
||||
RuntimeDict = new Dictionary<Type, DragonFieldCahce>();
|
||||
}
|
||||
public static DragonFieldCahce GetInfoFor(Type type)
|
||||
{
|
||||
if (RuntimeDict.TryGetValue(type, out var info))
|
||||
{
|
||||
return info;
|
||||
}
|
||||
if (AllDict.Contains(type))
|
||||
{
|
||||
info = new DragonFieldCahce(type);
|
||||
RuntimeDict.Add(type, info);
|
||||
return info;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static bool TryGetInfoFor(Type type, out DragonFieldCahce info)
|
||||
{
|
||||
if (RuntimeDict.TryGetValue(type, out info))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (AllDict.Contains(type))
|
||||
{
|
||||
info = new DragonFieldCahce(type);
|
||||
RuntimeDict.Add(type, info);
|
||||
return true;
|
||||
}
|
||||
info = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public readonly Type Type;
|
||||
public readonly Type ComponentType;
|
||||
public readonly string WrappedFieldName;
|
||||
public bool HasWrappedFieldName
|
||||
{
|
||||
get { return string.IsNullOrEmpty(WrappedFieldName) == false; }
|
||||
}
|
||||
public readonly bool IsUnique;
|
||||
private TypeMeta _meta;
|
||||
public TypeMeta Meta
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_meta == null)
|
||||
{
|
||||
_meta = Type.GetMeta();
|
||||
}
|
||||
return _meta;
|
||||
}
|
||||
}
|
||||
private bool _defaultValueTypeInit = false;
|
||||
private object _defaultValueDummy;
|
||||
public object DefaultValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_defaultValueTypeInit == false)
|
||||
{
|
||||
if (Type.IsValueType)
|
||||
{
|
||||
FieldInfo field;
|
||||
field = Type.GetField("Default", BindingFlags.Static | BindingFlags.Public);
|
||||
if (field != null && field.FieldType == Type)
|
||||
{
|
||||
_defaultValueDummy = field.GetValue(null).Clone_Reflection();
|
||||
}
|
||||
|
||||
if (_defaultValueDummy == null)
|
||||
{
|
||||
field = Type.GetField("Empty", BindingFlags.Static | BindingFlags.Public);
|
||||
if (field != null && field.FieldType == Type)
|
||||
{
|
||||
_defaultValueDummy = field.GetValue(null).Clone_Reflection();
|
||||
}
|
||||
}
|
||||
}
|
||||
_defaultValueTypeInit = true;
|
||||
}
|
||||
return _defaultValueDummy;
|
||||
}
|
||||
}
|
||||
|
||||
public DragonFieldCahce(Type type)
|
||||
{
|
||||
Type = type;
|
||||
IsUnique = false;
|
||||
|
||||
if(type.TryGetAttribute<DragonMemberWrapperAttribute>(out var atr))
|
||||
{
|
||||
WrappedFieldName = atr.WrappedFieldName;
|
||||
var field = type.GetField(atr.WrappedFieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
if (field != null && field.FieldType.IsConcreteType())
|
||||
{
|
||||
ComponentType = field.FieldType;
|
||||
}
|
||||
}
|
||||
|
||||
if (type.GetInterfaces().Contains(typeof(IComponentTemplate)))
|
||||
{
|
||||
var ct = (IComponentTemplate)Activator.CreateInstance(type);
|
||||
IsUnique = ct.IsUnique;
|
||||
ComponentType = ct.ComponentType;
|
||||
}
|
||||
|
||||
if(ComponentType == null)
|
||||
{
|
||||
ComponentType = Type;
|
||||
}
|
||||
}
|
||||
public object CreateInstance()
|
||||
{
|
||||
if (DefaultValue != null)
|
||||
{
|
||||
return DefaultValue.Clone_Reflection();
|
||||
}
|
||||
return Activator.CreateInstance(Type);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Type.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
internal class SystemsDropDown : MetaObjectsDropDown<Type>
|
||||
{
|
||||
public SystemsDropDown()
|
||||
@ -82,97 +320,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
|
||||
_fieldProperty.serializedObject.ApplyModifiedProperties();
|
||||
EcsGUI.DelayedChanged = true;
|
||||
DragonGUI.DelayedChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
internal class ComponentTemplatesDropDown : MetaObjectsDropDown<ComponentTemplateTypeCache>
|
||||
{
|
||||
private ComponentTemplatesDropDown() { }
|
||||
|
||||
private bool _isCheckUnique;
|
||||
private SerializedProperty _arrayProperty;
|
||||
private SerializedProperty _fieldProperty;
|
||||
|
||||
public static Dictionary<PredicateTypesKey, ComponentTemplatesDropDown> _dropDownsCache = new Dictionary<PredicateTypesKey, ComponentTemplatesDropDown>(32);
|
||||
public static ComponentTemplatesDropDown Get(PredicateTypesKey key)
|
||||
{
|
||||
if(_dropDownsCache.TryGetValue(key, out var result) == false)
|
||||
{
|
||||
result = new ComponentTemplatesDropDown();
|
||||
IEnumerable<(ComponentTemplateTypeCache template, ITypeMeta meta)> itemMetaPairs = ComponentTemplateTypeCache.All.ToArray()
|
||||
.Where(o =>
|
||||
{
|
||||
return key.Check(o.Type);
|
||||
})
|
||||
.Select(o =>
|
||||
{
|
||||
return (o, o.Meta);
|
||||
});
|
||||
//TODO оптимизировать или вырезать
|
||||
itemMetaPairs = itemMetaPairs.OrderBy(o => o.meta.Group.Name);
|
||||
result.Setup(itemMetaPairs);
|
||||
_dropDownsCache[key] = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void OpenForArray(Rect position, SerializedProperty arrayProperty, bool isCheckUnique)
|
||||
{
|
||||
_isCheckUnique = isCheckUnique;
|
||||
_arrayProperty = arrayProperty;
|
||||
_fieldProperty = null;
|
||||
Show(position);
|
||||
}
|
||||
public void OpenForField(Rect position, SerializedProperty fieldProperty)
|
||||
{
|
||||
_isCheckUnique = false;
|
||||
_arrayProperty = null;
|
||||
_fieldProperty = fieldProperty;
|
||||
Show(position);
|
||||
}
|
||||
|
||||
protected override void ItemSelected(Item item)
|
||||
{
|
||||
base.ItemSelected(item);
|
||||
|
||||
if (item.Obj == null)
|
||||
{
|
||||
_fieldProperty.managedReferenceValue = null;
|
||||
_fieldProperty.serializedObject.ApplyModifiedProperties();
|
||||
return;
|
||||
}
|
||||
|
||||
Type componentType = item.Obj.GetType();
|
||||
var data = item.Obj;
|
||||
|
||||
if (_arrayProperty != null && data != null)
|
||||
{
|
||||
int index = _arrayProperty.arraySize;
|
||||
if (_isCheckUnique)
|
||||
{
|
||||
if (data.IsUnique)
|
||||
{
|
||||
for (int i = 0, iMax = _arrayProperty.arraySize; i < iMax; i++)
|
||||
{
|
||||
if (_arrayProperty.GetArrayElementAtIndex(i).managedReferenceValue.GetType() == componentType)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_arrayProperty.arraySize += 1;
|
||||
_fieldProperty = _arrayProperty.GetArrayElementAtIndex(index);
|
||||
}
|
||||
|
||||
if (_fieldProperty != null)
|
||||
{
|
||||
_fieldProperty.managedReferenceValue = data.CreateInstance();
|
||||
_fieldProperty.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
internal class RuntimeComponentsDropDown : MetaObjectsDropDown<IEcsPool>
|
||||
{
|
||||
public RuntimeComponentsDropDown(IEnumerable<IEcsPool> pools)
|
||||
@ -215,6 +367,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
private bool _isContainsNull;
|
||||
public IEnumerable<(T, ITypeMeta)> _itemMetaPairs;
|
||||
|
||||
public virtual bool IsStaticList { get { return true; } }
|
||||
public MetaObjectsDropDown() : base(new AdvancedDropdownState())
|
||||
{
|
||||
minimumSize = new Vector2(220f, EditorGUIUtility.singleLineHeight * 20);
|
||||
@ -225,6 +378,10 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
_name = name;
|
||||
_isContainsNull = isContainsNull;
|
||||
_itemMetaPairs = itemMetaPairs;
|
||||
if (IsStaticList)
|
||||
{
|
||||
_itemMetaPairs = _itemMetaPairs.ToArray();
|
||||
}
|
||||
}
|
||||
protected override AdvancedDropdownItem BuildRoot()
|
||||
{
|
||||
@ -235,10 +392,9 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
root.AddChild(new Item(default, "<NULL>", increment++));
|
||||
}
|
||||
|
||||
Dictionary<Key, Item> dict = new Dictionary<Key, Item>();
|
||||
|
||||
|
||||
var list = _itemMetaPairs.ToArray();
|
||||
foreach (var pair in _itemMetaPairs)
|
||||
{
|
||||
ITypeMeta meta = pair.Item2;
|
||||
@ -324,10 +480,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is Key key && Equals(key);
|
||||
}
|
||||
public override bool Equals(object obj) { return obj is Key key && Equals(key); }
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#if UNITY_EDITOR
|
||||
using DCFApixels.DragonECS.Core;
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -44,10 +45,10 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
|
||||
|
||||
#region Properties
|
||||
private static ComponentColorMode AutoColorMode
|
||||
private static RuntimeDrawMode RuntimeDrawMode
|
||||
{
|
||||
get { return UserSettingsPrefs.instance.ComponentColorMode; }
|
||||
set { UserSettingsPrefs.instance.ComponentColorMode = value; }
|
||||
get { return UserSettingsPrefs.instance.RuntimeDrawMode; }
|
||||
set { UserSettingsPrefs.instance.RuntimeDrawMode = value; }
|
||||
}
|
||||
private static bool IsShowHidden
|
||||
{
|
||||
@ -65,6 +66,7 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
internal class RuntimeComponentReflectionCache
|
||||
{
|
||||
public readonly Type Type;
|
||||
public readonly bool IsValueType;
|
||||
public readonly bool IsUnmanaged;
|
||||
public readonly DrawerType DrawerType;
|
||||
public readonly FieldInfoData[] Fields;
|
||||
@ -74,12 +76,12 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
{
|
||||
return _wrappers[depth];
|
||||
}
|
||||
|
||||
public RuntimeComponentReflectionCache(Type type)
|
||||
{
|
||||
Type = type;
|
||||
ResetWrappers();
|
||||
IsUnmanaged = UnsafeUtility.IsUnmanaged(type);
|
||||
IsValueType = type.IsValueType;
|
||||
|
||||
bool isVoideType = type == typeof(void);
|
||||
bool isUnityObjectType = typeof(UnityObject).IsAssignableFrom(type);
|
||||
@ -246,7 +248,7 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
{
|
||||
bool isNull = world == null || world.IsDestroyed || world.ID == 0;
|
||||
if (isNull) { return; }
|
||||
using (EcsGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
||||
using (DragonGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
||||
{
|
||||
IsShowRuntimeComponents = EditorGUILayout.BeginFoldoutHeaderGroup(IsShowRuntimeComponents, "RUNTIME COMPONENTS", EditorStyles.foldout);
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
@ -266,41 +268,40 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
|
||||
object data = cmp.GetRaw(worldID);
|
||||
|
||||
ExpandMatrix expandMatrix = ExpandMatrix.Take(componentType);
|
||||
ExpandStack expandStack = ExpandStack.Take(componentType);
|
||||
|
||||
float padding = EditorGUIUtility.standardVerticalSpacing;
|
||||
Rect optionButton = GUILayoutUtility.GetLastRect();
|
||||
optionButton.yMin = optionButton.yMax;
|
||||
optionButton.yMax += EcsGUI.HeadIconsRect.height;
|
||||
optionButton.yMax += DragonGUI.HeadIconsRect.height;
|
||||
optionButton.xMin = optionButton.xMax - 64;
|
||||
optionButton.center += Vector2.up * padding * 2f;
|
||||
//Canceling isExpanded
|
||||
if (EcsGUI.ClickTest(optionButton))
|
||||
if (DragonGUI.ClickTest(optionButton))
|
||||
{
|
||||
ref bool isExpanded = ref expandMatrix.Down();
|
||||
ref bool isExpanded = ref expandStack.Down();
|
||||
isExpanded = !isExpanded;
|
||||
}
|
||||
|
||||
Color panelColor = EcsGUI.SelectPanelColor(meta, index, total);
|
||||
using (EcsGUI.Layout.BeginVertical(panelColor.SetAlpha(EscEditorConsts.COMPONENT_DRAWER_ALPHA)))
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
Color panelColor = DragonGUI.SelectPanelColor(meta, index, total);
|
||||
|
||||
using (DragonGUI.Layout.BeginVertical(panelColor.SetAlpha(EscEditorConsts.MetaBlockFillStyle_Alpha)))
|
||||
{
|
||||
//Edit script button
|
||||
if (ScriptsCache.TryGetScriptAsset(meta, out MonoScript script))
|
||||
{
|
||||
optionButton = EcsGUI.HeadIconsRect.MoveTo(optionButton.center - (Vector2.right * optionButton.width));
|
||||
EcsGUI.ScriptAssetButton(optionButton, script);
|
||||
optionButton = DragonGUI.HeadIconsRect.MoveTo(optionButton.center - (Vector2.right * optionButton.width));
|
||||
DragonGUI.ScriptAssetButton(optionButton, script);
|
||||
}
|
||||
//Description icon
|
||||
if (string.IsNullOrEmpty(meta.Description.Text) == false)
|
||||
{
|
||||
optionButton = EcsGUI.HeadIconsRect.MoveTo(optionButton.center - (Vector2.right * optionButton.width));
|
||||
EcsGUI.DescriptionIcon(optionButton, meta.Description.Text);
|
||||
optionButton = DragonGUI.HeadIconsRect.MoveTo(optionButton.center - (Vector2.right * optionButton.width));
|
||||
DragonGUI.DescriptionIcon(optionButton, meta.Description.Text);
|
||||
}
|
||||
|
||||
RuntimeComponentReflectionCache.FieldInfoData componentInfoData = new RuntimeComponentReflectionCache.FieldInfoData(null, componentType, meta.Name);
|
||||
if (DrawRuntimeData(ref componentInfoData, UnityEditorUtility.GetLabel(meta.Name), expandMatrix, data, out object resultData, 0))
|
||||
if (DrawRuntimeData(ref componentInfoData, UnityEditorUtility.GetLabel(meta.Name), expandStack, data, out object resultData, 0))
|
||||
{
|
||||
cmp.SetRaw(worldID, resultData);
|
||||
}
|
||||
@ -336,7 +337,7 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
}
|
||||
private void DrawRuntimeComponents(int entityID, EcsWorld world, bool isWithFoldout)
|
||||
{
|
||||
using (EcsGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle())) using (EcsGUI.SetIndentLevel(0))
|
||||
using (DragonGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle())) using (DragonGUI.SetIndentLevel(0))
|
||||
{
|
||||
if (_runtimeComponentsDepth >= RuntimeComponentsMaxDepth)
|
||||
{
|
||||
@ -350,81 +351,244 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
}
|
||||
if (isWithFoldout == false || IsShowRuntimeComponents)
|
||||
{
|
||||
if (EcsGUI.Layout.AddComponentButtons(out Rect dropDownRect))
|
||||
if (DragonGUI.Layout.AddComponentButtons(out Rect dropDownRect))
|
||||
{
|
||||
RuntimeComponentsUtility.GetAddComponentGenericMenu(world).Open(dropDownRect, entityID);
|
||||
}
|
||||
|
||||
using (EcsGUI.SetBackgroundColor(GUI.color.SetAlpha(0.16f)))
|
||||
using (DragonGUI.Layout.BeginVertical(Color.white.SetAlpha(0.066f)))
|
||||
{
|
||||
GUILayout.Box("", UnityEditorUtility.GetWhiteStyle(), GUILayout.ExpandWidth(true));
|
||||
IsShowHidden = EditorGUILayout.Toggle("Show Hidden", IsShowHidden);
|
||||
RuntimeDrawMode = (RuntimeDrawMode)EditorGUILayout.EnumPopup("Draw Mode", selected: RuntimeDrawMode);
|
||||
}
|
||||
IsShowHidden = EditorGUI.Toggle(GUILayoutUtility.GetLastRect(), "Show Hidden", IsShowHidden);
|
||||
|
||||
|
||||
world.GetComponentPoolsFor(entityID, _componentPoolsBuffer);
|
||||
for (int i = 0; i < _componentPoolsBuffer.Count; i++)
|
||||
{
|
||||
DrawRuntimeComponent(entityID, _componentPoolsBuffer[i], 9, i);
|
||||
var pool = _componentPoolsBuffer[i];
|
||||
if (pool.ComponentType.IsValueType)
|
||||
{
|
||||
DrawRuntimeValueComponent(entityID, pool, 9, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawRuntimeClassComponent(entityID, pool, 9, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void DrawRuntimeComponent(int entityID, IEcsPool pool, int total, int index)
|
||||
private struct DrawRuntimeCompoentnsCahce : IEcsWorldComponent<DrawRuntimeCompoentnsCahce>
|
||||
{
|
||||
var meta = pool.ComponentType.GetMeta();
|
||||
public EcsWorld World;
|
||||
public Record[] Records;
|
||||
|
||||
void IEcsWorldComponent<DrawRuntimeCompoentnsCahce>.Init(ref DrawRuntimeCompoentnsCahce component, EcsWorld world)
|
||||
{
|
||||
component.World = world;
|
||||
component.Records = new Record[world.Count];
|
||||
}
|
||||
void IEcsWorldComponent<DrawRuntimeCompoentnsCahce>.OnDestroy(ref DrawRuntimeCompoentnsCahce component, EcsWorld world) { }
|
||||
|
||||
public ref Record GetFor(int componentTypeID)
|
||||
{
|
||||
if(componentTypeID >= Records.Length)
|
||||
{
|
||||
var newSize = DragonArrayUtility.NextPow2(componentTypeID + 1);
|
||||
Array.Resize(ref Records, newSize);
|
||||
}
|
||||
ref var result = ref Records[componentTypeID];
|
||||
if(result.IsInit == false && World.TryFindPoolInstance(componentTypeID, out var pool))
|
||||
{
|
||||
var componentType = pool.ComponentType;
|
||||
result.Meta = componentType.GetMeta();
|
||||
result.ExpandStack = ExpandStack.Take(componentType);
|
||||
result.FieldInfoData = new RuntimeComponentReflectionCache.FieldInfoData(null, componentType, result.Meta.Name);
|
||||
if (ScriptsCache.TryGetScriptAsset(result.Meta, out result.ScriptReference) == false)
|
||||
{
|
||||
result.ScriptReference = null;
|
||||
}
|
||||
|
||||
result.IsInit = true;
|
||||
}
|
||||
return ref result;
|
||||
}
|
||||
|
||||
public struct Record
|
||||
{
|
||||
public bool IsInit;
|
||||
public TypeMeta Meta;
|
||||
public ExpandStack ExpandStack;
|
||||
public RuntimeComponentReflectionCache.FieldInfoData FieldInfoData;
|
||||
public MonoScript ScriptReference;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawRuntimeValueComponent(int entityID, IEcsPool pool, int total, int index)
|
||||
{
|
||||
ref var cache = ref pool.World.Get<DrawRuntimeCompoentnsCahce>().GetFor(pool.ComponentTypeID);
|
||||
|
||||
var meta = cache.Meta;
|
||||
if (meta.IsHidden == false || IsShowHidden)
|
||||
{
|
||||
Type componentType = pool.ComponentType;
|
||||
float padding = EditorGUIUtility.standardVerticalSpacing;
|
||||
Rect optionButton = GUILayoutUtility.GetLastRect();
|
||||
optionButton.yMin = optionButton.yMax;
|
||||
optionButton.yMax += DragonGUI.HeadIconsRect.height;
|
||||
optionButton.xMin = optionButton.xMax - 64;
|
||||
optionButton.center += Vector2.up * padding * 2f;
|
||||
|
||||
object data = pool.GetRaw(entityID);
|
||||
Color fillColor = Color.clear;
|
||||
Color backColor = Color.clear;
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
switch (UserSettingsPrefs.instance.MetaBlockRectStyle)
|
||||
{
|
||||
default:
|
||||
case MetaBlockRectStyle.Clean:
|
||||
{
|
||||
backColor = Color.white.SetAlpha(EscEditorConsts.MetaBlockCleanStyle_Alpha);
|
||||
}
|
||||
break;
|
||||
case MetaBlockRectStyle.Edge:
|
||||
{
|
||||
backColor = Color.white.SetAlpha(EscEditorConsts.MetaBlockCleanStyle_Alpha);
|
||||
fillColor = DragonGUI.SelectPanelColor(meta, index, total)
|
||||
.SetAlpha(EscEditorConsts.MetaBlockEdgeStyle_Alpha);
|
||||
}
|
||||
break;
|
||||
case MetaBlockRectStyle.Fill:
|
||||
{
|
||||
backColor = DragonGUI.SelectPanelColor(meta, index, total)
|
||||
.Desaturate(EscEditorConsts.COMPONENT_DRAWER_DESATURATE)
|
||||
.SetAlpha(EscEditorConsts.MetaBlockFillStyle_Alpha);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ExpandMatrix expandMatrix = ExpandMatrix.Take(componentType);
|
||||
using (DragonGUI.Layout.BeginVertical(UnityEditorUtility.GetWhiteStyle(), backColor))
|
||||
{
|
||||
using (DragonGUI.Layout.BeginVertical(UnityEditorUtility.GetWhiteEdge4Style(), fillColor))
|
||||
{
|
||||
//Close button
|
||||
optionButton.xMin = optionButton.xMax - DragonGUI.HeadIconsRect.width;
|
||||
if (DragonGUI.CloseButton(optionButton))
|
||||
{
|
||||
pool.Del(entityID);
|
||||
return;
|
||||
}
|
||||
//Edit script button
|
||||
if (cache.ScriptReference != null)
|
||||
{
|
||||
optionButton = DragonGUI.HeadIconsRect.MoveTo(optionButton.center - (Vector2.right * optionButton.width));
|
||||
DragonGUI.ScriptAssetButton(optionButton, cache.ScriptReference);
|
||||
}
|
||||
//Description icon
|
||||
if (string.IsNullOrEmpty(meta.Description.Text) == false)
|
||||
{
|
||||
optionButton = DragonGUI.HeadIconsRect.MoveTo(optionButton.center - (Vector2.right * optionButton.width));
|
||||
DragonGUI.DescriptionIcon(optionButton, meta.Description.Text);
|
||||
}
|
||||
|
||||
|
||||
ref bool peakExpand = ref cache.ExpandStack.Peek();
|
||||
var label = UnityEditorUtility.GetLabel(meta.Name);
|
||||
if (peakExpand)
|
||||
{
|
||||
object data = pool.GetRaw(entityID);
|
||||
if (DrawRuntimeData(ref cache.FieldInfoData, label, cache.ExpandStack, data, out object resultData, 0))
|
||||
{
|
||||
pool.SetRaw(entityID, resultData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var foldoutStyle = EditorStyles.foldout;
|
||||
Rect rect = GUILayoutUtility.GetRect(label, foldoutStyle);
|
||||
peakExpand = EditorGUI.BeginFoldoutHeaderGroup(rect, false, label, foldoutStyle, null, null);
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void DrawRuntimeClassComponent(int entityID, IEcsPool pool, int total, int index)
|
||||
{
|
||||
object data = pool.GetRaw(entityID);
|
||||
Type componentType = data.GetType();
|
||||
var meta = componentType.GetMeta();
|
||||
if (meta.IsHidden == false || IsShowHidden)
|
||||
{
|
||||
ExpandStack expandStack = ExpandStack.Take(componentType);
|
||||
|
||||
float padding = EditorGUIUtility.standardVerticalSpacing;
|
||||
Rect optionButton = GUILayoutUtility.GetLastRect();
|
||||
optionButton.yMin = optionButton.yMax;
|
||||
optionButton.yMax += EcsGUI.HeadIconsRect.height;
|
||||
optionButton.yMax += DragonGUI.HeadIconsRect.height;
|
||||
optionButton.xMin = optionButton.xMax - 64;
|
||||
optionButton.center += Vector2.up * padding * 2f;
|
||||
//Canceling isExpanded
|
||||
if (EcsGUI.ClickTest(optionButton))
|
||||
|
||||
Color fillColor = Color.clear;
|
||||
Color backColor = Color.clear;
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
ref bool isExpanded = ref expandMatrix.Down();
|
||||
isExpanded = !isExpanded;
|
||||
switch (UserSettingsPrefs.instance.MetaBlockRectStyle)
|
||||
{
|
||||
default:
|
||||
case MetaBlockRectStyle.Clean:
|
||||
{
|
||||
backColor = Color.white.SetAlpha(EscEditorConsts.MetaBlockCleanStyle_Alpha);
|
||||
}
|
||||
break;
|
||||
case MetaBlockRectStyle.Edge:
|
||||
{
|
||||
backColor = Color.white.SetAlpha(EscEditorConsts.MetaBlockCleanStyle_Alpha);
|
||||
fillColor = DragonGUI.SelectPanelColor(meta, index, total)
|
||||
.SetAlpha(EscEditorConsts.MetaBlockEdgeStyle_Alpha);
|
||||
}
|
||||
break;
|
||||
case MetaBlockRectStyle.Fill:
|
||||
{
|
||||
backColor = DragonGUI.SelectPanelColor(meta, index, total)
|
||||
.Desaturate(EscEditorConsts.COMPONENT_DRAWER_DESATURATE)
|
||||
.SetAlpha(EscEditorConsts.MetaBlockFillStyle_Alpha);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Color panelColor = EcsGUI.SelectPanelColor(meta, index, total);
|
||||
|
||||
using (EcsGUI.Layout.BeginVertical(panelColor.SetAlpha(EscEditorConsts.COMPONENT_DRAWER_ALPHA)))
|
||||
using (DragonGUI.Layout.BeginVertical(UnityEditorUtility.GetWhiteStyle(), backColor))
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
using (DragonGUI.Layout.BeginVertical(UnityEditorUtility.GetWhiteEdge4Style(), fillColor))
|
||||
{
|
||||
//Close button
|
||||
optionButton.xMin = optionButton.xMax - DragonGUI.HeadIconsRect.width;
|
||||
if (DragonGUI.CloseButton(optionButton))
|
||||
{
|
||||
pool.Del(entityID);
|
||||
return;
|
||||
}
|
||||
//Edit script button
|
||||
if (ScriptsCache.TryGetScriptAsset(meta, out MonoScript script))
|
||||
{
|
||||
optionButton = DragonGUI.HeadIconsRect.MoveTo(optionButton.center - (Vector2.right * optionButton.width));
|
||||
DragonGUI.ScriptAssetButton(optionButton, script);
|
||||
}
|
||||
//Description icon
|
||||
if (string.IsNullOrEmpty(meta.Description.Text) == false)
|
||||
{
|
||||
optionButton = DragonGUI.HeadIconsRect.MoveTo(optionButton.center - (Vector2.right * optionButton.width));
|
||||
DragonGUI.DescriptionIcon(optionButton, meta.Description.Text);
|
||||
}
|
||||
|
||||
//Close button
|
||||
optionButton.xMin = optionButton.xMax - EcsGUI.HeadIconsRect.width;
|
||||
if (EcsGUI.CloseButton(optionButton))
|
||||
{
|
||||
pool.Del(entityID);
|
||||
return;
|
||||
}
|
||||
//Edit script button
|
||||
if (ScriptsCache.TryGetScriptAsset(meta, out MonoScript script))
|
||||
{
|
||||
optionButton = EcsGUI.HeadIconsRect.MoveTo(optionButton.center - (Vector2.right * optionButton.width));
|
||||
EcsGUI.ScriptAssetButton(optionButton, script);
|
||||
}
|
||||
//Description icon
|
||||
if (string.IsNullOrEmpty(meta.Description.Text) == false)
|
||||
{
|
||||
optionButton = EcsGUI.HeadIconsRect.MoveTo(optionButton.center - (Vector2.right * optionButton.width));
|
||||
EcsGUI.DescriptionIcon(optionButton, meta.Description.Text);
|
||||
}
|
||||
RuntimeComponentReflectionCache.FieldInfoData componentInfoData = new RuntimeComponentReflectionCache.FieldInfoData(null, componentType, meta.Name);
|
||||
|
||||
RuntimeComponentReflectionCache.FieldInfoData componentInfoData = new RuntimeComponentReflectionCache.FieldInfoData(null, componentType, meta.Name);
|
||||
|
||||
if (DrawRuntimeData(ref componentInfoData, UnityEditorUtility.GetLabel(meta.Name), expandMatrix, data, out object resultData, 0))
|
||||
{
|
||||
pool.SetRaw(entityID, resultData);
|
||||
if (DrawRuntimeData(ref componentInfoData, UnityEditorUtility.GetLabel(meta.Name), expandStack, data, out object resultData, 0))
|
||||
{
|
||||
pool.SetRaw(entityID, resultData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -434,13 +598,12 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
|
||||
|
||||
#region draw data
|
||||
private bool DrawRuntimeData(ref RuntimeComponentReflectionCache.FieldInfoData fieldInfoData, GUIContent label, ExpandMatrix expandMatrix, object data, out object outData, int depth)
|
||||
private bool DrawRuntimeData(ref RuntimeComponentReflectionCache.FieldInfoData fieldInfoData, GUIContent label, ExpandStack expandStack, object data, out object outData, int depth)
|
||||
{
|
||||
const int DEPTH_MAX = 24;
|
||||
|
||||
using (EcsGUI.CheckChanged())
|
||||
using (DragonGUI.CheckChanged())
|
||||
{
|
||||
|
||||
outData = data;
|
||||
object newData = data;
|
||||
Type type = data == null ? typeof(void) : data.GetType();
|
||||
@ -451,19 +614,19 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
return false;
|
||||
}
|
||||
|
||||
RuntimeComponentReflectionCache cache = fieldInfoData.GetReflectionCache(type);
|
||||
if (depth >= DEPTH_MAX || cache == null)
|
||||
var reflectionCache = fieldInfoData.GetReflectionCache(type);
|
||||
if (depth >= DEPTH_MAX || reflectionCache == null)
|
||||
{
|
||||
EditorGUILayout.TextField(label, "error");
|
||||
return false;
|
||||
}
|
||||
|
||||
ref bool isExpanded = ref expandMatrix.Down();
|
||||
ref bool isExpanded = ref expandStack.Down();
|
||||
bool childElementChanged = false;
|
||||
var eventType = Event.current.type;
|
||||
|
||||
var label2 = "-";
|
||||
var drawerType = cache.DrawerType;
|
||||
var drawerType = reflectionCache.DrawerType;
|
||||
|
||||
if (isUnityObjectField)
|
||||
{
|
||||
@ -472,231 +635,261 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
switch (drawerType)
|
||||
{
|
||||
case DrawerType.UNDEFINED:
|
||||
EditorGUILayout.LabelField(label, label2);
|
||||
{
|
||||
EditorGUILayout.LabelField(label, label2);
|
||||
}
|
||||
break;
|
||||
case DrawerType.Ignored:
|
||||
EditorGUILayout.LabelField(label, label2);
|
||||
{
|
||||
EditorGUILayout.LabelField(label, label2);
|
||||
}
|
||||
break;
|
||||
case DrawerType.UnitySerializableComposite:
|
||||
|
||||
using (EcsGUI.CheckChanged())
|
||||
{
|
||||
RefEditorWrapper wrapper = cache.GetWrapper(_runtimeComponentsDepth);
|
||||
wrapper.data = data;
|
||||
wrapper.SO.Update();
|
||||
wrapper.IsExpanded = isExpanded;
|
||||
EditorGUILayout.PropertyField(wrapper.Property, label, true);
|
||||
|
||||
if (EcsGUI.Changed)
|
||||
using (DragonGUI.CheckChanged())
|
||||
{
|
||||
wrapper.SO.ApplyModifiedProperties();
|
||||
newData = wrapper.Data;
|
||||
childElementChanged = true;
|
||||
}
|
||||
isExpanded = wrapper.IsExpanded;
|
||||
}
|
||||
RefEditorWrapper wrapper = reflectionCache.GetWrapper(_runtimeComponentsDepth);
|
||||
wrapper.data = data;
|
||||
wrapper.SO.Update();
|
||||
wrapper.IsExpanded = isExpanded;
|
||||
EditorGUILayout.PropertyField(wrapper.Property, label, true);
|
||||
|
||||
if (DragonGUI.Changed)
|
||||
{
|
||||
wrapper.SO.ApplyModifiedProperties();
|
||||
newData = wrapper.Data;
|
||||
childElementChanged = true;
|
||||
}
|
||||
isExpanded = wrapper.IsExpanded;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DrawerType.UnityNotSerializableComposite:
|
||||
|
||||
GUILayout.Space(EcsGUI.Spacing);
|
||||
var foldoutStyle = EditorStyles.foldout;
|
||||
Rect rect = GUILayoutUtility.GetRect(label, foldoutStyle);
|
||||
//rect.xMin += EcsGUI.Indent;
|
||||
isExpanded = EditorGUI.BeginFoldoutHeaderGroup(rect, isExpanded, label, foldoutStyle, null, null);
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
|
||||
if (isExpanded)
|
||||
{
|
||||
using (EcsGUI.UpIndentLevel())
|
||||
GUILayout.Space(DragonGUI.Spacing);
|
||||
var foldoutStyle = EditorStyles.foldout;
|
||||
Rect rect = GUILayoutUtility.GetRect(label, foldoutStyle);
|
||||
//rect.xMin += EcsGUI.Indent;
|
||||
isExpanded = EditorGUI.BeginFoldoutHeaderGroup(rect, isExpanded, label, foldoutStyle, null, null);
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
|
||||
if (isExpanded)
|
||||
{
|
||||
for (int j = 0, jMax = cache.Fields.Length; j < jMax; j++)
|
||||
using (DragonGUI.UpIndentLevel())
|
||||
{
|
||||
var field = cache.Fields[j];
|
||||
if (DrawRuntimeData(ref field, UnityEditorUtility.GetLabel(field.UnityFormatName), expandMatrix, field.FieldInfo.GetValue(data), out object fieldData, depth + 1))
|
||||
for (int j = 0, jMax = reflectionCache.Fields.Length; j < jMax; j++)
|
||||
{
|
||||
field.FieldInfo.SetValue(data, fieldData);
|
||||
newData = data;
|
||||
childElementChanged = true;
|
||||
var field = reflectionCache.Fields[j];
|
||||
if (DrawRuntimeData(ref field, UnityEditorUtility.GetLabel(field.UnityFormatName), expandStack, field.FieldInfo.GetValue(data), out object fieldData, depth + 1))
|
||||
{
|
||||
field.FieldInfo.SetValue(data, fieldData);
|
||||
newData = data;
|
||||
childElementChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case DrawerType.UnityObject:
|
||||
|
||||
using (EcsGUI.CheckChanged())
|
||||
{
|
||||
var uobj = UnsafeUtility.As<object, UnityObject>(ref data);
|
||||
bool isComponent = typeof(UnityComponent).IsAssignableFrom(fieldInfoData.FieldType);
|
||||
var newuobj = EditorGUILayout.ObjectField(label, uobj, fieldInfoData.FieldType, true);
|
||||
|
||||
if (uobj != newuobj)
|
||||
using (DragonGUI.CheckChanged())
|
||||
{
|
||||
if (isComponent && newuobj is GameObject go)
|
||||
var uobj = UnsafeUtility.As<object, UnityObject>(ref data);
|
||||
bool isComponent = typeof(UnityComponent).IsAssignableFrom(fieldInfoData.FieldType);
|
||||
var newuobj = EditorGUILayout.ObjectField(label, uobj, fieldInfoData.FieldType, true);
|
||||
|
||||
if (uobj != newuobj)
|
||||
{
|
||||
newuobj = go.GetComponent(fieldInfoData.FieldType);
|
||||
if (isComponent && newuobj is GameObject go)
|
||||
{
|
||||
newuobj = go.GetComponent(fieldInfoData.FieldType);
|
||||
}
|
||||
newData = newuobj;
|
||||
childElementChanged = true;
|
||||
}
|
||||
newData = newuobj;
|
||||
childElementChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case DrawerType.Enum:
|
||||
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
var enumData = UnsafeUtility.As<object, Enum>(ref data);
|
||||
newData = EditorGUILayout.EnumPopup(label, enumData);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
var enumData = UnsafeUtility.As<object, Enum>(ref data);
|
||||
newData = EditorGUILayout.EnumPopup(label, enumData);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.EnumPopup(label, default);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.EnumPopup(label, default);
|
||||
}
|
||||
|
||||
break;
|
||||
case DrawerType.EnumFlags:
|
||||
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
var enumData = UnsafeUtility.As<object, Enum>(ref data);
|
||||
newData = EditorGUILayout.EnumFlagsField(label, enumData);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
var enumData = UnsafeUtility.As<object, Enum>(ref data);
|
||||
newData = EditorGUILayout.EnumFlagsField(label, enumData);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.EnumFlagsField(label, default);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.EnumFlagsField(label, default);
|
||||
}
|
||||
|
||||
break;
|
||||
case DrawerType.Bool:
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = EditorGUILayout.Toggle(label, (bool)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.Toggle(label, default);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = EditorGUILayout.Toggle(label, (bool)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.Toggle(label, default);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DrawerType.String:
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = EditorGUILayout.TextField(label, (string)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.TextField(label, default);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = EditorGUILayout.TextField(label, (string)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.TextField(label, default);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DrawerType.Float:
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = EditorGUILayout.FloatField(label, (float)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.FloatField(label, default);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = EditorGUILayout.FloatField(label, (float)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.FloatField(label, default);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DrawerType.Double:
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = EditorGUILayout.DoubleField(label, (double)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.DoubleField(label, default);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = EditorGUILayout.DoubleField(label, (double)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.DoubleField(label, default);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DrawerType.Byte:
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (byte)EditorGUILayout.IntField(label, (byte)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.IntField(label, default);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (byte)EditorGUILayout.IntField(label, (byte)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.IntField(label, default);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DrawerType.SByte:
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (sbyte)EditorGUILayout.IntField(label, (sbyte)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.IntField(label, default);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (sbyte)EditorGUILayout.IntField(label, (sbyte)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.IntField(label, default);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DrawerType.Short:
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (short)EditorGUILayout.IntField(label, (short)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.IntField(label, default);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (short)EditorGUILayout.IntField(label, (short)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.IntField(label, default);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DrawerType.UShort:
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (ushort)EditorGUILayout.IntField(label, (ushort)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.IntField(label, default);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (ushort)EditorGUILayout.IntField(label, (ushort)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.IntField(label, default);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DrawerType.Int:
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (int)EditorGUILayout.IntField(label, (int)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.IntField(label, default);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (int)EditorGUILayout.IntField(label, (int)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.IntField(label, default);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DrawerType.UInt:
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (uint)EditorGUILayout.IntField(label, (int)(uint)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.IntField(label, default);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (uint)EditorGUILayout.IntField(label, (int)(uint)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.IntField(label, default);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DrawerType.Long:
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = EditorGUILayout.LongField(label, (long)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.LongField(label, default);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = EditorGUILayout.LongField(label, (long)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.LongField(label, default);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DrawerType.ULong:
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (ulong)EditorGUILayout.LongField(label, (long)(ulong)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.LongField(label, default);
|
||||
if (eventType != EventType.Layout)
|
||||
{
|
||||
newData = (ulong)EditorGUILayout.LongField(label, (long)(ulong)data);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.LongField(label, default);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
EditorGUILayout.LabelField(label, label2);
|
||||
{
|
||||
EditorGUILayout.LabelField(label, label2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
expandMatrix.Up();
|
||||
if (childElementChanged || EcsGUI.Changed)
|
||||
expandStack.Up();
|
||||
if (childElementChanged || DragonGUI.Changed)
|
||||
{
|
||||
outData = newData;
|
||||
return true;
|
||||
@ -705,7 +898,6 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public enum DrawerType
|
||||
{
|
||||
@ -731,6 +923,7 @@ namespace DCFApixels.DragonECS.Unity.Editors.X
|
||||
Long,
|
||||
ULong,
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -457,7 +457,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
#region GetDefaultStyle
|
||||
private static Texture2D _whiteTexture;
|
||||
|
||||
private static GUIStyle _whiteStyleWithPadding;
|
||||
private static GUIStyle _whiteStyle;
|
||||
private static GUIStyle _whiteEdgeStyle;
|
||||
|
||||
private static GUIStyle _transperentBlackBackgrounStyle;
|
||||
private static GUIStyle _clearBackgrounStyle;
|
||||
public static Texture2D GetWhiteTexture()
|
||||
@ -470,16 +474,34 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
private static bool IsNotInitializedStyle(GUIStyle style)
|
||||
{
|
||||
//return style == null || style.normal.background == null;
|
||||
return style == null || style.normal.background == null;
|
||||
}
|
||||
public static GUIStyle GetWhiteStyleWithPadding()
|
||||
{
|
||||
if (IsNotInitializedStyle(_whiteStyleWithPadding))
|
||||
{
|
||||
_whiteStyleWithPadding = CreateStyle(GetWhiteTexture());
|
||||
}
|
||||
return _whiteStyleWithPadding;
|
||||
}
|
||||
public static GUIStyle GetWhiteStyle()
|
||||
{
|
||||
if (IsNotInitializedStyle(_whiteStyle))
|
||||
{
|
||||
_whiteStyle = CreateStyle(GetWhiteTexture(), GUI.skin.label);
|
||||
_whiteStyle = CreateStyle(GetWhiteTexture());
|
||||
_whiteStyle.padding = new RectOffset(0,0,0,0);
|
||||
}
|
||||
return _whiteStyle;
|
||||
}
|
||||
public static GUIStyle GetWhiteEdge4Style()
|
||||
{
|
||||
if (IsNotInitializedStyle(_whiteEdgeStyle))
|
||||
{
|
||||
_whiteEdgeStyle = CreateEdge4Style();
|
||||
}
|
||||
return _whiteEdgeStyle;
|
||||
}
|
||||
public static GUIStyle GetTransperentBlackBackgrounStyle()
|
||||
{
|
||||
if (IsNotInitializedStyle(_transperentBlackBackgrounStyle))
|
||||
@ -505,7 +527,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
referenceStyle = GUI.skin.box;
|
||||
}
|
||||
GUIStyle result = new GUIStyle(GUI.skin.box);
|
||||
GUIStyle result = new GUIStyle(referenceStyle);
|
||||
Texture2D texture2D = texture;
|
||||
result.hover.background = texture2D;
|
||||
result.hover.scaledBackgrounds = Array.Empty<Texture2D>();
|
||||
@ -517,6 +539,57 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
result.normal.scaledBackgrounds = Array.Empty<Texture2D>();
|
||||
return result;
|
||||
}
|
||||
private static GUIStyle CreateEdge4Style(GUIStyle referenceStyle = null)
|
||||
{
|
||||
const int Size = 8;
|
||||
const int EdgeSize = 4;
|
||||
|
||||
var pixels = new Color[Size * Size];
|
||||
for (var i = 0; i < pixels.Length; ++i)
|
||||
{
|
||||
pixels[i] = Color.clear;
|
||||
}
|
||||
for (int y = 0; y < Size; y++)
|
||||
{
|
||||
for (int x = 0; x < EdgeSize; x++)
|
||||
{
|
||||
pixels[y * Size + x] = Color.white;
|
||||
}
|
||||
}
|
||||
var texture = new Texture2D(Size, Size)
|
||||
{
|
||||
filterMode = FilterMode.Point
|
||||
};
|
||||
texture.SetPixels(pixels);
|
||||
texture.Apply();
|
||||
|
||||
if (referenceStyle == null)
|
||||
{
|
||||
referenceStyle = GUI.skin.box;
|
||||
}
|
||||
GUIStyle result = new GUIStyle(referenceStyle);
|
||||
Texture2D texture2D = texture;
|
||||
result.hover.background = texture2D;
|
||||
result.hover.scaledBackgrounds = Array.Empty<Texture2D>();
|
||||
result.focused.background = texture2D;
|
||||
result.focused.scaledBackgrounds = Array.Empty<Texture2D>();
|
||||
result.active.background = texture2D;
|
||||
result.active.scaledBackgrounds = Array.Empty<Texture2D>();
|
||||
result.normal.background = texture2D;
|
||||
result.normal.scaledBackgrounds = Array.Empty<Texture2D>();
|
||||
|
||||
result.margin = new RectOffset(0, 0, 0, 0);
|
||||
result.overflow = new RectOffset(0, 0, 0, 0);
|
||||
result.border = new RectOffset(EdgeSize, 0, 0, 0);
|
||||
result.contentOffset = Vector2.zero;
|
||||
result.fixedHeight = 0;
|
||||
result.fixedWidth = 0;
|
||||
result.richText = false;
|
||||
|
||||
var l = GUI.skin.box.padding.left;
|
||||
result.padding = new RectOffset(l + 4, l, l, l);
|
||||
return result;
|
||||
}
|
||||
private static Texture2D CreateTexture(int width, int height, Color color)
|
||||
{
|
||||
var pixels = new Color[width * height];
|
||||
|
||||
@ -2,7 +2,9 @@
|
||||
{
|
||||
internal static class EscEditorConsts
|
||||
{
|
||||
public const float COMPONENT_DRAWER_ALPHA = 0.26f;
|
||||
public const float MetaBlockFillStyle_Alpha = 0.26f;
|
||||
public const float MetaBlockEdgeStyle_Alpha = 0.74f;
|
||||
public const float MetaBlockCleanStyle_Alpha = 0.05f;
|
||||
public const float COMPONENT_DRAWER_DESATURATE = 0.86f;
|
||||
public const int AUTO_COLOR_RAINBOW_MIN_RANGE = 7;
|
||||
}
|
||||
|
||||
@ -3,11 +3,11 @@ guid: 8f9fb2a8877577940971d81a98aeaaaa
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -3,11 +3,11 @@ guid: d01e651682f48b548b597714f47e14b9
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -3,11 +3,11 @@ guid: 8a708e50662813d4a99c107e6431a60b
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -3,11 +3,11 @@ guid: 6a1d402595b00c24db2ba647fed93a5c
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -3,11 +3,11 @@ guid: c67e8a1d6cb0e904590c7847368fe794
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -7,7 +7,7 @@ TextureImporter:
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -67,11 +67,11 @@ TextureImporter:
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
@ -80,7 +80,7 @@ TextureImporter:
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
@ -93,7 +93,7 @@ TextureImporter:
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
@ -106,7 +106,7 @@ TextureImporter:
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
@ -123,7 +123,6 @@ TextureImporter:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
@ -133,8 +132,6 @@ TextureImporter:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
|
||||
@ -3,11 +3,11 @@ guid: e135cf23a5d53ce48a75e163b41e39d5
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -7,7 +7,7 @@ TextureImporter:
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -67,11 +67,11 @@ TextureImporter:
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
@ -80,7 +80,7 @@ TextureImporter:
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
@ -93,7 +93,7 @@ TextureImporter:
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
@ -110,7 +110,6 @@ TextureImporter:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
@ -120,8 +119,6 @@ TextureImporter:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
|
||||
@ -3,11 +3,11 @@ guid: ebb82b09315bde749a10dfa45e64067c
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -3,11 +3,11 @@ guid: 5476d6e1435981e4cbc915a080f93ee6
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -3,11 +3,11 @@ guid: d3c6215cfdc36cb448661398160560a7
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -3,11 +3,11 @@ guid: 0df5856dbbe53494aae23b959ca05ecc
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -3,11 +3,11 @@ guid: 561fcfb28d73d7c4f8c9fac36e8ece86
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 32
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -3,11 +3,11 @@ guid: 239e73d04c7ba4649bc4cc10e70e62e5
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -3,11 +3,11 @@ guid: 5baead89a941e034e9f44d63617d3246
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -3,11 +3,11 @@ guid: 1f25a5ca611092642a8ee4e08fafcd43
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -3,11 +3,11 @@ guid: 9ce9d719a106be04fa4cf0c369c61e1c
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -3,11 +3,11 @@ guid: 223d96e24d4b49f468b628cf9839584c
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -20,11 +20,12 @@ TextureImporter:
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
@ -63,17 +64,20 @@ TextureImporter:
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureFormat: 4
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -86,6 +90,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
@ -98,6 +103,7 @@ TextureImporter:
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
@ -114,9 +120,8 @@ TextureImporter:
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -1,117 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
internal interface IReferenceButtonAttribute
|
||||
{
|
||||
Type[] PredicateTypes { get; }
|
||||
bool IsHideButtonIfNotNull { get; }
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
namespace DCFApixels.DragonECS.Unity.Internal
|
||||
{
|
||||
using DCFApixels.DragonECS.Unity.Editors;
|
||||
using UnityEditor;
|
||||
internal partial class UnityReflectionCache
|
||||
{
|
||||
public bool IsReferenceButtonCacheInit_Editor;
|
||||
public bool InitReferenceButtonCache_Editor(SerializedProperty sp)
|
||||
{
|
||||
if (IsReferenceButtonCacheInit_Editor) { return false; }
|
||||
|
||||
HasSerializableData_Editor = sp.HasSerializableData();
|
||||
|
||||
IsReferenceButtonCacheInit_Editor = true;
|
||||
return true;
|
||||
}
|
||||
public bool HasSerializableData_Editor;
|
||||
}
|
||||
}
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomPropertyDrawer(typeof(ReferenceButtonAttribute), true)]
|
||||
internal sealed class ReferenceButtonAttributeDrawer : ExtendedPropertyDrawer<IReferenceButtonAttribute>
|
||||
{
|
||||
private Type[] _withOutTypes;
|
||||
protected override void OnInit()
|
||||
{
|
||||
Type fieldType = fieldInfo.FieldType;
|
||||
_withOutTypes = fieldType.TryGetAttribute(out ReferenceButtonWithOutAttribute a) ? a.PredicateTypes : Array.Empty<Type>();
|
||||
//if (fieldType.IsGenericType)
|
||||
//{
|
||||
// if (fieldType.IsGenericTypeDefinition == false)
|
||||
// {
|
||||
// fieldType = fieldType.GetGenericTypeDefinition();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
private UnityReflectionCache _reflectionCache;
|
||||
private UnityReflectionCache Cahce(SerializedProperty sp)
|
||||
{
|
||||
if (UnityReflectionCache.InitLocal(sp.managedReferenceValue.GetType(), ref _reflectionCache))
|
||||
{
|
||||
_reflectionCache.InitReferenceButtonCache_Editor(sp);
|
||||
}
|
||||
return _reflectionCache;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
Init();
|
||||
if (property.propertyType == SerializedPropertyType.ManagedReference &&
|
||||
property.managedReferenceValue != null &&
|
||||
Cahce(property).HasSerializableData_Editor)
|
||||
{
|
||||
return EditorGUI.GetPropertyHeight(property, label, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return OneLineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void DrawCustom(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
if(property.propertyType != SerializedPropertyType.ManagedReference)
|
||||
{
|
||||
GUI.Label(position, label);
|
||||
return;
|
||||
}
|
||||
if (IsArrayElement)
|
||||
{
|
||||
label = UnityEditorUtility.GetLabelTemp();
|
||||
}
|
||||
Rect selButtnoRect = position;
|
||||
selButtnoRect.height = OneLineHeight;
|
||||
DrawSelectionPopupButton(selButtnoRect, property);
|
||||
|
||||
if (property.managedReferenceValue != null &&
|
||||
Cahce(property).HasSerializableData_Editor)
|
||||
{
|
||||
EditorGUI.PropertyField(position, property, label, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
EditorGUI.LabelField(position, label);
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSelectionPopupButton(Rect position, SerializedProperty property)
|
||||
{
|
||||
Rect buttonRect = IsArrayElement ? position : position.AddPadding(EditorGUIUtility.labelWidth, 0f, 0f, 0f); ;
|
||||
EcsGUI.DrawSelectReferenceButton(buttonRect, property, Attribute.PredicateTypes.Length == 0 ? new Type[1] { fieldInfo.FieldType } : Attribute.PredicateTypes, _withOutTypes, Attribute.IsHideButtonIfNotNull);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -105,10 +105,6 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
||||
}
|
||||
return _memberwiseCloneMethdo.Invoke(obj, null);
|
||||
}
|
||||
internal static object Clone_Reflection<T>(this T obj)
|
||||
{
|
||||
return Clone_Reflection((object)obj);
|
||||
}
|
||||
}
|
||||
|
||||
internal partial class UnityReflectionCache
|
||||
|
||||
@ -351,7 +351,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.scriptPath) == false)
|
||||
{
|
||||
_metaIDScriptPathPairs.Add(item.metaID, item.scriptPath);
|
||||
_metaIDScriptPathPairs[item.metaID] = item.scriptPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,24 +1,30 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Internal
|
||||
{
|
||||
internal readonly struct PredicateTypesKey : IEquatable<PredicateTypesKey>
|
||||
{
|
||||
public readonly Type[] Types;
|
||||
public readonly Type TargetType;
|
||||
public readonly Type[] AllowTypes;
|
||||
public readonly Type[] WithoutTypes;
|
||||
public PredicateTypesKey(Type[] types) : this(types, Type.EmptyTypes) { }
|
||||
public PredicateTypesKey(Type[] types, Type[] withoutTypes)
|
||||
public PredicateTypesKey(Type signleType) : this(signleType, new Type[] { signleType } , Type.EmptyTypes) { }
|
||||
public PredicateTypesKey(Type targetType, Type[] types) : this(targetType, types, Type.EmptyTypes) { }
|
||||
public PredicateTypesKey(Type targetType, Type[] types, Type[] withoutTypes)
|
||||
{
|
||||
Types = types;
|
||||
if(targetType == null)
|
||||
{
|
||||
Throw.ArgumentNullException();
|
||||
}
|
||||
TargetType = targetType;
|
||||
AllowTypes = types;
|
||||
WithoutTypes = withoutTypes;
|
||||
}
|
||||
public bool Check(Type type)
|
||||
{
|
||||
bool isAssignable = false;
|
||||
foreach (Type predicateTypes in Types)
|
||||
bool isAssignable = AllowTypes.Length == 0;
|
||||
foreach (Type allowType in AllowTypes)
|
||||
{
|
||||
if (predicateTypes.IsAssignableFrom(type))
|
||||
if (allowType.IsAssignableFrom(type))
|
||||
{
|
||||
isAssignable = true;
|
||||
break;
|
||||
@ -37,15 +43,20 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
||||
}
|
||||
}
|
||||
|
||||
return isAssignable;
|
||||
return isAssignable && TargetType.IsAssignableFrom(type);
|
||||
}
|
||||
public bool Equals(PredicateTypesKey other)
|
||||
{
|
||||
if (Types.Length != other.Types.Length) { return false; }
|
||||
if (AllowTypes.Length != other.AllowTypes.Length) { return false; }
|
||||
if (WithoutTypes.Length != other.WithoutTypes.Length) { return false; }
|
||||
for (int i = 0; i < Types.Length; i++)
|
||||
|
||||
if (TargetType != other.TargetType)
|
||||
{
|
||||
if (Types[i] != other.Types[i])
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < AllowTypes.Length; i++)
|
||||
{
|
||||
if (AllowTypes[i] != other.AllowTypes[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -65,8 +76,7 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(Types, WithoutTypes);
|
||||
return HashCode.Combine(TargetType, AllowTypes, WithoutTypes);
|
||||
}
|
||||
public static implicit operator PredicateTypesKey((Type[], Type[]) types) { return new PredicateTypesKey(types.Item1, types.Item2); }
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,12 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
||||
{
|
||||
internal static class RectUtility
|
||||
{
|
||||
public static Rect AddOffset(in this Rect rect, Vector2 offset)
|
||||
{
|
||||
var r = rect;
|
||||
r.position += offset;
|
||||
return r;
|
||||
}
|
||||
public static (Rect, Rect) HorizontalSliceLerp(in this Rect rect, float t)
|
||||
{
|
||||
Rect l = rect;
|
||||
@ -22,6 +28,12 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
||||
r.xMin += with;
|
||||
return (l, r);
|
||||
}
|
||||
public static Rect HorizontalGetLeft(in this Rect rect, float with)
|
||||
{
|
||||
Rect l = rect;
|
||||
l.xMax = l.xMin + with;
|
||||
return l;
|
||||
}
|
||||
public static (Rect, Rect) HorizontalSliceRight(in this Rect rect, float with)
|
||||
{
|
||||
Rect l = rect;
|
||||
|
||||
@ -8,6 +8,10 @@ namespace DCFApixels.DragonECS.Unity.Internal
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
internal static void ArgumentNullException()
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
internal static void Argument(string message)
|
||||
{
|
||||
throw new ArgumentException(message);
|
||||
|
||||
@ -9,200 +9,222 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
[CustomPropertyDrawer(typeof(ComponentTemplateProperty), true)]
|
||||
internal class ComponentTemplatePropertyDrawer : ExtendedPropertyDrawer
|
||||
{
|
||||
private ComponentTemplateReferenceDrawer _drawer = new ComponentTemplateReferenceDrawer(new PredicateTypesKey(new Type[] { typeof(ITemplateNode) }));
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
//private EcsDragonFieldDrawer _drawer = new EcsDragonFieldDrawer(new PredicateTypesKey(typeof(ITemplateNode)));
|
||||
//protected override float GetCustomHeight(SerializedProperty property, GUIContent label)
|
||||
//{
|
||||
// property.Next(true);
|
||||
// _drawer.StaticInit();
|
||||
// _drawer.Init(property);
|
||||
// return _drawer.GetPropertyHeight(property, label);
|
||||
//}
|
||||
//protected override void DrawCustom(Rect position, SerializedProperty property, GUIContent label)
|
||||
//{
|
||||
// var root = property.Copy();
|
||||
// property.Next(true);
|
||||
// _drawer.StaticInit();
|
||||
// _drawer.Init(property);
|
||||
// _drawer.Draw(position, root, property, label);
|
||||
//}
|
||||
|
||||
protected override float GetCustomHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
property.Next(true);
|
||||
_drawer.StaticInit();
|
||||
_drawer.Init();
|
||||
return _drawer.GetPropertyHeight(property, label);
|
||||
return EditorGUI.GetPropertyHeight(property, label);
|
||||
}
|
||||
protected override void DrawCustom(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var root = property.Copy();
|
||||
property.Next(true);
|
||||
_drawer.StaticInit();
|
||||
_drawer.Init();
|
||||
_drawer.Draw(position, root, property, label);
|
||||
}
|
||||
}
|
||||
[CustomPropertyDrawer(typeof(ComponentTemplateFieldAttribute), true)]
|
||||
internal class ComponentTemplateReferenceDrawer : ExtendedPropertyDrawer<ComponentTemplateFieldAttribute>
|
||||
{
|
||||
private const float DamagedComponentHeight = 18f * 2f;
|
||||
private ComponentTemplatesDropDown _componentDropDown;
|
||||
private PredicateTypesKey? _predicateOverride;
|
||||
|
||||
|
||||
#region Properties
|
||||
private float Padding => Spacing;
|
||||
protected override bool IsInit => _componentDropDown != null;
|
||||
#endregion
|
||||
|
||||
public ComponentTemplateReferenceDrawer() { }
|
||||
public ComponentTemplateReferenceDrawer(PredicateTypesKey key)
|
||||
{
|
||||
_predicateOverride = key;
|
||||
}
|
||||
|
||||
#region Init
|
||||
protected override void OnInit()
|
||||
{
|
||||
PredicateTypesKey key;
|
||||
if(_predicateOverride == null)
|
||||
{
|
||||
Type[] withOutTypes = Type.EmptyTypes;
|
||||
if (fieldInfo != null)
|
||||
{
|
||||
withOutTypes = fieldInfo.TryGetAttribute(out ReferenceButtonWithOutAttribute a) ? a.PredicateTypes : Array.Empty<Type>();
|
||||
}
|
||||
if (Attribute != null)
|
||||
{
|
||||
var types = Attribute.PredicateTypes;
|
||||
if(types == null || types.Length == 0)
|
||||
{
|
||||
types = new Type[] { typeof(ITemplateNode) };
|
||||
}
|
||||
key = new PredicateTypesKey(types, withOutTypes);
|
||||
}
|
||||
else
|
||||
{
|
||||
key = new PredicateTypesKey(new Type[] { typeof(object) }, withOutTypes);
|
||||
}
|
||||
_predicateOverride = key;
|
||||
}
|
||||
_componentDropDown = ComponentTemplatesDropDown.Get(_predicateOverride.Value);
|
||||
_componentDropDown.OnSelected += SelectComponent;
|
||||
}
|
||||
|
||||
[ThreadStatic]
|
||||
private static SerializedProperty currentProperty;
|
||||
private static void SelectComponent(ComponentTemplatesDropDown.Item item)
|
||||
{
|
||||
//EcsGUI.Changed = true;
|
||||
object inst = item.Obj.CreateInstance();
|
||||
currentProperty.managedReferenceValue = inst;
|
||||
currentProperty.isExpanded = false;
|
||||
currentProperty.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
bool isSerializeReference = property.propertyType == SerializedPropertyType.ManagedReference;
|
||||
//#region No SerializeReference
|
||||
//if (property.propertyType != SerializedPropertyType.ManagedReference)
|
||||
//{
|
||||
// return EditorGUI.GetPropertyHeight(property, label);
|
||||
//}
|
||||
//#endregion
|
||||
|
||||
if (isSerializeReference)
|
||||
{
|
||||
var instance = property.managedReferenceValue;
|
||||
IComponentTemplate template = instance as IComponentTemplate;
|
||||
if (instance == null)
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight + Padding * 2f;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (instance is ComponentTemplateBase customTemplate)
|
||||
{
|
||||
property = property.FindPropertyRelative("component");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
property = null;
|
||||
}
|
||||
if (property == null)
|
||||
{
|
||||
return DamagedComponentHeight;
|
||||
}
|
||||
}
|
||||
|
||||
int propCount = EcsGUI.GetChildPropertiesCount(property);
|
||||
|
||||
return (propCount <= 0 ? EditorGUIUtility.singleLineHeight : EditorGUI.GetPropertyHeight(property, label)) + Padding * 4f;
|
||||
}
|
||||
|
||||
protected override void DrawCustom(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
Draw(position, property, property, label);
|
||||
}
|
||||
public void Draw(Rect rect, SerializedProperty rootProperty, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
bool isSerializeReference = property.propertyType == SerializedPropertyType.ManagedReference;
|
||||
//#region No SerializeReference
|
||||
//if (isSerializeReference == false)
|
||||
//{
|
||||
// EditorGUI.PropertyField(position, property, label, true);
|
||||
// return;
|
||||
//}
|
||||
//#endregion
|
||||
|
||||
ITypeMeta meta = null;
|
||||
SerializedProperty componentProp = property;
|
||||
if (isSerializeReference)
|
||||
{
|
||||
var instance = property.managedReferenceValue;
|
||||
if (instance == null)
|
||||
{
|
||||
DrawSelectionPopup(rect, property, label);
|
||||
return;
|
||||
}
|
||||
|
||||
IComponentTemplate template = instance as IComponentTemplate;
|
||||
if (componentProp.managedReferenceValue is ComponentTemplateBase customTemplate)
|
||||
{
|
||||
componentProp = property.FindPropertyRelative("component");
|
||||
}
|
||||
if (componentProp == null)
|
||||
{
|
||||
DrawDamagedComponent(rect, "Damaged component template.");
|
||||
return;
|
||||
}
|
||||
|
||||
meta = template is ITypeMeta metaOverride ? metaOverride : _predicateOverride.Value.Types[0].GetMeta();
|
||||
}
|
||||
else
|
||||
{
|
||||
meta = fieldInfo.FieldType.GetMeta();
|
||||
}
|
||||
|
||||
|
||||
if (EcsGUI.DrawTypeMetaBlock(ref rect, rootProperty, meta))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
label.text = meta.Name;
|
||||
if (componentProp.propertyType == SerializedPropertyType.Generic)
|
||||
{
|
||||
EditorGUI.PropertyField(rect, componentProp, label, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.PropertyField(rect.AddPadding(0, 20f, 0, 0), componentProp, label, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSelectionPopup(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
EditorGUI.LabelField(position, label);
|
||||
Rect buttonRect = RectUtility.AddPadding(position, EditorGUIUtility.labelWidth, 0f, 0f, 0f);
|
||||
if (GUI.Button(buttonRect, "Select"))
|
||||
{
|
||||
currentProperty = property;
|
||||
_componentDropDown.Show(buttonRect);
|
||||
}
|
||||
}
|
||||
private void DrawDamagedComponent(Rect position, string message)
|
||||
{
|
||||
EditorGUI.HelpBox(position, message, MessageType.Warning);
|
||||
EditorGUI.PropertyField(position, property, label);
|
||||
}
|
||||
}
|
||||
//[CustomPropertyDrawer(typeof(ComponentTemplateFieldAttribute), true)]
|
||||
//internal class ComponentTemplateFieldDrawer : ExtendedPropertyDrawer<ComponentTemplateFieldAttribute>
|
||||
//{
|
||||
// private const float DamagedComponentHeight = 18f * 2f;
|
||||
// private ComponentTemplatesDropDown _componentDropDown;
|
||||
// private PredicateTypesKey? _predicateOverride;
|
||||
//
|
||||
// #region Properties
|
||||
// private float Padding => Spacing;
|
||||
// protected override bool IsInit => _componentDropDown != null;
|
||||
// #endregion
|
||||
//
|
||||
// public ComponentTemplateFieldDrawer() { }
|
||||
// public ComponentTemplateFieldDrawer(PredicateTypesKey key)
|
||||
// {
|
||||
// _predicateOverride = key;
|
||||
// }
|
||||
//
|
||||
// #region Init
|
||||
// protected override void OnInit(SerializedProperty property)
|
||||
// {
|
||||
// PredicateTypesKey key;
|
||||
// if(_predicateOverride == null)
|
||||
// {
|
||||
// Type[] withOutTypes = Type.EmptyTypes;
|
||||
// if (fieldInfo != null)
|
||||
// {
|
||||
// withOutTypes = fieldInfo.TryGetAttribute(out ReferenceButtonWithOutAttribute a) ? a.PredicateTypes : Array.Empty<Type>();
|
||||
// }
|
||||
// if (Attribute != null)
|
||||
// {
|
||||
// var types = Attribute.PredicateTypes;
|
||||
// if(types == null || types.Length == 0)
|
||||
// {
|
||||
// types = new Type[] { typeof(ITemplateNode) };
|
||||
// }
|
||||
// key = new PredicateTypesKey(typeof(ITemplateNode), types, withOutTypes);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// key = new PredicateTypesKey(typeof(object), withOutTypes);
|
||||
// }
|
||||
// _predicateOverride = key;
|
||||
// }
|
||||
// _componentDropDown = ComponentTemplatesDropDown.Get(_predicateOverride.Value);
|
||||
// _componentDropDown.OnSelected += SelectComponent;
|
||||
// }
|
||||
//
|
||||
// [ThreadStatic]
|
||||
// private static SerializedProperty currentProperty;
|
||||
// private static void SelectComponent(ComponentTemplatesDropDown.Item item)
|
||||
// {
|
||||
// //EcsGUI.Changed = true;
|
||||
// object inst = item.Obj.CreateInstance();
|
||||
// currentProperty.managedReferenceValue = inst;
|
||||
// currentProperty.isExpanded = false;
|
||||
// currentProperty.serializedObject.ApplyModifiedProperties();
|
||||
// }
|
||||
// #endregion
|
||||
//
|
||||
// public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
// {
|
||||
// bool isSerializeReference = property.propertyType == SerializedPropertyType.ManagedReference;
|
||||
// //#region No SerializeReference
|
||||
// //if (property.propertyType != SerializedPropertyType.ManagedReference)
|
||||
// //{
|
||||
// // return EditorGUI.GetPropertyHeight(property, label);
|
||||
// //}
|
||||
// //#endregion
|
||||
//
|
||||
// if (isSerializeReference)
|
||||
// {
|
||||
// var instance = property.managedReferenceValue;
|
||||
// IComponentTemplate template = instance as IComponentTemplate;
|
||||
// if (instance == null)
|
||||
// {
|
||||
// return EditorGUIUtility.singleLineHeight + Padding * 2f;
|
||||
// }
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// if (instance is ComponentTemplateBase customTemplate)
|
||||
// {
|
||||
// property = property.FindPropertyRelative("component");
|
||||
// }
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// property = null;
|
||||
// }
|
||||
// if (property == null)
|
||||
// {
|
||||
// return DamagedComponentHeight;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// int propCount = EcsGUI.GetChildPropertiesCount(property);
|
||||
//
|
||||
// return (propCount <= 0 ? EditorGUIUtility.singleLineHeight : EditorGUI.GetPropertyHeight(property, label)) + Padding * 4f;
|
||||
// }
|
||||
//
|
||||
// protected override void DrawCustom(Rect position, SerializedProperty property, GUIContent label)
|
||||
// {
|
||||
// Draw(position, property, property, label);
|
||||
// }
|
||||
// public void Draw(Rect rect, SerializedProperty rootProperty, SerializedProperty property, GUIContent label)
|
||||
// {
|
||||
// bool isSerializeReference = property.propertyType == SerializedPropertyType.ManagedReference;
|
||||
// //#region No SerializeReference
|
||||
// //if (isSerializeReference == false)
|
||||
// //{
|
||||
// // EditorGUI.PropertyField(position, property, label, true);
|
||||
// // return;
|
||||
// //}
|
||||
// //#endregion
|
||||
//
|
||||
// ITypeMeta meta = null;
|
||||
// SerializedProperty componentProp = property;
|
||||
// if (isSerializeReference)
|
||||
// {
|
||||
// var template = property.managedReferenceValue;
|
||||
// if (template == null)
|
||||
// {
|
||||
// DrawSelectionPopup(rect, property, label);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// IComponentTemplate componentTemplate = template as IComponentTemplate;
|
||||
// if (componentProp.managedReferenceValue is ComponentTemplateBase customTemplate)
|
||||
// {
|
||||
// componentProp = property.FindPropertyRelative("component");
|
||||
// }
|
||||
// if (componentProp == null)
|
||||
// {
|
||||
// DrawDamagedComponent(rect, "Damaged component template.");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// meta = template as ITypeMeta;
|
||||
// if (meta == null)
|
||||
// {
|
||||
// if (componentTemplate != null)
|
||||
// {
|
||||
// meta = componentTemplate.ComponentType.GetMeta();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// meta = template.GetMeta();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// meta = fieldInfo.FieldType.GetMeta();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (EcsGUI.DrawTypeMetaBlock(ref rect, rootProperty, meta).skip)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// label.text = meta.Name;
|
||||
// if (componentProp.propertyType == SerializedPropertyType.Generic)
|
||||
// {
|
||||
// EditorGUI.PropertyField(rect, componentProp, label, true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// EditorGUI.PropertyField(rect.AddPadding(0, 20f, 0, 0), componentProp, label, true);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void DrawSelectionPopup(Rect position, SerializedProperty property, GUIContent label)
|
||||
// {
|
||||
// EditorGUI.LabelField(position, label);
|
||||
// Rect buttonRect = RectUtility.AddPadding(position, EditorGUIUtility.labelWidth, 0f, 0f, 0f);
|
||||
// if (GUI.Button(buttonRect, "Select"))
|
||||
// {
|
||||
// currentProperty = property;
|
||||
// _componentDropDown.Show(buttonRect);
|
||||
// }
|
||||
// }
|
||||
// private void DrawDamagedComponent(Rect position, string message)
|
||||
// {
|
||||
// EditorGUI.HelpBox(position, message, MessageType.Warning);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
#endif
|
||||
@ -10,13 +10,14 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
internal abstract class EntityTemplateEditorBase : ExtendedEditor
|
||||
{
|
||||
private ComponentTemplatesDropDown _componentDropDown;
|
||||
private DragonFieldDropDown _componentDropDown;
|
||||
|
||||
private SerializedProperty _componentsProp;
|
||||
private SerializedProperty _componentTemplatesProp;
|
||||
private SerializedProperty _templatesProp;
|
||||
private ReorderableList _reorderableComponentsList;
|
||||
private int _reorderableComponentsListLastCount;
|
||||
|
||||
private static readonly Type[] _predicateTypes = new Type[] { typeof(ITemplateNode) };
|
||||
private static readonly Type[] _predicateTypes = new Type[] { typeof(IComponentTemplate), typeof(IEcsComponentMember) };
|
||||
|
||||
protected abstract bool IsSO { get; }
|
||||
|
||||
@ -24,11 +25,12 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
protected override bool IsInit { get { return _componentDropDown != null; } }
|
||||
protected override void OnInit()
|
||||
{
|
||||
_componentDropDown = ComponentTemplatesDropDown.Get(new PredicateTypesKey(_predicateTypes, Type.EmptyTypes));
|
||||
_componentDropDown = DragonFieldDropDown.Get(new PredicateTypesKey(typeof(ITemplateNode), _predicateTypes, Type.EmptyTypes));
|
||||
|
||||
_componentsProp = serializedObject.FindProperty("_componentTemplates");
|
||||
_componentTemplatesProp = serializedObject.FindProperty("_componentTemplates");
|
||||
_templatesProp = serializedObject.FindProperty("_templates");
|
||||
|
||||
_reorderableComponentsList = new ReorderableList(serializedObject, _componentsProp, true, false, false, false);
|
||||
_reorderableComponentsList = new ReorderableList(serializedObject, _componentTemplatesProp, true, false, false, false);
|
||||
_reorderableComponentsList.onAddCallback += OnReorderableComponentsListAdd;
|
||||
_reorderableComponentsList.onRemoveCallback += OnReorderableListRemove;
|
||||
_reorderableComponentsList.drawElementCallback += OnReorderableListDrawEmptyElement;
|
||||
@ -50,7 +52,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
private void OnReorderableListReorder(ReorderableList list)
|
||||
{
|
||||
EcsGUI.Changed = true;
|
||||
DragonGUI.Changed = true;
|
||||
}
|
||||
|
||||
private SerializedProperty GetTargetProperty(SerializedProperty prop)
|
||||
@ -73,55 +75,74 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
private float OnReorderableComponentsListElementHeight(int index)
|
||||
{
|
||||
var componentProperty = GetTargetProperty(_componentsProp.GetArrayElementAtIndex(index));
|
||||
float result = EditorGUI.GetPropertyHeight(componentProperty);
|
||||
return EcsGUI.GetTypeMetaBlockHeight(result) + Spacing * 2f;
|
||||
SerializedProperty prop = _componentTemplatesProp.GetArrayElementAtIndex(index);
|
||||
GUIContent label = UnityEditorUtility.GetLabelTemp();
|
||||
return EditorGUI.GetPropertyHeight(prop, label) + Spacing * 2f;
|
||||
//var componentProperty = GetTargetProperty(_componentTemplatesProp.GetArrayElementAtIndex(index));
|
||||
//float result = EditorGUI.GetPropertyHeight(componentProperty);
|
||||
//return EcsGUI.GetTypeMetaBlockHeight(result) + Spacing * 2f;
|
||||
}
|
||||
private void OnReorderableComponentsListDrawElement(Rect rect, int index, bool isActive, bool isFocused)
|
||||
{
|
||||
if (index < 0 || Event.current.type == EventType.Used) { return; }
|
||||
SerializedProperty prop = _componentTemplatesProp.GetArrayElementAtIndex(index);
|
||||
GUIContent label = UnityEditorUtility.GetLabelTemp();
|
||||
rect = rect.AddPadding(OneLineHeight + Spacing, Spacing * 2f, Spacing, Spacing);
|
||||
using (EcsGUI.CheckChanged())
|
||||
{
|
||||
SerializedProperty prop = _componentsProp.GetArrayElementAtIndex(index);
|
||||
|
||||
IComponentTemplate template = prop.managedReferenceValue as IComponentTemplate;
|
||||
if (template == null || prop.managedReferenceValue == null)
|
||||
{
|
||||
//DrawDamagedComponent_Replaced(prop, index);
|
||||
EditorGUI.PropertyField(rect, prop, UnityEditorUtility.GetLabel(prop.displayName), true);
|
||||
return;
|
||||
}
|
||||
|
||||
var componentProp = GetTargetProperty(prop);
|
||||
|
||||
|
||||
ITypeMeta meta = template is ITypeMeta metaOverride ? metaOverride : template.Type.GetMeta();
|
||||
|
||||
if (EcsGUI.DrawTypeMetaElementBlock(ref rect, _componentsProp, index, componentProp, meta))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
GUIContent label = UnityEditorUtility.GetLabel(meta.Name);
|
||||
if (componentProp.propertyType == SerializedPropertyType.Generic)
|
||||
{
|
||||
EditorGUI.PropertyField(rect, componentProp, label, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.PropertyField(rect.AddPadding(0, 20f, 0, 0), componentProp, label, true);
|
||||
}
|
||||
|
||||
}
|
||||
EditorGUI.PropertyField(rect, prop, label);
|
||||
return;
|
||||
//rect = rect.AddPadding(OneLineHeight + Spacing, Spacing * 2f, Spacing, Spacing);
|
||||
//using (EcsGUI.CheckChanged())
|
||||
//{
|
||||
// SerializedProperty prop = _componentTemplatesProp.GetArrayElementAtIndex(index);
|
||||
//
|
||||
// var template = prop.managedReferenceValue;
|
||||
// if (template == null)
|
||||
// {
|
||||
// //DrawDamagedComponent_Replaced(prop, index);
|
||||
// EditorGUI.PropertyField(rect, prop, UnityEditorUtility.GetLabel(prop.displayName), true);
|
||||
// return;
|
||||
// }
|
||||
// IComponentTemplate componentTemplate = template as IComponentTemplate;
|
||||
// var componentProp = GetTargetProperty(prop);
|
||||
//
|
||||
// ITypeMeta meta = template as ITypeMeta;
|
||||
// if(meta == null)
|
||||
// {
|
||||
// if (componentTemplate != null)
|
||||
// {
|
||||
// meta = componentTemplate.ComponentType.GetMeta();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// meta = template.GetMeta();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (EcsGUI.DrawTypeMetaElementBlock(ref rect, _componentTemplatesProp, index, componentProp, meta).skip)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// GUIContent label = UnityEditorUtility.GetLabel(meta.Name);
|
||||
// if (componentProp.propertyType == SerializedPropertyType.Generic)
|
||||
// {
|
||||
// EditorGUI.PropertyField(rect, componentProp, label, true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// EditorGUI.PropertyField(rect.AddPadding(0, 20f, 0, 0), componentProp, label, true);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
}
|
||||
|
||||
private void OnReorderableComponentsListAdd(ReorderableList list)
|
||||
{
|
||||
list.serializedProperty.arraySize += 1;
|
||||
list.serializedProperty.GetArrayElementAtIndex(list.serializedProperty.arraySize - 1).ResetValues();
|
||||
EcsGUI.Changed = true;
|
||||
DragonGUI.Changed = true;
|
||||
}
|
||||
private void OnReorderableListRemove(ReorderableList list)
|
||||
{
|
||||
@ -137,7 +158,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
list.serializedProperty.DeleteArrayElementAtIndex(list.selectedIndices[i]);
|
||||
}
|
||||
EcsGUI.Changed = true;
|
||||
DragonGUI.Changed = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -147,9 +168,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
Init();
|
||||
|
||||
|
||||
|
||||
if (IsSO)
|
||||
{
|
||||
EcsGUI.Layout.ManuallySerializeButton(targets);
|
||||
DragonGUI.Layout.ManuallySerializeButton(targets);
|
||||
}
|
||||
|
||||
if (IsMultipleTargets)
|
||||
@ -162,17 +185,17 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
//костыль который насильно заставляет _reorderableComponentsList пересчитать высоту
|
||||
if (_reorderableComponentsListLastCount != _reorderableComponentsList.count)
|
||||
{
|
||||
EcsGUI.Changed = true;
|
||||
DragonGUI.Changed = true;
|
||||
_reorderableComponentsListLastCount = _reorderableComponentsList.count;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsMultipleTargets == false && SerializationUtility.HasManagedReferencesWithMissingTypes(target))
|
||||
{
|
||||
using (EcsGUI.Layout.BeginHorizontal(EditorStyles.helpBox))
|
||||
using (DragonGUI.Layout.BeginHorizontal(EditorStyles.helpBox))
|
||||
{
|
||||
GUILayout.Label(UnityEditorUtility.GetLabel(Icons.Instance.WarningIcon), GUILayout.ExpandWidth(false));
|
||||
using (EcsGUI.Layout.BeginVertical())
|
||||
using (DragonGUI.Layout.BeginVertical())
|
||||
{
|
||||
GUILayout.Label("This object contains SerializeReference types which are missing.", EditorStyles.miniLabel);
|
||||
if (GUILayout.Button("Repaire References Tool", EditorStyles.miniButton, GUILayout.MaxWidth(200f)))
|
||||
@ -186,33 +209,44 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
SerializedProperty iterator = serializedObject.GetIterator();
|
||||
iterator.NextVisible(true);
|
||||
using (DragonGUI.Disable)
|
||||
{
|
||||
EditorGUILayout.PropertyField(iterator, true);
|
||||
}
|
||||
while (iterator.NextVisible(false))
|
||||
{
|
||||
if (_componentsProp != null && iterator.name == _componentsProp.name)
|
||||
if ((_componentTemplatesProp != null && iterator.name == _componentTemplatesProp.name) ||
|
||||
(_templatesProp != null && iterator.name == _templatesProp.name))
|
||||
{
|
||||
using (EcsGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
||||
{
|
||||
DrawTop(_componentsProp);
|
||||
_reorderableComponentsList.DoLayoutList();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.PropertyField(iterator, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (_templatesProp != null)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_templatesProp, true);
|
||||
}
|
||||
using (DragonGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
||||
{
|
||||
DrawTop(_componentTemplatesProp);
|
||||
_reorderableComponentsList.DoLayoutList();
|
||||
}
|
||||
}
|
||||
private void DrawTop(SerializedProperty componentsProp)
|
||||
{
|
||||
GUILayout.Space(2f);
|
||||
|
||||
switch (EcsGUI.Layout.AddClearComponentButtons(out Rect rect))
|
||||
switch (DragonGUI.Layout.AddClearComponentButtons(out Rect rect))
|
||||
{
|
||||
case EcsGUI.AddClearButton.Add:
|
||||
case DragonGUI.AddClearButton.Add:
|
||||
Init();
|
||||
_componentDropDown.OpenForArray(rect, componentsProp, true);
|
||||
break;
|
||||
case EcsGUI.AddClearButton.Clear:
|
||||
case DragonGUI.AddClearButton.Clear:
|
||||
Init();
|
||||
componentsProp.ClearArray();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
@ -1,20 +1,35 @@
|
||||
#if DISABLE_DEBUG
|
||||
#undef DEBUG
|
||||
#endif
|
||||
using DCFApixels.DragonECS.Unity;
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
using static DCFApixels.DragonECS.IComponentTemplate;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = true, AllowMultiple = false)]
|
||||
public sealed class DragonMemberWrapperAttribute : Attribute
|
||||
{
|
||||
public string WrappedFieldName;
|
||||
public DragonMemberWrapperAttribute(string wrappedFieldName)
|
||||
{
|
||||
WrappedFieldName = wrappedFieldName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
|
||||
public interface IComponentTemplate : ITemplateNode
|
||||
{
|
||||
#region Properties
|
||||
Type Type { get; }
|
||||
Type ComponentType { get; }
|
||||
bool IsUnique { get; }
|
||||
#endregion
|
||||
|
||||
@ -33,94 +48,168 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public abstract class ComponentTemplateBase : IComponentTemplate, ITypeMeta
|
||||
[DragonMemberWrapper("component")]
|
||||
[MetaColor(MetaColor.DragonCyan)]
|
||||
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.OTHER_GROUP)]
|
||||
[MetaProxy(typeof(ComponentTemplateMetaProxy))]
|
||||
public abstract class ComponentTemplateBase : IComponentTemplate
|
||||
{
|
||||
#region Properties
|
||||
public abstract Type Type { get; }
|
||||
public virtual ITypeMeta BaseMeta { get { return null; } }
|
||||
public virtual string Name { get { return string.Empty; } }
|
||||
public virtual MetaColor Color { get { return new MetaColor(MetaColor.Black); } }
|
||||
public virtual MetaGroup Group { get { return MetaGroup.Empty; } }
|
||||
public virtual MetaDescription Description { get { return MetaDescription.Empty; } }
|
||||
public virtual IReadOnlyList<string> Tags { get { return Array.Empty<string>(); } }
|
||||
public abstract Type ComponentType { get; }
|
||||
public virtual bool IsUnique { get { return true; } }
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public abstract object GetRaw();
|
||||
public abstract void SetRaw(object raw);
|
||||
public virtual void OnGizmos(Transform transform, GizmosMode mode) { }
|
||||
public virtual void OnGizmos(Transform transform, IComponentTemplate.GizmosMode mode) { }
|
||||
public virtual void OnValidate(UnityEngine.Object obj) { }
|
||||
|
||||
public abstract void Apply(short worldID, int entityID);
|
||||
#endregion
|
||||
|
||||
#region MetaProxy
|
||||
protected class ComponentTemplateMetaProxy : MetaProxyBase
|
||||
{
|
||||
protected TypeMeta Meta;
|
||||
public override string Name { get { return Meta?.Name; } }
|
||||
public override MetaColor? Color { get { return Meta != null && Meta.IsCustomColor ? Meta.Color : null; } }
|
||||
public override MetaGroup Group { get { return Meta?.Group; } }
|
||||
public override MetaDescription Description { get { return Meta?.Description; } }
|
||||
public override IEnumerable<string> Tags { get { return Meta?.Tags; } }
|
||||
public ComponentTemplateMetaProxy(Type type) : base(type)
|
||||
{
|
||||
Meta = null;
|
||||
var fields = type.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (var field in fields)
|
||||
{
|
||||
if (field.Name == "component")
|
||||
{
|
||||
Meta = field.FieldType.GetMeta();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public abstract class ComponentTemplateBase<T> : ComponentTemplateBase, ICloneable
|
||||
where T : struct
|
||||
{
|
||||
protected static readonly TypeMeta Meta = EcsDebugUtility.GetTypeMeta<T>();
|
||||
|
||||
private static bool _defaultValueTypeInit = false;
|
||||
private static T _defaultValueType;
|
||||
protected static T DefaultValueType
|
||||
private static bool _defaultValueInit = false;
|
||||
private static bool _hasDefaultValue = false;
|
||||
private static T _defaultValue;
|
||||
private static ICloneable _defaultValueCloneable;
|
||||
private static CloneMethod _defaultValueCloneMethod;
|
||||
private enum CloneMethod
|
||||
{
|
||||
Set,
|
||||
Clone_Reflection,
|
||||
ICloneable,
|
||||
}
|
||||
protected static void InitStatic()
|
||||
{
|
||||
if (_defaultValueInit == false)
|
||||
{
|
||||
_hasDefaultValue = false;
|
||||
Type type = typeof(T);
|
||||
FieldInfo field;
|
||||
field = type.GetField("Default", BindingFlags.Static | BindingFlags.Public);
|
||||
if (field != null && field.FieldType == type)
|
||||
{
|
||||
_defaultValue = (T)field.GetValue(null);
|
||||
_hasDefaultValue = true;
|
||||
}
|
||||
if(_hasDefaultValue == false)
|
||||
{
|
||||
field = type.GetField("Empty", BindingFlags.Static | BindingFlags.Public);
|
||||
if (field != null && field.FieldType == type)
|
||||
{
|
||||
_defaultValue = (T)field.GetValue(null);
|
||||
_hasDefaultValue = true;
|
||||
}
|
||||
}
|
||||
if (_defaultValue == null)
|
||||
{
|
||||
_hasDefaultValue = false;
|
||||
}
|
||||
|
||||
if (_hasDefaultValue)
|
||||
{
|
||||
_defaultValueCloneable = _defaultValue as ICloneable;
|
||||
_defaultValueCloneMethod = CloneMethod.Set;
|
||||
|
||||
if (type.IsValueType == false)
|
||||
{
|
||||
_defaultValueCloneMethod = CloneMethod.Clone_Reflection;
|
||||
}
|
||||
if (_defaultValueCloneable != null)
|
||||
{
|
||||
_defaultValueCloneMethod = CloneMethod.ICloneable;
|
||||
}
|
||||
}
|
||||
|
||||
_defaultValueInit = true;
|
||||
}
|
||||
}
|
||||
protected virtual T DefaultComponent
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_defaultValueTypeInit == false)
|
||||
if (_hasDefaultValue)
|
||||
{
|
||||
Type type = typeof(T);
|
||||
if (type.IsValueType)
|
||||
{
|
||||
FieldInfo field;
|
||||
field = type.GetField("Default", BindingFlags.Static | BindingFlags.Public);
|
||||
if (field != null && field.FieldType == type)
|
||||
{
|
||||
_defaultValueType = (T)field.GetValue(null);
|
||||
}
|
||||
field = type.GetField("Empty", BindingFlags.Static | BindingFlags.Public);
|
||||
if (field != null && field.FieldType == type)
|
||||
{
|
||||
_defaultValueType = (T)field.GetValue(null);
|
||||
}
|
||||
}
|
||||
_defaultValueTypeInit = true;
|
||||
return CloneComponent(_defaultValue);
|
||||
}
|
||||
return _defaultValueType;
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
protected T component = DefaultValueType;
|
||||
protected T component;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private byte _offset; // Avoids the error "Cannot get managed reference index with out bounds offset"
|
||||
|
||||
#region Properties
|
||||
public sealed override ITypeMeta BaseMeta { get { return Meta; } }
|
||||
public sealed override Type Type { get { return typeof(T); } }
|
||||
public override string Name { get { return Meta.Name; } }
|
||||
public override MetaColor Color { get { return Meta.Color; } }
|
||||
public override MetaGroup Group { get { return Meta.Group; } }
|
||||
public override MetaDescription Description { get { return Meta.Description; } }
|
||||
public override IReadOnlyList<string> Tags { get { return Meta.Tags; } }
|
||||
#endregion
|
||||
public ComponentTemplateBase()
|
||||
{
|
||||
InitStatic();
|
||||
component = DefaultComponent;
|
||||
}
|
||||
|
||||
public sealed override Type ComponentType { get { return typeof(T); } }
|
||||
|
||||
#region Methods
|
||||
public sealed override object GetRaw() { return component; }
|
||||
public sealed override void SetRaw(object raw) { component = (T)raw; }
|
||||
protected virtual T CloneComponent() { return component; }
|
||||
protected virtual T CloneComponent(T component)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
switch (_defaultValueCloneMethod)
|
||||
{
|
||||
case CloneMethod.Set:
|
||||
return component;
|
||||
case CloneMethod.Clone_Reflection:
|
||||
return (T)component.Clone_Reflection();
|
||||
case CloneMethod.ICloneable:
|
||||
return (T)_defaultValueCloneable.Clone();
|
||||
}
|
||||
#endif
|
||||
return default;
|
||||
}
|
||||
object ICloneable.Clone()
|
||||
{
|
||||
ComponentTemplateBase<T> templateClone = (ComponentTemplateBase<T>)MemberwiseClone();
|
||||
templateClone.component = CloneComponent();
|
||||
templateClone.component = CloneComponent(component);
|
||||
return templateClone;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public abstract class ComponentTemplate<T> : ComponentTemplateBase<T>
|
||||
[System.Serializable]
|
||||
public class ComponentTemplate<T> : ComponentTemplateBase<T>
|
||||
where T : struct, IEcsComponent
|
||||
{
|
||||
public override void Apply(short worldID, int entityID)
|
||||
@ -128,7 +217,8 @@ namespace DCFApixels.DragonECS
|
||||
EcsPool<T>.Apply(ref component, entityID, worldID);
|
||||
}
|
||||
}
|
||||
public abstract class TagComponentTemplate<T> : ComponentTemplateBase<T>
|
||||
[System.Serializable]
|
||||
public class TagComponentTemplate<T> : ComponentTemplateBase<T>
|
||||
where T : struct, IEcsTagComponent
|
||||
{
|
||||
public override void Apply(short worldID, int entityID)
|
||||
@ -175,7 +265,9 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
if (_meta == null)
|
||||
{
|
||||
_meta = ComponentType.GetMeta();
|
||||
{
|
||||
_meta = ComponentType.GetMeta();
|
||||
}
|
||||
}
|
||||
return _meta;
|
||||
}
|
||||
@ -194,7 +286,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
field = Type.GetField("Default", BindingFlags.Static | BindingFlags.Public);
|
||||
if (field != null && field.FieldType == Type)
|
||||
{
|
||||
_defaultValueDummy = field.GetValue(null);
|
||||
_defaultValueDummy = field.GetValue(null).Clone_Reflection();
|
||||
}
|
||||
|
||||
if(_defaultValueDummy == null)
|
||||
@ -202,7 +294,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
field = Type.GetField("Empty", BindingFlags.Static | BindingFlags.Public);
|
||||
if (field != null && field.FieldType == Type)
|
||||
{
|
||||
_defaultValueDummy = field.GetValue(null);
|
||||
_defaultValueDummy = field.GetValue(null).Clone_Reflection();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -216,15 +308,17 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
Type = type;
|
||||
|
||||
IsUnique = false;
|
||||
if (typeof(IComponentTemplate).IsAssignableFrom(type))
|
||||
if (type.GetInterfaces().Contains(typeof(ITypeMeta)))
|
||||
{
|
||||
var metaOverride = (ITypeMeta)Activator.CreateInstance(type);
|
||||
_meta = metaOverride;
|
||||
}
|
||||
|
||||
if (type.GetInterfaces().Contains(typeof(IComponentTemplate)))
|
||||
{
|
||||
var ct = (IComponentTemplate)Activator.CreateInstance(type);
|
||||
IsUnique = ct.IsUnique;
|
||||
ComponentType = ct.Type;
|
||||
if (ct is ITypeMeta metaOverride)
|
||||
{
|
||||
_meta = metaOverride;
|
||||
}
|
||||
ComponentType = ct.ComponentType;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#if DISABLE_DEBUG
|
||||
#undef DEBUG
|
||||
#endif
|
||||
using DCFApixels.DragonECS.Unity.Editors;
|
||||
using DCFApixels.DragonECS.Unity;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using UnityEngine;
|
||||
@ -12,7 +12,10 @@ namespace DCFApixels.DragonECS
|
||||
public struct ComponentTemplateProperty : IEquatable<ComponentTemplateProperty>
|
||||
{
|
||||
[SerializeReference]
|
||||
[ReferenceDropDown]
|
||||
[DragonMetaBlock]
|
||||
private ITemplateNode _template;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public ComponentTemplateProperty(ITemplateNode template)
|
||||
{
|
||||
@ -28,7 +31,7 @@ namespace DCFApixels.DragonECS
|
||||
public Type Type
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return _template is IComponentTemplate tml ? tml.Type : _template.GetType(); }
|
||||
get { return _template is IComponentTemplate tml ? tml.ComponentType : _template.GetType(); }
|
||||
}
|
||||
public bool IsNull
|
||||
{
|
||||
@ -82,13 +85,4 @@ namespace DCFApixels.DragonECS
|
||||
public static bool operator !=(Null? a, ComponentTemplateProperty b) { return !b.IsNull; }
|
||||
public readonly struct Null { }
|
||||
}
|
||||
|
||||
public sealed class ComponentTemplateFieldAttribute : PropertyAttribute, IReferenceButtonAttribute
|
||||
{
|
||||
public Type[] PredicateTypes;
|
||||
Type[] IReferenceButtonAttribute.PredicateTypes { get { return PredicateTypes; } }
|
||||
bool IReferenceButtonAttribute.IsHideButtonIfNotNull { get { return true; } }
|
||||
public ComponentTemplateFieldAttribute() { }
|
||||
}
|
||||
public sealed class ComponentTemplateAttribute : PropertyAttribute { }
|
||||
}
|
||||
@ -2,6 +2,7 @@
|
||||
#undef DEBUG
|
||||
#endif
|
||||
using DCFApixels.DragonECS.Unity;
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -24,8 +25,8 @@ namespace DCFApixels.DragonECS
|
||||
public class MonoEntityTemplate : MonoEntityTemplateBase, ITemplateNode
|
||||
{
|
||||
[SerializeReference]
|
||||
[ReferenceButton(true, typeof(ITemplateNode))]
|
||||
[FormerlySerializedAs("_components")]
|
||||
[ReferenceDropDown(true)]
|
||||
[DragonMetaBlock]
|
||||
private ITemplateNode[] _componentTemplates;
|
||||
|
||||
#region Methods
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#undef DEBUG
|
||||
#endif
|
||||
using DCFApixels.DragonECS.Unity;
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -25,8 +26,8 @@ namespace DCFApixels.DragonECS
|
||||
[SerializeField]
|
||||
private ScriptableEntityTemplateBase[] _templates;
|
||||
[SerializeReference]
|
||||
[ReferenceButton(true, typeof(ITemplateNode))]
|
||||
[FormerlySerializedAs("_components")]
|
||||
[ReferenceDropDown(true)]
|
||||
[DragonMetaBlock]
|
||||
private ITemplateNode[] _componentTemplates;
|
||||
|
||||
#region Methods
|
||||
|
||||
@ -62,7 +62,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
private void OnReorderableListDrawEmptyElement(Rect rect, int index, bool isActive, bool isFocused) { }
|
||||
private void OnReorderableListReorder(ReorderableList list)
|
||||
{
|
||||
EcsGUI.Changed = true;
|
||||
DragonGUI.Changed = true;
|
||||
}
|
||||
private void OnReorderableListRemove(ReorderableList list)
|
||||
{
|
||||
@ -78,7 +78,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
list.serializedProperty.DeleteArrayElementAtIndex(list.selectedIndices[i]);
|
||||
}
|
||||
EcsGUI.Changed = true;
|
||||
DragonGUI.Changed = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -86,11 +86,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
private static readonly HashSet<string> _defaultLayersSet = new HashSet<string>(PipelineTemplateUtility.DefaultLayers);
|
||||
private void OnReorderableLayersListDrawElement(Rect rect, int index, bool isActive, bool isFocused)
|
||||
{
|
||||
using (EcsGUI.CheckChanged())
|
||||
using (DragonGUI.CheckChanged())
|
||||
{
|
||||
var elementProp = _layersProp.GetArrayElementAtIndex(index);
|
||||
string str = elementProp.stringValue;
|
||||
using (EcsGUI.SetEnable(_defaultLayersSet.Contains(str) == false))
|
||||
using (DragonGUI.SetEnable(_defaultLayersSet.Contains(str) == false))
|
||||
{
|
||||
elementProp.stringValue = EditorGUI.TextField(rect, str);
|
||||
}
|
||||
@ -102,7 +102,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
var added = list.serializedProperty.GetArrayElementAtIndex(list.serializedProperty.arraySize - 1);
|
||||
added.stringValue = $"Layer-{DateTime.Now.Ticks}";
|
||||
added.serializedObject.ApplyModifiedProperties();
|
||||
EcsGUI.Changed = true;
|
||||
DragonGUI.Changed = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -111,7 +111,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
if (index < 0 || Event.current.type == EventType.Used) { return; }
|
||||
rect = rect.AddPadding(OneLineHeight + Spacing, Spacing * 2f, Spacing, Spacing);
|
||||
using (EcsGUI.CheckChanged())
|
||||
using (DragonGUI.CheckChanged())
|
||||
{
|
||||
SerializedProperty prop = _recordsProp.GetArrayElementAtIndex(index);
|
||||
var targetProp = prop.FindPropertyRelative(nameof(PipelineTemplateUtility.Record.target));
|
||||
@ -119,7 +119,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
bool isNull = targetProp.managedReferenceValue == null;
|
||||
ITypeMeta meta = isNull ? null : targetProp.managedReferenceValue.GetMeta();
|
||||
|
||||
if (EcsGUI.DrawTypeMetaElementBlock(ref rect, _recordsProp, index, prop, meta))
|
||||
if (DragonGUI.DrawTypeMetaElementBlock(ref rect, _recordsProp, index, prop, meta).skip)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -130,14 +130,14 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
float result;
|
||||
result = EditorGUI.GetPropertyHeight(_recordsProp.GetArrayElementAtIndex(index));
|
||||
return EcsGUI.GetTypeMetaBlockHeight(result) + Spacing * 2f;
|
||||
return DragonGUI.GetTypeMetaBlockHeight(result) + Spacing * 2f;
|
||||
}
|
||||
|
||||
private void OnReorderableRecordsListAdd(ReorderableList list)
|
||||
{
|
||||
list.serializedProperty.arraySize += 1;
|
||||
list.serializedProperty.GetArrayElementAtIndex(list.serializedProperty.arraySize - 1).ResetValues();
|
||||
EcsGUI.Changed = true;
|
||||
DragonGUI.Changed = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -146,7 +146,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
if (IsSO)
|
||||
{
|
||||
EcsGUI.Layout.ManuallySerializeButton(targets);
|
||||
DragonGUI.Layout.ManuallySerializeButton(targets);
|
||||
}
|
||||
|
||||
if (IsMultipleTargets)
|
||||
@ -155,13 +155,13 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
return;
|
||||
}
|
||||
|
||||
EcsGUI.Changed = GUILayout.Button("Validate");
|
||||
DragonGUI.Changed = GUILayout.Button("Validate");
|
||||
|
||||
DrawLayoutNameList(_layersProp);
|
||||
EditorGUILayout.PropertyField(_parametersProp, UnityEditorUtility.GetLabel(_parametersProp.displayName));
|
||||
DrawRecordList(_recordsProp);
|
||||
|
||||
if (EcsGUI.Changed)
|
||||
if (DragonGUI.Changed)
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
Validate();
|
||||
@ -181,7 +181,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
|
||||
private void DrawLayoutNameList(SerializedProperty layersProp)
|
||||
{
|
||||
using (EcsGUI.Layout.BeginVertical())
|
||||
using (DragonGUI.Layout.BeginVertical())
|
||||
{
|
||||
GUILayout.Label(UnityEditorUtility.GetLabel(layersProp.displayName), EditorStyles.boldLabel);
|
||||
_reorderableLayersList.DoLayoutList();
|
||||
@ -190,16 +190,16 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
private void DrawRecordList(SerializedProperty recordsProp)
|
||||
{
|
||||
GUILayout.Label(UnityEditorUtility.GetLabel(recordsProp.displayName), EditorStyles.boldLabel);
|
||||
using (EcsGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
||||
using (DragonGUI.Layout.BeginVertical(UnityEditorUtility.GetTransperentBlackBackgrounStyle()))
|
||||
{
|
||||
GUILayout.Space(4f);
|
||||
|
||||
switch (EcsGUI.Layout.AddClearSystemButtons(out Rect dropDownRect))
|
||||
switch (DragonGUI.Layout.AddClearSystemButtons(out Rect dropDownRect))
|
||||
{
|
||||
case EcsGUI.AddClearButton.Add:
|
||||
case DragonGUI.AddClearButton.Add:
|
||||
_systemsDropDown.OpenForArray(dropDownRect, recordsProp);
|
||||
break;
|
||||
case EcsGUI.AddClearButton.Clear:
|
||||
case DragonGUI.AddClearButton.Clear:
|
||||
recordsProp.ClearArray();
|
||||
recordsProp.serializedObject.ApplyModifiedProperties();
|
||||
break;
|
||||
|
||||
@ -21,7 +21,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
|
||||
using (EcsGUI.SetIndentLevel(IsArrayElement ? EcsGUI.IndentLevel : EcsGUI.IndentLevel + 1))
|
||||
using (DragonGUI.SetIndentLevel(IsArrayElement ? DragonGUI.IndentLevel : DragonGUI.IndentLevel + 1))
|
||||
{
|
||||
Rect subPosition = position;
|
||||
int depth = -1;
|
||||
@ -41,7 +41,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
protected override float GetCustomHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
float result = 0f;
|
||||
if (IsArrayElement == false)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#if DISABLE_DEBUG
|
||||
#undef DEBUG
|
||||
#endif
|
||||
using DCFApixels.DragonECS.RunnersCore;
|
||||
using DCFApixels.DragonECS.Core;
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -103,8 +103,8 @@ namespace DCFApixels.DragonECS.Unity
|
||||
public struct Record
|
||||
{
|
||||
[SerializeReference]
|
||||
[ReferenceButton(true, typeof(IEcsModule), typeof(IEcsProcess))]
|
||||
[ReferenceButtonWithOut(typeof(IEcsRunner))]
|
||||
[ReferenceDropDown(true, typeof(IEcsModule), typeof(IEcsProcess))]
|
||||
[ReferenceDropDownWithout(typeof(IEcsRunner))]
|
||||
[ArrayElement]
|
||||
public object target;// нельзя менять поярдок полей, иначе это поломает отрисовку в инспекторе изза применения property.Next(bool);
|
||||
public AddParams parameters;
|
||||
|
||||
@ -36,7 +36,7 @@ namespace DCFApixels.DragonECS.Unity.Docs
|
||||
|
||||
private static List<Type> GetTypes()
|
||||
{
|
||||
Type metaAttributeType = typeof(EcsMetaAttribute);
|
||||
Type metaAttributeType = typeof(DragonMetaAttribute);
|
||||
List<Type> result = new List<Type>(512);
|
||||
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
|
||||
@ -57,6 +57,20 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
private void OnGUI()
|
||||
{
|
||||
Event current = Event.current;
|
||||
int moveSign = 0;
|
||||
if (hasFocus && current.type == EventType.KeyUp && current.isKey)
|
||||
{
|
||||
if(current.keyCode == KeyCode.DownArrow)
|
||||
{
|
||||
moveSign = 1;
|
||||
}
|
||||
if (current.keyCode == KeyCode.UpArrow)
|
||||
{
|
||||
moveSign = -1;
|
||||
}
|
||||
}
|
||||
// _selectedIndex += moveSign;
|
||||
|
||||
DragonDocs docs = DragonDocsPrefs.instance.Docs;
|
||||
if (docs == null || docs.Metas.IsEmpty)
|
||||
{
|
||||
@ -79,22 +93,21 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
_selectedIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
DrawToolbar();
|
||||
|
||||
GUILayout.BeginHorizontal(GUILayout.ExpandHeight(true));
|
||||
|
||||
MetaGroupInfo selectedGroupInfo;
|
||||
using (EcsGUI.Layout.BeginScrollView(ref ButtonsScrolPosition, UnityEditorUtility.GetClearBackgrounStyle(), GUILayout.Width(_buttonsWidth)))
|
||||
using (DragonGUI.Layout.BeginScrollView(ref ButtonsScrolPosition, UnityEditorUtility.GetClearBackgrounStyle(), GUILayout.Width(_buttonsWidth)))
|
||||
{
|
||||
selectedGroupInfo = DrawGroups();
|
||||
selectedGroupInfo = DrawGroups(moveSign);
|
||||
}
|
||||
|
||||
DrawDragger();
|
||||
|
||||
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * -2f);
|
||||
|
||||
using (EcsGUI.Layout.BeginScrollView(ref DataScrolPosition, UnityEditorUtility.GetTransperentBlackBackgrounStyle(), GUILayout.ExpandWidth(true)))
|
||||
using (DragonGUI.Layout.BeginScrollView(ref DataScrolPosition, UnityEditorUtility.GetTransperentBlackBackgrounStyle(), GUILayout.ExpandWidth(true)))
|
||||
{
|
||||
DrawSelectedGroupMeta(selectedGroupInfo);
|
||||
}
|
||||
@ -115,11 +128,17 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
{
|
||||
GUILayout.Label(infos[_selectedIndex].Path);
|
||||
}
|
||||
|
||||
if (moveSign != 0)
|
||||
{
|
||||
Repaint();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawToolbar()
|
||||
{
|
||||
using (EcsGUI.SetColor(GUI.color * 0.8f))
|
||||
using (DragonGUI.SetColor(GUI.color * 0.8f))
|
||||
GUILayout.BeginHorizontal(EditorStyles.toolbar);
|
||||
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing * 2f);
|
||||
|
||||
@ -129,12 +148,12 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
DragonDocsPrefs.instance.Save(docs);
|
||||
}
|
||||
|
||||
if (EcsGUI.Layout.IconButton(IsShowHidden ? Icons.Instance.VisibilityIconOn : Icons.Instance.VisibilityIconOff, 0f, IsShowHidden ? "Show Hidden" : "Don't Show Hidden", EditorStyles.toolbarButton, GUILayout.Width(EditorGUIUtility.singleLineHeight * 1.6f)))
|
||||
if (DragonGUI.Layout.IconButton(IsShowHidden ? Icons.Instance.VisibilityIconOn : Icons.Instance.VisibilityIconOff, 0f, IsShowHidden ? "Show Hidden" : "Don't Show Hidden", EditorStyles.toolbarButton, GUILayout.Width(EditorGUIUtility.singleLineHeight * 1.6f)))
|
||||
{
|
||||
IsShowHidden = !IsShowHidden;
|
||||
}
|
||||
|
||||
if (EcsGUI.Layout.IconButton(IsUseCustomNames ? Icons.Instance.LabelIconMeta : Icons.Instance.LabelIconType, 1f, IsUseCustomNames ? "Use Meta Name" : "Use Type Name", EditorStyles.toolbarButton, GUILayout.Width(EditorGUIUtility.singleLineHeight * 1.6f)))
|
||||
if (DragonGUI.Layout.IconButton(IsUseCustomNames ? Icons.Instance.LabelIconMeta : Icons.Instance.LabelIconType, 1f, IsUseCustomNames ? "Use Meta Name" : "Use Type Name", EditorStyles.toolbarButton, GUILayout.Width(EditorGUIUtility.singleLineHeight * 1.6f)))
|
||||
{
|
||||
IsUseCustomNames = !IsUseCustomNames;
|
||||
}
|
||||
@ -147,7 +166,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
_searchingSampleChanged = true;
|
||||
}
|
||||
if ((_searchingSampleChanged && Event.current.keyCode == KeyCode.Return) ||
|
||||
EcsGUI.Layout.IconButton(Icons.Instance.SearchIcon, 1f, null, EditorStyles.toolbarButton, GUILayout.ExpandHeight(true), GUILayout.Width(EditorGUIUtility.singleLineHeight * 1.6f)))
|
||||
DragonGUI.Layout.IconButton(Icons.Instance.SearchIcon, 1f, null, EditorStyles.toolbarButton, GUILayout.ExpandHeight(true), GUILayout.Width(EditorGUIUtility.singleLineHeight * 1.6f)))
|
||||
{
|
||||
Searh();
|
||||
}
|
||||
@ -246,29 +265,29 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
|
||||
private void DrawMeta(DragonDocsMeta meta, int index, int total)
|
||||
{
|
||||
using (EcsGUI.SetIndentLevel(0))
|
||||
using (DragonGUI.SetIndentLevel(0))
|
||||
{
|
||||
Color panelColor = EcsGUI.SelectPanelColor(meta.Color.ToMetaColor(), meta.IsCustomColor, index, total).Desaturate(EscEditorConsts.COMPONENT_DRAWER_DESATURATE);
|
||||
Color panelColor = DragonGUI.SelectPanelColor(meta.Color.ToMetaColor(), meta.IsCustomColor, index, total).Desaturate(EscEditorConsts.COMPONENT_DRAWER_DESATURATE);
|
||||
Color alphaPanelColor = panelColor;
|
||||
alphaPanelColor.a = EscEditorConsts.COMPONENT_DRAWER_ALPHA;
|
||||
alphaPanelColor.a = EscEditorConsts.MetaBlockFillStyle_Alpha;
|
||||
|
||||
using (EcsGUI.Layout.BeginVertical(alphaPanelColor))
|
||||
using (DragonGUI.Layout.BeginVertical(alphaPanelColor))
|
||||
{
|
||||
GUILayout.Space(1f);
|
||||
|
||||
//draw title block
|
||||
using (EcsGUI.Layout.BeginHorizontal())
|
||||
using (DragonGUI.Layout.BeginHorizontal())
|
||||
{
|
||||
GUILayout.TextArea(IsUseCustomNames ? meta.Name : meta.TypeName, EditorStyles.boldLabel, GUILayout.ExpandWidth(false));
|
||||
|
||||
if (meta.TryGetSourceType(out System.Type targetType) && ScriptsCache.TryGetScriptAsset(targetType.GetMeta(), out MonoScript script))
|
||||
{
|
||||
EcsGUI.Layout.ScriptAssetButton(script, GUILayout.Width(18f));
|
||||
DragonGUI.Layout.ScriptAssetButton(script, GUILayout.Width(18f));
|
||||
}
|
||||
|
||||
if (meta.IsCustomName)
|
||||
{
|
||||
using (EcsGUI.SetAlpha(0.64f)) using (EcsGUI.SetAlignment(GUI.skin.label, TextAnchor.MiddleRight))
|
||||
using (DragonGUI.SetAlpha(0.64f)) using (DragonGUI.SetAlignment(GUI.skin.label, TextAnchor.MiddleRight))
|
||||
{
|
||||
GUILayout.TextArea(IsUseCustomNames ? meta.TypeName : meta.Name, GUI.skin.label);
|
||||
}
|
||||
@ -282,7 +301,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
if (string.IsNullOrEmpty(meta.MetaID) == false)
|
||||
{
|
||||
GUILayout.Space(-EditorGUIUtility.standardVerticalSpacing);
|
||||
EcsGUI.Layout.CopyMetaIDButton(meta.MetaID, GUILayout.Width(18f));
|
||||
DragonGUI.Layout.CopyMetaIDButton(meta.MetaID, GUILayout.Width(18f));
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,7 +334,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
GUILayout.Space(3f);
|
||||
|
||||
var tagsstring = string.Join(',', meta._tags);
|
||||
using (EcsGUI.SetAlpha(0.5f))
|
||||
using (DragonGUI.SetAlpha(0.5f))
|
||||
{
|
||||
GUILayout.TextArea(tagsstring, EditorStyles.wordWrappedMiniLabel);
|
||||
}
|
||||
@ -326,14 +345,17 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
}
|
||||
}
|
||||
|
||||
private MetaGroupInfo DrawGroups()
|
||||
private MetaGroupInfo DrawGroups(int moveSign)
|
||||
{
|
||||
Event current = Event.current;
|
||||
MetaGroupInfo result = new MetaGroupInfo("NO_NAME", "NO_NAME", 0, 0, 0);
|
||||
var infos = Prefs.Infos;
|
||||
var isExpands = Prefs.IsExpands;
|
||||
|
||||
using (EcsGUI.SetIndentLevel(0))
|
||||
int prevIndex = 0;
|
||||
int nextIndex = 0;
|
||||
|
||||
using (DragonGUI.SetIndentLevel(0))
|
||||
{
|
||||
int clippingDepth = int.MaxValue;
|
||||
|
||||
@ -360,10 +382,19 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
{
|
||||
clippingDepth = int.MaxValue;
|
||||
}
|
||||
if(nextIndex < _selectedIndex)
|
||||
{
|
||||
prevIndex = nextIndex;
|
||||
}
|
||||
if (nextIndex <= _selectedIndex)
|
||||
{
|
||||
nextIndex = i;
|
||||
}
|
||||
|
||||
|
||||
if (_searchingSample.Length == 0)
|
||||
{
|
||||
EcsGUI.IndentLevel = groupInfo.Depth;
|
||||
DragonGUI.IndentLevel = groupInfo.Depth;
|
||||
}
|
||||
|
||||
GUIContent label = UnityEditorUtility.GetLabel(_searchingSample.Length == 0 ? groupInfo.Name : groupInfo.Path);
|
||||
@ -374,10 +405,10 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
EditorGUI.DrawRect(r, new Color(0.12f, 0.5f, 1f, 0.40f));
|
||||
}
|
||||
|
||||
using (EcsGUI.SetColor(0, 0, 0, 0)) using (EcsGUI.Disable) { GUI.Button(r, ""); }
|
||||
using (DragonGUI.SetColor(0, 0, 0, 0)) using (DragonGUI.Disable) { GUI.Button(r, ""); }
|
||||
|
||||
bool isClick = false;
|
||||
if (EcsGUI.HitTest(r))
|
||||
if (DragonGUI.HitTest(r))
|
||||
{
|
||||
EditorGUI.DrawRect(r, new Color(1f, 1f, 1f, 0.12f));
|
||||
if (current.type == EventType.MouseUp)
|
||||
@ -391,7 +422,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
|
||||
if (_searchingSample.Length != 0 || (i + 1 == infos.Length || infos[i + 1].Depth <= groupInfo.Depth))
|
||||
{
|
||||
using (EcsGUI.SetBackgroundColor(0, 0, 0, 0))
|
||||
using (DragonGUI.SetBackgroundColor(0, 0, 0, 0))
|
||||
{
|
||||
EditorGUI.Foldout(r, false, label, EditorStyles.foldout);
|
||||
}
|
||||
@ -428,6 +459,18 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(moveSign != 0)
|
||||
{
|
||||
if(moveSign < 0)
|
||||
{
|
||||
_selectedIndex = prevIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedIndex = nextIndex;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -451,7 +494,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors
|
||||
switch (current.type)
|
||||
{
|
||||
case EventType.MouseDown:
|
||||
if (EcsGUI.HitTest(rect))
|
||||
if (DragonGUI.HitTest(rect))
|
||||
{
|
||||
_buttonsWidthDragStartPos = current.mousePosition;
|
||||
_buttonsWidthDragStartValue = _buttonsWidth;
|
||||
|
||||
@ -61,7 +61,7 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
|
||||
if (index < 0 || index >= _cachedMissingsResolvingDatas.Length) { return; }
|
||||
ref var data = ref _cachedMissingsResolvingDatas[index];
|
||||
|
||||
using (EcsGUI.SetAlpha(0))
|
||||
using (DragonGUI.SetAlpha(0))
|
||||
{
|
||||
if (GUI.Button(rect, ""))
|
||||
{
|
||||
@ -75,7 +75,7 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
|
||||
{
|
||||
EditorGUI.DrawRect(rect, _activedColor);
|
||||
}
|
||||
if (EcsGUI.HitTest(rect))
|
||||
if (DragonGUI.HitTest(rect))
|
||||
{
|
||||
EditorGUI.DrawRect(rect, _dragColor);
|
||||
}
|
||||
@ -122,7 +122,7 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
|
||||
GUI.Label(nameRect, name);
|
||||
EditorGUI.DrawRect(oldRect, new Color(0, 0, 0, 0.16f));
|
||||
GUI.Label(oldRect, oldStr);
|
||||
using (EcsGUI.SetAlignment(GUI.skin.label, TextAnchor.MiddleCenter))
|
||||
using (DragonGUI.SetAlignment(GUI.skin.label, TextAnchor.MiddleCenter))
|
||||
{
|
||||
GUI.Label(arrowRect, "->");
|
||||
}
|
||||
@ -160,16 +160,16 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
|
||||
_panel = new GUIStyle();
|
||||
_panel.padding = new RectOffset(5, 5, 5, 5);
|
||||
}
|
||||
using (EcsGUI.Layout.BeginVertical(_panel))
|
||||
using (DragonGUI.Layout.BeginVertical(_panel))
|
||||
{
|
||||
const string LIST_EMPTY_MESSAGE = "List of Missings is Empty";
|
||||
const string COLLECT_BUTTON = "Collect Missings";
|
||||
if (_missingRefContainer.IsEmpty)
|
||||
{
|
||||
GUILayout.Label("", GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
|
||||
using (EcsGUI.SetFontSize(14))
|
||||
using (EcsGUI.SetFontSize(GUI.skin.button, 14))
|
||||
using (EcsGUI.SetAlignment(value: TextAnchor.MiddleCenter))
|
||||
using (DragonGUI.SetFontSize(14))
|
||||
using (DragonGUI.SetFontSize(GUI.skin.button, 14))
|
||||
using (DragonGUI.SetAlignment(value: TextAnchor.MiddleCenter))
|
||||
{
|
||||
Vector2 center = GUILayoutUtility.GetLastRect().center;
|
||||
Vector2 labelSize = GUI.skin.label.CalcSize(UnityEditorUtility.GetLabel(LIST_EMPTY_MESSAGE));
|
||||
@ -184,7 +184,7 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
|
||||
r = new Rect(Vector2.zero, buttonSize);
|
||||
r.center = center;
|
||||
r.y += buttonSize.y / 2f;
|
||||
if (Event.current.type == EventType.MouseDown && EcsGUI.HitTest(r))
|
||||
if (Event.current.type == EventType.MouseDown && DragonGUI.HitTest(r))
|
||||
{
|
||||
_isNoFound = false;
|
||||
}
|
||||
@ -222,8 +222,8 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
|
||||
InitList();
|
||||
}
|
||||
|
||||
var bc = EcsGUI.SetBackgroundColor(Color.black, 0.5f);
|
||||
using (EcsGUI.Layout.BeginVertical(EditorStyles.helpBox))
|
||||
var bc = DragonGUI.SetBackgroundColor(Color.black, 0.5f);
|
||||
using (DragonGUI.Layout.BeginVertical(EditorStyles.helpBox))
|
||||
{
|
||||
bc.Dispose();
|
||||
_scrollViewPosition = GUILayout.BeginScrollView(_scrollViewPosition, GUILayout.ExpandHeight(true));
|
||||
@ -232,7 +232,7 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
|
||||
}
|
||||
GUILayout.Space(4f);
|
||||
|
||||
using (EcsGUI.Layout.BeginVertical(GUILayout.ExpandHeight(false)))
|
||||
using (DragonGUI.Layout.BeginVertical(GUILayout.ExpandHeight(false)))
|
||||
{
|
||||
//GUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandHeight(false));
|
||||
|
||||
@ -245,14 +245,14 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
using (EcsGUI.SetAlignment(TextAnchor.MiddleCenter))
|
||||
using (DragonGUI.SetAlignment(TextAnchor.MiddleCenter))
|
||||
{
|
||||
GUI.Label(rect, "Select any record");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (EcsGUI.CheckChanged())
|
||||
using (DragonGUI.CheckChanged())
|
||||
{
|
||||
rect.height = EditorGUIUtility.singleLineHeight;
|
||||
rect = rect.Move(0, EditorGUIUtility.standardVerticalSpacing);
|
||||
@ -261,7 +261,7 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
|
||||
string NamespaceName = DrawEditableLine(rect, "Namespace:", data.OldTypeData.NamespaceName, data.NewTypeData.NamespaceName);
|
||||
rect = rect.Move(0, EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);
|
||||
string AssemblyName = DrawEditableLine(rect, "Assembly:", data.OldTypeData.AssemblyName, data.NewTypeData.AssemblyName);
|
||||
if (EcsGUI.Changed)
|
||||
if (DragonGUI.Changed)
|
||||
{
|
||||
data.NewTypeData = new Internal.TypeData(ClassName, NamespaceName, AssemblyName);
|
||||
}
|
||||
@ -269,7 +269,7 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
|
||||
}
|
||||
}
|
||||
|
||||
using (EcsGUI.Layout.BeginHorizontal(GUILayout.Height(26f)))
|
||||
using (DragonGUI.Layout.BeginHorizontal(GUILayout.Height(26f)))
|
||||
{
|
||||
if (GUILayout.Button("Re-Collect", GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
|
||||
477
src/Utils/InspectorAttributes.cs
Normal file
477
src/Utils/InspectorAttributes.cs
Normal file
@ -0,0 +1,477 @@
|
||||
#if DISABLE_DEBUG
|
||||
#undef DEBUG
|
||||
#endif
|
||||
using DCFApixels.DragonECS.Unity.Internal;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity
|
||||
{
|
||||
public sealed class ReferenceDropDownAttribute : PropertyAttribute
|
||||
{
|
||||
public readonly Type[] AllowTypes;
|
||||
public readonly bool IsHideButtonIfNotNull;
|
||||
public ReferenceDropDownAttribute(bool isHideButtonIfNotNull = false) : this(isHideButtonIfNotNull, Array.Empty<Type>()) { }
|
||||
public ReferenceDropDownAttribute(params Type[] predicateTypes) : this(false, predicateTypes) { }
|
||||
public ReferenceDropDownAttribute(bool isHideButtonIfNotNull, params Type[] predicateTypes)
|
||||
{
|
||||
IsHideButtonIfNotNull = isHideButtonIfNotNull;
|
||||
AllowTypes = predicateTypes;
|
||||
Array.Sort(predicateTypes, (a, b) => string.Compare(a.AssemblyQualifiedName, b.AssemblyQualifiedName, StringComparison.Ordinal));
|
||||
}
|
||||
}
|
||||
public sealed class ReferenceDropDownWithoutAttribute : Attribute
|
||||
{
|
||||
public readonly Type[] PredicateTypes;
|
||||
[Obsolete("With empty parameters, this attribute makes no sense.", true)]
|
||||
public ReferenceDropDownWithoutAttribute() : this(Array.Empty<Type>()) { }
|
||||
public ReferenceDropDownWithoutAttribute(params Type[] predicateTypes)
|
||||
{
|
||||
PredicateTypes = predicateTypes;
|
||||
Array.Sort(predicateTypes, (a, b) => string.Compare(a.AssemblyQualifiedName, b.AssemblyQualifiedName, StringComparison.Ordinal));
|
||||
}
|
||||
}
|
||||
public sealed class DragonMetaBlockAttribute : PropertyAttribute { }
|
||||
}
|
||||
|
||||
|
||||
#if UNITY_EDITOR
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
using UnityEditor;
|
||||
|
||||
[CustomPropertyDrawer(typeof(ReferenceDropDownAttribute), true)]
|
||||
[CustomPropertyDrawer(typeof(DragonMetaBlockAttribute), true)]
|
||||
internal class DragonFieldDrawer : ExtendedPropertyDrawer
|
||||
{
|
||||
private const float DamagedComponentHeight = 18f * 2f;
|
||||
private DragonFieldDropDown _dropDown;
|
||||
private PredicateTypesKey? _predicateOverride;
|
||||
|
||||
private ReferenceDropDownAttribute ReferenceDropDownAttribute;
|
||||
private ReferenceDropDownWithoutAttribute ReferenceDropDownWithoutAttribute;
|
||||
private DragonMetaBlockAttribute TypeMetaBlockAttribute;
|
||||
|
||||
private bool _isInit = false;
|
||||
private bool _hasSerializableData = true;
|
||||
|
||||
// this is a damn hack to prevent the drawer from being called recursively when multiple attributes are attached to it
|
||||
private static GUIContent _unrecursiveLabel;
|
||||
private bool _isSerializeReference;
|
||||
|
||||
|
||||
|
||||
private Type _cachedManagedType;
|
||||
private long _cachedManagedTypeID;
|
||||
private Type GetCachedManagedType(SerializedProperty sp)
|
||||
{
|
||||
var cid = sp.managedReferenceId;
|
||||
if (_cachedManagedType == null || _cachedManagedTypeID != cid)
|
||||
{
|
||||
//bool mrNull = sp.managedReferenceId == ManagedReferenceUtility.RefIdNull;
|
||||
//if(mrNull)
|
||||
//{
|
||||
// _cachedManagedType = null;
|
||||
//}
|
||||
//else
|
||||
{
|
||||
_cachedManagedType = sp.managedReferenceValue.GetType();
|
||||
}
|
||||
}
|
||||
return _cachedManagedType;
|
||||
}
|
||||
|
||||
#region Properties
|
||||
private float Padding => Spacing;
|
||||
protected override bool IsInit => _isInit;
|
||||
private bool IsDrawDropDown => ReferenceDropDownAttribute != null;
|
||||
private bool IsDrawMetaBlock => TypeMetaBlockAttribute != null;
|
||||
#endregion
|
||||
|
||||
#region Init
|
||||
protected override void OnStaticInit()
|
||||
{
|
||||
if (_unrecursiveLabel == null)
|
||||
{
|
||||
_unrecursiveLabel = new GUIContent();
|
||||
}
|
||||
}
|
||||
protected override void OnInit(SerializedProperty sp)
|
||||
{
|
||||
_isSerializeReference = sp.propertyType == SerializedPropertyType.ManagedReference;
|
||||
PredicateTypesKey key;
|
||||
_hasSerializableData = true;
|
||||
|
||||
if (fieldInfo != null)
|
||||
{
|
||||
foreach (var atrRaw in Attributes)
|
||||
{
|
||||
switch (atrRaw)
|
||||
{
|
||||
case ReferenceDropDownAttribute atr: ReferenceDropDownAttribute = atr; break;
|
||||
case ReferenceDropDownWithoutAttribute atr: ReferenceDropDownWithoutAttribute = atr; break;
|
||||
case DragonMetaBlockAttribute atr: TypeMetaBlockAttribute = atr; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_predicateOverride == null && PropertyType != null)
|
||||
{
|
||||
var targetType = PropertyType;
|
||||
if (ReferenceDropDownAttribute != null)
|
||||
{
|
||||
Type[] withOutTypes = ReferenceDropDownWithoutAttribute != null ? ReferenceDropDownWithoutAttribute.PredicateTypes : Type.EmptyTypes;
|
||||
|
||||
bool allAssignableTypes = targetType != typeof(ITemplateNode);
|
||||
|
||||
var types = ReferenceDropDownAttribute.AllowTypes;
|
||||
if (types == null || types.Length == 0)
|
||||
{
|
||||
if (allAssignableTypes)
|
||||
{
|
||||
types = new Type[] { targetType };
|
||||
}
|
||||
else
|
||||
{
|
||||
types = new Type[] { typeof(IComponentTemplate), typeof(IEcsComponentMember) };
|
||||
}
|
||||
}
|
||||
key = new PredicateTypesKey(targetType, types, withOutTypes);
|
||||
}
|
||||
else
|
||||
{
|
||||
key = new PredicateTypesKey(targetType, new Type[] { targetType });
|
||||
}
|
||||
_predicateOverride = key;
|
||||
}
|
||||
|
||||
if (IsDrawDropDown)
|
||||
{
|
||||
_dropDown = DragonFieldDropDown.Get(_predicateOverride.Value);
|
||||
_dropDown.OnSelected += SelectComponent;
|
||||
}
|
||||
|
||||
_isInit = true;
|
||||
}
|
||||
|
||||
[ThreadStatic]
|
||||
private static SerializedProperty currentProperty;
|
||||
private static void SelectComponent(DragonFieldDropDown.Item item)
|
||||
{
|
||||
//EcsGUI.Changed = true;
|
||||
if (item.Obj == null)
|
||||
{
|
||||
currentProperty.managedReferenceValue = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentProperty.managedReferenceValue = item.Obj.CreateInstance();
|
||||
currentProperty.isExpanded = false;
|
||||
}
|
||||
currentProperty.serializedObject.ApplyModifiedProperties();
|
||||
DragonGUI.DelayedChanged = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected override float GetCustomHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
if (ReferenceEquals(label, _unrecursiveLabel)) { return EditorGUI.GetPropertyHeight(property, label); }
|
||||
_unrecursiveLabel.text = label.text;
|
||||
_unrecursiveLabel.tooltip = label.tooltip;
|
||||
label = _unrecursiveLabel;
|
||||
|
||||
if (_isSerializeReference)
|
||||
{
|
||||
_hasSerializableData = property.HasSerializableData();
|
||||
}
|
||||
|
||||
SerializedProperty componentProp = property;
|
||||
if (_isSerializeReference)
|
||||
{
|
||||
if (property.IsNullManagedReference())
|
||||
{
|
||||
float result = EditorGUIUtility.singleLineHeight;
|
||||
if (IsDrawMetaBlock)
|
||||
{
|
||||
result += Padding * 2f;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//var instance = property.managedReferenceValue;
|
||||
//if (DragonFieldCahce.RuntimeDict.TryGetValue(instance.GetType(), out var info) && info.HasWrappedFieldName)
|
||||
var type = GetCachedManagedType(property);
|
||||
if (DragonFieldCahce.RuntimeDict.TryGetValue(type, out var info) && info.HasWrappedFieldName)
|
||||
{
|
||||
componentProp = property.FindPropertyRelative(info.WrappedFieldName);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
componentProp = property;
|
||||
}
|
||||
if (componentProp == null)
|
||||
{
|
||||
return DamagedComponentHeight;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var fieldType = PropertyType;
|
||||
if (DragonFieldCahce.RuntimeDict.TryGetValue(fieldType, out var info) && info.HasWrappedFieldName)
|
||||
{
|
||||
componentProp = property.FindPropertyRelative(info.WrappedFieldName);
|
||||
}
|
||||
}
|
||||
if (componentProp == null)
|
||||
{
|
||||
componentProp = property;
|
||||
}
|
||||
|
||||
{
|
||||
//EcsDebug.PrintPass(_hasSerializableData);
|
||||
float result = EditorGUIUtility.singleLineHeight;
|
||||
if (_hasSerializableData)
|
||||
{
|
||||
result = EditorGUI.GetPropertyHeight(componentProp, label);
|
||||
}
|
||||
if (IsDrawMetaBlock)
|
||||
{
|
||||
result += Padding * 4f;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void DrawCustom(Rect rect, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
if (ReferenceEquals(label, _unrecursiveLabel)) { EditorGUI.PropertyField(rect, property, label, true); return; }
|
||||
_unrecursiveLabel.text = label.text;
|
||||
_unrecursiveLabel.tooltip = label.tooltip;
|
||||
label = _unrecursiveLabel;
|
||||
|
||||
if (_isSerializeReference)
|
||||
{
|
||||
_hasSerializableData = property.HasSerializableData();
|
||||
}
|
||||
|
||||
//var e = Event.current;
|
||||
var rootProperty = property;
|
||||
|
||||
ITypeMeta meta = null;
|
||||
SerializedProperty componentProp = property;
|
||||
bool isDrawProperty = true;
|
||||
bool isDrawDropDown = IsDrawDropDown && _isSerializeReference;
|
||||
|
||||
Rect srcRect = rect;
|
||||
if (_isSerializeReference)
|
||||
{
|
||||
DragonFieldCahce info = null;
|
||||
bool mrNull = property.IsNullManagedReference();
|
||||
if (mrNull)
|
||||
{
|
||||
isDrawProperty = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//var instance = property.managedReferenceValue;
|
||||
//if (DragonFieldCahce.TryGetInfoFor(instance.GetType(), out info) && info.HasWrappedFieldName)
|
||||
var type = GetCachedManagedType(property);
|
||||
if (DragonFieldCahce.TryGetInfoFor(type, out info) && info.HasWrappedFieldName)
|
||||
{
|
||||
componentProp = property.FindPropertyRelative(info.WrappedFieldName);
|
||||
}
|
||||
}
|
||||
if (componentProp == null)
|
||||
{
|
||||
DrawDamagedComponent(rect, "Damaged component template.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (meta == null)
|
||||
{
|
||||
if (info != null)
|
||||
{
|
||||
meta = info.Type.GetMeta();
|
||||
}
|
||||
else if (mrNull == false)
|
||||
{
|
||||
var type = GetCachedManagedType(property);
|
||||
meta = type.GetMeta();
|
||||
}
|
||||
}
|
||||
|
||||
if (isDrawDropDown && mrNull == false && ReferenceDropDownAttribute.IsHideButtonIfNotNull)
|
||||
{
|
||||
isDrawDropDown = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var fieldType = PropertyType;
|
||||
if (DragonFieldCahce.RuntimeDict.TryGetValue(fieldType, out var info) && info.HasWrappedFieldName)
|
||||
{
|
||||
componentProp = property.FindPropertyRelative(info.WrappedFieldName);
|
||||
}
|
||||
meta = fieldType.GetMeta();
|
||||
}
|
||||
if (componentProp == null)
|
||||
{
|
||||
componentProp = property;
|
||||
}
|
||||
|
||||
|
||||
float selectionButtonRightOffset = 0f;
|
||||
|
||||
if (isDrawProperty)
|
||||
{
|
||||
if (IsDrawMetaBlock)
|
||||
{
|
||||
|
||||
ref var r = ref rect;
|
||||
var (skip, optionsWidth) = DragonGUI.DrawTypeMetaBlock(ref r, rootProperty, meta);
|
||||
selectionButtonRightOffset = optionsWidth;
|
||||
if (skip)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(Event.current.type == EventType.Used)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isDrawProperty)
|
||||
{
|
||||
if (IsArrayElement)
|
||||
{
|
||||
label.text = meta.Name;
|
||||
}
|
||||
}
|
||||
|
||||
if (isDrawDropDown)
|
||||
{
|
||||
srcRect.xMax -= selectionButtonRightOffset;
|
||||
DrawSelectionDropDown(srcRect, property, label);
|
||||
}
|
||||
|
||||
if (isDrawProperty)
|
||||
{
|
||||
var fieldRect = rect;
|
||||
|
||||
if (ReferenceEquals(property, componentProp) &&
|
||||
componentProp.propertyType != SerializedPropertyType.Generic &&
|
||||
componentProp.propertyType != SerializedPropertyType.ManagedReference)
|
||||
{
|
||||
fieldRect.xMax -= selectionButtonRightOffset;
|
||||
isDrawDropDown = false;
|
||||
}
|
||||
|
||||
if (_hasSerializableData)
|
||||
{
|
||||
//string oldText = label.text;
|
||||
//label.text = string.Empty;
|
||||
EditorGUI.PropertyField(fieldRect, componentProp, label, true);
|
||||
//label.text = oldText;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.LabelField(rect, label);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.LabelField(rect, label);
|
||||
}
|
||||
|
||||
if (isDrawDropDown)
|
||||
{
|
||||
DrawFakeSelectionDropDown(srcRect, property, label);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void DrawFakeSelectionDropDown(Rect rect, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
if (rect.width < 0) { return; }
|
||||
|
||||
Rect position;
|
||||
if (string.IsNullOrEmpty(label.text))
|
||||
{
|
||||
position = rect;
|
||||
}
|
||||
else
|
||||
{
|
||||
position = rect.AddPadding(EditorGUIUtility.labelWidth, 0f, 0f, 0f);
|
||||
}
|
||||
|
||||
position.height = OneLineHeight;
|
||||
position.y += Spacing * 2;
|
||||
|
||||
bool isHideButtonIfNotNull = ReferenceDropDownAttribute.IsHideButtonIfNotNull;
|
||||
|
||||
Type type = null;
|
||||
if (property.IsNullManagedReference() == false &&
|
||||
property.hasMultipleDifferentValues == false)
|
||||
{
|
||||
type = GetCachedManagedType(property);
|
||||
}
|
||||
|
||||
string text = type == null ? "Select..." : type.GetMeta().Name;
|
||||
if (!isHideButtonIfNotNull || type == null)
|
||||
{
|
||||
if (GUI.Button(position, text, EditorStyles.layerMaskField))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
private void DrawSelectionDropDown(Rect rect, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
if (rect.width < 0) { return; }
|
||||
|
||||
Rect position;
|
||||
if (string.IsNullOrEmpty(label.text))
|
||||
{
|
||||
position = rect;
|
||||
}
|
||||
else
|
||||
{
|
||||
position = rect.AddPadding(EditorGUIUtility.labelWidth, 0f, 0f, 0f);
|
||||
}
|
||||
|
||||
position.height = OneLineHeight;
|
||||
position.y += Spacing * 2;
|
||||
|
||||
bool isHideButtonIfNotNull = ReferenceDropDownAttribute.IsHideButtonIfNotNull;
|
||||
|
||||
Type type = null;
|
||||
if (property.IsNullManagedReference() == false &&
|
||||
property.hasMultipleDifferentValues == false)
|
||||
{
|
||||
type = GetCachedManagedType(property);
|
||||
}
|
||||
|
||||
string text = type == null ? "Select..." : type.GetMeta().Name;
|
||||
if (!isHideButtonIfNotNull || type == null)
|
||||
{
|
||||
if (GUI.Button(position, text, EditorStyles.layerMaskField))
|
||||
{
|
||||
currentProperty = property;
|
||||
_dropDown.OpenForField(position, property);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.Label(position, text);
|
||||
}
|
||||
}
|
||||
private void DrawDamagedComponent(Rect position, string message)
|
||||
{
|
||||
EditorGUI.HelpBox(position, message, MessageType.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1,8 +1,8 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
namespace DCFApixels.DragonECS.Unity
|
||||
{
|
||||
public static class MetaColorExstensions
|
||||
public static class MetaColorExtensions
|
||||
{
|
||||
public static Color ToUnityColor<T>(this T self) where T : IMetaColor
|
||||
{
|
||||
@ -1,36 +0,0 @@
|
||||
#if DISABLE_DEBUG
|
||||
#undef DEBUG
|
||||
#endif
|
||||
using DCFApixels.DragonECS.Unity.Editors;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public sealed class ReferenceButtonAttribute : PropertyAttribute, IReferenceButtonAttribute
|
||||
{
|
||||
public readonly Type[] PredicateTypes;
|
||||
public readonly bool IsHideButtonIfNotNull;
|
||||
Type[] IReferenceButtonAttribute.PredicateTypes { get { return PredicateTypes; } }
|
||||
bool IReferenceButtonAttribute.IsHideButtonIfNotNull { get { return IsHideButtonIfNotNull; } }
|
||||
public ReferenceButtonAttribute(bool isHideButtonIfNotNull = false) : this(isHideButtonIfNotNull, Array.Empty<Type>()) { }
|
||||
public ReferenceButtonAttribute(params Type[] predicateTypes) : this(false, predicateTypes) { }
|
||||
public ReferenceButtonAttribute(bool isHideButtonIfNotNull, params Type[] predicateTypes)
|
||||
{
|
||||
IsHideButtonIfNotNull = isHideButtonIfNotNull;
|
||||
PredicateTypes = predicateTypes;
|
||||
Array.Sort(predicateTypes, (a, b) => string.Compare(a.AssemblyQualifiedName, b.AssemblyQualifiedName, StringComparison.Ordinal));
|
||||
}
|
||||
}
|
||||
public sealed class ReferenceButtonWithOutAttribute : Attribute
|
||||
{
|
||||
public readonly Type[] PredicateTypes;
|
||||
[Obsolete("With empty parameters, this attribute makes no sense.", true)]
|
||||
public ReferenceButtonWithOutAttribute() : this(Array.Empty<Type>()) { }
|
||||
public ReferenceButtonWithOutAttribute(params Type[] predicateTypes)
|
||||
{
|
||||
PredicateTypes = predicateTypes;
|
||||
Array.Sort(predicateTypes, (a, b) => string.Compare(a.AssemblyQualifiedName, b.AssemblyQualifiedName, StringComparison.Ordinal));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user