本文整理汇总了C#中StringBuffer.AppendNum方法的典型用法代码示例。如果您正苦于以下问题:C# StringBuffer.AppendNum方法的具体用法?C# StringBuffer.AppendNum怎么用?C# StringBuffer.AppendNum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuffer
的用法示例。
在下文中一共展示了StringBuffer.AppendNum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TabKey
void TabKey()
{
int pos = caretPos == -1 ? buffer.Length - 1 : caretPos;
int start = pos;
char[] value = buffer.value;
while( start >= 0 && IsNameChar( value[start] ) )
start--;
start++;
if( pos < 0 || start > pos ) return;
string part = new String( value, start, pos + 1 - start );
List<string> matches = new List<string>();
game.Chat.Add( null, MessageType.ClientStatus5 );
bool extList = game.Network.UsingExtPlayerList;
CpeListInfo[] info = game.CpePlayersList;
Player[] players = game.Players.Players;
for( int i = 0; i < EntityList.MaxCount; i++ ) {
if( extList && info[i] == null ) continue;
if( !extList && players[i] == null ) continue;
string rawName = extList ? info[i].PlayerName : players[i].DisplayName;
string name = Utils.StripColours( rawName );
if( name.StartsWith( part, StringComparison.OrdinalIgnoreCase ) )
matches.Add( name );
}
if( matches.Count == 1 ) {
if( caretPos == -1 ) pos++;
int len = pos - start;
for( int i = 0; i < len; i++ )
buffer.DeleteAt( start );
if( caretPos != -1 ) caretPos -= len;
AppendText( matches[0] );
} else if( matches.Count > 1 ) {
StringBuffer sb = new StringBuffer( 64 );
int index = 0;
sb.Append( ref index, "&e" );
sb.AppendNum( ref index, matches.Count );
sb.Append( ref index, " matching names: " );
foreach( string match in matches ) {
if( (match.Length + 1 + sb.Length) > LineLength ) break;
sb.Append( ref index, match );
sb.Append( ref index, ' ' );
}
game.Chat.Add( sb.ToString(), MessageType.ClientStatus5 );
}
}