sh protobuf.sh
- - - - - - - - - - - - -
Type proto file name:
hello
-> proto/hello.proto
- - - - -
DONE! Press ENTER key to continue...
在OUTPUT_DIR目录里面就可以得到相应的AS3代码
HelloWorld.as代码内容
123456789101112131415161718192021222324252627
// Generated by the protocol buffer compiler. DO NOT EDIT!package{importcom.google.protobuf.*;importflash.utils.*;importcom.hurlant.math.BigInteger;importInfo;publicfinalclassHelloWorldextendsMessage{publicfunction HelloWorld(){registerField("code","",Descriptor.INT32,Descriptor.LABEL_OPTIONAL,1);registerField("name","",Descriptor.STRING,Descriptor.LABEL_OPTIONAL,2);registerField("info","Info",Descriptor.MESSAGE,Descriptor.LABEL_OPTIONAL,3);}// optional int32 code = 1;publicvarcode:int=0;// optional string name = 2;publicvarname:String="";// optional .HelloWorld.Info info = 3;publicvarinfo:Info=null;}}
Info.as代码内容
1234567891011121314151617
// Generated by the protocol buffer compiler. DO NOT EDIT!package{importcom.google.protobuf.*;importflash.utils.*;importcom.hurlant.math.BigInteger;publicfinalclassInfoextendsMessage{publicfunction Info(){registerField("version","",Descriptor.STRING,Descriptor.LABEL_OPTIONAL,1);}// optional string version = 1;publicvarversion:String="";}}