mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Compare commits
6 Commits
a05b0cd0ef
...
fix-typo
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cc8115f95a | ||
![]() |
5ba52c5ecb | ||
![]() |
7f2240fd63 | ||
![]() |
5cceae603f | ||
![]() |
2303decdef | ||
![]() |
a44810f71e |
@@ -803,7 +803,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Cube3DObject = new gd.ObjectJsImplementation();
|
const Cube3DObject = new gd.ObjectJsImplementation();
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
Cube3DObject.updateProperty = function (
|
Cube3DObject.updateProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -852,7 +851,6 @@ module.exports = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
Cube3DObject.getProperties = function (objectContent) {
|
Cube3DObject.getProperties = function (objectContent) {
|
||||||
const objectProperties = new gd.MapStringPropertyDescriptor();
|
const objectProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -1092,7 +1090,6 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// $FlowExpectedError
|
|
||||||
Cube3DObject.updateInitialInstanceProperty = function (
|
Cube3DObject.updateInitialInstanceProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
instance,
|
instance,
|
||||||
@@ -1104,7 +1101,6 @@ module.exports = {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// $FlowExpectedError
|
|
||||||
Cube3DObject.getInitialInstanceProperties = function (
|
Cube3DObject.getInitialInstanceProperties = function (
|
||||||
content,
|
content,
|
||||||
instance,
|
instance,
|
||||||
@@ -1960,7 +1956,7 @@ module.exports = {
|
|||||||
*
|
*
|
||||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
|
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
|
||||||
*/
|
*/
|
||||||
registerInstanceRenderers: function (ObjectsRenderingService) {
|
registerInstanceRenderers: function (objectsRenderingService) {
|
||||||
const RenderedInstance = objectsRenderingService.RenderedInstance;
|
const RenderedInstance = objectsRenderingService.RenderedInstance;
|
||||||
const Rendered3DInstance = objectsRenderingService.Rendered3DInstance;
|
const Rendered3DInstance = objectsRenderingService.Rendered3DInstance;
|
||||||
const PIXI = objectsRenderingService.PIXI;
|
const PIXI = objectsRenderingService.PIXI;
|
||||||
@@ -1968,39 +1964,25 @@ module.exports = {
|
|||||||
const THREE_ADDONS = objectsRenderingService.THREE_ADDONS;
|
const THREE_ADDONS = objectsRenderingService.THREE_ADDONS;
|
||||||
|
|
||||||
const materialIndexToFaceIndex = {
|
const materialIndexToFaceIndex = {
|
||||||
// $FlowFixMe
|
|
||||||
0: 3,
|
0: 3,
|
||||||
// $FlowFixMe
|
|
||||||
1: 2,
|
1: 2,
|
||||||
// $FlowFixMe
|
|
||||||
2: 5,
|
2: 5,
|
||||||
// $FlowFixMe
|
|
||||||
3: 4,
|
3: 4,
|
||||||
// $FlowFixMe
|
|
||||||
4: 0,
|
4: 0,
|
||||||
// $FlowFixMe
|
|
||||||
5: 1,
|
5: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
const noRepeatTextureVertexIndexToUvMapping = {
|
const noRepeatTextureVertexIndexToUvMapping = {
|
||||||
// $FlowFixMe
|
|
||||||
0: [0, 0],
|
0: [0, 0],
|
||||||
// $FlowFixMe
|
|
||||||
1: [1, 0],
|
1: [1, 0],
|
||||||
// $FlowFixMe
|
|
||||||
2: [0, 1],
|
2: [0, 1],
|
||||||
// $FlowFixMe
|
|
||||||
3: [1, 1],
|
3: [1, 1],
|
||||||
};
|
};
|
||||||
|
|
||||||
const noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ = {
|
const noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ = {
|
||||||
// $FlowFixMe
|
|
||||||
0: [0, 1],
|
0: [0, 1],
|
||||||
// $FlowFixMe
|
|
||||||
1: [0, 0],
|
1: [0, 0],
|
||||||
// $FlowFixMe
|
|
||||||
2: [1, 1],
|
2: [1, 1],
|
||||||
// $FlowFixMe
|
|
||||||
3: [1, 0],
|
3: [1, 0],
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2097,9 +2079,10 @@ module.exports = {
|
|||||||
static getThumbnail(project, resourcesLoader, objectConfiguration) {
|
static getThumbnail(project, resourcesLoader, objectConfiguration) {
|
||||||
const instance = this._instance;
|
const instance = this._instance;
|
||||||
|
|
||||||
const textureResourceName = RenderedCube3DObject2DInstance._getResourceNameToDisplay(
|
const textureResourceName =
|
||||||
objectConfiguration
|
RenderedCube3DObject2DInstance._getResourceNameToDisplay(
|
||||||
);
|
objectConfiguration
|
||||||
|
);
|
||||||
if (textureResourceName) {
|
if (textureResourceName) {
|
||||||
return resourcesLoader.getResourceFullUrl(
|
return resourcesLoader.getResourceFullUrl(
|
||||||
project,
|
project,
|
||||||
@@ -2111,18 +2094,20 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateTextureIfNeeded() {
|
updateTextureIfNeeded() {
|
||||||
const textureName = RenderedCube3DObject2DInstance._getResourceNameToDisplay(
|
const textureName =
|
||||||
this._associatedObjectConfiguration
|
RenderedCube3DObject2DInstance._getResourceNameToDisplay(
|
||||||
);
|
this._associatedObjectConfiguration
|
||||||
|
);
|
||||||
if (textureName === this._renderedResourceName) return;
|
if (textureName === this._renderedResourceName) return;
|
||||||
|
|
||||||
this.updateTexture();
|
this.updateTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTexture() {
|
updateTexture() {
|
||||||
const textureName = RenderedCube3DObject2DInstance._getResourceNameToDisplay(
|
const textureName =
|
||||||
this._associatedObjectConfiguration
|
RenderedCube3DObject2DInstance._getResourceNameToDisplay(
|
||||||
);
|
this._associatedObjectConfiguration
|
||||||
|
);
|
||||||
|
|
||||||
if (!textureName) {
|
if (!textureName) {
|
||||||
this._renderFallbackObject = true;
|
this._renderFallbackObject = true;
|
||||||
@@ -2380,9 +2365,10 @@ module.exports = {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const shouldRepeatTexture = this._shouldRepeatTextureOnFace[
|
const shouldRepeatTexture =
|
||||||
materialIndexToFaceIndex[materialIndex]
|
this._shouldRepeatTextureOnFace[
|
||||||
];
|
materialIndexToFaceIndex[materialIndex]
|
||||||
|
];
|
||||||
|
|
||||||
const shouldOrientateFacesTowardsY = this._facesOrientation === 'Y';
|
const shouldOrientateFacesTowardsY = this._facesOrientation === 'Y';
|
||||||
|
|
||||||
@@ -2417,16 +2403,13 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (shouldOrientateFacesTowardsY) {
|
if (shouldOrientateFacesTowardsY) {
|
||||||
[x, y] = noRepeatTextureVertexIndexToUvMapping[
|
[x, y] =
|
||||||
vertexIndex % 4
|
noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];
|
||||||
];
|
|
||||||
} else {
|
} else {
|
||||||
[
|
[x, y] =
|
||||||
x,
|
noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ[
|
||||||
y,
|
vertexIndex % 4
|
||||||
] = noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ[
|
];
|
||||||
vertexIndex % 4
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2456,16 +2439,13 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (shouldOrientateFacesTowardsY) {
|
if (shouldOrientateFacesTowardsY) {
|
||||||
[x, y] = noRepeatTextureVertexIndexToUvMapping[
|
[x, y] =
|
||||||
vertexIndex % 4
|
noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];
|
||||||
];
|
|
||||||
} else {
|
} else {
|
||||||
[
|
[x, y] =
|
||||||
x,
|
noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ[
|
||||||
y,
|
vertexIndex % 4
|
||||||
] = noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ[
|
];
|
||||||
vertexIndex % 4
|
|
||||||
];
|
|
||||||
x = -x;
|
x = -x;
|
||||||
y = -y;
|
y = -y;
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,8 @@
|
|||||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const stringifyOptions = (options) => '["' + options.join('","') + '"]';
|
||||||
|
|
||||||
/** @type {ExtensionModule} */
|
/** @type {ExtensionModule} */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
createExtension: function (_, gd) {
|
createExtension: function (_, gd) {
|
||||||
@@ -32,7 +34,6 @@ module.exports = {
|
|||||||
.setIcon('JsPlatform/Extensions/bbcode32.png');
|
.setIcon('JsPlatform/Extensions/bbcode32.png');
|
||||||
|
|
||||||
var objectBBText = new gd.ObjectJsImplementation();
|
var objectBBText = new gd.ObjectJsImplementation();
|
||||||
// $FlowExpectedError
|
|
||||||
objectBBText.updateProperty = function (
|
objectBBText.updateProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -49,7 +50,6 @@ module.exports = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError
|
|
||||||
objectBBText.getProperties = function (objectContent) {
|
objectBBText.getProperties = function (objectContent) {
|
||||||
const objectProperties = new gd.MapStringPropertyDescriptor();
|
const objectProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -116,8 +116,7 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
objectBBText.setRawJSONContent(
|
objectBBText.setRawJSONContent(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
text:
|
text: '[b]bold[/b] [i]italic[/i] [size=15]smaller[/size] [font=times]times[/font] font\n[spacing=12]spaced out[/spacing]\n[outline=yellow]outlined[/outline] [shadow=red]DropShadow[/shadow] ',
|
||||||
'[b]bold[/b] [i]italic[/i] [size=15]smaller[/size] [font=times]times[/font] font\n[spacing=12]spaced out[/spacing]\n[outline=yellow]outlined[/outline] [shadow=red]DropShadow[/shadow] ',
|
|
||||||
opacity: 255,
|
opacity: 255,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
visible: true,
|
visible: true,
|
||||||
@@ -128,7 +127,6 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// $FlowExpectedError
|
|
||||||
objectBBText.updateInitialInstanceProperty = function (
|
objectBBText.updateInitialInstanceProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
instance,
|
instance,
|
||||||
@@ -139,7 +137,6 @@ module.exports = {
|
|||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError
|
|
||||||
objectBBText.getInitialInstanceProperties = function (
|
objectBBText.getInitialInstanceProperties = function (
|
||||||
content,
|
content,
|
||||||
instance,
|
instance,
|
||||||
@@ -214,9 +211,10 @@ module.exports = {
|
|||||||
parameterType === 'string' ||
|
parameterType === 'string' ||
|
||||||
parameterType === 'stringWithSelector'
|
parameterType === 'stringWithSelector'
|
||||||
) {
|
) {
|
||||||
const parameterOptions = gd.ParameterOptions.makeNewOptions().setDescription(
|
const parameterOptions =
|
||||||
property.paramLabel
|
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||||
);
|
property.paramLabel
|
||||||
|
);
|
||||||
if (property.options) {
|
if (property.options) {
|
||||||
parameterOptions.setTypeExtraInfo(
|
parameterOptions.setTypeExtraInfo(
|
||||||
stringifyOptions(property.options)
|
stringifyOptions(property.options)
|
||||||
@@ -266,9 +264,10 @@ module.exports = {
|
|||||||
parameterType === 'number' ||
|
parameterType === 'number' ||
|
||||||
parameterType === 'stringWithSelector'
|
parameterType === 'stringWithSelector'
|
||||||
) {
|
) {
|
||||||
const parameterOptions = gd.ParameterOptions.makeNewOptions().setDescription(
|
const parameterOptions =
|
||||||
property.paramLabel
|
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||||
);
|
property.paramLabel
|
||||||
|
);
|
||||||
if (property.options) {
|
if (property.options) {
|
||||||
parameterOptions.setTypeExtraInfo(
|
parameterOptions.setTypeExtraInfo(
|
||||||
stringifyOptions(property.options)
|
stringifyOptions(property.options)
|
||||||
@@ -550,9 +549,8 @@ module.exports = {
|
|||||||
this._pixiObject.alpha = opacity / 255;
|
this._pixiObject.alpha = opacity / 255;
|
||||||
|
|
||||||
const color = properties.get('color').getValue();
|
const color = properties.get('color').getValue();
|
||||||
this._pixiObject.textStyles.default.fill = objectsRenderingService.rgbOrHexToHexNumber(
|
this._pixiObject.textStyles.default.fill =
|
||||||
color
|
objectsRenderingService.rgbOrHexToHexNumber(color);
|
||||||
);
|
|
||||||
|
|
||||||
const fontSize = properties.get('fontSize').getValue();
|
const fontSize = properties.get('fontSize').getValue();
|
||||||
this._pixiObject.textStyles.default.fontSize = `${fontSize}px`;
|
this._pixiObject.textStyles.default.fontSize = `${fontSize}px`;
|
||||||
|
@@ -34,7 +34,6 @@ module.exports = {
|
|||||||
.setIcon('JsPlatform/Extensions/bitmapfont32.png');
|
.setIcon('JsPlatform/Extensions/bitmapfont32.png');
|
||||||
|
|
||||||
const bitmapTextObject = new gd.ObjectJsImplementation();
|
const bitmapTextObject = new gd.ObjectJsImplementation();
|
||||||
// $FlowExpectedError
|
|
||||||
bitmapTextObject.updateProperty = function (
|
bitmapTextObject.updateProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -51,7 +50,6 @@ module.exports = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError
|
|
||||||
bitmapTextObject.getProperties = function (objectContent) {
|
bitmapTextObject.getProperties = function (objectContent) {
|
||||||
const objectProperties = new gd.MapStringPropertyDescriptor();
|
const objectProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -119,8 +117,7 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
bitmapTextObject.setRawJSONContent(
|
bitmapTextObject.setRawJSONContent(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
text:
|
text: 'This text use the default bitmap font.\nUse a custom Bitmap Font to create your own texts.',
|
||||||
'This text use the default bitmap font.\nUse a custom Bitmap Font to create your own texts.',
|
|
||||||
opacity: 255,
|
opacity: 255,
|
||||||
scale: 1,
|
scale: 1,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
@@ -132,7 +129,6 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// $FlowExpectedError
|
|
||||||
bitmapTextObject.updateInitialInstanceProperty = function (
|
bitmapTextObject.updateInitialInstanceProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
instance,
|
instance,
|
||||||
@@ -143,7 +139,6 @@ module.exports = {
|
|||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError
|
|
||||||
bitmapTextObject.getInitialInstanceProperties = function (
|
bitmapTextObject.getInitialInstanceProperties = function (
|
||||||
content,
|
content,
|
||||||
instance,
|
instance,
|
||||||
@@ -704,9 +699,8 @@ module.exports = {
|
|||||||
this._pixiObject.align = align;
|
this._pixiObject.align = align;
|
||||||
|
|
||||||
const color = properties.get('tint').getValue();
|
const color = properties.get('tint').getValue();
|
||||||
this._pixiObject.tint = objectsRenderingService.rgbOrHexToHexNumber(
|
this._pixiObject.tint =
|
||||||
color
|
objectsRenderingService.rgbOrHexToHexNumber(color);
|
||||||
);
|
|
||||||
|
|
||||||
const scale = properties.get('scale').getValue() || 1;
|
const scale = properties.get('scale').getValue() || 1;
|
||||||
this._pixiObject.scale.set(scale);
|
this._pixiObject.scale.set(scale);
|
||||||
|
@@ -145,7 +145,6 @@ module.exports = {
|
|||||||
// Everything that is stored inside the behavior is in "behaviorContent" and is automatically
|
// Everything that is stored inside the behavior is in "behaviorContent" and is automatically
|
||||||
// saved/loaded to JSON.
|
// saved/loaded to JSON.
|
||||||
var dummyBehavior = new gd.BehaviorJsImplementation();
|
var dummyBehavior = new gd.BehaviorJsImplementation();
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
dummyBehavior.updateProperty = function (
|
dummyBehavior.updateProperty = function (
|
||||||
behaviorContent,
|
behaviorContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -162,7 +161,6 @@ module.exports = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
dummyBehavior.getProperties = function (behaviorContent) {
|
dummyBehavior.getProperties = function (behaviorContent) {
|
||||||
var behaviorProperties = new gd.MapStringPropertyDescriptor();
|
var behaviorProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -179,7 +177,6 @@ module.exports = {
|
|||||||
|
|
||||||
return behaviorProperties;
|
return behaviorProperties;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
dummyBehavior.initializeContent = function (behaviorContent) {
|
dummyBehavior.initializeContent = function (behaviorContent) {
|
||||||
behaviorContent.setStringAttribute('property1', 'Initial value 1');
|
behaviorContent.setStringAttribute('property1', 'Initial value 1');
|
||||||
behaviorContent.setBoolAttribute('property2', true);
|
behaviorContent.setBoolAttribute('property2', true);
|
||||||
@@ -207,7 +204,6 @@ module.exports = {
|
|||||||
// Create a new gd.BehaviorSharedDataJsImplementation object and implement the methods
|
// Create a new gd.BehaviorSharedDataJsImplementation object and implement the methods
|
||||||
// that are called to get and set the properties of the shared data.
|
// that are called to get and set the properties of the shared data.
|
||||||
var dummyBehaviorWithSharedData = new gd.BehaviorJsImplementation();
|
var dummyBehaviorWithSharedData = new gd.BehaviorJsImplementation();
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
dummyBehaviorWithSharedData.updateProperty = function (
|
dummyBehaviorWithSharedData.updateProperty = function (
|
||||||
behaviorContent,
|
behaviorContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -220,7 +216,6 @@ module.exports = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
dummyBehaviorWithSharedData.getProperties = function (behaviorContent) {
|
dummyBehaviorWithSharedData.getProperties = function (behaviorContent) {
|
||||||
var behaviorProperties = new gd.MapStringPropertyDescriptor();
|
var behaviorProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -230,13 +225,11 @@ module.exports = {
|
|||||||
|
|
||||||
return behaviorProperties;
|
return behaviorProperties;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
dummyBehaviorWithSharedData.initializeContent = function (behaviorContent) {
|
dummyBehaviorWithSharedData.initializeContent = function (behaviorContent) {
|
||||||
behaviorContent.setStringAttribute('property1', 'Initial value 1');
|
behaviorContent.setStringAttribute('property1', 'Initial value 1');
|
||||||
};
|
};
|
||||||
|
|
||||||
var sharedData = new gd.BehaviorSharedDataJsImplementation();
|
var sharedData = new gd.BehaviorSharedDataJsImplementation();
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
sharedData.updateProperty = function (
|
sharedData.updateProperty = function (
|
||||||
sharedContent,
|
sharedContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -249,7 +242,6 @@ module.exports = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
sharedData.getProperties = function (sharedContent) {
|
sharedData.getProperties = function (sharedContent) {
|
||||||
var sharedProperties = new gd.MapStringPropertyDescriptor();
|
var sharedProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -259,7 +251,6 @@ module.exports = {
|
|||||||
|
|
||||||
return sharedProperties;
|
return sharedProperties;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
sharedData.initializeContent = function (behaviorContent) {
|
sharedData.initializeContent = function (behaviorContent) {
|
||||||
behaviorContent.setStringAttribute(
|
behaviorContent.setStringAttribute(
|
||||||
'sharedProperty1',
|
'sharedProperty1',
|
||||||
@@ -294,7 +285,6 @@ module.exports = {
|
|||||||
// Everything that is stored inside the object is in "content" and is automatically
|
// Everything that is stored inside the object is in "content" and is automatically
|
||||||
// saved/loaded to JSON.
|
// saved/loaded to JSON.
|
||||||
var dummyObject = new gd.ObjectJsImplementation();
|
var dummyObject = new gd.ObjectJsImplementation();
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
dummyObject.updateProperty = function (
|
dummyObject.updateProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -319,7 +309,6 @@ module.exports = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
dummyObject.getProperties = function (objectContent) {
|
dummyObject.getProperties = function (objectContent) {
|
||||||
var objectProperties = new gd.MapStringPropertyDescriptor();
|
var objectProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -354,7 +343,6 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
dummyObject.updateInitialInstanceProperty = function (
|
dummyObject.updateInitialInstanceProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
instance,
|
instance,
|
||||||
@@ -374,7 +362,6 @@ module.exports = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
dummyObject.getInitialInstanceProperties = function (
|
dummyObject.getInitialInstanceProperties = function (
|
||||||
content,
|
content,
|
||||||
instance,
|
instance,
|
||||||
|
@@ -1,35 +0,0 @@
|
|||||||
// @flow
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file This file contains the (Flow) types that are used in the JavaScript
|
|
||||||
* extensions declaration (i.e: JsExtension.js files).
|
|
||||||
* Extension runtime files are in TypeScript (ts files) and not using Flow.
|
|
||||||
*
|
|
||||||
* If you do changes here, run `node import-GDJS-Runtime.js` (in newIDE/app/scripts),
|
|
||||||
* and be sure that the types declared here are reflecting the types exposed by the editor.
|
|
||||||
*
|
|
||||||
* Note that Flow comments are used to avoid having to preprocess this file and the
|
|
||||||
* JsExtension.js files through Babel. This allows to keep plain JS files, while allowing
|
|
||||||
* Flow static type checking to be run on them when integrated in the editor.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*::
|
|
||||||
export type ObjectsRenderingService = {
|
|
||||||
gd: libGDevelop,
|
|
||||||
PIXI: any,
|
|
||||||
THREE: any,
|
|
||||||
THREE_ADDONS: {SkeletonUtils: any},
|
|
||||||
RenderedInstance: any,
|
|
||||||
Rendered3DInstance: any,
|
|
||||||
registerInstanceRenderer: (objectType: string, renderer: any) => void,
|
|
||||||
registerInstance3DRenderer: (objectType: string, renderer: any) => void,
|
|
||||||
requireModule: (dirname: string, moduleName: string) => any,
|
|
||||||
getThumbnail: (project: gdProject, objectConfiguration: gdObjectConfiguration) => string,
|
|
||||||
rgbOrHexToHexNumber: (value: string) => number,
|
|
||||||
registerClearCache: (clearCache: any => void) => void,
|
|
||||||
};
|
|
||||||
export type ObjectsEditorService = {
|
|
||||||
registerEditorConfiguration: (objectType: string, editorConfiguration: any) => void,
|
|
||||||
getDefaultObjectJsImplementationPropertiesEditor: ({| helpPagePath: string |}) => any,
|
|
||||||
};
|
|
||||||
*/
|
|
@@ -30,7 +30,6 @@ module.exports = {
|
|||||||
.setTags('light');
|
.setTags('light');
|
||||||
|
|
||||||
const lightObstacleBehavior = new gd.BehaviorJsImplementation();
|
const lightObstacleBehavior = new gd.BehaviorJsImplementation();
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
lightObstacleBehavior.updateProperty = function (
|
lightObstacleBehavior.updateProperty = function (
|
||||||
behaviorContent,
|
behaviorContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -39,14 +38,12 @@ module.exports = {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
lightObstacleBehavior.getProperties = function (behaviorContent) {
|
lightObstacleBehavior.getProperties = function (behaviorContent) {
|
||||||
const behaviorProperties = new gd.MapStringPropertyDescriptor();
|
const behaviorProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
return behaviorProperties;
|
return behaviorProperties;
|
||||||
};
|
};
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
lightObstacleBehavior.initializeContent = function (behaviorContent) {};
|
lightObstacleBehavior.initializeContent = function (behaviorContent) {};
|
||||||
extension
|
extension
|
||||||
.addBehavior(
|
.addBehavior(
|
||||||
@@ -70,7 +67,6 @@ module.exports = {
|
|||||||
|
|
||||||
const lightObject = new gd.ObjectJsImplementation();
|
const lightObject = new gd.ObjectJsImplementation();
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object.
|
|
||||||
lightObject.updateProperty = function (
|
lightObject.updateProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -99,7 +95,6 @@ module.exports = {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object.
|
|
||||||
lightObject.getProperties = function (objectContent) {
|
lightObject.getProperties = function (objectContent) {
|
||||||
const objectProperties = new gd.MapStringPropertyDescriptor();
|
const objectProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -153,7 +148,6 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object.
|
|
||||||
lightObject.updateInitialInstanceProperty = function (
|
lightObject.updateInitialInstanceProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
instance,
|
instance,
|
||||||
@@ -165,7 +159,6 @@ module.exports = {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object.
|
|
||||||
lightObject.getInitialInstanceProperties = function (
|
lightObject.getInitialInstanceProperties = function (
|
||||||
content,
|
content,
|
||||||
instance,
|
instance,
|
||||||
|
@@ -33,7 +33,6 @@ module.exports = {
|
|||||||
.setIcon('res/physics32.png');
|
.setIcon('res/physics32.png');
|
||||||
|
|
||||||
var physics2Behavior = new gd.BehaviorJsImplementation();
|
var physics2Behavior = new gd.BehaviorJsImplementation();
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
physics2Behavior.updateProperty = function (
|
physics2Behavior.updateProperty = function (
|
||||||
behaviorContent,
|
behaviorContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -91,7 +90,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
if (propertyName === 'vertices') {
|
if (propertyName === 'vertices') {
|
||||||
behaviorContent.addChild('vertices');
|
behaviorContent.addChild('vertices');
|
||||||
// $FlowFixMe
|
|
||||||
behaviorContent.setChild('vertices', gd.Serializer.fromJSON(newValue));
|
behaviorContent.setChild('vertices', gd.Serializer.fromJSON(newValue));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -140,7 +138,6 @@ module.exports = {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
physics2Behavior.getProperties = function (behaviorContent) {
|
physics2Behavior.getProperties = function (behaviorContent) {
|
||||||
var behaviorProperties = new gd.MapStringPropertyDescriptor();
|
var behaviorProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -304,7 +301,6 @@ module.exports = {
|
|||||||
return behaviorProperties;
|
return behaviorProperties;
|
||||||
};
|
};
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
physics2Behavior.initializeContent = function (behaviorContent) {
|
physics2Behavior.initializeContent = function (behaviorContent) {
|
||||||
behaviorContent.addChild('bodyType').setStringValue('Dynamic');
|
behaviorContent.addChild('bodyType').setStringValue('Dynamic');
|
||||||
behaviorContent.addChild('bullet').setBoolValue(false);
|
behaviorContent.addChild('bullet').setBoolValue(false);
|
||||||
@@ -328,7 +324,6 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var sharedData = new gd.BehaviorSharedDataJsImplementation();
|
var sharedData = new gd.BehaviorSharedDataJsImplementation();
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
sharedData.updateProperty = function (
|
sharedData.updateProperty = function (
|
||||||
sharedContent,
|
sharedContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -361,7 +356,6 @@ module.exports = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
sharedData.getProperties = function (sharedContent) {
|
sharedData.getProperties = function (sharedContent) {
|
||||||
var sharedProperties = new gd.MapStringPropertyDescriptor();
|
var sharedProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -394,7 +388,6 @@ module.exports = {
|
|||||||
|
|
||||||
return sharedProperties;
|
return sharedProperties;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
sharedData.initializeContent = function (behaviorContent) {
|
sharedData.initializeContent = function (behaviorContent) {
|
||||||
behaviorContent.addChild('gravityX').setDoubleValue(0);
|
behaviorContent.addChild('gravityX').setDoubleValue(0);
|
||||||
behaviorContent.addChild('gravityY').setDoubleValue(9.8);
|
behaviorContent.addChild('gravityY').setDoubleValue(9.8);
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
// @flow
|
// @ts-check
|
||||||
|
/// <reference path="../JsExtensionTypes.d.ts" />
|
||||||
/**
|
/**
|
||||||
* This is a declaration of an extension for GDevelop 5.
|
* This is a declaration of an extension for GDevelop 5.
|
||||||
*
|
*
|
||||||
@@ -12,18 +13,9 @@
|
|||||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*::
|
/** @type {ExtensionModule} */
|
||||||
// Import types to allow Flow to do static type checking on this file.
|
|
||||||
// Extensions declaration are typed using Flow (like the editor), but the files
|
|
||||||
// for the game engine are checked with TypeScript annotations.
|
|
||||||
import { type ObjectsRenderingService, type ObjectsEditorService } from '../JsExtensionTypes.flow.js'
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
createExtension: function (
|
createExtension: function (_, gd) {
|
||||||
_ /*: (string) => string */,
|
|
||||||
gd /*: libGDevelop */
|
|
||||||
) {
|
|
||||||
const extension = new gd.PlatformExtension();
|
const extension = new gd.PlatformExtension();
|
||||||
|
|
||||||
extension
|
extension
|
||||||
@@ -94,10 +86,7 @@ module.exports = {
|
|||||||
* But it is recommended to create tests for the behaviors/objects properties you created
|
* But it is recommended to create tests for the behaviors/objects properties you created
|
||||||
* to avoid mistakes.
|
* to avoid mistakes.
|
||||||
*/
|
*/
|
||||||
runExtensionSanityTests: function (
|
runExtensionSanityTests: function (gd, extension) {
|
||||||
gd /*: libGDevelop */,
|
|
||||||
extension /*: gdPlatformExtension*/
|
|
||||||
) {
|
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -105,17 +94,13 @@ module.exports = {
|
|||||||
*
|
*
|
||||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
|
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
|
||||||
*/
|
*/
|
||||||
registerEditorConfigurations: function (
|
registerEditorConfigurations: function (objectsEditorService) {},
|
||||||
objectsEditorService /*: ObjectsEditorService */
|
|
||||||
) {},
|
|
||||||
/**
|
/**
|
||||||
* Register renderers for instance of objects on the scene editor.
|
* Register renderers for instance of objects on the scene editor.
|
||||||
*
|
*
|
||||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
|
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
|
||||||
*/
|
*/
|
||||||
registerInstanceRenderers: function (
|
registerInstanceRenderers: function (objectsRenderingService) {
|
||||||
objectsRenderingService /*: ObjectsRenderingService */
|
|
||||||
) {
|
|
||||||
const { PIXI, RenderedInstance, gd } = objectsRenderingService;
|
const { PIXI, RenderedInstance, gd } = objectsRenderingService;
|
||||||
|
|
||||||
class RenderedSpineInstance extends RenderedInstance {
|
class RenderedSpineInstance extends RenderedInstance {
|
||||||
|
@@ -31,7 +31,6 @@ module.exports = {
|
|||||||
.setIcon('JsPlatform/Extensions/text_input.svg');
|
.setIcon('JsPlatform/Extensions/text_input.svg');
|
||||||
|
|
||||||
const textInputObject = new gd.ObjectJsImplementation();
|
const textInputObject = new gd.ObjectJsImplementation();
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
textInputObject.updateProperty = function (
|
textInputObject.updateProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -86,7 +85,6 @@ module.exports = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
textInputObject.getProperties = function (objectContent) {
|
textInputObject.getProperties = function (objectContent) {
|
||||||
const objectProperties = new gd.MapStringPropertyDescriptor();
|
const objectProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -224,7 +222,6 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
textInputObject.updateInitialInstanceProperty = function (
|
textInputObject.updateInitialInstanceProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
instance,
|
instance,
|
||||||
@@ -243,7 +240,6 @@ module.exports = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
textInputObject.getInitialInstanceProperties = function (
|
textInputObject.getInitialInstanceProperties = function (
|
||||||
content,
|
content,
|
||||||
instance,
|
instance,
|
||||||
|
@@ -18,7 +18,6 @@
|
|||||||
/** @type {ExtensionModule} */
|
/** @type {ExtensionModule} */
|
||||||
const defineTileMap = function (extension, _, gd) {
|
const defineTileMap = function (extension, _, gd) {
|
||||||
var objectTileMap = new gd.ObjectJsImplementation();
|
var objectTileMap = new gd.ObjectJsImplementation();
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
objectTileMap.updateProperty = function (
|
objectTileMap.updateProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -59,7 +58,6 @@ const defineTileMap = function (extension, _, gd) {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
objectTileMap.getProperties = function (objectContent) {
|
objectTileMap.getProperties = function (objectContent) {
|
||||||
var objectProperties = new gd.MapStringPropertyDescriptor();
|
var objectProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -158,7 +156,6 @@ const defineTileMap = function (extension, _, gd) {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
objectTileMap.updateInitialInstanceProperty = function (
|
objectTileMap.updateInitialInstanceProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
instance,
|
instance,
|
||||||
@@ -169,7 +166,6 @@ const defineTileMap = function (extension, _, gd) {
|
|||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
objectTileMap.getInitialInstanceProperties = function (
|
objectTileMap.getInitialInstanceProperties = function (
|
||||||
content,
|
content,
|
||||||
instance,
|
instance,
|
||||||
@@ -604,7 +600,6 @@ const defineCollisionMask = function (
|
|||||||
gd /*: libGDevelop */
|
gd /*: libGDevelop */
|
||||||
) {
|
) {
|
||||||
var collisionMaskObject = new gd.ObjectJsImplementation();
|
var collisionMaskObject = new gd.ObjectJsImplementation();
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
collisionMaskObject.updateProperty = function (
|
collisionMaskObject.updateProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -649,7 +644,6 @@ const defineCollisionMask = function (
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
collisionMaskObject.getProperties = function (objectContent) {
|
collisionMaskObject.getProperties = function (objectContent) {
|
||||||
var objectProperties = new gd.MapStringPropertyDescriptor();
|
var objectProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -758,7 +752,6 @@ const defineCollisionMask = function (
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
collisionMaskObject.updateInitialInstanceProperty = function (
|
collisionMaskObject.updateInitialInstanceProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
instance,
|
instance,
|
||||||
@@ -769,7 +762,6 @@ const defineCollisionMask = function (
|
|||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
collisionMaskObject.getInitialInstanceProperties = function (
|
collisionMaskObject.getInitialInstanceProperties = function (
|
||||||
content,
|
content,
|
||||||
instance,
|
instance,
|
||||||
@@ -1340,14 +1332,14 @@ module.exports = {
|
|||||||
|
|
||||||
async _loadTileMap(tilemapJsonFile, tilesetJsonFile) {
|
async _loadTileMap(tilemapJsonFile, tilesetJsonFile) {
|
||||||
try {
|
try {
|
||||||
const tileMapJsonData = await this._pixiResourcesLoader.getResourceJsonData(
|
const tileMapJsonData =
|
||||||
this._project,
|
await this._pixiResourcesLoader.getResourceJsonData(
|
||||||
tilemapJsonFile
|
this._project,
|
||||||
);
|
tilemapJsonFile
|
||||||
|
);
|
||||||
|
|
||||||
const tileMap = TilemapHelper.TileMapManager.identify(
|
const tileMap =
|
||||||
tileMapJsonData
|
TilemapHelper.TileMapManager.identify(tileMapJsonData);
|
||||||
);
|
|
||||||
|
|
||||||
if (tileMap.kind === 'tiled') {
|
if (tileMap.kind === 'tiled') {
|
||||||
const tilesetJsonData = tilesetJsonFile
|
const tilesetJsonData = tilesetJsonFile
|
||||||
@@ -1584,14 +1576,14 @@ module.exports = {
|
|||||||
|
|
||||||
async _loadTileMap(tilemapJsonFile, tilesetJsonFile) {
|
async _loadTileMap(tilemapJsonFile, tilesetJsonFile) {
|
||||||
try {
|
try {
|
||||||
const tileMapJsonData = await this._pixiResourcesLoader.getResourceJsonData(
|
const tileMapJsonData =
|
||||||
this._project,
|
await this._pixiResourcesLoader.getResourceJsonData(
|
||||||
tilemapJsonFile
|
this._project,
|
||||||
);
|
tilemapJsonFile
|
||||||
|
);
|
||||||
|
|
||||||
const tileMap = TilemapHelper.TileMapManager.identify(
|
const tileMap =
|
||||||
tileMapJsonData
|
TilemapHelper.TileMapManager.identify(tileMapJsonData);
|
||||||
);
|
|
||||||
|
|
||||||
if (tileMap.kind === 'tiled') {
|
if (tileMap.kind === 'tiled') {
|
||||||
const tilesetJsonData = tilesetJsonFile
|
const tilesetJsonData = tilesetJsonFile
|
||||||
|
@@ -593,7 +593,6 @@ module.exports = {
|
|||||||
|
|
||||||
const tweenBehavior = new gd.BehaviorJsImplementation();
|
const tweenBehavior = new gd.BehaviorJsImplementation();
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
tweenBehavior.updateProperty = function (
|
tweenBehavior.updateProperty = function (
|
||||||
behaviorContent,
|
behaviorContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -602,13 +601,11 @@ module.exports = {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
tweenBehavior.getProperties = function (behaviorContent) {
|
tweenBehavior.getProperties = function (behaviorContent) {
|
||||||
var behaviorProperties = new gd.MapStringPropertyDescriptor();
|
var behaviorProperties = new gd.MapStringPropertyDescriptor();
|
||||||
return behaviorProperties;
|
return behaviorProperties;
|
||||||
};
|
};
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
|
||||||
tweenBehavior.initializeContent = function (behaviorContent) {};
|
tweenBehavior.initializeContent = function (behaviorContent) {};
|
||||||
|
|
||||||
const behavior = extension
|
const behavior = extension
|
||||||
@@ -622,6 +619,7 @@ module.exports = {
|
|||||||
'',
|
'',
|
||||||
'JsPlatform/Extensions/tween_behavior32.png',
|
'JsPlatform/Extensions/tween_behavior32.png',
|
||||||
'TweenBehavior',
|
'TweenBehavior',
|
||||||
|
// @ts-ignore - TODO: Fix tweenBehavior being an BehaviorJsImplementation instead of an Behavior
|
||||||
tweenBehavior,
|
tweenBehavior,
|
||||||
new gd.BehaviorsSharedData()
|
new gd.BehaviorsSharedData()
|
||||||
)
|
)
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
//@ts-check
|
//@ts-check
|
||||||
/// <reference path="../JsExtensionTypes.d.ts" />
|
/// <reference path="../JsExtensionTypes.d.ts" />
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a declaration of an extension for GDevelop 5.
|
* This is a declaration of an extension for GDevelop 5.
|
||||||
*
|
*
|
||||||
@@ -34,7 +35,6 @@ module.exports = {
|
|||||||
.setIcon('JsPlatform/Extensions/videoicon16.png');
|
.setIcon('JsPlatform/Extensions/videoicon16.png');
|
||||||
|
|
||||||
var videoObject = new gd.ObjectJsImplementation();
|
var videoObject = new gd.ObjectJsImplementation();
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
videoObject.updateProperty = function (
|
videoObject.updateProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
propertyName,
|
propertyName,
|
||||||
@@ -59,7 +59,6 @@ module.exports = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
videoObject.getProperties = function (objectContent) {
|
videoObject.getProperties = function (objectContent) {
|
||||||
var objectProperties = new gd.MapStringPropertyDescriptor();
|
var objectProperties = new gd.MapStringPropertyDescriptor();
|
||||||
|
|
||||||
@@ -99,7 +98,6 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
videoObject.updateInitialInstanceProperty = function (
|
videoObject.updateInitialInstanceProperty = function (
|
||||||
objectContent,
|
objectContent,
|
||||||
instance,
|
instance,
|
||||||
@@ -110,7 +108,6 @@ module.exports = {
|
|||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
|
||||||
videoObject.getInitialInstanceProperties = function (
|
videoObject.getInitialInstanceProperties = function (
|
||||||
content,
|
content,
|
||||||
instance,
|
instance,
|
||||||
@@ -127,6 +124,7 @@ module.exports = {
|
|||||||
_('Video'),
|
_('Video'),
|
||||||
_('Displays a video.'),
|
_('Displays a video.'),
|
||||||
'JsPlatform/Extensions/videoicon32.png',
|
'JsPlatform/Extensions/videoicon32.png',
|
||||||
|
// @ts-ignore - TODO: Fix videoObject being an ObjectJsImplementation instead of an ObjectConfiguration
|
||||||
videoObject
|
videoObject
|
||||||
)
|
)
|
||||||
.setIncludeFile('Extensions/Video/videoruntimeobject.js')
|
.setIncludeFile('Extensions/Video/videoruntimeobject.js')
|
||||||
@@ -631,7 +629,8 @@ module.exports = {
|
|||||||
that._pixiObject.texture.on('error', function () {
|
that._pixiObject.texture.on('error', function () {
|
||||||
that._pixiObject.texture.off('error', this);
|
that._pixiObject.texture.off('error', this);
|
||||||
|
|
||||||
that._pixiObject.texture = that._pixiResourcesLoader.getInvalidPIXITexture();
|
that._pixiObject.texture =
|
||||||
|
that._pixiResourcesLoader.getInvalidPIXITexture();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1381,8 +1381,8 @@ interface ParameterOptions {
|
|||||||
interface AbstractFunctionMetadata {
|
interface AbstractFunctionMetadata {
|
||||||
[Ref] AbstractFunctionMetadata AddParameter([Const] DOMString type,
|
[Ref] AbstractFunctionMetadata AddParameter([Const] DOMString type,
|
||||||
[Const] DOMString description,
|
[Const] DOMString description,
|
||||||
[Const] DOMString optionalObjectType,
|
[Const] optional DOMString optionalObjectType,
|
||||||
boolean parameterIsOptional);
|
optional boolean parameterIsOptional);
|
||||||
[Ref] AbstractFunctionMetadata AddCodeOnlyParameter(
|
[Ref] AbstractFunctionMetadata AddCodeOnlyParameter(
|
||||||
[Const] DOMString type, [Const] DOMString supplementaryInformation);
|
[Const] DOMString type, [Const] DOMString supplementaryInformation);
|
||||||
[Ref] AbstractFunctionMetadata SetDefaultValue([Const] DOMString defaultValue);
|
[Ref] AbstractFunctionMetadata SetDefaultValue([Const] DOMString defaultValue);
|
||||||
@@ -1432,8 +1432,8 @@ interface InstructionMetadata {
|
|||||||
[Ref] InstructionMetadata SetRelevantForCustomObjectEventsOnly();
|
[Ref] InstructionMetadata SetRelevantForCustomObjectEventsOnly();
|
||||||
[Ref] InstructionMetadata AddParameter([Const] DOMString type,
|
[Ref] InstructionMetadata AddParameter([Const] DOMString type,
|
||||||
[Const] DOMString description,
|
[Const] DOMString description,
|
||||||
[Const] DOMString optionalObjectType,
|
[Const] optional DOMString optionalObjectType,
|
||||||
boolean parameterIsOptional);
|
optional boolean parameterIsOptional);
|
||||||
[Ref] InstructionMetadata AddCodeOnlyParameter(
|
[Ref] InstructionMetadata AddCodeOnlyParameter(
|
||||||
[Const] DOMString type, [Const] DOMString supplementaryInformation);
|
[Const] DOMString type, [Const] DOMString supplementaryInformation);
|
||||||
[Ref] InstructionMetadata SetDefaultValue([Const] DOMString defaultValue);
|
[Ref] InstructionMetadata SetDefaultValue([Const] DOMString defaultValue);
|
||||||
@@ -1497,8 +1497,8 @@ interface ExpressionMetadata {
|
|||||||
[Ref] ExpressionMetadata AddParameter(
|
[Ref] ExpressionMetadata AddParameter(
|
||||||
[Const] DOMString type,
|
[Const] DOMString type,
|
||||||
[Const] DOMString description,
|
[Const] DOMString description,
|
||||||
[Const] DOMString optionalObjectType,
|
[Const] optional DOMString optionalObjectType,
|
||||||
boolean parameterIsOptional);
|
optional boolean parameterIsOptional);
|
||||||
[Ref] ExpressionMetadata AddCodeOnlyParameter(
|
[Ref] ExpressionMetadata AddCodeOnlyParameter(
|
||||||
[Const] DOMString type, [Const] DOMString supplementaryInformation);
|
[Const] DOMString type, [Const] DOMString supplementaryInformation);
|
||||||
[Ref] ExpressionMetadata SetDefaultValue([Const] DOMString defaultValue);
|
[Ref] ExpressionMetadata SetDefaultValue([Const] DOMString defaultValue);
|
||||||
@@ -1519,8 +1519,8 @@ ExpressionMetadata implements AbstractFunctionMetadata;
|
|||||||
interface MultipleInstructionMetadata {
|
interface MultipleInstructionMetadata {
|
||||||
[Ref] MultipleInstructionMetadata AddParameter([Const] DOMString type,
|
[Ref] MultipleInstructionMetadata AddParameter([Const] DOMString type,
|
||||||
[Const] DOMString description,
|
[Const] DOMString description,
|
||||||
[Const] DOMString optionalObjectType,
|
[Const] optional DOMString optionalObjectType,
|
||||||
boolean parameterIsOptional);
|
optional boolean parameterIsOptional);
|
||||||
[Ref] MultipleInstructionMetadata AddCodeOnlyParameter(
|
[Ref] MultipleInstructionMetadata AddCodeOnlyParameter(
|
||||||
[Const] DOMString type, [Const] DOMString supplementaryInformation);
|
[Const] DOMString type, [Const] DOMString supplementaryInformation);
|
||||||
[Ref] MultipleInstructionMetadata SetDefaultValue([Const] DOMString defaultValue);
|
[Ref] MultipleInstructionMetadata SetDefaultValue([Const] DOMString defaultValue);
|
||||||
|
@@ -175,7 +175,9 @@ for (const [_, interfaceName, interfaceCode] of bindingsFile.matchAll(
|
|||||||
|
|
||||||
if (isAttribute) {
|
if (isAttribute) {
|
||||||
const attributeName = Parser.readUntil(';');
|
const attributeName = Parser.readUntil(';');
|
||||||
attributes.push(`${attributeName}: ${returnType};`);
|
attributes.push(
|
||||||
|
`${attributeName}${optionalReturn ? '?' : ''}: ${returnType};`
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +252,11 @@ for (const [_, interfaceName, interfaceCode] of bindingsFile.matchAll(
|
|||||||
);
|
);
|
||||||
|
|
||||||
interfaces.push(
|
interfaces.push(
|
||||||
`export class ${interfaceName} extends ${inheritedClass ? inheritedClass[1] : 'EmscriptenObject'} {${methods.length ? '\n ' + methods.join('\n ') : ''}${attributes.length ? '\n ' + attributes.join('\n ') : ''}
|
`export class ${interfaceName} extends ${
|
||||||
|
inheritedClass ? inheritedClass[1] : 'EmscriptenObject'
|
||||||
|
} {${methods.length ? '\n ' + methods.join('\n ') : ''}${
|
||||||
|
attributes.length ? '\n ' + attributes.join('\n ') : ''
|
||||||
|
}
|
||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
8
GDevelop.js/types.d.ts
vendored
8
GDevelop.js/types.d.ts
vendored
@@ -1196,7 +1196,7 @@ export class ParameterOptions extends EmscriptenObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class AbstractFunctionMetadata extends EmscriptenObject {
|
export class AbstractFunctionMetadata extends EmscriptenObject {
|
||||||
addParameter(type: string, description: string, optionalObjectType: string, parameterIsOptional: boolean): AbstractFunctionMetadata;
|
addParameter(type: string, description: string, optionalObjectType?: string, parameterIsOptional?: boolean): AbstractFunctionMetadata;
|
||||||
addCodeOnlyParameter(type: string, supplementaryInformation: string): AbstractFunctionMetadata;
|
addCodeOnlyParameter(type: string, supplementaryInformation: string): AbstractFunctionMetadata;
|
||||||
setDefaultValue(defaultValue: string): AbstractFunctionMetadata;
|
setDefaultValue(defaultValue: string): AbstractFunctionMetadata;
|
||||||
setParameterLongDescription(longDescription: string): AbstractFunctionMetadata;
|
setParameterLongDescription(longDescription: string): AbstractFunctionMetadata;
|
||||||
@@ -1239,7 +1239,7 @@ export class InstructionMetadata extends AbstractFunctionMetadata {
|
|||||||
setRelevantForFunctionEventsOnly(): InstructionMetadata;
|
setRelevantForFunctionEventsOnly(): InstructionMetadata;
|
||||||
setRelevantForAsynchronousFunctionEventsOnly(): InstructionMetadata;
|
setRelevantForAsynchronousFunctionEventsOnly(): InstructionMetadata;
|
||||||
setRelevantForCustomObjectEventsOnly(): InstructionMetadata;
|
setRelevantForCustomObjectEventsOnly(): InstructionMetadata;
|
||||||
addParameter(type: string, description: string, optionalObjectType: string, parameterIsOptional: boolean): InstructionMetadata;
|
addParameter(type: string, description: string, optionalObjectType?: string, parameterIsOptional?: boolean): InstructionMetadata;
|
||||||
addCodeOnlyParameter(type: string, supplementaryInformation: string): InstructionMetadata;
|
addCodeOnlyParameter(type: string, supplementaryInformation: string): InstructionMetadata;
|
||||||
setDefaultValue(defaultValue: string): InstructionMetadata;
|
setDefaultValue(defaultValue: string): InstructionMetadata;
|
||||||
setParameterLongDescription(longDescription: string): InstructionMetadata;
|
setParameterLongDescription(longDescription: string): InstructionMetadata;
|
||||||
@@ -1285,7 +1285,7 @@ export class ExpressionMetadata extends AbstractFunctionMetadata {
|
|||||||
setRelevantForFunctionEventsOnly(): ExpressionMetadata;
|
setRelevantForFunctionEventsOnly(): ExpressionMetadata;
|
||||||
setRelevantForAsynchronousFunctionEventsOnly(): ExpressionMetadata;
|
setRelevantForAsynchronousFunctionEventsOnly(): ExpressionMetadata;
|
||||||
setRelevantForCustomObjectEventsOnly(): ExpressionMetadata;
|
setRelevantForCustomObjectEventsOnly(): ExpressionMetadata;
|
||||||
addParameter(type: string, description: string, optionalObjectType: string, parameterIsOptional: boolean): ExpressionMetadata;
|
addParameter(type: string, description: string, optionalObjectType?: string, parameterIsOptional?: boolean): ExpressionMetadata;
|
||||||
addCodeOnlyParameter(type: string, supplementaryInformation: string): ExpressionMetadata;
|
addCodeOnlyParameter(type: string, supplementaryInformation: string): ExpressionMetadata;
|
||||||
setDefaultValue(defaultValue: string): ExpressionMetadata;
|
setDefaultValue(defaultValue: string): ExpressionMetadata;
|
||||||
setParameterLongDescription(longDescription: string): ExpressionMetadata;
|
setParameterLongDescription(longDescription: string): ExpressionMetadata;
|
||||||
@@ -1300,7 +1300,7 @@ export class ExpressionMetadata extends AbstractFunctionMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class MultipleInstructionMetadata extends AbstractFunctionMetadata {
|
export class MultipleInstructionMetadata extends AbstractFunctionMetadata {
|
||||||
addParameter(type: string, description: string, optionalObjectType: string, parameterIsOptional: boolean): MultipleInstructionMetadata;
|
addParameter(type: string, description: string, optionalObjectType?: string, parameterIsOptional?: boolean): MultipleInstructionMetadata;
|
||||||
addCodeOnlyParameter(type: string, supplementaryInformation: string): MultipleInstructionMetadata;
|
addCodeOnlyParameter(type: string, supplementaryInformation: string): MultipleInstructionMetadata;
|
||||||
setDefaultValue(defaultValue: string): MultipleInstructionMetadata;
|
setDefaultValue(defaultValue: string): MultipleInstructionMetadata;
|
||||||
setParameterLongDescription(longDescription: string): MultipleInstructionMetadata;
|
setParameterLongDescription(longDescription: string): MultipleInstructionMetadata;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// Automatically generated by GDevelop.js/scripts/generate-types.js
|
// Automatically generated by GDevelop.js/scripts/generate-types.js
|
||||||
declare class gdAbstractFunctionMetadata {
|
declare class gdAbstractFunctionMetadata {
|
||||||
addParameter(type: string, description: string, optionalObjectType: string, parameterIsOptional: boolean): gdAbstractFunctionMetadata;
|
addParameter(type: string, description: string, optionalObjectType?: string, parameterIsOptional?: boolean): gdAbstractFunctionMetadata;
|
||||||
addCodeOnlyParameter(type: string, supplementaryInformation: string): gdAbstractFunctionMetadata;
|
addCodeOnlyParameter(type: string, supplementaryInformation: string): gdAbstractFunctionMetadata;
|
||||||
setDefaultValue(defaultValue: string): gdAbstractFunctionMetadata;
|
setDefaultValue(defaultValue: string): gdAbstractFunctionMetadata;
|
||||||
setParameterLongDescription(longDescription: string): gdAbstractFunctionMetadata;
|
setParameterLongDescription(longDescription: string): gdAbstractFunctionMetadata;
|
||||||
|
@@ -47,7 +47,6 @@
|
|||||||
"GDJS/Runtime/Electron",
|
"GDJS/Runtime/Electron",
|
||||||
"GDJS/Runtime/FacebookInstantGames",
|
"GDJS/Runtime/FacebookInstantGames",
|
||||||
"GDJS/Runtime/libs/CocoonJS",
|
"GDJS/Runtime/libs/CocoonJS",
|
||||||
"Extensions/**/JsExtension.js",
|
|
||||||
"Extensions/Effects/pixi-filters/filter-alpha.js",
|
"Extensions/Effects/pixi-filters/filter-alpha.js",
|
||||||
"Extensions/P2P/A_peer.js"
|
"Extensions/P2P/A_peer.js"
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user