-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdjs-evtsext__stayonscreen__stayonscreen.js
125 lines (103 loc) · 8.11 KB
/
gdjs-evtsext__stayonscreen__stayonscreen.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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
gdjs.evtsExt__StayOnScreen__StayOnScreen = gdjs.evtsExt__StayOnScreen__StayOnScreen || {};
/**
* Behavior generated from Stay on Screen
* @class StayOnScreen
* @extends gdjs.RuntimeBehavior
* @constructor
*/
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen = function(runtimeScene, behaviorData, owner)
{
gdjs.RuntimeBehavior.call(this, runtimeScene, behaviorData, owner);
this._runtimeScene = runtimeScene;
this._behaviorData = {};
this._behaviorData.MarginTop = behaviorData.MarginTop !== undefined ? behaviorData.MarginTop : Number("0") || 0;
this._behaviorData.MarginBottom = behaviorData.MarginBottom !== undefined ? behaviorData.MarginBottom : Number("0") || 0;
this._behaviorData.MarginLeft = behaviorData.MarginLeft !== undefined ? behaviorData.MarginLeft : Number("0") || 0;
this._behaviorData.MarginRight = behaviorData.MarginRight !== undefined ? behaviorData.MarginRight : Number("0") || 0;
};
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype = Object.create( gdjs.RuntimeBehavior.prototype );
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.thisIsARuntimeBehaviorConstructor = "StayOnScreen::StayOnScreen";
// Properties:
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext = {};
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1= [];
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects2= [];
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.conditionTrue_0 = {val:false};
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.condition0IsTrue_0 = {val:false};
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.eventsList0xb58a0 = function(runtimeScene, eventsFunctionContext) {
{
{
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1.createFrom(eventsFunctionContext.getObjects("Object"));
{for(var i = 0, len = gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1.length ;i < len;++i) {
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].setX(Math.min(Math.max((gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getX()), gdjs.evtTools.camera.getCameraX(runtimeScene, (gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getLayer()), 0) - gdjs.evtTools.camera.getCameraWidth(runtimeScene, (gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getLayer()), 0) / 2 + (gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getMarginLeft())), gdjs.evtTools.camera.getCameraX(runtimeScene, (gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getLayer()), 0) + gdjs.evtTools.camera.getCameraWidth(runtimeScene, (gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getLayer()), 0) / 2 - (gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getMarginRight())));
}
}{for(var i = 0, len = gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1.length ;i < len;++i) {
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].setY(Math.min(Math.max((gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getY()), gdjs.evtTools.camera.getCameraY(runtimeScene, (gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getLayer()), 0) - gdjs.evtTools.camera.getCameraHeight(runtimeScene, (gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getLayer()), 0) / 2 + (gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getMarginTop())), gdjs.evtTools.camera.getCameraY(runtimeScene, (gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getLayer()), 0) + gdjs.evtTools.camera.getCameraHeight(runtimeScene, (gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getLayer()), 0) / 2 - (gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getMarginBottom())));
}
}}
}
}; //End of gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.eventsList0xb58a0
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEvents = function(parentEventsFunctionContext) {
var runtimeScene = this._runtimeScene;
var thisObjectList = [this.owner];
var Object = Hashtable.newFrom({Object: thisObjectList});
var Behavior = this.name;
var eventsFunctionContext = {
_objectsMap: {
"Object": Object
},
_behaviorNamesMap: {
"Behavior": Behavior
},
getObjects: function(objectName) {
if (objectName === "Object") { return thisObjectList; } var objectsList = eventsFunctionContext._objectsMap[objectName];
return objectsList ? gdjs.objectsListsToArray(objectsList) : [];
},
getObjectsLists: function(objectName) {
return eventsFunctionContext._objectsMap[objectName] || null;
},
getBehaviorName: function(behaviorName) {
return eventsFunctionContext._behaviorNamesMap[behaviorName];
},
createObject: function(objectName) {
var objectsList = eventsFunctionContext._objectsMap[objectName];
if (objectsList) {
return parentEventsFunctionContext ?
parentEventsFunctionContext.createObject(objectsList.firstKey()) :
runtimeScene.createObject(objectsList.firstKey());
}
return null;
},
getArgument: function(argName) {
return "";
}
};
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects1.length = 0;
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.GDObjectObjects2.length = 0;
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype.doStepPostEventsContext.eventsList0xb58a0(runtimeScene, eventsFunctionContext);
return;
}
// Methods:
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype._getMarginTop = function() {
return this._behaviorData.MarginTop !== undefined ? this._behaviorData.MarginTop : Number("0") || 0;
};
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype._setMarginTop = function(newValue) {
this._behaviorData.MarginTop = newValue;
};
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype._getMarginBottom = function() {
return this._behaviorData.MarginBottom !== undefined ? this._behaviorData.MarginBottom : Number("0") || 0;
};
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype._setMarginBottom = function(newValue) {
this._behaviorData.MarginBottom = newValue;
};
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype._getMarginLeft = function() {
return this._behaviorData.MarginLeft !== undefined ? this._behaviorData.MarginLeft : Number("0") || 0;
};
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype._setMarginLeft = function(newValue) {
this._behaviorData.MarginLeft = newValue;
};
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype._getMarginRight = function() {
return this._behaviorData.MarginRight !== undefined ? this._behaviorData.MarginRight : Number("0") || 0;
};
gdjs.evtsExt__StayOnScreen__StayOnScreen.StayOnScreen.prototype._setMarginRight = function(newValue) {
this._behaviorData.MarginRight = newValue;
};