In an effort to make DObject updates easier to react to in actionscript, gendobj now generates
signals for each field that can be listened to individually.
From the old:
barrel.addListener(new AttributeChangeAdapter(function (event :AttributeChangedEvent) :void {
if (event.getName() == BarrelObject.MONKEY_COUNT) {
// ... cast event.getValue() and use it
}
}));
to the new:
barrel.onMonkeyCountChanged.add(function (newValue :int, oldValue :int) :void {
// ...
});
Only AttributeChangedEvent have been signalified, but I'm planning to continue with the other
ChangeListeners shortly.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6328 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -82,6 +82,11 @@ public class GenActionScriptStreamableTask extends GenTask
|
||||
ActionScriptUtils.addImportAndGetShortType(sclass.getSuperclass(), false, imports);
|
||||
}
|
||||
|
||||
boolean isDObject = DObject.class.isAssignableFrom(sclass);
|
||||
if (isDObject) {
|
||||
imports.add("org.osflash.signals.Signal");
|
||||
}
|
||||
|
||||
Set<String> implemented = Sets.newLinkedHashSet();
|
||||
for (Class<?> iface : sclass.getInterfaces()) {
|
||||
implemented.add(ActionScriptUtils.addImportAndGetShortType(iface, false, imports));
|
||||
@@ -99,7 +104,7 @@ public class GenActionScriptStreamableTask extends GenTask
|
||||
"implements", Joiner.on(", ").join(implemented),
|
||||
"superclassStreamable", reqs.superclassStreamable,
|
||||
"fields", fields,
|
||||
"dobject", DObject.class.isAssignableFrom(sclass));
|
||||
"dobject", isDObject);
|
||||
|
||||
File outputLocation = ActionScriptUtils.createActionScriptPath(_asroot, sclass);
|
||||
if (outputLocation.exists()) {
|
||||
|
||||
Reference in New Issue
Block a user