Add a 'destroyed' signal to generated ActionScript DObjects

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6389 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Tom Conkling
2010-12-21 19:54:57 +00:00
parent 0b3e8297e4
commit 865c00dbfe
@@ -32,6 +32,7 @@ public class {{classname}} {{^extends.isEmpty}}extends {{extends}}
public var updated{{capitalName}} :Signal = new Signal(int, Object, Object); public var updated{{capitalName}} :Signal = new Signal(int, Object, Object);
{{/array}} {{/array}}
{{/pubFields}} {{/pubFields}}
public var destroyed :Signal = new Signal();
{{#pubFields}} {{#pubFields}}
public static const {{dobjectField}} :String = "{{name}}"; public static const {{dobjectField}} :String = "{{name}}";
@@ -93,12 +94,14 @@ import com.threerings.presents.dobj.ElementUpdateListener;
import com.threerings.presents.dobj.EntryAddedEvent; import com.threerings.presents.dobj.EntryAddedEvent;
import com.threerings.presents.dobj.EntryRemovedEvent; import com.threerings.presents.dobj.EntryRemovedEvent;
import com.threerings.presents.dobj.EntryUpdatedEvent; import com.threerings.presents.dobj.EntryUpdatedEvent;
import com.threerings.presents.dobj.ObjectDeathListener;
import com.threerings.presents.dobj.ObjectDestroyedEvent;
import com.threerings.presents.dobj.SetListener; import com.threerings.presents.dobj.SetListener;
import {{package}}.{{classname}}; import {{package}}.{{classname}};
class Signaller class Signaller
implements AttributeChangeListener, SetListener, ElementUpdateListener implements AttributeChangeListener, SetListener, ElementUpdateListener, ObjectDeathListener
{ {
public function Signaller (obj :{{classname}}) public function Signaller (obj :{{classname}})
{ {
@@ -181,6 +184,11 @@ class Signaller
signal.dispatch(event.getIndex(), event.getValue(), event.getOldValue()); signal.dispatch(event.getIndex(), event.getValue(), event.getOldValue());
} }
public function objectDestroyed (event :ObjectDestroyedEvent) :void
{
_obj.destroyed.dispatch();
}
protected var _obj :{{classname}}; protected var _obj :{{classname}};
} }
// GENERATED SIGNALLER END // GENERATED SIGNALLER END