完善pomelo客户端

This commit is contained in:
leo
2018-08-22 10:57:12 +08:00
parent cd8aa7d6c5
commit 821a8f550d
47 changed files with 4468 additions and 322 deletions

View File

@@ -1,4 +1,21 @@
# 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)
>基于 Pomelo的 Chat
服务器的搭建请到[官方查看](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)
### 脚本结构
* libs
- PomeloClient (pomelo 客户端第三方库)
- promise
* model
- ChatInfoModel (Chat信息数据)
- ChatUserModel (Chat在线用户信息)
* netApi
- ChatRoomApi (Chat房间通信接口)
- LoginApi (登陆通信接口)
* view
- chat (Ui)
- common
- scene
- utils
* Globals.js

View File

@@ -0,0 +1,5 @@
{
"ver": "1.0.1",
"uuid": "75074655-14f9-4346-8e65-50706d95b887",
"subMetas": {}
}

View File

@@ -0,0 +1,111 @@
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_rawFiles": null,
"data": {
"__id__": 1
}
},
{
"__type__": "cc.Node",
"_name": "ChatUserItem",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 2
},
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_id": "",
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 73,
"height": 35
},
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": -84,
"y": -22.5
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_opacityModifyRGB": false,
"groupIndex": 0
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_useOriginalSize": false,
"_actualFontSize": 30,
"_fontSize": 30,
"_lineHeight": 35,
"_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__": "5ee706F9ptPz7IJ6dEqDr7q",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"labelName": {
"__id__": 2
}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "b0ayi6VE1KnIxjF1l9eiWX",
"sync": false
}
]

View File

@@ -0,0 +1,6 @@
{
"ver": "1.0.0",
"uuid": "6ec5a7ad-8b4b-4935-aee1-7a693a51dff1",
"asyncLoadAssets": false,
"subMetas": {}
}

View File

@@ -1,130 +1,49 @@
[
{
"__type__": "cc.SceneAsset",
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_rawFiles": null,
"scene": {
"data": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_name": "",
"__type__": "cc.Node",
"_name": "Chatitem",
"_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__": 5
},
{
"__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,
"_prefab": {
"__id__": 12
},
"_id": "",
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 27,
"g": 38,
"b": 46,
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_parent": {
"__id__": 2
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
@@ -132,10 +51,9 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 960,
"height": 640
"width": 700,
"height": 30
},
"_children": [],
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
@@ -143,133 +61,121 @@
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"y": -17
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_opacityModifyRGB": false,
"groupIndex": 0
},
{
"__type__": "cc.Node",
"_name": "time",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_id": "",
"_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": 63,
"height": 30
},
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": -293,
"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
"groupIndex": 0
},
{
"__type__": "cc.Widget",
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
"__id__": 2
},
"_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
"_actualFontSize": 25,
"_fontSize": 25,
"_lineHeight": 30,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_N$string": "01:02",
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "05240e19-f5df-46ab-a8b6-a768adf4efac"
},
"fileId": "f6fWZSNwpLGajblUYkAAer",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "cocos",
"_name": "name",
"_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
"__id__": 1
},
"_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
"__id__": 6
}
],
"_prefab": null
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
"_prefab": {
"__id__": 7
},
"_enabled": true,
"_spriteFrame": {
"__uuid__": "31bc895a-c003-4566-a9f3-2e54ae1c17dc"
},
"_type": 0,
"_useOriginalSize": true,
"_atlas": null
},
{
"__type__": "cc.Node",
"_name": "label",
"_objFlags": 0,
"_id": "",
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
@@ -279,44 +185,118 @@
"a": 255
},
"_cascadeOpacityEnabled": true,
"_parent": {
"__id__": 2
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"x": 0,
"y": 0.5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 492,
"height": 112
"width": 63,
"height": 30
},
"_children": [],
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"y": -180
"x": -245.6,
"y": 0
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_ignoreAnchorPointForPosition": false,
"_tag": -1,
"_opacityModifyRGB": false,
"_id": "31f1bH7V69Ajr1iXhluMpTB",
"groupIndex": 0
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_useOriginalSize": false,
"_actualFontSize": 25,
"_fontSize": 25,
"_lineHeight": 30,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_N$string": "name",
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "05240e19-f5df-46ab-a8b6-a768adf4efac"
},
"fileId": "f6XY2P4ldE35uVtzsEQVG8",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "context",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 9
}
],
"_prefab": null
"_prefab": {
"__id__": 10
},
"_id": "",
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 1
},
"_contentSize": {
"__type__": "cc.Size",
"width": 25,
"height": 30
},
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": -157.7,
"y": 15
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_opacityModifyRGB": false,
"groupIndex": 0
},
{
"__type__": "cc.Label",
@@ -327,42 +307,57 @@
},
"_enabled": true,
"_useOriginalSize": false,
"_fontSize": 60,
"_lineHeight": 60,
"_actualFontSize": 25,
"_fontSize": 25,
"_lineHeight": 30,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_N$string": "Label",
"_spacingX": 0,
"_N$string": "---",
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 960,
"height": 640
"asset": {
"__uuid__": "05240e19-f5df-46ab-a8b6-a768adf4efac"
},
"_fitWidth": false,
"_fitHeight": true
"fileId": "70vEJUnGdFD67q6W+TbYoF",
"sync": false
},
{
"__type__": "280c3rsZJJKnZ9RqbALVwtK",
"__type__": "4fde3uuq6lJQpZ5OoxayXRI",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
"__id__": 1
},
"_enabled": true,
"label": {
"__id__": 9
"timeLabel": {
"__id__": 3
},
"text": "Hello, World!"
"nameLabel": {
"__id__": 6
},
"contextLabel": {
"__id__": 9
}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "05240e19-f5df-46ab-a8b6-a768adf4efac"
},
"fileId": "23tDGEoQNAZ7earfrbEPGV",
"sync": false
}
]

View File

@@ -0,0 +1,6 @@
{
"ver": "1.0.0",
"uuid": "05240e19-f5df-46ab-a8b6-a768adf4efac",
"asyncLoadAssets": false,
"subMetas": {}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
{
"ver": "1.0.0",
"uuid": "d6a087a8-00f1-43f8-8615-bbfe08050d7f",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}

View File

@@ -0,0 +1,757 @@
[
{
"__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
},
{
"__id__": 10
},
{
"__id__": 12
}
],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 18
},
{
"__id__": 19
}
],
"_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": "label",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 7
}
],
"_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": 120,
"height": 60
},
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"y": 187
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_opacityModifyRGB": false,
"groupIndex": 0
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
},
"_enabled": true,
"_useOriginalSize": false,
"_actualFontSize": 60,
"_fontSize": 60,
"_lineHeight": 60,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_N$string": "登陆",
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0
},
{
"__type__": "cc.Node",
"_name": "IDInput",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 9
}
],
"_prefab": null,
"_id": "3alRAumZlL7oFtGWVfLYuO",
"_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": 160,
"height": 40
},
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"y": 52
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_opacityModifyRGB": false,
"groupIndex": 0
},
{
"__type__": "cc.EditBox",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_useOriginalSize": false,
"_string": "",
"_tabIndex": 0,
"editingDidBegan": [],
"textChanged": [],
"editingDidEnded": [],
"editingReturn": [],
"_N$backgroundImage": {
"__uuid__": "67e68bc9-dad5-4ad9-a2d8-7e03d458e32f"
},
"_N$returnType": 0,
"_N$inputFlag": 5,
"_N$inputMode": 6,
"_N$fontSize": 29,
"_N$lineHeight": 40,
"_N$fontColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_N$placeholder": "Enter text here...",
"_N$placeholderFontSize": 20,
"_N$placeholderFontColor": {
"__type__": "cc.Color",
"r": 127,
"g": 127,
"b": 127,
"a": 255
},
"_N$maxLength": 8,
"_N$stayOnTop": false
},
{
"__type__": "cc.Node",
"_name": "RoomInput",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 11
}
],
"_prefab": null,
"_id": "548jtwXoBCgpt/HaRRiUpz",
"_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": 160,
"height": 40
},
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"y": -46
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_opacityModifyRGB": false,
"groupIndex": 0
},
{
"__type__": "cc.EditBox",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
},
"_enabled": true,
"_useOriginalSize": false,
"_string": "",
"_tabIndex": 0,
"editingDidBegan": [],
"textChanged": [],
"editingDidEnded": [],
"editingReturn": [],
"_N$backgroundImage": {
"__uuid__": "67e68bc9-dad5-4ad9-a2d8-7e03d458e32f"
},
"_N$returnType": 0,
"_N$inputFlag": 5,
"_N$inputMode": 6,
"_N$fontSize": 29,
"_N$lineHeight": 40,
"_N$fontColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_N$placeholder": "Enter text here...",
"_N$placeholderFontSize": 20,
"_N$placeholderFontColor": {
"__type__": "cc.Color",
"r": 127,
"g": 127,
"b": 127,
"a": 255
},
"_N$maxLength": 8,
"_N$stayOnTop": false
},
{
"__type__": "cc.Node",
"_name": "login",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 13
}
],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 15
},
{
"__id__": 16
}
],
"_prefab": null,
"_id": "3bkZwVE0NGRb2c7sfd20VI",
"_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": 100,
"height": 40
},
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"y": -177
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_opacityModifyRGB": false,
"groupIndex": 0
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 0,
"_parent": {
"__id__": 12
},
"_children": [],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 14
}
],
"_prefab": null,
"_id": "53+vZSoDhJ7Laxq0YSVPtv",
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 40
},
"_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.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 13
},
"_enabled": true,
"_useOriginalSize": false,
"_actualFontSize": 20,
"_fontSize": 20,
"_lineHeight": 40,
"_enableWrapText": false,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_N$string": "login",
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 1
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 12
},
"_enabled": true,
"_spriteFrame": {
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
},
"_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.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 12
},
"_enabled": true,
"transition": 2,
"pressedColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 17
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$normalSprite": {
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
},
"_N$pressedSprite": {
"__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
},
"pressedSprite": {
"__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
},
"_N$hoverSprite": {
"__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
},
"hoverSprite": {
"__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
},
"_N$disabledSprite": {
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 12
}
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 2
},
"component": "LoginScene",
"handler": "onEventClicked_login",
"customEventData": ""
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 960,
"height": 640
},
"_fitWidth": false,
"_fitHeight": true
},
{
"__type__": "40379evNvpLrI7xTt4cBc0B",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"editBoxID": {
"__id__": 9
},
"editBoxRoom": {
"__id__": 11
}
}
]

View File

@@ -1,3 +1,8 @@
console.log('Globals');
require('PomeloClient');
console.log('pomelo', window.pomelo);
window.Promise = require('promise');
let myModel = {};
window.myModel = myModel;
myModel.chatUserModel = require('ChatUserModel');
myModel.chatInfoModel = require('ChatInfoModel');
// console.log('promise=', window.Promise);

View File

@@ -1,75 +0,0 @@
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

@@ -1344,6 +1344,7 @@ cc.Pomelo = function () {
pomelo.emit('close', event);
pomelo.emit('disconnect', event);
console.log('socket close: ', event);
// params.onclose && params.onclose();
if (!!params.reconnect && reconnectAttempts < maxReconnectAttempts) {
reconnect = true;
reconnectAttempts++;

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"ver": "1.0.5",
"uuid": "280c3aec-6492-4a9d-9f51-a9b00b570b4a",
"uuid": "1b74425f-4146-4ab5-be70-87c947e60228",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,

View File

@@ -0,0 +1,5 @@
{
"ver": "1.0.1",
"uuid": "0c50863e-702d-445a-bf94-b0aafef89992",
"subMetas": {}
}

View File

@@ -0,0 +1,23 @@
class ChatInfoModel {
constructor() {
this.chatInfo = {};
}
setName(name) {
this.chatInfo.name = name;
}
getName() {
return this.chatInfo.name;
}
setRoomId(rid) {
this.chatInfo.rid = rid;
}
getRoomId() {
return this.chatInfo.rid;
}
}
module.exports = new ChatInfoModel();

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "756b8874-c003-4da3-be5f-51d7f0f6ad5e",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,20 @@
class ChatUserModel {
constructor() {
this.users = [];
}
setUsers(arr) {
delete this.users;
this.users = arr;
}
getUser() {
return this.users;
}
addUser(user) {
this.users.push(user);
}
}
module.exports = new ChatUserModel();

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "e6a0f93a-9079-44dc-b204-ce03cdf9764e",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,5 @@
{
"ver": "1.0.1",
"uuid": "c8fc2d5d-105e-49d1-8e36-858e1a45714f",
"subMetas": {}
}

View File

@@ -0,0 +1,81 @@
class ChatRoomApi {
constructor() {
}
init(opt) {
this.opt = opt;
this.chatInfo = myModel.chatInfoModel;
this.listenEvents();
}
bindEvent(event, context) {
return event.bind(context);
}
listenEvents() {
this.bindOnDisconnect = this.bindEvent(this.onDisconnect, this);
this.bindOnChat = this.bindEvent(this.onChat, this);
this.bindOnAdd = this.bindEvent(this.onAdd, this);
this.bindOnLeave = this.bindEvent(this.onLeave, this);
pomelo.on('disconnect', this.bindOnDisconnect);
pomelo.on('onChat', this.bindOnChat);
pomelo.on('onAdd', this.bindOnAdd);
pomelo.on('onLeave', this.bindOnLeave);
}
onDisconnect() {
console.log('disconnect data');
this.opt.onDisconnect && this.opt.onDisconnect();
}
onChat(data) {
console.log('onChat data', data);
this.opt.onChat && this.opt.onChat(data);
}
onAdd(data) {
console.log('onAdd data=', data);
this.opt.onAdd && this.opt.onAdd(data);
}
onLeave(data) {
console.log('onLeave data=', data);
this.opt.onLeave && this.opt.onLeave(data);
}
sendMsg(msg) {
let route = "chat.chatHandler.send";
return new Promise((resolve, reject) => {
try {
pomelo.request(route, {
rid: this.chatInfo.getRoomId(),
content: msg,
from: this.chatInfo.getName(),
target: '*'
}, function (data) {
console.log('sendMsg ', data);
resolve(data);
});
} catch (error) {
reject(error);
}
});
}
removeEvents() {
pomelo.off('disconnect', this.bindOnDisconnect);
pomelo.off('onChat', this.bindOnChat);
pomelo.off('onAdd', this.bindOnAdd);
pomelo.off('onLeave', this.bindOnLeave);
}
destroy() {
this.removeEvents();
this.opt = {};
this.chatInfo = {};
}
}
module.exports = new ChatRoomApi();

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "49b55556-d2f5-4419-8c98-938a892c76e3",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,60 @@
const LOGIN_ERROR = "There is no server to log in, please wait.";
const DUPLICATE_ERROR = "Please change your name to login.";
class LoginApi {
constructor() {
this.host = '192.168.0.124'
this.port = 3014;
}
// query connector
queryEntry(uid) {
let route = 'gate.gateHandler.queryEntry';
return new Promise((resolve, reject) => {
pomelo.init({
host: this.host,
port: this.port,
log: true
}, function () {
pomelo.request(route, {
uid: uid
}, function (data) {
pomelo.disconnect(function () {
console.log(this, data);
if (data.code === 500) {
reject(LOGIN_ERROR);
return;
}
resolve(data);
});
});
});
});
};
// connect entry
loginEntry(data, user) {
var route = "connector.entryHandler.enter";
return new Promise((resolve, reject) => {
pomelo.init({
host: data.host,
port: data.port,
log: true
}, function () {
pomelo.request(route, {
username: user.username,
rid: user.rid
}, function (data) {
if (data.error) {
reject(DUPLICATE_ERROR);
return;
}
resolve(data);
});
});
});
};
}
module.exports = new LoginApi();

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "2170af5c-4855-488f-92ed-a9af0f7fb84c",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,5 @@
{
"ver": "1.0.1",
"uuid": "ad3d0321-a18c-48df-9864-34633c2d46aa",
"subMetas": {}
}

View File

@@ -0,0 +1,5 @@
{
"ver": "1.0.1",
"uuid": "33659f56-7756-4b3d-b02d-aa1deff9729e",
"subMetas": {}
}

View File

@@ -0,0 +1,26 @@
const timeUtil = require('TimeUtil');
cc.Class({
extends: cc.Component,
properties: {
timeLabel: cc.Label,
nameLabel: cc.Label,
contextLabel: cc.Label
},
onLoad() {
},
init(data) {
this.contextLabel.node.active = false;
this.timeLabel.string = timeUtil.timeString(new Date());
this.nameLabel.string = data.name + ' : ' + data.msg;
}
// start () {
// },
// update (dt) {},
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "4fde3bae-aba9-4942-9679-3a8c5ac97448",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,28 @@
cc.Class({
extends: cc.Component,
properties: {
nodeContent: cc.Node,
prefabItem: cc.Prefab,
editBoxInput: cc.EditBox
},
onLoad() {
this.nodeContent.removeAllChildren();
},
createItem(data, componentName) {
let node = cc.instantiate(this.prefabItem);
node.script = node.getComponent(componentName);
node.script.init();
this.nodeContent.addChild(node);
},
onEventClicked_send() {
if (!this.editBoxInput.string) {
return;
}
}
// update (dt) {},
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "022bc4ef-5334-4a19-a38b-0238660ddabc",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,22 @@
cc.Class({
extends: cc.Component,
properties: {
labelName: cc.Label
},
onLoad() {
},
init(name) {
this.labelName.string = name;
}
// start () {
// },
// update (dt) {},
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "5ee70e85-f69b-4fcf-b209-e9d12a0ebeea",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,14 @@
cc.Class({
extends: cc.Component,
properties: {
nodeContext: cc.Node
},
onLoad() {
this.nodeContext.removeAllChildren();
},
// update (dt) {},
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "2092b3d2-067d-47f5-93f0-033a06008068",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,5 @@
{
"ver": "1.0.1",
"uuid": "be92e8c5-4737-4f45-a958-7afcca0015c5",
"subMetas": {}
}

View File

@@ -0,0 +1,44 @@
cc.Class({
extends: cc.Component,
properties: {
nodeContent: cc.Node,
prefabItem: cc.Prefab,
itemName: ''
},
// onLoad() {
// },
init(args = {}) {
this.clear();
let data = args.data || [];
let len = data.length;
for (let i = 0; i < len; i++) {
this.createItem({
data: data[i],
fn: args.fn
});
}
},
createItem(args) {
let data = args.data
let node = cc.instantiate(this.prefabItem);
node.script = node.getComponent(this.itemName);
this.nodeContent.addChild(node);
node.script.init(data);
args.fn && args.fn(node.script)
},
clear() {
this.nodeContent.removeAllChildren();
},
childrenCount() {
return this.nodeContent.childrenCount;
}
// update (dt) {},
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "b2a96011-d6e0-447f-b6b9-1dd3bbb3df35",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,5 @@
{
"ver": "1.0.1",
"uuid": "48dfcc38-233e-499e-9681-7a182fa0c907",
"subMetas": {}
}

View File

@@ -0,0 +1,69 @@
const chatRoomApi = require('ChatRoomApi');
cc.Class({
extends: cc.Component,
properties: {
nodeScrollViewChat: cc.Node,
nodeScrollViewUser: cc.Node,
editBoxInput: cc.EditBox
},
onLoad() {
console.log('ChatRoomApi');
this.nodeScrollViewChatScript = this.nodeScrollViewChat.getComponent('ScrollViewMgr');
this.nodeScrollViewUserScript = this.nodeScrollViewUser.getComponent('ScrollViewMgr');
console.log(this.chatUiScript);
this.nodeScrollViewChatScript.init();
this.nodeScrollViewUserScript.init({
data: myModel.chatUserModel.getUser()
});
let opts = {};
opts.onAdd = this.onAdd.bind(this);
opts.onChat = this.onChat.bind(this);
chatRoomApi.init(opts);
},
onDisconnect() {
console.log('disconnect data');
},
onChat(data) {
console.log(this);
console.log('onChat data', data);
this.nodeScrollViewChatScript.createItem({
data: {
name: data.from,
msg: data.msg
}
});
},
onAdd(data) {
console.log('onAdd data=', data);
},
onLeave(data) {
console.log('onLeave data=', data);
},
onEventClicked_send() {
let msg = this.editBoxInput.string || '';
if (!msg) {
return;
}
console.log('msg=', msg);
chatRoomApi.sendMsg(msg).then(() => {
this.editBoxInput.string = '';
}).catch((err) => {
console.log('err', err);
});
},
onDestroy() {
this.chatRoomApi.destroy();
}
// update (dt) {},
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "a7c42b43-b7e9-49ef-9418-22a527429647",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,49 @@
const loginApi = require('LoginApi');
cc.Class({
extends: cc.Component,
properties: {
editBoxID: cc.EditBox,
editBoxRoom: cc.EditBox,
},
onLoad() {
},
/**
*
*/
onEventClicked_login() {
console.log('onEventClicked_login');
let id = this.editBoxID.string || Date.now();
let room = this.editBoxRoom.string || 'room_1';
//
loginApi.queryEntry(id).then((data) => {
return loginApi.loginEntry(data, {
username: id,
rid: room
});
}).then((data) => {
myModel.chatInfoModel.setName(id);
myModel.chatInfoModel.setRoomId(room);
this.onLogin(data);
}).catch((err) => {
console.log('err=', err);
});
},
/**
*
* @param {*} data
*/
onLogin(data) {
console.log('login data', data);
myModel.chatUserModel.setUsers(data.users);
cc.director.loadScene('Chat');
}
// update (dt) {},
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "403797af-36fa-4bac-8ef1-4ede1c05cd01",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,5 @@
{
"ver": "1.0.1",
"uuid": "31cc75cb-0083-4372-90fd-3f5df0297410",
"subMetas": {}
}

View File

@@ -0,0 +1,25 @@
function TimeUtil() {
console.log('TimeUtil');
}
//pads n with zeros on the left,
//digits is minimum length of output
//zeroPad(3, 5); returns "005"
//zeroPad(2, 500); returns "500"
function zeroPad(digits, n) {
n = n.toString();
while (n.length < digits)
n = '0' + n;
return n;
};
//it is almost 8 o'clock PM here
//timeString(new Date); returns "19:49"
TimeUtil.prototype.timeString = function (date) {
console.log('timeString');
var minutes = date.getMinutes().toString();
var hours = date.getHours().toString();
return zeroPad(2, hours) + ":" + zeroPad(2, minutes);
};
module.exports = new TimeUtil();

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "04425e17-a421-408e-8891-81835fce9781",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -1,28 +1,30 @@
{
"cocos-analytics": {
"appID": "13798",
"appSecret": "959b3ac0037d0f3c2fdce94f8421a9b2",
"channel": "",
"enable": false,
"version": ""
},
"collision-matrix": [
[
true
]
],
"design-resolution-height": 640,
"design-resolution-width": 960,
"excluded-modules": [],
"fit-height": true,
"fit-width": false,
"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
"height": 640,
"width": 960
},
"cocos-analytics": {
"enable": false,
"appID": "13798",
"appSecret": "959b3ac0037d0f3c2fdce94f8421a9b2"
}
"start-scene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"use-customize-simulator": false,
"use-project-simulator-setting": false
}