wcPlayNodes.wcNode.extend('wcNodeStorage', 'Storage', '', {
/**
* The base class for all storage nodes. These are nodes designed solely for managing data.
* <br>When inheriting, make sure to include 'this._super(parent, pos);' at the top of your init function.
* <br>Also when inheriting, a 'value' property MUST be created as the storage value.
* @class wcNodeStorage
* @param {string} parent - The parent object of this node.
* @param {wcPlay~Coordinates} pos - The position of this node in the visual editor.
*/
init: function(parent, pos) {
this._super(parent, pos);
this.color = '#009900';
},
/**
* Magic function that is called whenever any new class type is extended from this one.
* <br>Handles initializing of the class as well as registering the new node type.
* @function wcNodeStorage#classInit
* @param {string} className - The name of the class constructor.
* @param {string} type - The type name for the node.
* @param {string} category - A category where this node will be grouped.
*/
classInit: function(className, type, category) {
if (category) {
this.className = className;
this.type = type;
this.nodeType = wcPlay.NODE.STORAGE;
this.category = category;
wcPlay.registerNodeType(className, type, category, wcPlay.NODE.STORAGE);
}
},
/**
* Event that is called as soon as the Play script has started.
* <br>Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.
* @function wcNodeStorage#onStart
*/
onStart: function() {
this._super();
// Force a property change event so all connected nodes receive our value.
this.property('value', this.property('value'), true);
}
});