Ejemplo n.º 1
0
        public void DragDrop(Widget dragWidget, object data)
        {
            InventoryDragData inventoryDragData = data as InventoryDragData;

            if (m_inventory != null && inventoryDragData != null)
            {
                HandleDragDrop(inventoryDragData.Inventory, inventoryDragData.SlotIndex, inventoryDragData.DragMode, m_inventory, m_slotIndex);
            }
        }
Ejemplo n.º 2
0
        public FurnitureDesign GetFurnitureDesign(object dragData)
        {
            InventoryDragData inventoryDragData = dragData as InventoryDragData;

            if (inventoryDragData != null)
            {
                int slotValue = inventoryDragData.Inventory.GetSlotValue(inventoryDragData.SlotIndex);
                if (Terrain.ExtractContents(slotValue) == 227)
                {
                    int designIndex = FurnitureBlock.GetDesignIndex(Terrain.ExtractData(slotValue));
                    return(m_furnitureInventoryPanel.SubsystemFurnitureBlockBehavior.GetDesign(designIndex));
                }
            }
            return(null);
        }
Ejemplo n.º 3
0
 public override void Draw(DrawContext dc)
 {
     if (m_inventory != null && m_inventoryDragData != null)
     {
         int slotValue = m_inventoryDragData.Inventory.GetSlotValue(m_inventoryDragData.SlotIndex);
         if (m_inventory.GetSlotProcessCapacity(m_slotIndex, slotValue) >= 0 || m_inventory.GetSlotCapacity(m_slotIndex, slotValue) > 0)
         {
             float       num         = 80f * base.GlobalTransform.Right.Length();
             Vector2     center      = Vector2.Transform(base.ActualSize / 2f, base.GlobalTransform);
             FlatBatch2D flatBatch2D = dc.PrimitivesRenderer2D.FlatBatch(100);
             flatBatch2D.QueueEllipse(center, new Vector2(num), 0f, new Color(0, 0, 0, 96) * base.GlobalColorTransform, 64);
             flatBatch2D.QueueEllipse(center, new Vector2(num - 0.5f), 0f, new Color(0, 0, 0, 64) * base.GlobalColorTransform, 64);
             flatBatch2D.QueueEllipse(center, new Vector2(num + 0.5f), 0f, new Color(0, 0, 0, 48) * base.GlobalColorTransform, 64);
             flatBatch2D.QueueDisc(center, new Vector2(num), 0f, new Color(0, 0, 0, 48) * base.GlobalColorTransform, 64);
         }
     }
     m_inventoryDragData = null;
 }
Ejemplo n.º 4
0
        public void DragDrop(Widget dragWidget, object data)
        {
            InventoryDragData inventoryDragData = data as InventoryDragData;

            if (inventoryDragData != null && GameManager.Project != null)
            {
                SubsystemPickables subsystemPickables = GameManager.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
                ComponentPlayer    componentPlayer    = GameWidget.PlayerData.ComponentPlayer;
                int slotValue = inventoryDragData.Inventory.GetSlotValue(inventoryDragData.SlotIndex);
                int count     = (componentPlayer != null && componentPlayer.ComponentInput.SplitSourceInventory == inventoryDragData.Inventory && componentPlayer.ComponentInput.SplitSourceSlotIndex == inventoryDragData.SlotIndex) ? 1 : ((inventoryDragData.DragMode != DragMode.SingleItem) ? inventoryDragData.Inventory.GetSlotCount(inventoryDragData.SlotIndex) : MathUtils.Min(inventoryDragData.Inventory.GetSlotCount(inventoryDragData.SlotIndex), 1));
                int num       = inventoryDragData.Inventory.RemoveSlotItems(inventoryDragData.SlotIndex, count);
                if (num > 0)
                {
                    Vector2 vector = dragWidget.WidgetToScreen(dragWidget.ActualSize / 2f);
                    Vector3 value  = Vector3.Normalize(GameWidget.ActiveCamera.ScreenToWorld(new Vector3(vector.X, vector.Y, 1f), Matrix.Identity) - GameWidget.ActiveCamera.ViewPosition) * 12f;
                    subsystemPickables.AddPickable(slotValue, num, GameWidget.ActiveCamera.ViewPosition, value, null);
                }
            }
        }
Ejemplo n.º 5
0
 public void DragOver(Widget dragWidget, object data)
 {
     m_inventoryDragData = (data as InventoryDragData);
 }