本文整理汇总了C#中fCraft.Player.SelectMarks方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SelectMarks方法的具体用法?C# Player.SelectMarks怎么用?C# Player.SelectMarks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fCraft.Player
的用法示例。
在下文中一共展示了Player.SelectMarks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MarkHandler
static void MarkHandler( Player player, Command cmd )
{
Map map = player.WorldMap;
int x, y, z;
Vector3I coords;
if( cmd.NextInt( out x ) && cmd.NextInt( out y ) && cmd.NextInt( out z ) ) {
if( cmd.HasNext ) {
CdMark.PrintUsage( player );
return;
}
coords = new Vector3I( x, y, z );
} else {
coords = player.Position.ToBlockCoords();
}
coords.X = Math.Min( map.Width - 1, Math.Max( 0, coords.X ) );
coords.Y = Math.Min( map.Length - 1, Math.Max( 0, coords.Y ) );
coords.Z = Math.Min(map.Height - 1, Math.Max(0, coords.Z));
if (player.SelectionMarksExpected > 0)
{
player.SelectionAddMark(coords, true);
}
else if(player.markSet > 0)
{
player.selectedMarks.Add(coords);
player.SelectMarks();
}
else
{
player.MessageNow("Cannot mark - no selection in progress.");
}
}
示例2: HighlightHandler
static void HighlightHandler(Player player, Command cmd)
{
string option = cmd.Next();
if (String.IsNullOrEmpty(option))
{
CdHighlight.PrintUsage(player);
return;
}
switch (option.ToLower())
{
case "create":
case "new":
case "add":
string name = cmd.Next();
if (String.IsNullOrEmpty(name))
{
player.Message("Usage is /Highlight create [highlight name]");
return;
}
if (Server.Highlights.Keys.Contains(name))
{
player.Message("A highlight with that name already exists!");
return;
}
System.Drawing.Color systemColor;
string color = cmd.Next();
if (String.IsNullOrEmpty(color))
{
player.Message("Usage is /Highlight create [highlight name] [color or #htmlcolor] [Percent Opaque]");
return;
}
if (color.Contains('#'))
{
try
{
systemColor = System.Drawing.ColorTranslator.FromHtml(color);
}
catch
{
player.Message("Unrecognized color! Please use a valid color name or html color code.");
return;
}
}
else
{
try
{
systemColor = System.Drawing.Color.FromName(color);
}
catch
{
player.Message("Unrecognized color! Please use a valid color name or html color code.");
return;
}
}
string opacity = cmd.Next();
int percentOpacity;
if (String.IsNullOrEmpty(opacity))
{
player.Message("Usage is /Highlight create [highlight name] [color or #htmlcolor] [Percent Opaque]");
return;
}
if (!Int32.TryParse(opacity, out percentOpacity))
{
player.Message("Percent opacity must be from 0-100, where 0 would be transparent, and 100 would be completely opaque.");
return;
}
player.highlightName = name;
player.cmd = cmd.Name;
player.color = systemColor;
player.percentOpacity = percentOpacity;
player.SelectMarks();
break;
case "remove":
case "delete":
string targetHighlight = cmd.Next();
if (String.IsNullOrEmpty(targetHighlight))
{
CdHighlight.PrintUsage(player);
return;
}
if(!Server.Highlights.Keys.Contains(targetHighlight))
{
player.Message("That highlight zone was not found! Please make sure you spelled it correctly!");
return;
}
Tuple<int, Vector3I, Vector3I, System.Drawing.Color, int> ID;
Server.Highlights.TryGetValue(targetHighlight, out ID);
player.World.Players.Send(PacketWriter.RemoveSelectionCuboid((byte)ID.Item1));
break;
//.........这里部分代码省略.........