-
Notifications
You must be signed in to change notification settings - Fork 29
/
IScriptRuntime.h
47 lines (37 loc) · 1.03 KB
/
IScriptRuntime.h
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
#pragma once
#include "IResource.h"
#include <cstdint>
#include <functional>
namespace alt
{
enum InitState: uint8_t
{
DownloadingResources = 0,
ValidatingResources,
DownloadingRuntime,
ValidatingRuntime,
DownloadingAdditionalResources
};
class IPackage;
class IScriptRuntime
{
public:
virtual ~IScriptRuntime() = default;
virtual bool RequiresMain() const { return true; }
virtual IResource::Impl* CreateImpl(IResource* resource) = 0;
virtual void DestroyImpl(IResource::Impl* impl) = 0;
virtual void OnTick() { };
virtual void OnDispose() { };
#ifdef ALT_SERVER_API
virtual bool GetProcessClientType(std::string& clientType) { return false; }
virtual void ProcessClientFile(IResource* resource, IPackage* clientPackage) { };
#endif
#ifdef ALT_CLIENT_API
// Called every time when connecting to a server
virtual void Init(std::function<void(bool success, std::string error)> next, std::function<void(InitState state, float progress, float total, int)> setProgress)
{
next(true, "");
}
#endif
};
}