Skip to content

Instantly share code, notes, and snippets.

@sonygod
Created January 19, 2013 02:26
Show Gist options
  • Save sonygod/4570352 to your computer and use it in GitHub Desktop.
Save sonygod/4570352 to your computer and use it in GitHub Desktop.
test for each
package ;
import flash.display.BlendMode;
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.Lib;
import TaskData;
/**
* ...
* @author sonygod
*/
@:fakeEnum(Int)
enum MyEnum {
A;
B;
C;
}
typedef MyDef = {
a:UInt,
b:UInt,
c:String,
}
typedef MyDef2 = {
>MyDef,
d:UInt,
}
extern class Unused {}
using Type;
class Main {
static function main() {
var tasks:Array<UInt> = [1, 2, 3];
var a:MyDef2 = { a:1, b:2, c:'3', d:4 };
var taskFormat:TaskFormat = {
id:1,
serialId:1,
preTask:1,
nexId:2,
branch:0,
mainId:1,
name:"task1",
type:1,
accept_level:1,
sumitType:[1, 1],
storyId:0,
npc:[1, 1],
autoRun:0,
autoSumit:0,
triggerCondition:[{id:1, args:[0]}],
target:[{id:3, args:[1, 1]}],
award:[{id:1, args:[150]}, {id:1, args:[260]}]
}
var obj = { };
for(i in Reflect.fields(taskFormat)) {
var value= Reflect.field(taskFormat, Std.string(i));
Reflect.setProperty(obj, i,value);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment