-
-
Notifications
You must be signed in to change notification settings - Fork 164
Expand file tree
/
Copy pathdialogs.hpp
More file actions
60 lines (48 loc) · 1.71 KB
/
dialogs.hpp
File metadata and controls
60 lines (48 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/.
*
* The original code is copyright (c) 2022, open.mp team and contributors.
*/
#pragma once
#include <sdk.hpp>
/// The style of the dialog: https://open.mp/docs/scripting/resources/dialogstyles
enum DialogStyle
{
DialogStyle_MSGBOX = 0,
DialogStyle_INPUT,
DialogStyle_LIST,
DialogStyle_PASSWORD,
DialogStyle_TABLIST,
DialogStyle_TABLIST_HEADERS
};
enum DialogResponse
{
DialogResponse_Right = 0,
DialogResponse_Left
};
static const UID DialogData_UID = UID(0xbc03376aa3591a11);
struct IPlayerDialogData : public IExtension
{
PROVIDE_EXT_UID(DialogData_UID);
/// Hide a dialog from a player
virtual void hide(IPlayer& player) = 0;
/// Show a dialog to a player
virtual void show(IPlayer& player, int id, DialogStyle style, StringView title, StringView body, StringView button1, StringView button2) = 0;
/// Get a player's current dialog data.
virtual void get(int& id, DialogStyle& style, StringView& title, StringView& body, StringView& button1, StringView& button2) = 0;
/// Get player's active dialog
virtual int getActiveID() const = 0;
};
struct PlayerDialogEventHandler
{
virtual void onDialogResponse(IPlayer& player, int dialogId, DialogResponse response, int listItem, StringView inputText) { }
};
static const UID DialogsComponent_UID = UID(0x44a111350d611dde);
struct IDialogsComponent : public IComponent
{
PROVIDE_UID(DialogsComponent_UID);
/// Access to event dispatchers for other components to add handlers to
virtual IEventDispatcher<PlayerDialogEventHandler>& getEventDispatcher() = 0;
};