本文整理汇总了C#中GuiRenderer.AddTextLines方法的典型用法代码示例。如果您正苦于以下问题:C# GuiRenderer.AddTextLines方法的具体用法?C# GuiRenderer.AddTextLines怎么用?C# GuiRenderer.AddTextLines使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiRenderer
的用法示例。
在下文中一共展示了GuiRenderer.AddTextLines方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnRenderUI
protected override void OnRenderUI( GuiRenderer renderer )
{
base.OnRenderUI( renderer );
UpdateHUD();
//render user names for moving pieces by users
foreach( Entity entity in Map.Instance.Children )
{
JigsawPuzzlePiece piece = entity as JigsawPuzzlePiece;
if( piece != null )
{
string userName = null;
if( EntitySystemWorld.Instance.IsServer() )
{
if( piece.Server_MovingByUser != null )
userName = piece.Server_MovingByUser.Name;
}
if( EntitySystemWorld.Instance.IsClientOnly() )
{
if( piece.Client_MovingByUser != null )
userName = piece.Client_MovingByUser.Name;
}
if( !string.IsNullOrEmpty( userName ) )
{
Vec2 screenPosition;
if( RendererWorld.Instance.DefaultCamera.ProjectToScreenCoordinates(
piece.Position, out screenPosition ) )
{
renderer.AddText( userName,
screenPosition, HorizontalAlign.Left, VerticalAlign.Top,
new ColorValue( 0, 1, 0, .75f ) );
}
}
}
}
//show list of users
if( GameNetworkServer.Instance != null || GameNetworkClient.Instance != null )
{
List<string> lines = new List<string>();
lines.Add( "Players:" );
if( GameNetworkServer.Instance != null )
{
UserManagementServerNetworkService userService =
GameNetworkServer.Instance.UserManagementService;
foreach( UserManagementServerNetworkService.UserInfo user in userService.Users )
{
string line = " " + user.Name;
if( user == userService.ServerUser )
line += " (you)";
lines.Add( line );
}
}
if( GameNetworkClient.Instance != null )
{
UserManagementClientNetworkService userService =
GameNetworkClient.Instance.UserManagementService;
foreach( UserManagementClientNetworkService.UserInfo user in userService.Users )
{
string line = " " + user.Name;
if( user == userService.ThisUser )
line += " (you)";
lines.Add( line );
}
}
renderer.AddTextLines( lines, new Vec2( .01f, .15f ), HorizontalAlign.Left, VerticalAlign.Top,
0, new ColorValue( 1, 1, 0 ) );
}
//screenMessages
{
Vec2 pos = new Vec2( .01f, .9f );
for( int n = screenMessages.Count - 1; n >= 0; n-- )
{
ScreenMessage message = screenMessages[ n ];
ColorValue color = new ColorValue( 1, 1, 1, message.timeRemaining );
if( color.Alpha > 1 )
color.Alpha = 1;
renderer.AddText( message.text, pos, HorizontalAlign.Left, VerticalAlign.Top,
color );
pos.Y -= renderer.DefaultFont.Height;
}
}
//Game is paused on server
if( EntitySystemWorld.Instance.IsClientOnly() && !EntitySystemWorld.Instance.Simulation )
{
renderer.AddText( "Game is paused on server", new Vec2( .5f, .5f ),
HorizontalAlign.Center, VerticalAlign.Center, new ColorValue( 1, 0, 0 ) );
//.........这里部分代码省略.........