Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending UI docs #158

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions docs/v2.6/23_extending-ui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
slug: /current/extending-ui
sidebar_position: 23
sidebar_label: Extending UI
---

# Extending UI

:::info

This page shows you how to extend UI for the SDK.

:::

To Extend UI for the SDK, you can create your own UI scripts that inherit from `GuiScreen`

## Overlays

There are three overlay types `GuiOverlayManager.GuiOverlayType` available in the SDK:

1. **Error :** Displays an error message.
2. **Loading :** Displays a message with a loading spinner.
3. **Toast :** Displays a toast message with a timeout.

### Usage

To show an overlay, you can call the following method:

```csharp
int GuiManager.Instance.Overlays.Show(GuiOverlayType type, string message, bool deactivateOnClick, Action onClose = null, float timeOut = 0)
```

| **Name** | **Type** | **Description** |
|---------------------|------------------|------------------------------------------------------------------------------------------------------|
| `type` | `GuiOverlayType` | Type of the overlay, it be `Error`, `Loading` or `Toast` |
| `message` | `string` | Message to display in overlay |
| `deactivateOnClick` | `bool` | Can overlay be closed on click |
| `onClose` | `Action` | Callback to be invoked when overlay is closed |
| `timeOut` | `float` | Time in seconds after which overlay should be closed, if it is equal to 0 then it has has no timeout |

1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = {
'v2.6/ramp',
'v2.6/lootboxes',
'v2.6/extending-the-sdk',
'v2.6/extending-ui',
],
},
{
Expand Down
Loading