1212
1313namespace Materials . Systems
1414{
15+ using static Constants ;
16+
1517 public partial class MaterialImportSystem : SystemBase , IListener < DataUpdate >
1618 {
17- //todo: move all this static junk to an internal static class
18- private static readonly BlendFactor [ ] blendFactors = Enum . GetValues < BlendFactor > ( ) ;
19- private static readonly BlendOperation [ ] blendOperations = Enum . GetValues < BlendOperation > ( ) ;
20- private static readonly CompareOperation [ ] compareOperations = Enum . GetValues < CompareOperation > ( ) ;
21- private static readonly StencilOperation [ ] stencilOperations = Enum . GetValues < StencilOperation > ( ) ;
22- private static readonly string [ ] blendFactorOptions ;
23- private static readonly string [ ] blendOperationOptions ;
24- private static readonly string [ ] compareOperationOptions ;
25- private static readonly string [ ] stencilOperationOptions ;
26-
27- static MaterialImportSystem ( )
28- {
29- blendFactorOptions = new string [ blendFactors . Length ] ;
30- for ( int i = 0 ; i < blendFactors . Length ; i ++ )
31- {
32- blendFactorOptions [ i ] = blendFactors [ i ] . ToString ( ) ;
33- }
34-
35- blendOperationOptions = new string [ blendOperations . Length ] ;
36- for ( int i = 0 ; i < blendOperations . Length ; i ++ )
37- {
38- blendOperationOptions [ i ] = blendOperations [ i ] . ToString ( ) ;
39- }
40-
41- compareOperationOptions = new string [ compareOperations . Length ] ;
42- for ( int i = 0 ; i < compareOperations . Length ; i ++ )
43- {
44- compareOperationOptions [ i ] = compareOperations [ i ] . ToString ( ) ;
45- }
46-
47- stencilOperationOptions = new string [ stencilOperations . Length ] ;
48- for ( int i = 0 ; i < stencilOperations . Length ; i ++ )
49- {
50- stencilOperationOptions [ i ] = stencilOperations [ i ] . ToString ( ) ;
51- }
52- }
53-
5419 private readonly World world ;
5520 private readonly Dictionary < ShaderKey , uint > cachedShaders ;
5621 private readonly Operation operation ;
@@ -362,57 +327,5 @@ private static BlendSettings GetBlendSettings(JSONObject jsonObject)
362327
363328 return settings ;
364329 }
365-
366- private static BlendFactor ? GetBlendFactor ( ReadOnlySpan < char > text )
367- {
368- for ( int i = 0 ; i < blendFactorOptions . Length ; i ++ )
369- {
370- if ( text . Equals ( blendFactorOptions [ i ] , StringComparison . OrdinalIgnoreCase ) )
371- {
372- return blendFactors [ i ] ;
373- }
374- }
375-
376- return null ;
377- }
378-
379- private static BlendOperation ? GetBlendOperation ( ReadOnlySpan < char > text )
380- {
381- for ( int i = 0 ; i < blendOperationOptions . Length ; i ++ )
382- {
383- if ( text . Equals ( blendOperationOptions [ i ] , StringComparison . OrdinalIgnoreCase ) )
384- {
385- return blendOperations [ i ] ;
386- }
387- }
388-
389- return null ;
390- }
391-
392- private static CompareOperation ? GetCompareOperation ( ReadOnlySpan < char > text )
393- {
394- for ( int i = 0 ; i < compareOperationOptions . Length ; i ++ )
395- {
396- if ( text . Equals ( compareOperationOptions [ i ] , StringComparison . OrdinalIgnoreCase ) )
397- {
398- return compareOperations [ i ] ;
399- }
400- }
401-
402- return null ;
403- }
404-
405- private static StencilOperation ? GetStencilOperation ( ReadOnlySpan < char > text )
406- {
407- for ( int i = 0 ; i < stencilOperationOptions . Length ; i ++ )
408- {
409- if ( text . Equals ( stencilOperationOptions [ i ] , StringComparison . OrdinalIgnoreCase ) )
410- {
411- return stencilOperations [ i ] ;
412- }
413- }
414-
415- return null ;
416- }
417330 }
418331}
0 commit comments