mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
31 lines
970 B
JavaScript
31 lines
970 B
JavaScript
(function() {
|
|
Script.include('utils.js');
|
|
|
|
Button = function() {
|
|
};
|
|
Button.prototype = {
|
|
preload: function(entityID) {
|
|
print("Loaded enemy entity");
|
|
this.entityID = entityID;
|
|
|
|
var props = Entities.getEntityProperties(this.entityID, 'parentID');
|
|
this.gameChannel = 'button-' + props.parentID;
|
|
|
|
Messages.subscribe(this.gameChannel);
|
|
Messages.messageReceived.connect(this, this.onReceivedMessage);
|
|
},
|
|
unload: function() {
|
|
Messages.unsubscribe(this.gameChannel);
|
|
Messages.messageReceived.disconnect(this, this.onReceivedMessage);
|
|
},
|
|
onReceivedMessage: function(channel, message, senderID) {
|
|
if (channel === this.gameChannel) {
|
|
Entities.editEntity(this.entityID, {
|
|
visible: message === 'show'
|
|
});
|
|
}
|
|
},
|
|
};
|
|
|
|
return new Button();
|
|
});
|