当前位置: 首页>>代码示例>>C#>>正文


C# Command.Next方法代码示例

本文整理汇总了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 );
             }
         }
     }
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:17,代码来源:BrushManager.cs

示例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;
        }
开发者ID:GlennMR,项目名称:800craft,代码行数:49,代码来源:ImageDrawOperation.cs


注:本文中的Command.Next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。