本文整理汇总了C#中fCraft.Player.SetCallback方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SetCallback方法的具体用法?C# Player.SetCallback怎么用?C# Player.SetCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fCraft.Player
的用法示例。
在下文中一共展示了Player.SetCallback方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ZoneTest
static void ZoneTest( Player player, Command cmd ) {
player.SetCallback( 1, ZoneTestCallback, null );
player.Message( "Click the block that you would like to test." );
}
示例2: Measure
internal static void Measure( Player player, Command cmd ) {
player.SetCallback( 2, MeasureCallback, null );
player.Message( "Measure: Select the area to be measured" );
}
示例3: ZoneAdd
internal static void ZoneAdd( Player player, Command cmd ) {
string zoneName = cmd.Next();
if( zoneName == null ) {
cdZoneAdd.PrintUsage( player );
return;
}
Zone zone = new Zone();
if( zoneName.StartsWith( "+" ) ) {
PlayerInfo info;
if( !PlayerDB.FindPlayerInfo( zoneName.Substring( 1 ), out info ) ) {
player.Message( "More than one player found matching \"{0}\"", zoneName.Substring( 1 ) );
return;
}
if( info == null ) {
player.NoPlayerMessage( zoneName.Substring( 1 ) );
return;
}
zone.Name = info.Name;
zone.Controller.MinRank = info.Rank.NextRankUp ?? info.Rank;
zone.Controller.Include( info );
player.Message( "Zone: Creating a {0}+&S zone for player {1}&S. Place a block or type /mark to use your location.",
zone.Controller.MinRank.GetClassyName(), info.GetClassyName() );
player.SetCallback( 2, ZoneAddCallback, zone, cdZoneAdd.Permissions );
} else {
if( !World.IsValidName( zoneName ) ) {
player.Message( "\"{0}\" is not a valid zone name", zoneName );
return;
}
if( player.World.Map.FindZone( zoneName ) != null ) {
player.Message( "A zone with this name already exists. Use &H/zedit&S to edit." );
return;
}
zone.Name = zoneName;
string rankName = cmd.Next();
if( rankName == null ) {
player.Message( "No rank was specified. See &H/help zone" );
return;
}
Rank minRank = RankManager.ParseRank( rankName );
if( minRank != null ) {
string name;
while( (name = cmd.Next()) != null ) {
if( name.Length == 0 ) continue;
PlayerInfo info;
if( !PlayerDB.FindPlayerInfo( name.Substring( 1 ), out info ) ) {
player.Message( "More than one player found matching \"{0}\"", name.Substring( 1 ) );
return;
}
if( info == null ) {
player.NoPlayerMessage( name.Substring( 1 ) );
return;
}
if( name.StartsWith( "+" ) ) {
zone.Controller.Include( info );
} else if( name.StartsWith( "-" ) ) {
zone.Controller.Exclude( info );
}
}
zone.Controller.MinRank = minRank;
player.SetCallback( 2, ZoneAddCallback, zone, cdZoneAdd.Permissions );
player.Message( "Zone: Place a block or type /mark to use your location." );
} else {
player.NoRankMessage( rankName );
}
}
}
示例4: Draw
//.........这里部分代码省略.........
case DrawMode.SphereHollow:
if( mode == DrawMode.CuboidHollow ) {
callback = CuboidHollowCallback;
} else if( mode == DrawMode.EllipsoidHollow ) {
callback = EllipsoidHollowCallback;
} else {
callback = SphereHollowCallback;
}
string innerBlockName = cmd.Next();
Block innerBlock = Block.Undefined;
if( innerBlockName != null ) {
innerBlock = Map.GetBlockByName( innerBlockName );
if( innerBlock == Block.Undefined ) {
player.Message( "{0}: Unrecognized block: {1}",
mode, innerBlockName );
}
}
selectionArgs = new HollowShapeArgs {
OuterBlock = block,
InnerBlock = innerBlock
};
break;
case DrawMode.CuboidWireframe:
callback = CuboidWireframeCallback;
break;
case DrawMode.Ellipsoid:
callback = EllipsoidCallback;
break;
case DrawMode.Sphere:
callback = SphereCallback;
break;
case DrawMode.Replace:
case DrawMode.ReplaceNot:
string affectedBlockName = cmd.Next();
if( affectedBlockName == null ) {
if( mode == DrawMode.ReplaceNot ) {
cdReplaceNot.PrintUsage( player );
} else {
cdReplace.PrintUsage( player );
}
return;
}
List<Block> affectedTypes = new List<Block> { block };
do {
Block affectedType = Map.GetBlockByName( affectedBlockName );
if( affectedType != Block.Undefined ) {
affectedTypes.Add( affectedType );
} else {
player.MessageNow( "{0}: Unrecognized block type: {1}", mode, affectedBlockName );
return;
}
} while( (affectedBlockName = cmd.Next()) != null );
Block[] replacedTypes = affectedTypes.Take( affectedTypes.Count - 1 ).ToArray();
Block replacementType = affectedTypes.Last();
selectionArgs = new ReplaceArgs {
DoExclude = (mode == DrawMode.ReplaceNot),
Types = replacedTypes,
ReplacementBlock = replacementType
};
callback = ReplaceCallback;
if( mode == DrawMode.ReplaceNot ) {
player.MessageNow( "ReplaceNot: Ready to replace everything EXCEPT ({0}) with {1}",
replacedTypes.JoinToString(),
replacementType );
} else {
player.MessageNow( "Replace: Ready to replace ({0}) with {1}",
replacedTypes.JoinToString(),
replacementType );
}
break;
case DrawMode.Line:
callback = LineCallback;
break;
default:
throw new ArgumentOutOfRangeException( "mode" );
}
player.SetCallback( 2, callback, selectionArgs, Permission.Draw );
if( block != Block.Undefined ) {
player.MessageNow( "{0} ({1}): Click a block or use &H/mark",
mode, block );
} else {
player.MessageNow( "{0}: Click a block or use &H/mark",
mode, block );
}
}
示例5: Paste
internal static void Paste( Player player, Command cmd ) {
if( player.CopyInformation == null ) {
player.MessageNow( "Nothing to paste! Copy something first." );
return;
}
List<Block> includedTypes = new List<Block>();
string includedBlockName = cmd.Next();
if( includedBlockName != null ) {
do {
Block includedType = Map.GetBlockByName( includedBlockName );
if( includedType != Block.Undefined ) {
includedTypes.Add( includedType );
} else {
player.MessageNow( "PasteNot: Unrecognized block type: {0}", includedBlockName );
return;
}
} while( (includedBlockName = cmd.Next()) != null );
}
PasteArgs args;
if( includedTypes.Count > 0 ) {
args = new PasteArgs {
DoInclude = true,
BlockTypes = includedTypes.ToArray()
};
player.MessageNow( "Ready to paste ONLY {0}", includedTypes.JoinToString() );
} else {
args = new PasteArgs {
BlockTypes = new Block[0]
};
}
player.SetCallback( 1, PasteCallback, args, cdPaste.Permissions );
player.MessageNow( "Paste: Place a block or type /mark to use your location. " );
}
示例6: PasteNot
internal static void PasteNot( Player player, Command cmd ) {
if( player.CopyInformation == null ) {
player.MessageNow( "Nothing to paste! Copy something first." );
return;
}
PasteArgs args;
List<Block> excludedTypes = new List<Block>();
string excludedBlockName = cmd.Next();
if( excludedBlockName != null ) {
do {
Block excludedType = Map.GetBlockByName( excludedBlockName );
if( excludedType != Block.Undefined ) {
excludedTypes.Add( excludedType );
} else {
player.MessageNow( "PasteNot: Unrecognized block type: {0}", excludedBlockName );
return;
}
} while( (excludedBlockName = cmd.Next()) != null );
}
if( excludedTypes.Count > 0 ) {
args = new PasteArgs {
DoExclude = true,
BlockTypes = excludedTypes.ToArray()
};
player.MessageNow( "Ready to paste all EXCEPT {0}",
excludedTypes.JoinToString() );
} else {
player.MessageNow( "PasteNot: Please specify block(s) to exclude." );
return;
}
player.SetCallback( 1, PasteCallback, args, cdPasteNot.Permissions );
player.MessageNow( "PasteNot: Place a block or type /mark to use your location. " );
}
示例7: Cut
internal static void Cut( Player player, Command cmd ) {
Block fillBlock = Block.Air;
string fillBlockName = cmd.Next();
if( fillBlockName != null ) {
fillBlock = Map.GetBlockByName( fillBlockName );
if( fillBlock == Block.Undefined ) {
player.Message( "Cut: Unknown block type \"{0}\"", fillBlockName );
return;
}
}
player.SetCallback( 2, CutCallback, fillBlock, cdCut.Permissions );
player.MessageNow( "Cut: Place a block or type /mark to use your location." );
}
示例8: Copy
internal static void Copy( Player player, Command cmd ) {
player.SetCallback( 2, CopyCallback, null, cdCopy.Permissions );
player.MessageNow( "Copy: Place a block or type /mark to use your location." );
}