Ejemplo n.º 1
0
	// this should be menthod  of text panel
	// Sys func to parser one line script

	void ParserScript( CTextLine line )
	{
		for( int i = 0 ; i < line.GetRowNum() ; i++ )
		{
			string s = line.GetString( i ).ToUpper();
			if( s == "ADDCHAR" )
			{
				string sp = line.GetString( ++i );	if( sp == null ) return; //  null = error
				List<string> lst = cTextArray.GetParamLst( sp );

				// default value			
				int[] array1 = new int[5];
				int j = 0 ; 

				foreach( string s2 in lst )
				{
					array1[j++] = int.Parse( s2.Trim( ) );

				}

				AddChar( array1[0] , array1[1] , array1[2] );

			}
			else if( s == "MOVECHAR" )
			{
				string sp = line.GetString( ++i );	if( sp == null ) return; //  null = error
				List<string> lst = cTextArray.GetParamLst( sp );
				
				// default value			
				int[] array1 = new int[5];
				int j = 0 ; 
				
				foreach( string s2 in lst )
				{
					array1[j++] = int.Parse( s2.Trim( ) );
					
				}
				
				MoveChar( array1[0] , array1[1] , array1[2] );
			}
			else if( s == "DELCHAR" )
			{
				string sp = line.GetString( ++i );	if( sp == null ) return; //  null = error
				List<string> lst = cTextArray.GetParamLst( sp );
				
				// default value			
				int[] array1 = new int[5];
				int j = 0 ; 
				
				foreach( string s2 in lst )
				{
					array1[j++] = int.Parse( s2.Trim( ) );
					
				}
				
				DelChar( array1[0] , array1[1] );
			}
			else if( s == "DELALL" )
			{
				string sp = line.GetString( ++i );	if( sp == null ) return; //  null = error
				int nType = 0;
				nType = int.Parse( sp.Trim() );
				//if( lst.Count > 0 )
				//	nID = int.Parse( lst[0] );
				
				DelAll( nType  );
				//DelChar( nCharid , nType );
			}
			else if( s == "TEXT" )
			{
				string sp= line.GetString( ++i );	if( sp == null ) return; //  null = error 
				//List<string> lst = cTextArray.GetParamLst( sp );
				
				// only 1 par default value
				int nID = 0;
				nID = int.Parse( sp.Trim() );
				//if( lst.Count > 0 )
				//	nID = int.Parse( lst[0] );
			
				AddStoryText( nID  );
			}
			else if( s == "BGM" )
			{
				string sp1 = line.GetString( ++i );	if( sp1 == null ) return; //  null = error
				int nBgm = int.Parse( sp1 );
				GameSystem.PlayBGM( nBgm ) ;
				
			}
			else if( s == "END" )
			{
				// no need param
				End();
				return;
			}
		}
	}