Table of Contents

Class GuiElementItemSlotGridBase

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll

A base class for the slot grid. For all your slot grid needs.

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

capi ICoreClientAPI

The client API

inventory IInventory

The attached inventory

sendPacket Action<object>

A handler that should send supplied network packet to the server, if the inventory modifications should be synced

columns int

The number of columns in the GUI.

bounds ElementBounds

The bounds of the slot grid.

Fields

CanClickSlot

public CanClickSlotDelegate CanClickSlot

Field Value

CanClickSlotDelegate

DrawIconHandler

public DrawIconDelegate DrawIconHandler

Field Value

DrawIconDelegate

KeyboardControlEnabled

public bool KeyboardControlEnabled

Field Value

bool

SendPacketHandler

protected Action<object> SendPacketHandler

Field Value

Action<object>

SlotBounds

public ElementBounds[] SlotBounds

Field Value

ElementBounds[]

cols

protected int cols

Field Value

int

crossedOutTexture

protected LoadedTexture crossedOutTexture

Field Value

LoadedTexture

highlightSlotId

protected int highlightSlotId

Field Value

int

highlightSlotTexture

protected LoadedTexture highlightSlotTexture

Field Value

LoadedTexture

hoverSlotId

protected int hoverSlotId

Field Value

int

inventory

protected IInventory inventory

Field Value

IInventory

prevSlotQuantity

protected int prevSlotQuantity

Field Value

int

rows

protected int rows

Field Value

int

scissorBounds

protected ElementBounds[] scissorBounds

Field Value

ElementBounds[]

searchText

protected string searchText

Field Value

string

slotQuantityTextures

protected LoadedTexture[] slotQuantityTextures

Field Value

LoadedTexture[]

slotTexture

protected LoadedTexture slotTexture

Field Value

LoadedTexture

textComposer

protected GuiElementStaticText textComposer

Field Value

GuiElementStaticText

unscaledSlotPadding

public static double unscaledSlotPadding

Field Value

double

Properties

AlwaysRenderIcon

public bool AlwaysRenderIcon { get; set; }

Property Value

bool

Focusable

Whether or not the element can be focused.

public override bool Focusable { get; }

Property Value

bool

HighlightSlotTexture

public LoadedTexture HighlightSlotTexture { get; }

Property Value

LoadedTexture

Methods

ComposeElements(Context, ImageSurface)

Composes the elements.

public override void ComposeElements(Context unusedCtx, ImageSurface unusedSurface)

Parameters

unusedCtx Context
unusedSurface ImageSurface

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public override void Dispose()

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

text string
searchCache Dictionary<int, string>

Can be set to increase search performance, otherwise a slow search is performed

searchCacheNames Dictionary<int, string>

HighlightSlot(int)

Highlights a specific slot.

public void HighlightSlot(int slotId)

Parameters

slotId int

The slot to highlight.

OnGuiClosed(ICoreClientAPI)

public void OnGuiClosed(ICoreClientAPI api)

Parameters

api ICoreClientAPI

OnKeyDown(ICoreClientAPI, KeyEvent)

The event fired when a key is held down.

public override void OnKeyDown(ICoreClientAPI api, KeyEvent args)

Parameters

api ICoreClientAPI

The client API

args KeyEvent

The 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

api ICoreClientAPI

The Client API

mouse MouseEvent

The 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

api ICoreClientAPI

The Client API

args MouseEvent

The mouse event args.

OnMouseLeaveSlot(ICoreClientAPI, ItemSlot)

public override bool OnMouseLeaveSlot(ICoreClientAPI api, ItemSlot slot)

Parameters

api ICoreClientAPI
slot ItemSlot

Returns

bool

OnMouseMove(ICoreClientAPI, MouseEvent)

The event fired when the mouse is moved.

public override void OnMouseMove(ICoreClientAPI api, MouseEvent args)

Parameters

api ICoreClientAPI

The Client API.

args MouseEvent

The mouse event arguments.

OnMouseUp(ICoreClientAPI, MouseEvent)

The event fired when the mouse is released.

public override void OnMouseUp(ICoreClientAPI api, MouseEvent args)

Parameters

api ICoreClientAPI

The Client API.

args MouseEvent

The 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

api ICoreClientAPI

The Client API

args MouseWheelEventArgs

The mouse wheel arguments.

OutlineColor()

The compressed version of the debug outline color as a single int value.

public override int OutlineColor()

Returns

int

PostRenderInteractiveElements(float)

The post render of the interactive element.

public override void PostRenderInteractiveElements(float deltaTime)

Parameters

deltaTime float

The 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

deltaTime float

The 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

api ICoreClientAPI
slotId int
mouseButton EnumMouseButton
shiftPressed bool
ctrlPressed bool
altPressed bool