@@ -20,7 +20,7 @@ public class OutfitInstance : AppearanceInstance
2020 private Color _legsColor = Color . white ;
2121 private Color _detailColor = Color . white ;
2222
23- private Dictionary < int , MaterialPropertyBlock > _channelProps = new Dictionary < int , MaterialPropertyBlock > ( ) ;
23+ private Dictionary < uint , MaterialPropertyBlock > _channelProps = new Dictionary < uint , MaterialPropertyBlock > ( ) ;
2424
2525 private int _phase = 0 ;
2626 private bool _walking = false ;
@@ -97,21 +97,24 @@ public override void Draw(CommandBuffer commandBuffer, Vector2Int screenPosition
9797
9898 int spriteIndex = GetSpriteIndex ( - 1 , patternX , patternY , patternZ ) ;
9999
100- OpenTibiaUnity . AppearanceStorage . GetSprite ( ActiveFrameGroup . SpriteInfo . SpriteIDs [ spriteIndex ] , out CachedSprite baseSprite ) ;
101- OpenTibiaUnity . AppearanceStorage . GetSprite ( ActiveFrameGroup . SpriteInfo . SpriteIDs [ spriteIndex + 1 ] , out CachedSprite channelSprite ) ;
100+ var baseSpriteId = ActiveFrameGroup . SpriteInfo . SpriteIDs [ spriteIndex ] ;
101+ var channelSpriteId = ActiveFrameGroup . SpriteInfo . SpriteIDs [ ++ spriteIndex ] ;
102+
103+ OpenTibiaUnity . AppearanceStorage . GetSprite ( baseSpriteId , out CachedSprite baseSprite ) ;
104+ OpenTibiaUnity . AppearanceStorage . GetSprite ( channelSpriteId , out CachedSprite channelSprite ) ;
102105
103106 // if these are not loaded yet we should still continue to
104107 // ensure that next time all layers are loaded!
105108 if ( baseSprite == null || channelSprite == null )
106109 dontDraw = true ;
107110
108111 if ( ! dontDraw ) {
109- if ( ! _channelProps . TryGetValue ( spriteIndex , out MaterialPropertyBlock props ) ) {
112+ if ( ! _channelProps . TryGetValue ( channelSpriteId , out MaterialPropertyBlock props ) ) {
110113 props = new MaterialPropertyBlock ( ) ;
111114 baseSprite . GenerateMaterialProps ( props ) ;
112115 channelSprite . GenerateChannelsMaterialProps ( props ) ;
113116 UpdateMaterialProppertyBlock ( props ) ;
114- _channelProps . Add ( spriteIndex , props ) ;
117+ _channelProps . Add ( channelSpriteId , props ) ;
115118 }
116119
117120 InternalDrawTo ( commandBuffer , screenPosition , zoom , highlighted , highlightOpacity , baseSprite ) ;
0 commit comments