本文整理汇总了C#中Command.Next方法的典型用法代码示例。如果您正苦于以下问题:C# Command.Next方法的具体用法?C# Command.Next怎么用?C# Command.Next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command
的用法示例。
在下文中一共展示了Command.Next方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BrushHandler
static void BrushHandler( Player player, Command cmd ) {
string brushName = cmd.Next();
if( brushName == null ) {
player.Message( player.Brush.Description );
} else {
IBrushFactory brushFactory = GetBrushFactory( brushName );
if( brushFactory == null ) {
player.Message( "Unrecognized brush \"{0}\"", brushName );
} else {
IBrush newBrush = brushFactory.MakeBrush( player, cmd );
if( newBrush != null ) {
player.Brush = newBrush;
player.Message( "Brush set to {0}", player.Brush.Description );
}
}
}
}
示例2: ReadParams
public override bool ReadParams( Command cmd )
{
// get image URL
string urlString = cmd.Next();
if( String.IsNullOrEmpty( urlString ) ) {
return false;
}
// if string starts with "++", load image from imgur
if( urlString.StartsWith( "++" ) ) {
urlString = "http://i.imgur.com/" + urlString.Substring( 2 );
}
// prepend the protocol, if needed (assume http)
if( !urlString.StartsWith( "http://", StringComparison.OrdinalIgnoreCase ) ) {
urlString = "http://" + urlString;
}
// validate the image URL
Uri url;
if( !Uri.TryCreate( urlString, UriKind.Absolute, out url ) ) {
Player.Message( "DrawImage: Invalid URL given." );
return false;
} else if( !url.Scheme.Equals( Uri.UriSchemeHttp ) && !url.Scheme.Equals( Uri.UriSchemeHttps ) ) {
Player.Message( "DrawImage: Invalid URL given. Only HTTP and HTTPS links are allowed." );
return false;
}
ImageUrl = url;
// Check if player gave optional second argument (palette name)
string paletteName = cmd.Next();
if( paletteName != null ) {
StandardBlockPalettes paletteType;
if( EnumUtil.TryParse( paletteName, out paletteType, true ) ) {
Palette = BlockPalette.GetPalette( paletteType );
} else {
Player.Message( "DrawImage: Unrecognized palette \"{0}\". Available palettes are: \"{1}\"",
paletteName,
Enum.GetNames( typeof( StandardBlockPalettes ) ).JoinToString() );
return false;
}
} else {
// default to "Light" (lit single-layer) palette
Palette = BlockPalette.Light;
}
// All set
return true;
}