Class GuiElementItemSlotGridBase
- Namespace
- Vintagestory.API.Client
- Assembly
- VintagestoryAPI.dll
A base class for the slot grid. For all your slot grid needs. Open in GitHub
public abstract class GuiElementItemSlotGridBase : GuiElement, IDisposable
- Inheritance
-
GuiElementItemSlotGridBase
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
GuiElementItemSlotGridBase(ICoreClientAPI, IInventory, Action<object>, int, ElementBounds)
Creates a new instance of this class.
public GuiElementItemSlotGridBase(ICoreClientAPI capi, IInventory inventory, Action<object> sendPacket, int columns, ElementBounds bounds)
Parameters
capiICoreClientAPIThe client API
inventoryIInventoryThe attached inventory
sendPacketAction<object>A handler that should send supplied network packet to the server, if the inventory modifications should be synced
columnsintThe number of columns in the GUI.
boundsElementBoundsThe bounds of the slot grid.
Fields
CanClickSlot
public CanClickSlotDelegate CanClickSlot
Field Value
DrawIconHandler
public DrawIconDelegate DrawIconHandler
Field Value
KeyboardControlEnabled
public bool KeyboardControlEnabled
Field Value
SendPacketHandler
protected Action<object> SendPacketHandler
Field Value
SlotBounds
public ElementBounds[] SlotBounds
Field Value
cols
protected int cols
Field Value
crossedOutTexture
protected LoadedTexture crossedOutTexture
Field Value
highlightSlotId
protected int highlightSlotId
Field Value
highlightSlotTexture
protected LoadedTexture highlightSlotTexture
Field Value
hoverSlotId
protected int hoverSlotId
Field Value
inventory
protected IInventory inventory
Field Value
prevSlotQuantity
protected int prevSlotQuantity
Field Value
rows
protected int rows
Field Value
scissorBounds
protected ElementBounds[] scissorBounds
Field Value
searchText
protected string searchText
Field Value
slotQuantityTextures
protected LoadedTexture[] slotQuantityTextures
Field Value
slotTexture
protected LoadedTexture slotTexture
Field Value
textComposer
protected GuiElementStaticText textComposer
Field Value
unscaledSlotPadding
public static double unscaledSlotPadding
Field Value
Properties
AlwaysRenderIcon
public bool AlwaysRenderIcon { get; set; }
Property Value
Focusable
Whether or not the element can be focused.
public override bool Focusable { get; }
Property Value
HighlightSlotTexture
public LoadedTexture HighlightSlotTexture { get; }
Property Value
Methods
ComposeElements(Context, ImageSurface)
Composes the elements.
public override void ComposeElements(Context unusedCtx, ImageSurface unusedSurface)
Parameters
unusedCtxContextunusedSurfaceImageSurface
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public override void Dispose()
DrawSlotBackground(ICoreClientAPI, double, double, double[], double[], Action<Context>)
public static int DrawSlotBackground(ICoreClientAPI api, double absSlotWidth, double absSlotHeight, double[] bgcolor, double[] fontcolor, Action<Context> extraDrawing)
Parameters
apiICoreClientAPIabsSlotWidthdoubleabsSlotHeightdoublebgcolordouble[]fontcolordouble[]extraDrawingAction<Context>
Returns
FilterItemsBySearchText(string, Dictionary<int, string>, Dictionary<int, string>)
Renders only a subset of all available slots filtered by searching given text on the item name/description
public void FilterItemsBySearchText(string text, Dictionary<int, string> searchCache = null, Dictionary<int, string> searchCacheNames = null)
Parameters
textstringsearchCacheDictionary<int, string>Can be set to increase search performance, otherwise a slow search is performed
searchCacheNamesDictionary<int, string>
HighlightSlot(int)
Highlights a specific slot.
public void HighlightSlot(int slotId)
Parameters
slotIdintThe slot to highlight.
OnGuiClosed(ICoreClientAPI)
public void OnGuiClosed(ICoreClientAPI api)
Parameters
apiICoreClientAPI
OnKeyDown(ICoreClientAPI, KeyEvent)
The event fired when a key is held down.
public override void OnKeyDown(ICoreClientAPI api, KeyEvent args)
Parameters
apiICoreClientAPIThe client API
argsKeyEventThe key event arguments.
OnMouseDown(ICoreClientAPI, MouseEvent)
The event fired when the mouse is down the element is around. Fires before OnMouseDownOnElement, however OnMouseDownOnElement is called within the base function.
public override void OnMouseDown(ICoreClientAPI api, MouseEvent mouse)
Parameters
apiICoreClientAPIThe Client API
mouseMouseEventThe mouse event args.
OnMouseDownOnElement(ICoreClientAPI, MouseEvent)
The event fired when the mouse is pressed while on the element. Called after OnMouseDown and tells the engine that the event is handled.
public override void OnMouseDownOnElement(ICoreClientAPI api, MouseEvent args)
Parameters
apiICoreClientAPIThe Client API
argsMouseEventThe mouse event args.
OnMouseLeaveSlot(ICoreClientAPI, ItemSlot)
public override bool OnMouseLeaveSlot(ICoreClientAPI api, ItemSlot slot)
Parameters
apiICoreClientAPIslotItemSlot
Returns
OnMouseMove(ICoreClientAPI, MouseEvent)
The event fired when the mouse is moved.
public override void OnMouseMove(ICoreClientAPI api, MouseEvent args)
Parameters
apiICoreClientAPIThe Client API.
argsMouseEventThe mouse event arguments.
OnMouseUp(ICoreClientAPI, MouseEvent)
The event fired when the mouse is released.
public override void OnMouseUp(ICoreClientAPI api, MouseEvent args)
Parameters
apiICoreClientAPIThe Client API.
argsMouseEventThe arguments for the mouse event.
OnMouseWheel(ICoreClientAPI, MouseWheelEventArgs)
The event fired when the mouse wheel is scrolled.
public override void OnMouseWheel(ICoreClientAPI api, MouseWheelEventArgs args)
Parameters
apiICoreClientAPIThe Client API
argsMouseWheelEventArgsThe mouse wheel arguments.
OutlineColor()
The compressed version of the debug outline color as a single int value.
public override int OutlineColor()
Returns
PostRenderInteractiveElements(float)
The post render of the interactive element.
public override void PostRenderInteractiveElements(float deltaTime)
Parameters
deltaTimefloatThe change in time.
RemoveSlotHighlight()
Removes the active slot highlight.
public void RemoveSlotHighlight()
RenderInteractiveElements(float)
Renders the element as an interactive element.
public override void RenderInteractiveElements(float deltaTime)
Parameters
deltaTimefloatThe change in time.
SlotClick(ICoreClientAPI, int, EnumMouseButton, bool, bool, bool)
public virtual void SlotClick(ICoreClientAPI api, int slotId, EnumMouseButton mouseButton, bool shiftPressed, bool ctrlPressed, bool altPressed)
Parameters
apiICoreClientAPIslotIdintmouseButtonEnumMouseButtonshiftPressedboolctrlPressedboolaltPressedbool