本文整理汇总了C#中fCraft.Player.SelectionStart方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SelectionStart方法的具体用法?C# Player.SelectionStart怎么用?C# Player.SelectionStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fCraft.Player
的用法示例。
在下文中一共展示了Player.SelectionStart方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw2DHandler
static void Draw2DHandler( Player player, Command cmd )
{
string Shape = cmd.Next();
if ( Shape == null ) {
CdDraw2D.PrintUsage( player );
return;
}
switch ( Shape.ToLower() ) {
case "polygon":
case "star":
case "spiral":
break;
default:
CdDraw2D.PrintUsage( player );
return;
}
int radius = 0;
int Points = 0;
if ( !cmd.NextInt( out radius ) ) {
radius = 20;
}
if ( !cmd.NextInt( out Points ) ) {
Points = 5;
}
bool fill = true;
if ( cmd.HasNext ) {
if ( !bool.TryParse( cmd.Next(), out fill ) ) {
fill = true;
}
}
Draw2DData tag = new Draw2DData() { Shape = Shape, Points = Points, Radius = radius, Fill = fill };
player.Message( "Draw2D({0}): Click 2 blocks or use &H/Mark&S to set direction.", Shape );
player.SelectionStart( 2, Draw2DCallback, tag, Permission.DrawAdvanced );
}
示例2: Fill2DHandler
static void Fill2DHandler( Player player, CommandReader cmd ) {
Fill2DDrawOperation op = new Fill2DDrawOperation( player );
IBrushInstance brush = player.Brush.MakeInstance( player, cmd, op );
if( brush == null ) return;
op.Brush = brush;
player.SelectionStart( 1, Fill2DCallback, op, Permission.Draw );
player.Message( "{0}: Click a block to start filling.", op.Description );
}
示例3: CopyHandler
static void CopyHandler( Player player, CommandReader cmd ) {
if( cmd.HasNext ) {
CdCopy.PrintUsage( player );
return;
}
player.SelectionStart( 2, CopyCallback, null, CdCopy.Permissions );
player.MessageNow( "Copy: Click or &H/Mark&S 2 blocks." );
}
示例4: RestoreHandler
static void RestoreHandler( Player player, CommandReader cmd ) {
string fileName = cmd.Next();
if( fileName == null ) {
CdRestore.PrintUsage( player );
return;
}
if( cmd.HasNext ) {
CdRestore.PrintUsage( player );
return;
}
string fullFileName = WorldManager.FindMapFile( player, fileName );
if( fullFileName == null ) return;
Map map;
if( !MapUtility.TryLoad( fullFileName, true, out map ) ) {
player.Message( "Could not load the given map file ({0})", fileName );
return;
}
Map playerMap = player.WorldMap;
if( playerMap.Width != map.Width || playerMap.Length != map.Length || playerMap.Height != map.Height ) {
player.Message( "Map file dimensions must match your current world's dimensions ({0}x{1}x{2})",
playerMap.Width,
playerMap.Length,
playerMap.Height );
return;
}
map.Metadata["fCraft.Temp", "FileName"] = fullFileName;
player.SelectionStart( 2, RestoreCallback, map, CdRestore.Permissions );
player.MessageNow( "Restore: Click or &H/Mark&S 2 blocks." );
}
示例5: UndoAreaNotHandler
static void UndoAreaNotHandler( Player player, CommandReader cmd ) {
BlockDBUndoArgs args = ParseBlockDBUndoParams( player, cmd, "UndoAreaNot", true );
if( args == null ) return;
player.SelectionStart( 2, UndoAreaSelectionCallback, args, CdUndoAreaNot.Permissions );
player.MessageNow( "UndoAreaNot: Click or &H/Mark&S 2 blocks." );
}
示例6: CopyHandler
static void CopyHandler( Player player, Command cmd )
{
if( cmd.HasNext ) {
CdCopy.PrintUsage( player );
return;
}
player.SelectionStart( 2, CopyCallback, null, CdCopy.Permissions );
player.MessageNow( "Copy: Place a block or type /Mark to use your location." );
}
示例7: Fill2DHandler
static void Fill2DHandler( Player player, CommandReader cmd ) {
Fill2DDrawOperation op = new Fill2DDrawOperation( player );
if( !op.ReadParams( cmd ) ) return;
player.SelectionStart( 1, Fill2DCallback, op, Permission.Draw );
player.Message( "{0}: Click a block to start filling.", op.Description );
}
示例8: DrawOperationBegin
//copy-paste from BuildingCommands
private static void DrawOperationBegin(Player player, Command cmd, DrawOperation op)
{
IBrushInstance instance = player.Brush.MakeInstance(player, cmd, op);
if (instance != null)
{
op.Brush = instance;
player.SelectionStart(op.ExpectedMarks, new SelectionCallback(DrawOperationCallback), op, new Permission[] { Permission.DrawAdvanced });
player.Message("{0}: Click {1} blocks or use &H/Mark&S to make a selection.", new object[] { op.Description, op.ExpectedMarks });
}
}
示例9: PortalH
private static void PortalH(Player player, Command command)
{
try
{
String option = command.Next();
if (option == null)
{
CdPortal.PrintUsage(player);
}
else if (option.ToLower().Equals("create"))
{
if (player.Can(Permission.ManagePortal))
{
string world = command.Next();
if (world != null && WorldManager.FindWorldExact(world) != null)
{
DrawOperation operation = new CuboidDrawOperation(player);
NormalBrush brush = new NormalBrush(Block.Water, Block.Water);
string blockTypeOrName = command.Next();
if (blockTypeOrName != null && blockTypeOrName.ToLower().Equals("lava"))
{
brush = new NormalBrush(Block.Lava, Block.Lava);
}
else if (blockTypeOrName != null && !blockTypeOrName.ToLower().Equals("water"))
{
player.Message("Invalid block, choose between water or lava.");
return;
}
string portalName = command.Next();
if (portalName == null)
{
player.PortalName = null;
}
else
{
if (!Portal.DoesNameExist(player.World, portalName))
{
player.PortalName = portalName;
}
else
{
player.Message("A portal with name {0} already exists in this world.", portalName);
return;
}
}
operation.Brush = brush;
player.PortalWorld = world;
player.SelectionStart(operation.ExpectedMarks, PortalCreateCallback, operation, Permission.Draw);
player.Message("Click {0} blocks or use &H/Mark&S to mark the area of the portal.", operation.ExpectedMarks);
}
else
{
if (world == null)
{
player.Message("No world specified.");
}
else
{
player.MessageNoWorld(world);
}
}
}
else
{
player.MessageNoAccess(Permission.ManagePortal);
}
}
else if (option.ToLower().Equals("remove"))
{
if (player.Can(Permission.ManagePortal))
{
string portalName = command.Next();
if (portalName == null)
{
player.Message("No portal name specified.");
}
else
{
if (player.World.Portals != null && player.World.Portals.Count > 0)
{
bool found = false;
Portal portalFound = null;
lock (player.World.Portals.SyncRoot)
{
foreach (Portal portal in player.World.Portals)
{
if (portal.Name.Equals(portalName))
{
portalFound = portal;
found = true;
//.........这里部分代码省略.........
示例10: FeedHandler
static void FeedHandler( Player player, Command cmd )
{
string Option = cmd.Next();
if ( Option == null ) {
player.Message( "Argument cannot be null, try /Feed <create | remove | list>" );
return;
}
if ( Option.ToLower() == "create" ) {
player.Message( "Feed: Click 2 blocks or use &H/Mark&S to set direction." );
player.SelectionStart( 2, FeedCallback, Option, Permission.Draw );
return;
}
if ( Option.ToLower() == "list" ) {
FeedData[] list = player.World.Feeds.Values.OrderBy( feed => feed.Id ).ToArray();
if ( list.Length == 0 ) {
player.Message( "No feeds running." );
} else {
player.Message( "There are {0} feeds running:", list.Length );
foreach ( FeedData data in list ) {
player.Message( " #{0} ({1},{2},{3}) World: {4}",
data.Id, data.StartPos.X, data.StartPos.Y, data.StartPos.Z, data.world.ClassyName );
}
}
return;
}
if ( Option.ToLower() == "remove" || Option.ToLower() == "stop" ) {
int Id;
if ( cmd.NextInt( out Id ) ) {
FeedData data = FeedData.FindFeedById( Id, player.World );
if ( data == null ) {
player.Message( "Given feed (#{0}) does not exist.", Id );
} else {
data.started = false;
FeedData.RemoveFeedFromList( data, player.World );
player.Message( "Feed #" + Id + " has been removed" );
}
} else {
player.Message( "&WUnable to remove any feeds. Try /Feed remove <ID>" );
}
return;
} else {
player.Message( "&WUnknown argument. Check /Help Feed" );
return;
}
}
示例11: MessageBlock
static void MessageBlock( Player player, Command cmd )
{
string option = cmd.Next();
if ( option == null ) {
CdMessageBlock.PrintUsage( player );
return;
} else if ( option.ToLower() == "add" || option.ToLower() == "create" ) {
string Message = cmd.NextAll();
player.SelectionStart( 1, MessageBlockAdd, Message, CdMessageBlock.Permissions );
player.Message( "MessageBlock: Place a block or type /mark to use your location." );
return;
} else if ( option.ToLower().Equals( "remove" ) || option.ToLower().Equals( "rd" ) ) {
string MessageBlockName = cmd.Next();
if ( MessageBlockName == null ) {
player.Message( "No MessageBlock name specified." );
} else {
if ( player.World.Map.MessageBlocks != null && player.World.Map.MessageBlocks.Count > 0 ) {
bool found = false;
MessageBlock MessageBlockFound = null;
lock ( player.World.Map.MessageBlocks.SyncRoot ) {
foreach ( MessageBlock MessageBlock in player.World.Map.MessageBlocks ) {
if ( MessageBlock.Name.ToLower().Equals( MessageBlockName.ToLower() ) ) {
MessageBlockFound = MessageBlock;
found = true;
break;
}
}
if ( !found ) {
player.Message( "Could not find MessageBlock by name {0}.", MessageBlockName );
} else {
MessageBlockFound.Remove( player );
player.Message( "MessageBlock was removed." );
}
}
} else {
player.Message( "Could not find MessageBlock as this world doesn't contain a MessageBlock." );
}
}
} else if ( option.ToLower().Equals( "info" ) ) {
string MessageBlockName = cmd.Next();
if ( MessageBlockName == null ) {
player.Message( "No MessageBlock name specified." );
} else {
if ( player.World.Map.MessageBlocks != null && player.World.Map.MessageBlocks.Count > 0 ) {
bool found = false;
lock ( player.World.Map.MessageBlocks.SyncRoot ) {
foreach ( MessageBlock MessageBlock in player.World.Map.MessageBlocks ) {
if ( MessageBlock.Name.ToLower().Equals( MessageBlockName.ToLower() ) ) {
World MessageBlockWorld = WorldManager.FindWorldExact( MessageBlock.World );
player.Message( "MessageBlock '{0}&S' was created by {1}&S at {2}",
MessageBlock.Name, MessageBlock.Creator, MessageBlock.Created );
found = true;
}
}
}
if ( !found ) {
player.Message( "Could not find MessageBlock by name {0}.", MessageBlockName );
}
} else {
player.Message( "Could not find MessageBlock as this world doesn't contain a MessageBlock." );
}
}
} else if ( option.ToLower().Equals( "test" ) ) {
player.SelectionStart( 1, MessageBlockTestCallback, null, CdMessageBlock.Permissions );
player.Message( "MessageBlockTest: Click a block or type /mark to use your location." );
} else if ( option.ToLower().Equals( "list" ) ) {
if ( player.World.Map.MessageBlocks == null || player.World.Map.MessageBlocks.Count == 0 ) {
player.Message( "There are no MessageBlocks in {0}&S.", player.World.ClassyName );
} else {
String[] MessageBlockNames = new String[player.World.Map.MessageBlocks.Count];
System.Text.StringBuilder output = new System.Text.StringBuilder( "There are " + player.World.Map.MessageBlocks.Count + " MessageBlocks in " + player.World.ClassyName + "&S: " );
for ( int i = 0; i < player.World.Map.MessageBlocks.Count; i++ ) {
MessageBlockNames[i] = ( ( MessageBlock )player.World.Map.MessageBlocks[i] ).Name;
}
output.Append( MessageBlockNames.JoinToString( ", " ) );
player.Message( output.ToString() );
}
} else {
CdMessageBlock.PrintUsage( player );
}
}
示例12: Door
static void Door(Player player, Command cmd)
{
string name = cmd.Next();
if (String.IsNullOrEmpty(name))
{
player.Message("You must have a name for your door! Usage is /door [name]");
return;
}
if (player.WorldMap.Zones.FindExact("Door_" + name) != null)
{
player.Message("There is a door on this world with that name already!");
return;
}
Zone door = new Zone();
door.Name = "Door_" + name;
player.SelectionStart(2, DoorAdd, door, cdDoor.Permissions);
player.Message("Door: Place a block or type /mark to use your location.");
}
示例13: WriteHandler
static void WriteHandler( Player player, Command cmd )
{
string sentence = cmd.NextAll();
if ( sentence.Length < 1 ) {
CdWrite.PrintUsage( player );
return;
} else {
player.Message( "Write: Click 2 blocks or use &H/Mark&S to set direction." );
player.SelectionStart( 2, WriteCallback, sentence, Permission.DrawAdvanced );
}
}
示例14: DrawImageHandler
static void DrawImageHandler( Player player, Command cmd )
{
string Url = cmd.Next();
if ( string.IsNullOrEmpty( Url ) ) {
CdDrawImage.PrintUsage( player );
return;
} else {
player.Message( "DrawImage: Click 2 blocks or use &H/Mark&S to set direction." );
player.SelectionStart( 2, DrawImgCallback, Url, Permission.DrawAdvanced );
}
}
示例15: UndoAreaHandler
static void UndoAreaHandler( Player player, Command cmd )
{
if( !BlockDB.IsEnabledGlobally ) {
player.Message( "&WBlockDB is disabled on this server." );
return;
}
World playerWorld = player.World;
if( playerWorld == null ) PlayerOpException.ThrowNoWorld( player );
if( !playerWorld.BlockDB.IsEnabled ) {
player.Message( "&WBlockDB is disabled in this world." );
return;
}
string name = cmd.Next();
string range = cmd.Next();
if( name == null || range == null ) {
CdUndoArea.PrintUsage( player );
return;
}
if( cmd.HasNext ) {
CdUndoArea.PrintUsage( player );
return;
}
PlayerInfo target = PlayerDB.FindPlayerInfoOrPrintMatches( player, name );
if( target == null ) return;
if( player.Info != target && !player.Can( Permission.UndoOthersActions, target.Rank ) ) {
player.Message( "You may only undo actions of players ranked {0}&S or lower.",
player.Info.Rank.GetLimit( Permission.UndoOthersActions ).ClassyName );
player.Message( "Player {0}&S is ranked {1}", target.ClassyName, target.Rank.ClassyName );
return;
}
int count;
TimeSpan span;
if( Int32.TryParse( range, out count ) ) {
UndoAreaCountArgs args = new UndoAreaCountArgs {
Target = target,
World = playerWorld,
MaxBlocks = count
};
player.SelectionStart( 2, UndoAreaCountSelectionCallback, args, Permission.UndoOthersActions );
} else if( range.TryParseMiniTimespan( out span ) ) {
if( span > DateTimeUtil.MaxTimeSpan ) {
player.MessageMaxTimeSpan();
return;
}
UndoAreaTimeArgs args = new UndoAreaTimeArgs {
Target = target,
Time = span,
World = playerWorld
};
player.SelectionStart( 2, UndoAreaTimeSelectionCallback, args, Permission.UndoOthersActions );
} else {
CdUndoArea.PrintUsage( player );
return;
}
player.MessageNow( "UndoArea: Click 2 blocks or use &H/Mark&S to make a selection." );
}