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); } }
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); }
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; }
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); } } }
public void DragOver(Widget dragWidget, object data) { m_inventoryDragData = (data as InventoryDragData); }