Axiom.Serialization.MaterialSerializer.ParseIteration C# (CSharp) Метод

ParseIteration() приватный Метод

private ParseIteration ( string parameters, MaterialScriptContext context ) : bool
parameters string
context MaterialScriptContext
Результат bool
		protected static bool ParseIteration( string parameters, MaterialScriptContext context )
		{
			string[] values = parameters.Split( new char[] { ' ', '\t' } );

			if ( values.Length < 1 || values.Length > 2 )
			{
				LogParseError( context, "Bad iteration attribute, wrong number of parameters (expected 1 or 2)." );
				return false;
			}

			if ( values[ 0 ] == "once" )
			{
				context.pass.SetRunOncePerLight( false );
			}
			else if ( values[ 0 ] == "once_per_light" )
			{
				if ( values.Length == 2 )
				{
					// parse light type

					// lookup the real enum equivalent to the script value
					object val = ScriptEnumAttribute.Lookup( values[ 1 ], typeof( LightType ) );

					// if a value was found, assign it
					if ( val != null )
					{
						context.pass.SetRunOncePerLight( true, true, (LightType)val );
					}
					else
					{
						string legalValues = ScriptEnumAttribute.GetLegalValues( typeof( LightType ) );
						LogParseError( context, "Bad iteration attribute, valid values are {0}", legalValues );
					}
				}
				else
				{
					context.pass.SetRunOncePerLight( true, false );
				}
			}
			else
			{
				LogParseError( context, "Bad iteration attribute, valid valies are 'once' and 'once_per_light'." );
			}

			return false;
		}