This repository was archived by the owner on Jan 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruntime.js
More file actions
98 lines (77 loc) · 2.07 KB
/
runtime.js
File metadata and controls
98 lines (77 loc) · 2.07 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// ECMAScript 5 strict mode
"use strict";
assert2(cr, "cr namespace not created");
assert2(cr.plugins_, "cr.plugins_ not created");
/////////////////////////////////////
// Plugin class
cr.plugins_.pakohuone = function(runtime)
{
this.runtime = runtime;
};
(function ()
{
var pluginProto = cr.plugins_.pakohuone.prototype;
/////////////////////////////////////
// Object type class
pluginProto.Type = function(plugin)
{
this.plugin = plugin;
this.runtime = plugin.runtime;
};
var typeProto = pluginProto.Type.prototype;
// called on startup for each object type
typeProto.onCreate = function()
{
};
/////////////////////////////////////
// Instance class
pluginProto.Instance = function(type)
{
this.type = type;
this.runtime = type.runtime;
// any other properties you need, e.g...
// this.myValue = 0;
};
var instanceProto = pluginProto.Instance.prototype;
// called whenever an instance is created
instanceProto.onCreate = function()
{
// note the object is sealed after this call; ensure any properties you'll ever need are set on the object
// e.g...
// this.myValue = 0;
};
// only called if a layout object - draw to a canvas 2D context
instanceProto.draw = function(ctx)
{
};
// only called if a layout object in WebGL mode - draw to the WebGL context
// 'glw' is not a WebGL context, it's a wrapper - you can find its methods in GLWrap.js in the install
// directory or just copy what other plugins do.
instanceProto.drawGL = function (glw)
{
};
//////////////////////////////////////
// Conditions
function Cnds() {};
pluginProto.cnds = new Cnds();
//////////////////////////////////////
// Actions
function Acts() {};
Acts.prototype.CompleteLevel = function ()
{
const message = {
pakohuone: true,
type: 'Event',
data: {
name: 'LevelCompleted',
parameter: this.runtime.projectName
}
};
parent.postMessage(JSON.stringify(message));
};
pluginProto.acts = new Acts();
//////////////////////////////////////
// Expressions
function Exps() {};
pluginProto.exps = new Exps();
}());