@ SuppressWarnings ( "unchecked" ) @ OnMessage ( AutumnMessage . SKINS_LOADED ) public boolean injectFields ( final InterfaceService interfaceService ) { for ( final Entry < Pair < String , String > , Array < Pair < Field , Object > > > entry : fieldsToInject ) { final Skin skin = interfaceService . getParser ( ) . getData ( ) . getSkin ( entry . key . getSecond ( ) ) ; final String assetId = entry . key . getFirst ( ) ; if ( skin == null ) { throw new ContextInitiationException ( "Unable to inject asset: " + assetId + ". Unknown skin ID: " + entry . key . getSecond ( ) ) ; } for ( final Pair < Field , Object > injection : entry . value ) { try { Reflection . setFieldValue ( injection . getFirst ( ) , injection . getSecond ( ) , skin . get ( assetId , injection . getFirst ( ) . getType ( ) ) ) ; } catch ( final ReflectionException exception ) { throw new GdxRuntimeException ( "Unable to inject skin asset: " + assetId + " from skin: " + skin + " to field: " + injection . getFirst ( ) + " of component: " + injection . getSecond ( ) , exception ) ; } } } fieldsToInject . clear ( ) ; return OnMessage . REMOVE ; }
Invoked when all skins are loaded . Injects skin assets .