本文整理汇总了C#中fCraft.Player.Spectate方法的典型用法代码示例。如果您正苦于以下问题:C# Player.Spectate方法的具体用法?C# Player.Spectate怎么用?C# Player.Spectate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fCraft.Player
的用法示例。
在下文中一共展示了Player.Spectate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpectateHandler
static void SpectateHandler( Player player, CommandReader cmd ) {
string targetName = cmd.Next();
if( targetName == null ) {
PlayerInfo lastSpec = player.LastSpectatedPlayer;
if( lastSpec != null ) {
Player spec = player.SpectatedPlayer;
if( spec != null ) {
player.Message( "Now spectating {0}", spec.ClassyName );
} else {
player.Message( "Last spectated {0}", lastSpec.ClassyName );
}
} else {
CdSpectate.PrintUsage( player );
}
return;
}
Player target = Server.FindPlayerOrPrintMatches( player, targetName, false, false, true );
if( target == null ) return;
if( !player.Can( Permission.Spectate, target.Info.Rank ) ) {
player.Message( "You may only spectate players ranked {0}&S or lower.",
player.Info.Rank.GetLimit( Permission.Spectate ).ClassyName );
player.Message( "{0}&S is ranked {1}",
target.ClassyName, target.Info.Rank.ClassyName );
return;
}
if( !player.Spectate( target ) ) {
player.Message( "Already spectating {0}", target.ClassyName );
}
}
示例2: SpectateHandler
static void SpectateHandler( Player player, Command cmd )
{
string targetName = cmd.Next();
if( targetName == null ) {
PlayerInfo lastSpec = player.LastSpectatedPlayer;
if( lastSpec != null ) {
Player spec = player.SpectatedPlayer;
if( spec != null )
{
if (spec.World.Name != player.World.Name)
{
player.JoinWorld(spec.World, WorldChangeReason.SpectateTargetJoined);
player.Message("Joined " + spec.World.Name + " to continue spectating " + spec.ClassyName);
}
player.Message( "Now spectating {0}", spec.ClassyName );
}
else
{
player.Message( "Last spectated {0}", lastSpec.ClassyName );
}
} else {
CdSpectate.PrintUsage( player );
}
return;
}
Player target = Server.FindPlayerOrPrintMatches( player, targetName, false, true );
if( target == null ) return;
if( target == player ) {
player.Message( "You cannot spectate yourself." );
return;
}
if( !player.Can( Permission.Spectate, target.Info.Rank ) ) {
player.Message( "You may only spectate players ranked {0}&S or lower.",
player.Info.Rank.GetLimit( Permission.Spectate ).ClassyName );
player.Message( "{0}&S is ranked {1}",
target.ClassyName, target.Info.Rank.ClassyName );
return;
}
if( !player.Spectate( target ) ) {
player.Message( "Already spectating {0}", target.ClassyName );
}
}
示例3: SpecPatrolHandler
static void SpecPatrolHandler( Player player, CommandReader cmd ) {
World playerWorld = player.World;
if( playerWorld == null ) PlayerOpException.ThrowNoWorld( player );
Player target = playerWorld.GetNextPatrolTarget( player,
p => player.Can( Permission.Spectate, p.Info.Rank ),
true );
if( target == null ) {
player.Message( "Patrol: No one to spec-patrol in this world." );
return;
}
target.LastPatrolTime = DateTime.UtcNow;
player.Spectate( target );
}
示例4: SpecPatrolHandler
static void SpecPatrolHandler( Player player, Command cmd )
{
World playerWorld = player.World;
if( playerWorld == null ) PlayerOpException.ThrowNoWorld( player );
Player target = playerWorld.GetNextPatrolTarget( player );
if( target == null ) {
player.Message( "Patrol: No one to patrol in this world." );
return;
}
target.LastPatrolTime = DateTime.UtcNow;
player.Spectate( target );
}