Пример #1
0
 public static void HandleOpenWindowPacket(IPacket _packet, MultiplayerClient client)
 {
     var packet = (OpenWindowPacket)_packet;
     IWindow window = null;
     switch (packet.Type)
     {
         case 1: // Crafting bench window
             window = new CraftingBenchWindow(client.CraftingRepository, client.Inventory);
             break;
     }
     window.ID = packet.WindowID;
     client.CurrentWindow = window;
 }
Пример #2
0
 public override bool BlockRightClicked(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user)
 {
     var window = new CraftingBenchWindow(user.Server.CraftingRepository, (InventoryWindow)user.Inventory);
     user.OpenWindow(window);
     window.Disposed += (sender, e) =>
     {
         var entityManager = user.Server.GetEntityManagerForWorld(world);
         for (int i = 0; i < window.CraftingGrid.StartIndex + window.CraftingGrid.Length; i++)
         {
             var item = window[i];
             if (!item.Empty)
             {
                 var entity = new ItemEntity(descriptor.Coordinates + Coordinates3D.Up, item);
                 entityManager.SpawnEntity(entity);
             }
         }
     };
     return false;
 }
Пример #3
0
 public override bool BlockRightClicked(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user)
 {
     var window = new CraftingBenchWindow(user.Server.CraftingRepository, (InventoryWindow)user.Inventory);
     user.OpenWindow(window);
     return false;
 }