mirror of
https://github.com/Leo501/CocosCreatorTutorial.git
synced 2026-05-09 15:18:40 +08:00
添加使用ProtoBuf3的使用demo
This commit is contained in:
67
ProtoBufDemo/.gitignore
vendored
Normal file
67
ProtoBufDemo/.gitignore
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# Fireball Projects
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
library/
|
||||
temp/
|
||||
local/
|
||||
build/
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# Logs and databases
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# files for debugger
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
*.sln
|
||||
*.csproj
|
||||
*.pidb
|
||||
*.unityproj
|
||||
*.suo
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# OS generated files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
.DS_Store
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# exvim files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
*UnityVS.meta
|
||||
*.err
|
||||
*.err.meta
|
||||
*.exvim
|
||||
*.exvim.meta
|
||||
*.vimentry
|
||||
*.vimentry.meta
|
||||
*.vimproject
|
||||
*.vimproject.meta
|
||||
.vimfiles.*/
|
||||
.exvim.*/
|
||||
quick_gen_project_*_autogen.bat
|
||||
quick_gen_project_*_autogen.bat.meta
|
||||
quick_gen_project_*_autogen.sh
|
||||
quick_gen_project_*_autogen.sh.meta
|
||||
.exvim.app
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# webstorm files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
.idea/
|
||||
|
||||
#//////////////////////////
|
||||
# VS Code
|
||||
#//////////////////////////
|
||||
|
||||
.vscode/
|
||||
2
ProtoBufDemo/README.md
Normal file
2
ProtoBufDemo/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# hello-world
|
||||
Hello world new project template.
|
||||
6
ProtoBufDemo/assets/Scene.meta
Normal file
6
ProtoBufDemo/assets/Scene.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "29f52784-2fca-467b-92e7-8fd9ef8c57b7",
|
||||
"isGroup": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
403
ProtoBufDemo/assets/Scene/helloworld.fire
Normal file
403
ProtoBufDemo/assets/Scene/helloworld.fire
Normal file
@@ -0,0 +1,403 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.SceneAsset",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_rawFiles": null,
|
||||
"scene": {
|
||||
"__id__": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Scene",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
}
|
||||
],
|
||||
"_tag": -1,
|
||||
"_active": true,
|
||||
"_components": [],
|
||||
"_prefab": null,
|
||||
"_id": "2d2f792f-a40c-49bb-a189-ed176a246e49",
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_cascadeOpacityEnabled": true,
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 0,
|
||||
"height": 0
|
||||
},
|
||||
"_localZOrder": 0,
|
||||
"_globalZOrder": 0,
|
||||
"_opacityModifyRGB": false,
|
||||
"groupIndex": 0,
|
||||
"autoReleaseAssets": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Canvas",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 3
|
||||
},
|
||||
{
|
||||
"__id__": 6
|
||||
},
|
||||
{
|
||||
"__id__": 8
|
||||
}
|
||||
],
|
||||
"_tag": -1,
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 10
|
||||
},
|
||||
{
|
||||
"__id__": 11
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_id": "a286bbGknJLZpRpxROV6M94",
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 252,
|
||||
"g": 252,
|
||||
"b": 252,
|
||||
"a": 255
|
||||
},
|
||||
"_cascadeOpacityEnabled": true,
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 960,
|
||||
"height": 640
|
||||
},
|
||||
"_rotationX": 0,
|
||||
"_rotationY": 0,
|
||||
"_scaleX": 1,
|
||||
"_scaleY": 1,
|
||||
"_position": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 480,
|
||||
"y": 320
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_localZOrder": 0,
|
||||
"_globalZOrder": 0,
|
||||
"_opacityModifyRGB": false,
|
||||
"groupIndex": 0
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "background",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_children": [],
|
||||
"_tag": -1,
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 4
|
||||
},
|
||||
{
|
||||
"__id__": 5
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_id": "e2e0crkOLxGrpMxpbC4iQg1",
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 27,
|
||||
"g": 38,
|
||||
"b": 46,
|
||||
"a": 255
|
||||
},
|
||||
"_cascadeOpacityEnabled": true,
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 960,
|
||||
"height": 640
|
||||
},
|
||||
"_rotationX": 0,
|
||||
"_rotationY": 0,
|
||||
"_scaleX": 1,
|
||||
"_scaleY": 1,
|
||||
"_position": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_localZOrder": 0,
|
||||
"_globalZOrder": 0,
|
||||
"_opacityModifyRGB": false,
|
||||
"groupIndex": 0
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_enabled": true,
|
||||
"isAlignOnce": true,
|
||||
"_target": null,
|
||||
"_alignFlags": 45,
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": 0,
|
||||
"_bottom": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 200,
|
||||
"_originalHeight": 150
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_enabled": true,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "410fb916-8721-4663-bab8-34397391ace7"
|
||||
},
|
||||
"_type": 1,
|
||||
"_sizeMode": 0,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_atlas": null
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "cocos",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_children": [],
|
||||
"_tag": -1,
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 7
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_id": "c4f30YOS65G64U2TwufdJ+2",
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_cascadeOpacityEnabled": true,
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 195,
|
||||
"height": 270
|
||||
},
|
||||
"_rotationX": 0,
|
||||
"_rotationY": 0,
|
||||
"_scaleX": 1,
|
||||
"_scaleY": 1,
|
||||
"_position": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 50
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_localZOrder": 0,
|
||||
"_globalZOrder": 0,
|
||||
"_opacityModifyRGB": false,
|
||||
"groupIndex": 0
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 6
|
||||
},
|
||||
"_enabled": true,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "31bc895a-c003-4566-a9f3-2e54ae1c17dc"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 1,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_atlas": null
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "label",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_children": [],
|
||||
"_tag": -1,
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 9
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_id": "31f1bH7V69Ajr1iXhluMpTB",
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_cascadeOpacityEnabled": true,
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 147,
|
||||
"height": 60
|
||||
},
|
||||
"_rotationX": 0,
|
||||
"_rotationY": 0,
|
||||
"_scaleX": 1,
|
||||
"_scaleY": 1,
|
||||
"_position": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": -180
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_localZOrder": 0,
|
||||
"_globalZOrder": 0,
|
||||
"_opacityModifyRGB": false,
|
||||
"groupIndex": 0
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 8
|
||||
},
|
||||
"_enabled": true,
|
||||
"_useOriginalSize": false,
|
||||
"_actualFontSize": 40,
|
||||
"_fontSize": 60,
|
||||
"_lineHeight": 60,
|
||||
"_enableWrapText": true,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_N$string": "Label",
|
||||
"_N$horizontalAlign": 1,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 0
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Canvas",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"_designResolution": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 960,
|
||||
"height": 640
|
||||
},
|
||||
"_fitWidth": false,
|
||||
"_fitHeight": true
|
||||
},
|
||||
{
|
||||
"__type__": "280c3rsZJJKnZ9RqbALVwtK",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"label": {
|
||||
"__id__": 9
|
||||
},
|
||||
"text": "Hello, World!"
|
||||
}
|
||||
]
|
||||
7
ProtoBufDemo/assets/Scene/helloworld.fire.meta
Normal file
7
ProtoBufDemo/assets/Scene/helloworld.fire.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.0",
|
||||
"uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
6
ProtoBufDemo/assets/Script.meta
Normal file
6
ProtoBufDemo/assets/Script.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "4734c20c-0db8-4eb2-92ea-e692f4d70934",
|
||||
"isGroup": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
42
ProtoBufDemo/assets/Script/HelloWorld.js
Normal file
42
ProtoBufDemo/assets/Script/HelloWorld.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const ProtoUtil = require('./proto/PersonPb');
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
label: {
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
text: 'Hello, World!'
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
this.label.string = this.text;
|
||||
// ProtoUtil.getProto();
|
||||
|
||||
let personInfoPB = ProtoUtil.getPb();
|
||||
let req = personInfoPB.create();
|
||||
console.log('req=', req);
|
||||
req.uid = 10000100;
|
||||
req.name = 'test';
|
||||
req.grender = true;
|
||||
req.skills = {
|
||||
favorite: 'ride',
|
||||
hobby: ['1', '2']
|
||||
}
|
||||
|
||||
//压包
|
||||
let buffer = personInfoPB.encode(req).finish();
|
||||
console.log('encode msg=', buffer);
|
||||
|
||||
//解包
|
||||
let data = personInfoPB.decode(buffer);
|
||||
console.log('decode msg=', data);
|
||||
},
|
||||
|
||||
// called every frame
|
||||
update: function (dt) {
|
||||
|
||||
},
|
||||
});
|
||||
9
ProtoBufDemo/assets/Script/HelloWorld.js.meta
Normal file
9
ProtoBufDemo/assets/Script/HelloWorld.js.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "280c3aec-6492-4a9d-9f51-a9b00b570b4a",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
5
ProtoBufDemo/assets/Script/proto.meta
Normal file
5
ProtoBufDemo/assets/Script/proto.meta
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "77662e39-85d7-4145-b630-e72e10d16d07",
|
||||
"subMetas": {}
|
||||
}
|
||||
509
ProtoBufDemo/assets/Script/proto/Person.js
Normal file
509
ProtoBufDemo/assets/Script/proto/Person.js
Normal file
@@ -0,0 +1,509 @@
|
||||
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
|
||||
"use strict";
|
||||
|
||||
var $protobuf = require("protobufjs");
|
||||
|
||||
// Common aliases
|
||||
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
||||
|
||||
// Exported root namespace
|
||||
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
|
||||
|
||||
$root.Person = (function() {
|
||||
|
||||
/**
|
||||
* Namespace Person.
|
||||
* @exports Person
|
||||
* @namespace
|
||||
*/
|
||||
var Person = {};
|
||||
|
||||
Person.personInfo = (function() {
|
||||
|
||||
/**
|
||||
* Properties of a personInfo.
|
||||
* @memberof Person
|
||||
* @interface IpersonInfo
|
||||
* @property {number|null} [uid] personInfo uid
|
||||
* @property {string|null} [name] personInfo name
|
||||
* @property {boolean|null} [grender] personInfo grender
|
||||
* @property {Person.personInfo.ISkill|null} [skills] personInfo skills
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new personInfo.
|
||||
* @memberof Person
|
||||
* @classdesc Represents a personInfo.
|
||||
* @implements IpersonInfo
|
||||
* @constructor
|
||||
* @param {Person.IpersonInfo=} [properties] Properties to set
|
||||
*/
|
||||
function personInfo(properties) {
|
||||
if (properties)
|
||||
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* personInfo uid.
|
||||
* @member {number} uid
|
||||
* @memberof Person.personInfo
|
||||
* @instance
|
||||
*/
|
||||
personInfo.prototype.uid = 0;
|
||||
|
||||
/**
|
||||
* personInfo name.
|
||||
* @member {string} name
|
||||
* @memberof Person.personInfo
|
||||
* @instance
|
||||
*/
|
||||
personInfo.prototype.name = "";
|
||||
|
||||
/**
|
||||
* personInfo grender.
|
||||
* @member {boolean} grender
|
||||
* @memberof Person.personInfo
|
||||
* @instance
|
||||
*/
|
||||
personInfo.prototype.grender = false;
|
||||
|
||||
/**
|
||||
* personInfo skills.
|
||||
* @member {Person.personInfo.ISkill|null|undefined} skills
|
||||
* @memberof Person.personInfo
|
||||
* @instance
|
||||
*/
|
||||
personInfo.prototype.skills = null;
|
||||
|
||||
/**
|
||||
* Creates a new personInfo instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof Person.personInfo
|
||||
* @static
|
||||
* @param {Person.IpersonInfo=} [properties] Properties to set
|
||||
* @returns {Person.personInfo} personInfo instance
|
||||
*/
|
||||
personInfo.create = function create(properties) {
|
||||
return new personInfo(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified personInfo message. Does not implicitly {@link Person.personInfo.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof Person.personInfo
|
||||
* @static
|
||||
* @param {Person.IpersonInfo} message personInfo message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
personInfo.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.uid != null && message.hasOwnProperty("uid"))
|
||||
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.uid);
|
||||
if (message.name != null && message.hasOwnProperty("name"))
|
||||
writer.uint32(/* id 2, wireType 2 =*/18).string(message.name);
|
||||
if (message.grender != null && message.hasOwnProperty("grender"))
|
||||
writer.uint32(/* id 3, wireType 0 =*/24).bool(message.grender);
|
||||
if (message.skills != null && message.hasOwnProperty("skills"))
|
||||
$root.Person.personInfo.Skill.encode(message.skills, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified personInfo message, length delimited. Does not implicitly {@link Person.personInfo.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof Person.personInfo
|
||||
* @static
|
||||
* @param {Person.IpersonInfo} message personInfo message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
personInfo.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a personInfo message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof Person.personInfo
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {Person.personInfo} personInfo
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
personInfo.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Person.personInfo();
|
||||
while (reader.pos < end) {
|
||||
var tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.uid = reader.int32();
|
||||
break;
|
||||
case 2:
|
||||
message.name = reader.string();
|
||||
break;
|
||||
case 3:
|
||||
message.grender = reader.bool();
|
||||
break;
|
||||
case 4:
|
||||
message.skills = $root.Person.personInfo.Skill.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a personInfo message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof Person.personInfo
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {Person.personInfo} personInfo
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
personInfo.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a personInfo message.
|
||||
* @function verify
|
||||
* @memberof Person.personInfo
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
personInfo.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
if (message.uid != null && message.hasOwnProperty("uid"))
|
||||
if (!$util.isInteger(message.uid))
|
||||
return "uid: integer expected";
|
||||
if (message.name != null && message.hasOwnProperty("name"))
|
||||
if (!$util.isString(message.name))
|
||||
return "name: string expected";
|
||||
if (message.grender != null && message.hasOwnProperty("grender"))
|
||||
if (typeof message.grender !== "boolean")
|
||||
return "grender: boolean expected";
|
||||
if (message.skills != null && message.hasOwnProperty("skills")) {
|
||||
var error = $root.Person.personInfo.Skill.verify(message.skills);
|
||||
if (error)
|
||||
return "skills." + error;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a personInfo message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof Person.personInfo
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {Person.personInfo} personInfo
|
||||
*/
|
||||
personInfo.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.Person.personInfo)
|
||||
return object;
|
||||
var message = new $root.Person.personInfo();
|
||||
if (object.uid != null)
|
||||
message.uid = object.uid | 0;
|
||||
if (object.name != null)
|
||||
message.name = String(object.name);
|
||||
if (object.grender != null)
|
||||
message.grender = Boolean(object.grender);
|
||||
if (object.skills != null) {
|
||||
if (typeof object.skills !== "object")
|
||||
throw TypeError(".Person.personInfo.skills: object expected");
|
||||
message.skills = $root.Person.personInfo.Skill.fromObject(object.skills);
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a personInfo message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof Person.personInfo
|
||||
* @static
|
||||
* @param {Person.personInfo} message personInfo
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
personInfo.toObject = function toObject(message, options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
var object = {};
|
||||
if (options.defaults) {
|
||||
object.uid = 0;
|
||||
object.name = "";
|
||||
object.grender = false;
|
||||
object.skills = null;
|
||||
}
|
||||
if (message.uid != null && message.hasOwnProperty("uid"))
|
||||
object.uid = message.uid;
|
||||
if (message.name != null && message.hasOwnProperty("name"))
|
||||
object.name = message.name;
|
||||
if (message.grender != null && message.hasOwnProperty("grender"))
|
||||
object.grender = message.grender;
|
||||
if (message.skills != null && message.hasOwnProperty("skills"))
|
||||
object.skills = $root.Person.personInfo.Skill.toObject(message.skills, options);
|
||||
return object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this personInfo to JSON.
|
||||
* @function toJSON
|
||||
* @memberof Person.personInfo
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
personInfo.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
personInfo.Skill = (function() {
|
||||
|
||||
/**
|
||||
* Properties of a Skill.
|
||||
* @memberof Person.personInfo
|
||||
* @interface ISkill
|
||||
* @property {string|null} [favorite] Skill favorite
|
||||
* @property {Array.<string>|null} [hobby] Skill hobby
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new Skill.
|
||||
* @memberof Person.personInfo
|
||||
* @classdesc Represents a Skill.
|
||||
* @implements ISkill
|
||||
* @constructor
|
||||
* @param {Person.personInfo.ISkill=} [properties] Properties to set
|
||||
*/
|
||||
function Skill(properties) {
|
||||
this.hobby = [];
|
||||
if (properties)
|
||||
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Skill favorite.
|
||||
* @member {string} favorite
|
||||
* @memberof Person.personInfo.Skill
|
||||
* @instance
|
||||
*/
|
||||
Skill.prototype.favorite = "eat";
|
||||
|
||||
/**
|
||||
* Skill hobby.
|
||||
* @member {Array.<string>} hobby
|
||||
* @memberof Person.personInfo.Skill
|
||||
* @instance
|
||||
*/
|
||||
Skill.prototype.hobby = $util.emptyArray;
|
||||
|
||||
/**
|
||||
* Creates a new Skill instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof Person.personInfo.Skill
|
||||
* @static
|
||||
* @param {Person.personInfo.ISkill=} [properties] Properties to set
|
||||
* @returns {Person.personInfo.Skill} Skill instance
|
||||
*/
|
||||
Skill.create = function create(properties) {
|
||||
return new Skill(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified Skill message. Does not implicitly {@link Person.personInfo.Skill.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof Person.personInfo.Skill
|
||||
* @static
|
||||
* @param {Person.personInfo.ISkill} message Skill message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Skill.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.favorite != null && message.hasOwnProperty("favorite"))
|
||||
writer.uint32(/* id 1, wireType 2 =*/10).string(message.favorite);
|
||||
if (message.hobby != null && message.hobby.length)
|
||||
for (var i = 0; i < message.hobby.length; ++i)
|
||||
writer.uint32(/* id 2, wireType 2 =*/18).string(message.hobby[i]);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified Skill message, length delimited. Does not implicitly {@link Person.personInfo.Skill.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof Person.personInfo.Skill
|
||||
* @static
|
||||
* @param {Person.personInfo.ISkill} message Skill message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
Skill.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a Skill message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof Person.personInfo.Skill
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {Person.personInfo.Skill} Skill
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Skill.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Person.personInfo.Skill();
|
||||
while (reader.pos < end) {
|
||||
var tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.favorite = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
if (!(message.hobby && message.hobby.length))
|
||||
message.hobby = [];
|
||||
message.hobby.push(reader.string());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a Skill message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof Person.personInfo.Skill
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {Person.personInfo.Skill} Skill
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
Skill.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a Skill message.
|
||||
* @function verify
|
||||
* @memberof Person.personInfo.Skill
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
Skill.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
if (message.favorite != null && message.hasOwnProperty("favorite"))
|
||||
if (!$util.isString(message.favorite))
|
||||
return "favorite: string expected";
|
||||
if (message.hobby != null && message.hasOwnProperty("hobby")) {
|
||||
if (!Array.isArray(message.hobby))
|
||||
return "hobby: array expected";
|
||||
for (var i = 0; i < message.hobby.length; ++i)
|
||||
if (!$util.isString(message.hobby[i]))
|
||||
return "hobby: string[] expected";
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a Skill message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof Person.personInfo.Skill
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {Person.personInfo.Skill} Skill
|
||||
*/
|
||||
Skill.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.Person.personInfo.Skill)
|
||||
return object;
|
||||
var message = new $root.Person.personInfo.Skill();
|
||||
if (object.favorite != null)
|
||||
message.favorite = String(object.favorite);
|
||||
if (object.hobby) {
|
||||
if (!Array.isArray(object.hobby))
|
||||
throw TypeError(".Person.personInfo.Skill.hobby: array expected");
|
||||
message.hobby = [];
|
||||
for (var i = 0; i < object.hobby.length; ++i)
|
||||
message.hobby[i] = String(object.hobby[i]);
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a Skill message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof Person.personInfo.Skill
|
||||
* @static
|
||||
* @param {Person.personInfo.Skill} message Skill
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
Skill.toObject = function toObject(message, options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
var object = {};
|
||||
if (options.arrays || options.defaults)
|
||||
object.hobby = [];
|
||||
if (options.defaults)
|
||||
object.favorite = "eat";
|
||||
if (message.favorite != null && message.hasOwnProperty("favorite"))
|
||||
object.favorite = message.favorite;
|
||||
if (message.hobby && message.hobby.length) {
|
||||
object.hobby = [];
|
||||
for (var j = 0; j < message.hobby.length; ++j)
|
||||
object.hobby[j] = message.hobby[j];
|
||||
}
|
||||
return object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this Skill to JSON.
|
||||
* @function toJSON
|
||||
* @memberof Person.personInfo.Skill
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
Skill.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
return Skill;
|
||||
})();
|
||||
|
||||
return personInfo;
|
||||
})();
|
||||
|
||||
return Person;
|
||||
})();
|
||||
|
||||
module.exports = $root;
|
||||
9
ProtoBufDemo/assets/Script/proto/Person.js.meta
Normal file
9
ProtoBufDemo/assets/Script/proto/Person.js.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "a96f3aed-cd30-4780-9b81-f0a73b81cad7",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
14
ProtoBufDemo/assets/Script/proto/Person.proto
Normal file
14
ProtoBufDemo/assets/Script/proto/Person.proto
Normal file
@@ -0,0 +1,14 @@
|
||||
package Person;
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
message personInfo{
|
||||
int32 uid =1;
|
||||
string name=2;
|
||||
bool grender =3;
|
||||
Skill skills=4;
|
||||
message Skill {
|
||||
string favorite =1 [default =eat];
|
||||
repeated string hobby=2 ;
|
||||
}
|
||||
}
|
||||
5
ProtoBufDemo/assets/Script/proto/Person.proto.meta
Normal file
5
ProtoBufDemo/assets/Script/proto/Person.proto.meta
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.0",
|
||||
"uuid": "278ac52e-6e97-4508-a446-39e81704929b",
|
||||
"subMetas": {}
|
||||
}
|
||||
10
ProtoBufDemo/assets/Script/proto/PersonPb.js
Normal file
10
ProtoBufDemo/assets/Script/proto/PersonPb.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const Pb = require('./Person');
|
||||
|
||||
exports.getPb = function () {
|
||||
console.log('package', Pb.Person);
|
||||
return Pb.Person.personInfo;
|
||||
}
|
||||
|
||||
exports.create = function () {
|
||||
|
||||
}
|
||||
9
ProtoBufDemo/assets/Script/proto/PersonPb.js.meta
Normal file
9
ProtoBufDemo/assets/Script/proto/PersonPb.js.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "9f48a3aa-2f8d-4354-8114-7c05211886c8",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
8706
ProtoBufDemo/assets/Script/proto/protobufjs.js
Normal file
8706
ProtoBufDemo/assets/Script/proto/protobufjs.js
Normal file
File diff suppressed because it is too large
Load Diff
9
ProtoBufDemo/assets/Script/proto/protobufjs.js.meta
Normal file
9
ProtoBufDemo/assets/Script/proto/protobufjs.js.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "5461ad9e-d4c1-449f-a330-d69071157342",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
6
ProtoBufDemo/assets/Texture.meta
Normal file
6
ProtoBufDemo/assets/Texture.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "7b81d4e8-ec84-4716-968d-500ac1d78a54",
|
||||
"isGroup": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
BIN
ProtoBufDemo/assets/Texture/HelloWorld.png
Normal file
BIN
ProtoBufDemo/assets/Texture/HelloWorld.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
30
ProtoBufDemo/assets/Texture/HelloWorld.png.meta
Normal file
30
ProtoBufDemo/assets/Texture/HelloWorld.png.meta
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"ver": "1.0.0",
|
||||
"uuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"subMetas": {
|
||||
"HelloWorld": {
|
||||
"ver": "1.0.3",
|
||||
"uuid": "31bc895a-c003-4566-a9f3-2e54ae1c17dc",
|
||||
"rawTextureUuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 195,
|
||||
"height": 270,
|
||||
"rawWidth": 195,
|
||||
"rawHeight": 270,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
ProtoBufDemo/assets/Texture/singleColor.png
Normal file
BIN
ProtoBufDemo/assets/Texture/singleColor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
30
ProtoBufDemo/assets/Texture/singleColor.png.meta
Normal file
30
ProtoBufDemo/assets/Texture/singleColor.png.meta
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"ver": "1.0.0",
|
||||
"uuid": "a8027877-d8d6-4645-97a0-52d4a0123dba",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"subMetas": {
|
||||
"singleColor": {
|
||||
"ver": "1.0.3",
|
||||
"uuid": "410fb916-8721-4663-bab8-34397391ace7",
|
||||
"rawTextureUuid": "a8027877-d8d6-4645-97a0-52d4a0123dba",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 2,
|
||||
"height": 2,
|
||||
"rawWidth": 2,
|
||||
"rawHeight": 2,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
20635
ProtoBufDemo/creator.d.ts
vendored
Normal file
20635
ProtoBufDemo/creator.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
15
ProtoBufDemo/jsconfig.json
Normal file
15
ProtoBufDemo/jsconfig.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"module": "commonjs",
|
||||
"experimentalDecorators": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
".vscode",
|
||||
"library",
|
||||
"local",
|
||||
"settings",
|
||||
"temp"
|
||||
]
|
||||
}
|
||||
4
ProtoBufDemo/project.json
Normal file
4
ProtoBufDemo/project.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"engine": "cocos2d-html5",
|
||||
"packages": "packages"
|
||||
}
|
||||
1
ProtoBufDemo/protobuf_order.txt
Normal file
1
ProtoBufDemo/protobuf_order.txt
Normal file
@@ -0,0 +1 @@
|
||||
pbjs -t static-module -w commonjs -o 要生成的文件名.js proto文件名.proto
|
||||
13
ProtoBufDemo/settings/builder.json
Normal file
13
ProtoBufDemo/settings/builder.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"excludeScenes": [],
|
||||
"orientation": {
|
||||
"landscapeLeft": true,
|
||||
"landscapeRight": true,
|
||||
"portrait": false,
|
||||
"upsideDown": false
|
||||
},
|
||||
"packageName": "org.cocos2d.helloworld",
|
||||
"startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
|
||||
"title": "hello_world",
|
||||
"webOrientation": "auto"
|
||||
}
|
||||
7
ProtoBufDemo/settings/builder.panel.json
Normal file
7
ProtoBufDemo/settings/builder.panel.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"excludeScenes": [],
|
||||
"packageName": "org.cocos2d.helloworld",
|
||||
"platform": "web-mobile",
|
||||
"startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
|
||||
"title": "HelloWorld"
|
||||
}
|
||||
28
ProtoBufDemo/settings/project.json
Normal file
28
ProtoBufDemo/settings/project.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"collision-matrix": [
|
||||
[
|
||||
true
|
||||
]
|
||||
],
|
||||
"excluded-modules": [],
|
||||
"group-list": [
|
||||
"default"
|
||||
],
|
||||
"start-scene": "current",
|
||||
"design-resolution-width": 960,
|
||||
"design-resolution-height": 640,
|
||||
"fit-width": false,
|
||||
"fit-height": true,
|
||||
"use-project-simulator-setting": false,
|
||||
"simulator-orientation": false,
|
||||
"use-customize-simulator": false,
|
||||
"simulator-resolution": {
|
||||
"width": 960,
|
||||
"height": 640
|
||||
},
|
||||
"cocos-analytics": {
|
||||
"enable": false,
|
||||
"appID": "13798",
|
||||
"appSecret": "959b3ac0037d0f3c2fdce94f8421a9b2"
|
||||
}
|
||||
}
|
||||
BIN
ProtoBufDemo/template-banner.png
Normal file
BIN
ProtoBufDemo/template-banner.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
5
ProtoBufDemo/template.json
Normal file
5
ProtoBufDemo/template.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "TEMPLATES.helloworld.name",
|
||||
"desc": "TEMPLATES.helloworld.desc",
|
||||
"banner": "template-banner.png"
|
||||
}
|
||||
Reference in New Issue
Block a user