添加Pomelo demo

This commit is contained in:
leo
2018-08-13 18:04:29 +08:00
parent 386523ffd9
commit cd8aa7d6c5
26 changed files with 23002 additions and 0 deletions

67
PomeloClient/.gitignore vendored Normal file
View 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/

4
PomeloClient/README.md Normal file
View File

@@ -0,0 +1,4 @@
# PomeloClientDemo
>基于Pomelo的client
服务器的搭建请到[官方查看](https://github.com/NetEase/pomelo/wiki/chat%E6%BA%90%E7%A0%81%E4%B8%8B%E8%BD%BD%E4%B8%8E%E5%AE%89%E8%A3%85)。
使用基于Cocos Create的[pomelo第三方库](https://github.com/fuhongxue/CocosCreator-Pomelo-plugin)

View File

@@ -0,0 +1,6 @@
{
"ver": "1.0.1",
"uuid": "29f52784-2fca-467b-92e7-8fd9ef8c57b7",
"isGroup": false,
"subMetas": {}
}

View File

@@ -0,0 +1,368 @@
[
{
"__type__": "cc.SceneAsset",
"_name": "",
"_objFlags": 0,
"_rawFiles": null,
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_name": "",
"_objFlags": 0,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_parent": null,
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_children": [
{
"__id__": 2
}
],
"_localZOrder": 0,
"_globalZOrder": 0,
"_ignoreAnchorPointForPosition": false,
"_tag": -1,
"_opacityModifyRGB": false,
"_id": "2d2f792f-a40c-49bb-a189-ed176a246e49"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 252,
"g": 252,
"b": 252,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_parent": {
"__id__": 1
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 960,
"height": 640
},
"_children": [
{
"__id__": 3
},
{
"__id__": 6
},
{
"__id__": 8
}
],
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 480,
"y": 320
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_ignoreAnchorPointForPosition": false,
"_tag": -1,
"_opacityModifyRGB": false,
"_id": "a286bbGknJLZpRpxROV6M94",
"_active": true,
"_components": [
{
"__id__": 10
},
{
"__id__": 11
}
],
"_prefab": null
},
{
"__type__": "cc.Node",
"_name": "background",
"_objFlags": 0,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 27,
"g": 38,
"b": 46,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_parent": {
"__id__": 2
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 960,
"height": 640
},
"_children": [],
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_ignoreAnchorPointForPosition": false,
"_tag": -1,
"_opacityModifyRGB": false,
"_id": "e2e0crkOLxGrpMxpbC4iQg1",
"_active": true,
"_components": [
{
"__id__": 4
},
{
"__id__": 5
}
],
"_prefab": null
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": 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,
"_useOriginalSize": false,
"_atlas": null
},
{
"__type__": "cc.Node",
"_name": "cocos",
"_objFlags": 0,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_parent": {
"__id__": 2
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 195,
"height": 270
},
"_children": [],
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"y": 50
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_ignoreAnchorPointForPosition": false,
"_tag": -1,
"_opacityModifyRGB": false,
"_id": "c4f30YOS65G64U2TwufdJ+2",
"_active": true,
"_components": [
{
"__id__": 7
}
],
"_prefab": null
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
},
"_enabled": true,
"_spriteFrame": {
"__uuid__": "31bc895a-c003-4566-a9f3-2e54ae1c17dc"
},
"_type": 0,
"_useOriginalSize": true,
"_atlas": null
},
{
"__type__": "cc.Node",
"_name": "label",
"_objFlags": 0,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_parent": {
"__id__": 2
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 492,
"height": 112
},
"_children": [],
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"y": -180
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_ignoreAnchorPointForPosition": false,
"_tag": -1,
"_opacityModifyRGB": false,
"_id": "31f1bH7V69Ajr1iXhluMpTB",
"_active": true,
"_components": [
{
"__id__": 9
}
],
"_prefab": null
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_useOriginalSize": false,
"_fontSize": 60,
"_lineHeight": 60,
"_enableWrapText": true,
"_isSystemFontUsed": true,
"_N$string": "Label",
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_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!"
}
]

View File

@@ -0,0 +1,7 @@
{
"ver": "1.0.0",
"uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}

View File

@@ -0,0 +1,6 @@
{
"ver": "1.0.1",
"uuid": "4734c20c-0db8-4eb2-92ea-e692f4d70934",
"isGroup": false,
"subMetas": {}
}

View File

@@ -0,0 +1,3 @@
console.log('Globals');
require('PomeloClient');
console.log('pomelo', window.pomelo);

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "a0fe662c-b580-4d6d-8e1d-a39ce3f35b67",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,75 @@
cc.Class({
extends: cc.Component,
properties: {
label: {
default: null,
type: cc.Label
},
// defaults, set visually when attaching this script to the Canvas
text: 'Hello, World!'
},
// use this for initialization
onLoad: function () {
this.label.string = this.text;
this.connectServer({
host: '127.0.0.1',
uid: '' + Date.now(),
port: 3014,
log: true
}, (err) => {
console.log('err');
}, (data) => {
console.log('gate', data);
this.label.string = data.host + ':' + data.port
});
console.log(Date.now());
},
/**
*
*/
connectServer(data, showError, callback) {
console.log('data');
var route = 'gate.gateHandler.queryEntry';
pomelo.init({
host: data.host,
// reconnect: true,
port: 3014,
log: true
}, function () {
pomelo.request(route, {
uid: data.uid
}, function (data) {
pomelo.disconnect();
if (data.code === 500) {
showError(LOGIN_ERROR);
return;
}
callback(data);
});
});
// pomelo.init({
// host: data.host,
// port: data.port
// }, function () {
// var route = 'gate.gateHandler.queryEntry';
// pomelo.request(route, {}, function () {
// pomelo.disconnect(function () {
// pomelo.init({
// host: host2,
// port: port2,
// reconnect: true
// }, function () {})
// });
// })
// });
},
// called every frame
update: function (dt) {
},
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "280c3aec-6492-4a9d-9f51-a9b00b570b4a",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,5 @@
{
"ver": "1.0.1",
"uuid": "57025a17-de63-45ac-bb66-0102c9cabe37",
"subMetas": {}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "746f7d52-2090-455f-878c-71da521c3f22",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,6 @@
{
"ver": "1.0.1",
"uuid": "7b81d4e8-ec84-4716-968d-500ac1d78a54",
"isGroup": false,
"subMetas": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View 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": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View 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
PomeloClient/creator.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"experimentalDecorators": true
},
"exclude": [
"node_modules",
".vscode",
"library",
"local",
"settings",
"temp"
]
}

View File

@@ -0,0 +1,4 @@
{
"engine": "cocos2d-html5",
"packages": "packages"
}

View File

@@ -0,0 +1,41 @@
{
"appKey": "",
"appSecret": "",
"encryptJs": true,
"excludeScenes": [],
"fb-instant-games": {},
"includeAnySDK": false,
"includeSDKBox": false,
"inlineSpriteFrames": true,
"inlineSpriteFrames_native": true,
"jailbreakPlatform": false,
"md5Cache": false,
"mergeStartScene": false,
"oauthLoginServer": "",
"optimizeHotUpdate": false,
"orientation": {
"landscapeLeft": true,
"landscapeRight": true,
"portrait": false,
"upsideDown": false
},
"packageName": "org.cocos2d.helloworld",
"privateKey": "",
"qqplay": {
"REMOTE_SERVER_ROOT": "",
"orientation": "portrait"
},
"renderMode": "0",
"startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"title": "hello_world",
"webOrientation": "auto",
"wechatgame": {
"REMOTE_SERVER_ROOT": "",
"appid": "wx6ac3f5090a6b99c5",
"isSubdomain": false,
"orientation": "portrait",
"subContext": ""
},
"xxteaKey": "14578023-708d-4a",
"zipCompressJs": true
}

View File

@@ -0,0 +1,7 @@
{
"excludeScenes": [],
"packageName": "org.cocos2d.helloworld",
"platform": "web-mobile",
"startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"title": "HelloWorld"
}

View 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"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -0,0 +1,5 @@
{
"name": "TEMPLATES.helloworld.name",
"desc": "TEMPLATES.helloworld.desc",
"banner": "template-banner.png"
}