forked from AvixGames/poki-c3-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.js
73 lines (62 loc) · 2.87 KB
/
plugin.js
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
61
62
63
64
65
66
67
68
69
70
71
72
73
"use strict";
{
const SDK = self.SDK;
////////////////////////////////////////////
// The plugin ID is how Construct identifies different kinds of plugins.
// *** NEVER CHANGE THE PLUGIN ID! ***
// If you change the plugin ID after releasing the plugin, Construct will think it is an entirely different
// plugin and assume it is incompatible with the old one, and YOU WILL BREAK ALL EXISTING PROJECTS USING THE PLUGIN.
// Only the plugin name is displayed in the editor, so to rename your plugin change the name but NOT the ID.
// If you want to completely replace a plugin, make it deprecated (it will be hidden but old projects keep working),
// and create an entirely new plugin with a different plugin ID.
const PLUGIN_ID = "Avix_PokiSDK_ForC3";
////////////////////////////////////////////
const PLUGIN_VERSION = "1.0.2.1";
const PLUGIN_CATEGORY = "platform-specific";
const PLUGIN_CLASS =
(SDK.Plugins.Avix_PokiSDK_ForC3 = class PokiSDKC3Plugin extends (
SDK.IPluginBase
) {
constructor() {
super(PLUGIN_ID);
SDK.Lang.PushContext("plugins." + PLUGIN_ID.toLowerCase());
this._info.SetName(self.lang(".name"));
this._info.SetDescription(self.lang(".description"));
this._info.SetVersion(PLUGIN_VERSION);
this._info.SetCategory(PLUGIN_CATEGORY);
this._info.SetAuthor("Avix Games");
this._info.SetHelpUrl(self.lang(".help-url"));
this._info.SetIsSingleGlobal(true);
this._info.SetSupportedRuntimes(["c3"]);
this._info.AddRemoteScriptDependency(
"//game-cdn.poki.com/scripts/v2/poki-sdk.js"
);
this._info.SetDOMSideScripts(["c3runtime/domSide.js"]);
SDK.Lang.PushContext(".properties");
this._info.SetProperties([
new SDK.PluginProperty("check", "poki-enabled", true),
new SDK.PluginProperty("check", "debug-on-preview", true),
new SDK.PluginProperty("combo", "loading-notification", {
items: ["immediate", "first-layout", "manual"],
initialValue: "immediate",
}),
new SDK.PluginProperty("check", "automatic-suspend", true),
new SDK.PluginProperty("check", "prevent-scroll", true),
new SDK.PluginProperty("check", "adblock-sim", false),
new SDK.PluginProperty("integer", "suspend-timeout", 0),
new SDK.PluginProperty("link", "site-lock-help", {
linkCallback: () =>
window.open("https://sdk.poki.com/html5/#thats-it"),
callbackType: "once-for-type",
}),
new SDK.PluginProperty("link", "qa-link", {
linkCallback: () => window.open("https://qa.po.ki/"),
callbackType: "once-for-type",
}),
]);
SDK.Lang.PopContext(); // .properties
SDK.Lang.PopContext();
}
});
PLUGIN_CLASS.Register(PLUGIN_ID, PLUGIN_CLASS);
}