mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-23 02:25:52 -04:00
aa7a4a4ff3
* Rename onOwnerRemovedFromScene to onDestroy (because it can be now called when a scene is destroyed) * Fix it being not called when a scene is destroyed (so behavior don't get a chance to clean up what they have created) * Fix onCreated being called before the object is fully initialized (for custom behaviors or behaviors relying on an object type)
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
gdjs.TextEntryRuntimeObjectCocosRenderer = function(runtimeObject, runtimeScene)
|
|
{
|
|
this._object = runtimeObject;
|
|
this._textField = new cc.TextFieldTTF('', cc.size(500,150), cc.TEXT_ALIGNMENT_LEFT,"Arial", 32);
|
|
this._textField.setOpacity(0);
|
|
|
|
var renderer = runtimeScene.getLayer("").getRenderer();
|
|
renderer.addRendererObject(this._textField, runtimeObject.getZOrder());
|
|
|
|
this.updateString();
|
|
};
|
|
|
|
gdjs.TextEntryRuntimeObjectRenderer = gdjs.TextEntryRuntimeObjectCocosRenderer; //Register the class to let the engine use it.
|
|
|
|
gdjs.TextEntryRuntimeObjectCocosRenderer.prototype.onDestroy = function() {
|
|
this.activate(false);
|
|
};
|
|
|
|
gdjs.TextEntryRuntimeObjectCocosRenderer.prototype.getRendererObject = function() {
|
|
return this._textField;
|
|
};
|
|
|
|
gdjs.TextEntryRuntimeObjectCocosRenderer.prototype.getString = function() {
|
|
return this._textField.getString();
|
|
}
|
|
|
|
gdjs.TextEntryRuntimeObjectCocosRenderer.prototype.updateString = function() {
|
|
this._textField.setString(this._object.getString());
|
|
}
|
|
|
|
gdjs.TextEntryRuntimeObjectCocosRenderer.prototype.activate = function(enable) {
|
|
if (enable) {
|
|
this._textField.attachWithIME();
|
|
} else {
|
|
this._textField.detachWithIME();
|
|
}
|
|
}
|