当前位置: 首页>>代码示例>>C#>>正文


C# Player.SendNow方法代码示例

本文整理汇总了C#中fCraft.Player.SendNow方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendNow方法的具体用法?C# Player.SendNow怎么用?C# Player.SendNow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fCraft.Player的用法示例。


在下文中一共展示了Player.SendNow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendGlobalDefinitions

 public static void SendGlobalDefinitions(Player p) {
     for (int i = (int)Map.MaxCustomBlockType + 1; i < GlobalDefinitions.Length; i++) {
         BlockDefinition def = GlobalDefinitions[i];
         if (def == null) continue;
         
         if (p.Supports(CpeExtension.BlockDefinitionsExt) && def.Shape != 0)
             p.SendNow(Packet.MakeDefineBlockExt(def));
         else
             p.SendNow(Packet.MakeDefineBlock(def));
         p.SendNow(Packet.MakeSetBlockPermission(
             (Block)def.BlockID, true, true));
     }
 }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:13,代码来源:BlockDefinition.cs

示例2: PlaceHandler

 private static void PlaceHandler(Player player, CommandReader cmd) {
     bool isConsole = (player == Player.Console);
     if (isConsole && cmd.Count < 6) {
         player.Message("When used by console /Place requires a world name.");
         player.Message("/Place [x] [y] [z] [block] [world]");
         return;
     }
     Block block = Block.Stone;
     if (!isConsole && player.LastUsedBlockType != Block.None)
     	block = player.LastUsedBlockType;
     Vector3I coords;
     int x, y, z;
     if (cmd.NextInt(out x) && cmd.NextInt(out y) && cmd.NextInt(out z)) {
         if (cmd.HasNext) {
             string last = cmd.Next();
             if (!Map.GetBlockByName(last, false, out block)) {
                 player.Message("\"{0}\" is not a valid block type", last);
                 return;
             }
         }
         coords = new Vector3I(x, y, z);
     } else if (isConsole) {
         player.Message("Invalid coordinates!");
         return;
     } else {
         cmd.Rewind();
         if (cmd.HasNext) {
             string last = cmd.Next();
             if (!Map.GetBlockByName(last, false, out block)) {
                 player.Message("\"{0}\" is not a valid block type", last);
                 return;
             }
         }
         coords = new Vector3I(player.Position.X / 32, player.Position.Y / 32, (player.Position.Z - 64) / 32);
     }
     World world;
     if (player == Player.Console) {
         string worldName = cmd.Next();
         if (string.IsNullOrEmpty(worldName)) {
             player.Message("Console must specify a world!");
         }
         world = WorldManager.FindWorldOrPrintMatches(player, worldName);
         if (world == null)
             return;
     } else {
         world = player.World;
     }
     bool unLoad = false;
     if (!world.IsLoaded) {
         world.LoadMap();
         unLoad = true;
     }
     coords.X = Math.Min(world.map.Width - 1, Math.Max(0, coords.X));
     coords.Y = Math.Min(world.map.Length - 1, Math.Max(0, coords.Y));
     coords.Z = Math.Min(world.map.Height - 1, Math.Max(0, coords.Z));
     
     if (player == Player.Console) {
         BlockUpdate blockUpdate = new BlockUpdate(player, coords, block);
         player.Info.ProcessBlockPlaced((byte)block);
         world.map.QueueUpdate(blockUpdate);
         player.RaisePlayerPlacedBlockEvent(player, world.map, coords, block, world.map.GetBlock(coords), BlockChangeContext.Manual, true);
     } else {
         player.SendNow(Packet.MakeSetBlock(coords, block, player));
         player.PlaceBlockWithEvents(coords, ClickAction.Build, block);
     }
     if (!isConsole) 
         player.Message("{0} placed at {1}", block.ToString(), coords.ToString());
     if (unLoad) {
         world.UnloadMap(true);
     }
 }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:71,代码来源:BuildingCommands.cs


注:本文中的fCraft.Player.SendNow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。