@@ -7,6 +7,7 @@ import { useMutableState } from '@ir-engine/hyperflux'
77import { TransformComponent } from '@ir-engine/spatial'
88import { RenderInfoState } from '@ir-engine/spatial/src/renderer/RenderInfoSystem'
99import { setVisibleComponent } from '@ir-engine/spatial/src/renderer/components/VisibleComponent'
10+ import { ResourceState } from '@ir-engine/spatial/src/resources/ResourceState'
1011import Button from '@ir-engine/ui/src/primitives/tailwind/Button'
1112import React , { useEffect } from 'react'
1213import { MathUtils } from 'three'
@@ -109,10 +110,13 @@ function RenderInfoUI() {
109110 const renderInfo = useRendererInfo ( )
110111
111112 return (
112- < div className = "absolute right-0 top-0" >
113- { Object . entries ( renderInfo ) . map ( ( [ key , value ] ) => {
114- return < div key = { key } className = "text-white" > { `${ key } : ${ value } ` } </ div >
115- } ) }
113+ < div className = "" >
114+ < h1 className = "text-white" > Render Info</ h1 >
115+ < div className = "ml-2" >
116+ { Object . entries ( renderInfo ) . map ( ( [ key , value ] ) => {
117+ return < div key = { key } className = "ml-2 text-white" > { `${ key } : ${ value } ` } </ div >
118+ } ) }
119+ </ div >
116120 </ div >
117121 )
118122}
@@ -121,36 +125,55 @@ function ResourceTrackingUI(props: { entity: Entity }) {
121125 const { entity } = props
122126 const buttonContainerClass = 'h-16 px-1.5 py-1 w-2/4'
123127 const buttonClass = 'h-full w-full basis-2/5 cursor-pointer'
128+ const resourceState = useMutableState ( ResourceState )
124129 return (
125- < >
126- < div className = "absolute bottom-0 right-0 h-1/4 w-1/4" style = { { pointerEvents : 'all' , zIndex : 100 } } >
127- { assets . map ( ( asset ) => {
128- return (
129- < div className = "flex h-auto w-full" key = { asset . endpoint } >
130- < div className = { buttonContainerClass } >
131- < Button
132- className = { buttonClass }
133- onClick = { ( ) => {
134- if ( ! resources [ asset . name ] ) resources [ asset . name ] = [ ]
135- resources [ asset . name ] . push ( createAsset ( entity , asset ) )
136- } }
137- > { `Create ${ asset . name } ` } </ Button >
130+ < div
131+ className = "absolute right-0 top-0 flex max-h-[95vh] w-1/4 flex-col overflow-y-auto"
132+ style = { { pointerEvents : 'all' , zIndex : 100 } }
133+ >
134+ < RenderInfoUI />
135+ < div >
136+ < h1 className = "text-white" > Resources</ h1 >
137+ < div className = "ml-2" >
138+ { Object . entries ( resourceState . resources . value ) . map ( ( [ key , val ] ) => {
139+ return (
140+ < div key = { key } className = "text-white" >
141+ { `${ key } : ${ val . references . join ( ', ' ) } ` }
138142 </ div >
139- < div className = { buttonContainerClass } >
140- < Button
141- className = { buttonClass }
142- onClick = { ( ) => {
143- if ( ! resources [ asset . name ] ) resources [ asset . name ] = [ ]
144- resources [ asset . name ] . pop ( ) ?.( )
145- } }
146- > { `Remove ${ asset . name } ` } </ Button >
143+ )
144+ } ) }
145+ </ div >
146+ </ div >
147+ < div >
148+ < h1 className = "text-white" > Assets</ h1 >
149+ < div className = "ml-2" >
150+ { assets . map ( ( asset ) => {
151+ return (
152+ < div className = "flex h-auto w-full" key = { asset . endpoint } >
153+ < div className = { buttonContainerClass } >
154+ < Button
155+ className = { buttonClass }
156+ onClick = { ( ) => {
157+ if ( ! resources [ asset . name ] ) resources [ asset . name ] = [ ]
158+ resources [ asset . name ] . push ( createAsset ( entity , asset ) )
159+ } }
160+ > { `Create ${ asset . name } ` } </ Button >
161+ </ div >
162+ < div className = { buttonContainerClass } >
163+ < Button
164+ className = { buttonClass }
165+ onClick = { ( ) => {
166+ if ( ! resources [ asset . name ] ) resources [ asset . name ] = [ ]
167+ resources [ asset . name ] . pop ( ) ?.( )
168+ } }
169+ > { `Remove ${ asset . name } ` } </ Button >
170+ </ div >
147171 </ div >
148- </ div >
149- )
150- } ) }
172+ )
173+ } ) }
174+ </ div >
151175 </ div >
152- < RenderInfoUI />
153- </ >
176+ </ div >
154177 )
155178}
156179
0 commit comments