@@ -18,7 +18,7 @@ sealed class GuiDialogsVerifier : GameVerifier
1818{
1919 internal const string DefaultComponentIdentifier = "<<DEFAULT>>" ;
2020
21- private static readonly GuiComponentType [ ] GuiComponentTypes =
21+ private static readonly IReadOnlyList < GuiComponentType > GuiComponentTypes =
2222 Enum . GetValues ( typeof ( GuiComponentType ) ) . OfType < GuiComponentType > ( ) . ToArray ( ) ;
2323
2424 private readonly IAlreadyVerifiedCache ? _cache ;
@@ -85,13 +85,18 @@ private void VerifyMegaTexturesExist(CancellationToken token)
8585
8686 private void VerifyGuiComponentTexturesExist ( string component )
8787 {
88- var middleButtonInRepoMode = false ;
88+ var buttonSpecialMode = false ;
8989
9090 var entriesForComponent = GetTextureEntriesForComponents ( component , out var defined ) ;
9191 if ( ! defined )
9292 return ;
9393
94- // TODO: Button Middle needs to be checked first as the engine checks this first
94+ if ( entriesForComponent . TryGetValue ( GuiComponentType . ButtonMiddle , out var middleTexture ) )
95+ {
96+ GameEngine . GuiDialogManager . TextureExists ( middleTexture , out var origin , out _ ) ;
97+ if ( origin == GuiTextureOrigin . Repository )
98+ buttonSpecialMode = true ;
99+ }
95100
96101 foreach ( var componentType in GuiComponentTypes )
97102 {
@@ -100,11 +105,17 @@ private void VerifyGuiComponentTexturesExist(string component)
100105 if ( ! entriesForComponent . TryGetValue ( componentType , out var texture ) )
101106 continue ;
102107
108+ if ( buttonSpecialMode && componentType . IsButton ( ) && ! componentType . SupportsSpecialTextureMode ( ) )
109+ {
110+ // If we are in special button mode, non-supported button textures won't be loaded anyway.
111+ continue ;
112+ }
113+
103114 var cached = _cache ? . GetEntry ( texture . Texture ) ;
104115 if ( cached ? . AlreadyVerified is true )
105116 {
106117 // If we are in a special case we don't want to skip
107- if ( ! middleButtonInRepoMode &&
118+ if ( ! buttonSpecialMode &&
108119 componentType is not GuiComponentType . ButtonMiddle &&
109120 componentType is not GuiComponentType . Scanlines &&
110121 componentType is not GuiComponentType . FrameBackground )
@@ -115,7 +126,7 @@ componentType is not GuiComponentType.Scanlines &&
115126 texture ,
116127 out var origin ,
117128 out var isNone ,
118- middleButtonInRepoMode ) ;
129+ buttonSpecialMode ) ;
119130
120131 if ( ! exists && ! isNone )
121132 {
@@ -130,16 +141,13 @@ componentType is not GuiComponentType.Scanlines &&
130141 AddNotFoundError ( texture , component , origin ) ;
131142 }
132143 }
133-
134- if ( componentType is GuiComponentType . ButtonMiddle && origin is GuiTextureOrigin . Repository )
135- middleButtonInRepoMode = true ;
136-
144+
137145 _cache ? . TryAddEntry ( texture . Texture , exists ) ;
138146 }
139147 finally
140148 {
141- if ( componentType >= GuiComponentType . ButtonRightDisabled )
142- middleButtonInRepoMode = false ;
149+ if ( ! componentType . IsButton ( ) )
150+ buttonSpecialMode = false ;
143151 }
144152 }
145153 }
0 commit comments