@ -4,7 +4,6 @@ using System.Linq;
using System.Numerics ;
using System.Numerics ;
using gaemstone.Client.Utility ;
using gaemstone.Client.Utility ;
using gaemstone.ECS ;
using gaemstone.ECS ;
using gaemstone.Flecs ;
using ImGuiNET ;
using ImGuiNET ;
using static gaemstone . Client . Systems . ImGuiManager ;
using static gaemstone . Client . Systems . ImGuiManager ;
using ImGuiInternal = ImGuiNET . Internal . ImGui ;
using ImGuiInternal = ImGuiNET . Internal . ImGui ;
@ -20,7 +19,7 @@ public partial class EntityInspector
public struct InspectorWindow { }
public struct InspectorWindow { }
[Relation, Exclusive]
[Relation, Exclusive]
[Add<Core.OnDeleteTarget, C ore.Delete>]
[Add<flecs.core.OnDeleteTarget, flecs.c ore.Delete>]
public struct Selected { }
public struct Selected { }
[Tag]
[Tag]
@ -173,7 +172,7 @@ public partial class EntityInspector
if ( ! isOpen ) window . Delete ( ) ;
if ( ! isOpen ) window . Delete ( ) ;
}
}
[Observer<C ore.OnRemove>]
[Observer<flecs.c ore.OnRemove>]
public static void ClearStorageOnRemove < T > ( Entity < T > _ 1 , InspectorWindow _ 2 )
public static void ClearStorageOnRemove < T > ( Entity < T > _ 1 , InspectorWindow _ 2 )
{
{
// TODO: Clear out settings store for the window.
// TODO: Clear out settings store for the window.
@ -197,9 +196,9 @@ public partial class EntityInspector
ImGui . TableSetupColumn ( "Entity" , ImGuiTableColumnFlags . WidthFixed ) ;
ImGui . TableSetupColumn ( "Entity" , ImGuiTableColumnFlags . WidthFixed ) ;
ImGui . TableNextColumn ( ) ;
ImGui . TableNextColumn ( ) ;
var hasExpanded = window . Has < Expanded , C ore. Wildcard > ( ) ;
var hasExpanded = window . Has < Expanded , flecs . c ore. Wildcard > ( ) ;
if ( IconButtonWithToolTip ( ForkAwesome . Outdent , "Collapse all items in the Explorer View" , hasExpanded ) )
if ( IconButtonWithToolTip ( ForkAwesome . Outdent , "Collapse all items in the Explorer View" , hasExpanded ) )
window . Remove < Expanded , C ore. Wildcard > ( ) ;
window . Remove < Expanded , flecs . c ore. Wildcard > ( ) ;
if ( history ! = null ) {
if ( history ! = null ) {
var hasPrev = ( ( selected ! = null ) ? history . Current ? . Prev : history . Current ) ! = null ;
var hasPrev = ( ( selected ! = null ) ? history . Current ? . Prev : history . Current ) ! = null ;
@ -374,10 +373,10 @@ public partial class EntityInspector
// nullable, so let's be explicit about the type here.
// nullable, so let's be explicit about the type here.
var world = window . World ;
var world = window . World ;
var Wildcard = world . Entity < C ore. Wildcard > ( ) . Value ;
var Wildcard = world . Entity < flecs . c ore. Wildcard > ( ) . Value ;
var Any = world . Entity < C ore. Any > ( ) . Value ;
var Any = world . Entity < flecs . c ore. Any > ( ) . Value ;
var This = world . Entity < C ore. This > ( ) . Value ;
var This = world . Entity < flecs . c ore. This > ( ) . Value ;
var Variable = world . Entity < C ore. Variable > ( ) . Value ;
var Variable = world . Entity < flecs . c ore. Variable > ( ) . Value ;
bool IsSpecialEntity ( Entity entity )
bool IsSpecialEntity ( Entity entity )
= > ( entity = = Wildcard ) | | ( entity = = Any )
= > ( entity = = Wildcard ) | | ( entity = = Any )
| | ( entity = = This ) | | ( entity = = Variable ) ;
| | ( entity = = This ) | | ( entity = = Variable ) ;
@ -396,7 +395,7 @@ public partial class EntityInspector
for ( var i = 0 ; i < iter . Count ; i + + ) {
for ( var i = 0 ; i < iter . Count ; i + + ) {
var entity = iter . Entity ( i ) ;
var entity = iter . Entity ( i ) ;
var count = IsSpecialEntity ( entity ) ? 0
var count = IsSpecialEntity ( entity ) ? 0
: world . Pair < C ore. ChildOf > ( entity ) . Count ;
: world . Pair < flecs . c ore. ChildOf > ( entity ) . Count ;
result . Add ( new ExplorerEntry < T > ( entity , count , isExpanded , isDisabled ) ) ;
result . Add ( new ExplorerEntry < T > ( entity , count , isExpanded , isDisabled ) ) ;
}
}
}
}
@ -480,7 +479,7 @@ public partial class EntityInspector
private static void ComponentsTab < T > ( Entity < T > window , History ? history , Entity < T > ? sel )
private static void ComponentsTab < T > ( Entity < T > window , History ? history , Entity < T > ? sel )
{
{
if ( sel is not Entity < T > selected ) return ;
if ( sel is not Entity < T > selected ) return ;
var ChildOf = window . World . Entity < C ore. ChildOf > ( ) ;
var ChildOf = window . World . Entity < flecs . c ore. ChildOf > ( ) ;
foreach ( var id in selected . Type ) {
foreach ( var id in selected . Type ) {
// Hide ChildOf relations, as they are visible in the explorer.
// Hide ChildOf relations, as they are visible in the explorer.
if ( id . IsPair & & ( id . Value . RelationUnsafe = = ChildOf ) ) continue ;
if ( id . IsPair & & ( id . Value . RelationUnsafe = = ChildOf ) ) continue ;
@ -492,8 +491,8 @@ public partial class EntityInspector
{
{
if ( sel is not Entity < T > selected ) return ;
if ( sel is not Entity < T > selected ) return ;
var world = window . World ;
var world = window . World ;
var ChildOf = world . Entity < C ore. ChildOf > ( ) ;
var ChildOf = world . Entity < flecs . c ore. ChildOf > ( ) ;
var Wildcard = world . Entity < C ore. Wildcard > ( ) ;
var Wildcard = world . Entity < flecs . c ore. Wildcard > ( ) ;
if ( ImGui . CollapsingHeader ( $"As {ForkAwesome.Tag} Component" , ImGuiTreeNodeFlags . DefaultOpen ) )
if ( ImGui . CollapsingHeader ( $"As {ForkAwesome.Tag} Component" , ImGuiTreeNodeFlags . DefaultOpen ) )
foreach ( var iter in world . Term ( new ( selected ) ) )
foreach ( var iter in world . Term ( new ( selected ) ) )
@ -631,7 +630,7 @@ public partial class EntityInspector
bool scrollTo = true ) // Should entity be scrolled to in the explorer view?
bool scrollTo = true ) // Should entity be scrolled to in the explorer view?
{
{
if ( entity is Entity < T > e1 ) window . Add < Selected > ( e1 ) ;
if ( entity is Entity < T > e1 ) window . Add < Selected > ( e1 ) ;
else window . Remove < Selected , C ore. Wildcard > ( ) ;
else window . Remove < Selected , flecs . c ore. Wildcard > ( ) ;
for ( var p = entity ? . Parent ; p is Entity < T > parent ; p = parent . Parent )
for ( var p = entity ? . Parent ; p is Entity < T > parent ; p = parent . Parent )
window . Add < Expanded > ( parent ) ;
window . Add < Expanded > ( parent ) ;
@ -671,7 +670,7 @@ public partial class EntityInspector
private static ( Entity < T > ? DisplayType , float Priority ) FindDisplayType < T > ( Entity < T > entity )
private static ( Entity < T > ? DisplayType , float Priority ) FindDisplayType < T > ( Entity < T > entity )
{
{
var world = entity . World ;
var world = entity . World ;
var component = world . Entity < C ore. Component > ( ) ;
var component = world . Entity < flecs . c ore. Component > ( ) ;
var rule = ( Rule < T > ) ( _f indDisplayTypeRule ? ? = world . Rule ( new (
var rule = ( Rule < T > ) ( _f indDisplayTypeRule ? ? = world . Rule ( new (
$"$Type, gaemstone.Doc.DisplayType($Type)" ) ) ) ;
$"$Type, gaemstone.Doc.DisplayType($Type)" ) ) ) ;
@ -682,8 +681,8 @@ public partial class EntityInspector
foreach ( var iter in rule . Iter ( ) . SetVar ( rule . ThisVar ! , entity ) )
foreach ( var iter in rule . Iter ( ) . SetVar ( rule . ThisVar ! , entity ) )
for ( var i = 0 ; i < iter . Count ; i + + ) {
for ( var i = 0 ; i < iter . Count ; i + + ) {
var type = iter . GetVar ( typeVar ) ;
var type = iter . GetVar ( typeVar ) ;
if ( ( type = = component ) & & ( entity . GetOrNull < C ore. Component > ( component ) ? . Size = = 0 ) )
if ( ( type = = component ) & & ( entity . GetOrNull < flecs . c ore. Component > ( component ) ? . Size = = 0 ) )
type = world . Entity < C ore. Tag > ( ) ;
type = world . Entity < flecs . c ore. Tag > ( ) ;
var priority = type ? . GetOrNull < Priority > ( ) ? . Value ? ? float . MaxValue ;
var priority = type ? . GetOrNull < Priority > ( ) ? . Value ? ? float . MaxValue ;
if ( priority < = curPriority ) { curType = type ; curPriority = priority ; }
if ( priority < = curPriority ) { curType = type ; curPriority = priority ; }
}
}
@ -773,7 +772,7 @@ public partial class EntityInspector
if ( isHeaderLike ) pos . X + = ImGui . GetStyle ( ) . FramePadding . X ;
if ( isHeaderLike ) pos . X + = ImGui . GetStyle ( ) . FramePadding . X ;
drawList . AddText ( ImGui . GetFont ( ) , ImGui . GetFontSize ( ) , pos , color . RGBA , displayName ) ;
drawList . AddText ( ImGui . GetFont ( ) , ImGui . GetFontSize ( ) , pos , color . RGBA , displayName ) ;
if ( ! isHeaderLike & & canClick & & hovered ) {
if ( ! isHeaderLike & & canClick & & hovered ) {
// Draw a hyperlink-link underscore.
// Draw a hyperlink-link undersflecs. core.
var p1 = pos + new Vector2 ( 0 , size . Y - 1.75f ) ;
var p1 = pos + new Vector2 ( 0 , size . Y - 1.75f ) ;
var p2 = pos + new Vector2 ( size . X , size . Y - 1.75f ) ;
var p2 = pos + new Vector2 ( size . X , size . Y - 1.75f ) ;
if ( docIcon ! = null ) p1 . X + = ImGui . CalcTextSize ( $"{docIcon} " ) . X ;
if ( docIcon ! = null ) p1 . X + = ImGui . CalcTextSize ( $"{docIcon} " ) . X ;