本文整理汇总了C#中Scanner.NextLine方法的典型用法代码示例。如果您正苦于以下问题:C# Scanner.NextLine方法的具体用法?C# Scanner.NextLine怎么用?C# Scanner.NextLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scanner
的用法示例。
在下文中一共展示了Scanner.NextLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadMap
private void loadMap()
{
ArrayList<string> lines = new ArrayList<string>();
int width = 0;
int height = 0;
var scanner = new Scanner(SampleGame.map);
while (scanner.HasNextLine())
{
string line = scanner.NextLine();
// no more lines to read
if (line == null)
{
break;
}
if (!line.StartsWith("!"))
{
lines.Add(line);
width = Math.Max(width, line.Length);
}
}
height = lines.Size();
for (int j = 0; j < 12; j++)
{
string line = (string) lines.Get(j);
for (int i = 0; i < width; i++)
{
if (i < line.Length)
{
char ch = line[i];
Tile t = new Tile(i, j, char.GetNumericValue(ch));
tilearray.Add(t);
}
}
}
}
示例2: Create
}//Call
public override IObject Create( int argc )
{
if( argc == 0 )
{
return null;
}
string arglist = null;
for( var i = 0; i < (argc - 1); i++ )
{
if( arglist == null )
{
arglist = Arg( argc, i ).String;
}
else
{
arglist += ", " + Arg( argc, i ).String;
}
}
List<Engine.ArgInfo> args = null;
if( arglist != null )
{
var scanner = new Scanner();
scanner.Line = arglist;
for( ; ; )
{
if( scanner.Word == null )
{
return null;
}
if( args == null )
{
args = new List<Engine.ArgInfo>();
}
args.Add( new Engine.ArgInfo() {
Name = scanner.Word,
Type = -1,
Value = -1
} );
if( scanner.Next().Eol )
{
scanner.NextLine();
}
if( scanner.Eof )
{
break;
}
if( scanner.Curr != ',' )
{
return null;
}
if( scanner.Next().Eol )
{
scanner.NextLine();
}
if( scanner.Eof )
{
break;
}
}
}
var body = Arg( argc, argc - 1 ).String;
var code = Engine.Compile( body );
return new FunctionObj( Engine, Prototype, code, 0, code.Length, -1, args?.ToArray(), (Engine.Opts & Engine.Opt.FuncText) == 0 ? null : ((("function anonymous(" + (args == null ? "" : System.String.Join( ", ", args.Select( x => x.Name ) ))) + ") {\n") + body) + "\n}" );
}//Create