Cocos Creator 使用protobuf

protobuf.js 5.x 異步加載方式:

var ByteBuffer = require("bytebuffer");

var ProtoBuf = require("protobuf");

cc.loader.loadRes(path, function (error, content) {

var Builder = ProtoBuf.loadProto(content);

var Data = Builder.build(str);

var data = new Data();

data.setLoginType(loginType);

同步加載方式需要修改源碼:

參考:https://blog.csdn.net/wzh200x/article/details/51858931

http://docs.cocos.com/creator/manual/zh/release-notes/raw-asset-migration.html?q=

https://mp.weixin.qq.com/s?__biz=MzA5MjEwOTI4Ng==&mid=2247483966&idx=1&sn=dc2e59e1a638e3caf3a3fc1b8528b9e8&chksm=907362b7a704eba1ab6588f09813f31307ee73ba0bda85f6790388f4e4b159fd03ed249da338&scene=21#wechat_redirect

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章