[add] Lobby 按鈕功能

This commit is contained in:
建喵 2022-05-08 20:36:56 +08:00
parent b644e0e0ab
commit d302a52d8d
105 changed files with 52578 additions and 3849 deletions

1
.gitignore vendored
View File

@ -89,3 +89,4 @@ settings/logo.png
/packages/sdkbox/
/packages/Buile_Add_Version/
/packages/cocos_inspector
/node_modules/

12
assets/MainControl.meta Normal file
View File

@ -0,0 +1,12 @@
{
"ver": "1.1.2",
"uuid": "2805bb40-79cf-47d2-a68d-46e6ae57ac53",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.2",
"uuid": "8124b9e0-9e66-4c72-be6c-603d6602052e",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,46 @@
{
"__type__": "cc.AnimationClip",
"_name": "APP_DelayPanel",
"_objFlags": 0,
"_native": "",
"_duration": 1,
"sample": 60,
"speed": 1,
"wrapMode": 1,
"curveData": {
"paths": {
"Mask": {
"props": {
"active": [
{
"frame": 0,
"value": false
},
{
"frame": 1,
"value": true
}
]
}
},
"DelayLoad": {
"props": {
"active": [
{
"frame": 0,
"value": false
},
{
"frame": 1,
"value": true
}
]
}
}
},
"props": {
"active": []
}
},
"events": []
}

View File

@ -0,0 +1,5 @@
{
"ver": "2.1.0",
"uuid": "f0699251-13b2-4e04-ad36-0c883dd77c8b",
"subMetas": {}
}

View File

@ -0,0 +1,29 @@
{
"__type__": "cc.AnimationClip",
"_name": "APP_DelayPanel_Load",
"_objFlags": 0,
"_native": "",
"_duration": 1,
"sample": 60,
"speed": 1,
"wrapMode": 2,
"curveData": {
"paths": {
"Load": {
"props": {
"angle": [
{
"frame": 0,
"value": 0
},
{
"frame": 1,
"value": -360
}
]
}
}
}
},
"events": []
}

View File

@ -0,0 +1,5 @@
{
"ver": "2.1.0",
"uuid": "e41087e5-3b3a-4499-af8d-a0cb359bfd8a",
"subMetas": {}
}

View File

@ -0,0 +1,170 @@
{
"__type__": "cc.AnimationClip",
"_name": "APP_MainUI_FlyMoney",
"_objFlags": 0,
"_native": "",
"_duration": 0.7666666666666667,
"sample": 60,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": []
}
},
"paths": {
"MoneyPic": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "3bff8bef-c6d1-4458-90ce-3a26da33e0fb"
}
},
{
"frame": 0.05,
"value": {
"__uuid__": "67899faa-38c4-4269-9643-50d82897bad3"
}
},
{
"frame": 0.1,
"value": {
"__uuid__": "4aba1954-f56c-49f2-be08-b533dd80559b"
}
},
{
"frame": 0.15,
"value": {
"__uuid__": "c08f9ebd-36f3-4279-bb5c-bcb09da91151"
}
},
{
"frame": 0.2,
"value": {
"__uuid__": "56996918-a0ab-4e1c-a269-f17e42837388"
}
},
{
"frame": 0.25,
"value": {
"__uuid__": "135daf96-0fdb-47ec-85ed-44e206e87dff"
}
},
{
"frame": 0.3,
"value": {
"__uuid__": "487e589e-8b93-4df7-9bcf-68bc617fc18a"
}
},
{
"frame": 0.35,
"value": {
"__uuid__": "c22c076d-7d77-4e89-9406-e87cc5cc2a81"
}
},
{
"frame": 0.4,
"value": {
"__uuid__": "daa7537c-6098-49e2-8c0a-e80dbc33395d"
}
},
{
"frame": 0.45,
"value": {
"__uuid__": "fda67b7b-6494-4cba-aa8c-172eccb63bef"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "c315f270-f523-4380-bad3-fc4f4f19b330"
}
},
{
"frame": 0.55,
"value": {
"__uuid__": "c303c1b1-7d6d-4701-ac89-9927f5da36f0"
}
},
{
"frame": 0.6,
"value": {
"__uuid__": "3a18d428-cea2-4a4a-92b3-15ad7280d504"
}
},
{
"frame": 0.65,
"value": {
"__uuid__": "c06ff260-d488-4503-8114-53a35d8292ac"
}
},
{
"frame": 0.7,
"value": {
"__uuid__": "8202a58b-d5a0-4bb9-94e2-223f681105f6"
}
},
{
"frame": 0.75,
"value": {
"__uuid__": "9149d2f8-0437-44ae-a728-dbc642fd50b5"
}
}
]
}
}
},
"APP_FX_Light02": {
"props": {
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 1.1,
"y": 0.9
}
},
{
"frame": 0.23333333333333334,
"value": {
"__type__": "cc.Vec2",
"x": 1.1,
"y": 0.4
}
},
{
"frame": 0.4166666666666667,
"value": {
"__type__": "cc.Vec2",
"x": 1.1,
"y": 0.9
}
},
{
"frame": 0.6,
"value": {
"__type__": "cc.Vec2",
"x": 1.1,
"y": 0.4
}
},
{
"frame": 0.75,
"value": {
"__type__": "cc.Vec2",
"x": 1.1,
"y": 0.9
}
}
]
}
}
}
},
"events": []
}

View File

@ -0,0 +1,5 @@
{
"ver": "2.1.0",
"uuid": "99222295-c97e-485e-bc2a-aea20cb92ede",
"subMetas": {}
}

View File

@ -0,0 +1,29 @@
{
"__type__": "cc.AnimationClip",
"_name": "APP_NoDelayPanel",
"_objFlags": 0,
"_native": "",
"_duration": 1,
"sample": 60,
"speed": 1,
"wrapMode": 2,
"curveData": {
"paths": {
"DelayLoad/Load": {
"props": {
"angle": [
{
"frame": 0,
"value": 0
},
{
"frame": 1,
"value": -360
}
]
}
}
}
},
"events": []
}

View File

@ -0,0 +1,5 @@
{
"ver": "2.1.0",
"uuid": "64e62812-4368-4af8-adf8-6740323c85aa",
"subMetas": {}
}

View File

@ -0,0 +1,591 @@
{
"__type__": "cc.AnimationClip",
"_name": "ClickOnEffect",
"_objFlags": 0,
"_native": "",
"_duration": 0.38333333333333336,
"sample": 60,
"speed": 1,
"wrapMode": 1,
"curveData": {
"paths": {
"B_pic": {
"props": {
"opacity": [
{
"frame": 0,
"value": 0
},
{
"frame": 0.05,
"value": 255
},
{
"frame": 0.25,
"value": 255
},
{
"frame": 0.38333333333333336,
"value": 0
}
],
"scale": [
{
"frame": 0.05,
"value": {
"__type__": "cc.Vec2",
"x": 0.2,
"y": 0.2
}
},
{
"frame": 0.08333333333333333,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
}
]
},
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0.05,
"value": {
"__uuid__": "7fc6bc10-06dc-4d16-b10a-d22943489904"
}
},
{
"frame": 0.11666666666666667,
"value": {
"__uuid__": "fd532478-cc70-4924-8b2b-da6f35fd7c82"
}
},
{
"frame": 0.16666666666666666,
"value": {
"__uuid__": "f5f0ae00-09c7-42ed-8ba5-1953d93810f6"
}
},
{
"frame": 0.21666666666666667,
"value": {
"__uuid__": "d22ad86d-5103-424b-84aa-1539f7a3013c"
}
},
{
"frame": 0.3,
"value": {
"__uuid__": "c739a162-3e15-4aea-a206-43ecb0e70f80"
}
}
]
}
}
},
"Light1/01": {
"props": {
"position": [
{
"frame": 0,
"value": [
0,
0,
0
],
"curve": [
0.14693045563549162,
0.19793764988009588,
0.6789208633093524,
1
]
},
{
"frame": 0.31666666666666665,
"value": [
0,
60,
0
]
},
{
"frame": 0.38333333333333336,
"value": [
0,
75,
0
]
}
],
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
},
{
"frame": 0.08333333333333333,
"value": {
"__type__": "cc.Vec2",
"x": 3,
"y": 3
}
},
{
"frame": 0.31666666666666665,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
}
]
}
},
"Light1": {
"props": {
"opacity": [
{
"frame": 0,
"value": 0
},
{
"frame": 0.016666666666666666,
"value": 168
},
{
"frame": 0.03333333333333333,
"value": 255
},
{
"frame": 0.2,
"value": 196
},
{
"frame": 0.2833333333333333,
"value": 111
},
{
"frame": 0.38333333333333336,
"value": 0
}
]
}
},
"Light1/02": {
"props": {
"position": [
{
"frame": 0,
"value": [
0,
0,
0
],
"curve": [
0.14393285371702635,
0.19793764988009588,
0.684916067146283,
1
]
},
{
"frame": 0.31666666666666665,
"value": [
60,
0,
0
]
},
{
"frame": 0.38333333333333336,
"value": [
75,
0,
0
]
}
],
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
},
{
"frame": 0.08333333333333333,
"value": {
"__type__": "cc.Vec2",
"x": 3,
"y": 3
}
},
{
"frame": 0.31666666666666665,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
}
]
}
},
"Light1/03": {
"props": {
"position": [
{
"frame": 0,
"value": [
0,
0,
0
],
"curve": [
0.14992805755395683,
0.2009352517985611,
0.684916067146283,
0.9970023980815348
]
},
{
"frame": 0.31666666666666665,
"value": [
0,
-60,
0
]
},
{
"frame": 0.38333333333333336,
"value": [
0,
-75,
0
]
}
],
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
},
{
"frame": 0.08333333333333333,
"value": {
"__type__": "cc.Vec2",
"x": 3,
"y": 3
}
},
{
"frame": 0.31666666666666665,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
}
]
}
},
"Light1/04": {
"props": {
"position": [
{
"frame": 0,
"value": [
0,
0,
0
],
"curve": [
0.14393285371702638,
0.2039328537170263,
0.6819184652278177,
1.0029976019184652
]
},
{
"frame": 0.31666666666666665,
"value": [
-60,
0,
0
]
},
{
"frame": 0.38333333333333336,
"value": [
-75,
0,
0
]
}
],
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 3,
"y": 1
}
},
{
"frame": 0.08333333333333333,
"value": {
"__type__": "cc.Vec2",
"x": 3,
"y": 3
}
},
{
"frame": 0.31666666666666665,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
}
]
}
},
"Light2/01": {
"props": {
"position": [
{
"frame": 0,
"value": [
0,
0,
0
]
},
{
"frame": 0.31666666666666665,
"value": [
0,
60,
0
]
},
{
"frame": 0.38333333333333336,
"value": [
0,
75,
0
]
}
],
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 3,
"y": 3
}
},
{
"frame": 0.31666666666666665,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
}
]
}
},
"Light2/02": {
"props": {
"position": [
{
"frame": 0,
"value": [
0,
0,
0
]
},
{
"frame": 0.31666666666666665,
"value": [
60,
0,
0
]
},
{
"frame": 0.38333333333333336,
"value": [
75,
0,
0
]
}
],
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 3,
"y": 3
}
},
{
"frame": 0.31666666666666665,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
}
]
}
},
"Light2/03": {
"props": {
"position": [
{
"frame": 0,
"value": [
0,
0,
0
]
},
{
"frame": 0.31666666666666665,
"value": [
0,
-60,
0
]
},
{
"frame": 0.38333333333333336,
"value": [
0,
-75,
0
]
}
],
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 3,
"y": 3
}
},
{
"frame": 0.31666666666666665,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
}
]
}
},
"Light2/04": {
"props": {
"position": [
{
"frame": 0,
"value": [
0,
0,
0
]
},
{
"frame": 0.31666666666666665,
"value": [
-60,
0,
0
]
},
{
"frame": 0.38333333333333336,
"value": [
-75,
0,
0
]
}
],
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 3,
"y": 3
}
},
{
"frame": 0.31666666666666665,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
}
]
}
},
"Light2": {
"props": {
"opacity": [
{
"frame": 0,
"value": 0
},
{
"frame": 0.016666666666666666,
"value": 168
},
{
"frame": 0.03333333333333333,
"value": 255
},
{
"frame": 0.2,
"value": 196
},
{
"frame": 0.2833333333333333,
"value": 111
},
{
"frame": 0.38333333333333336,
"value": 0
}
]
}
}
}
},
"events": []
}

View File

@ -0,0 +1,5 @@
{
"ver": "2.1.0",
"uuid": "7d8970e2-c3ca-476d-aba5-f7e55ab7b5f2",
"subMetas": {}
}

View File

@ -0,0 +1,100 @@
{
"__type__": "cc.AnimationClip",
"_name": "GameMessage_MiddleJump",
"_objFlags": 0,
"_native": "",
"_duration": 0.4,
"sample": 30,
"speed": 1,
"wrapMode": 1,
"curveData": {
"props": {
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 0.95,
"y": 0.95
}
},
{
"frame": 0.16666666666666666,
"value": {
"__type__": "cc.Vec2",
"x": 1.025,
"y": 1.025
}
},
{
"frame": 0.3,
"value": {
"__type__": "cc.Vec2",
"x": 0.98,
"y": 0.98
}
},
{
"frame": 0.4,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
}
],
"opacity": [
{
"frame": 0,
"value": 128,
"curve": "cubicOut"
},
{
"frame": 0.16666666666666666,
"value": 255
}
]
},
"paths": {
"Mask": {
"props": {
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 1.052,
"y": 1.052
}
},
{
"frame": 0.16666666666666666,
"value": {
"__type__": "cc.Vec2",
"x": 0.975,
"y": 0.975
}
},
{
"frame": 0.3,
"value": {
"__type__": "cc.Vec2",
"x": 1.02,
"y": 1.02
}
},
{
"frame": 0.4,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
}
]
}
}
}
},
"events": []
}

View File

@ -0,0 +1,5 @@
{
"ver": "2.1.0",
"uuid": "0306e439-b155-4edc-9140-3482e2ea5740",
"subMetas": {}
}

View File

@ -0,0 +1,208 @@
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "MainControl",
"_objFlags": 512,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
{
"__id__": 4
},
{
"__id__": 5
}
],
"_prefab": {
"__id__": 6
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 720,
"height": 1280
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
360,
640,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "MessageContent",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 3
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "0f0455df-49c3-4d7d-b362-92dedc4e8fd3"
},
"fileId": "cbjfM0tXtMD7XwuEWLdcLF",
"sync": false
},
{
"__type__": "ec0e4ssUBhPhJBicEA9g4Ph",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"MessageContent": {
"__id__": 2
},
"SourceMessage": {
"__uuid__": "aa0aea1a-f1fe-42c1-98ee-a333e20586bd"
},
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"alignMode": 1,
"_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": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "0f0455df-49c3-4d7d-b362-92dedc4e8fd3"
},
"fileId": "",
"sync": false
}
]

View File

@ -0,0 +1,8 @@
{
"ver": "1.2.9",
"uuid": "0f0455df-49c3-4d7d-b362-92dedc4e8fd3",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.2",
"uuid": "33082505-c5b4-4fb3-8887-e7996b85fa35",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
{
"ver": "1.2.9",
"uuid": "aa0aea1a-f1fe-42c1-98ee-a333e20586bd",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.2",
"uuid": "c8043952-c80d-49fd-9d8c-13589a782dfc",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.2",
"uuid": "6564f2e9-7755-4323-bcbc-c88229c78cff",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,36 @@
{
"ver": "2.3.5",
"uuid": "b2ee4910-8143-47c2-ba1e-aa880f071d03",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 4,
"height": 4,
"platformSettings": {},
"subMetas": {
"Mask": {
"ver": "1.0.4",
"uuid": "b14d3080-6873-40e9-9f15-aead4884b0a7",
"rawTextureUuid": "b2ee4910-8143-47c2-ba1e-aa880f071d03",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 4,
"height": 4,
"rawWidth": 4,
"rawHeight": 4,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,36 @@
{
"ver": "2.3.5",
"uuid": "35af7c86-80b7-4a9e-96d6-6633bafd89ac",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2,
"height": 2,
"platformSettings": {},
"subMetas": {
"White": {
"ver": "1.0.4",
"uuid": "8bb36cf4-a044-4f19-bf0f-7109508dee6d",
"rawTextureUuid": "35af7c86-80b7-4a9e-96d6-6633bafd89ac",
"trimType": "custom",
"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": {}
}
}
}

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.2",
"uuid": "85df5aef-f86d-462f-b65c-2932e5e406c0",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,36 @@
{
"ver": "2.3.5",
"uuid": "a13d4c95-50f9-4363-bab1-3f45e5b19a2c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 116,
"height": 1010,
"platformSettings": {},
"subMetas": {
"Bg01": {
"ver": "1.0.4",
"uuid": "bcedb466-3eca-4270-89ed-938fb20922d5",
"rawTextureUuid": "a13d4c95-50f9-4363-bab1-3f45e5b19a2c",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 116,
"height": 1010,
"rawWidth": 116,
"rawHeight": 1010,
"borderTop": 18,
"borderBottom": 18,
"borderLeft": 30,
"borderRight": 30,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

View File

@ -0,0 +1,36 @@
{
"ver": "2.3.5",
"uuid": "dfb47658-93c7-4a6b-94b5-ce3320550dfc",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 70,
"height": 66,
"platformSettings": {},
"subMetas": {
"Bg02": {
"ver": "1.0.4",
"uuid": "b52a640c-0ac2-4a29-a994-6f6662896ca3",
"rawTextureUuid": "dfb47658-93c7-4a6b-94b5-ce3320550dfc",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 70,
"height": 66,
"rawWidth": 70,
"rawHeight": 66,
"borderTop": 20,
"borderBottom": 20,
"borderLeft": 20,
"borderRight": 20,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,36 @@
{
"ver": "2.3.5",
"uuid": "2e13c59a-e437-4da1-8795-3c501e6fa20d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 674,
"height": 93,
"platformSettings": {},
"subMetas": {
"Bg03": {
"ver": "1.0.4",
"uuid": "fa3effbc-80ad-48cb-874b-5b59cb9a2cad",
"rawTextureUuid": "2e13c59a-e437-4da1-8795-3c501e6fa20d",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 674,
"height": 93,
"rawWidth": 674,
"rawHeight": 93,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,36 @@
{
"ver": "2.3.5",
"uuid": "3e35d732-2569-42fc-bd16-283375bce1f2",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 70,
"height": 68,
"platformSettings": {},
"subMetas": {
"Btn_Bg01": {
"ver": "1.0.4",
"uuid": "fe373032-416b-4879-a3a2-b242b6b550c2",
"rawTextureUuid": "3e35d732-2569-42fc-bd16-283375bce1f2",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 70,
"height": 68,
"rawWidth": 70,
"rawHeight": 68,
"borderTop": 20,
"borderBottom": 20,
"borderLeft": 20,
"borderRight": 20,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,36 @@
{
"ver": "2.3.5",
"uuid": "6fede7ee-5d18-42f8-9512-8196163a602c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 70,
"height": 68,
"platformSettings": {},
"subMetas": {
"Btn_Bg02": {
"ver": "1.0.4",
"uuid": "19082bbf-1556-4235-bfc0-b4a1088afe61",
"rawTextureUuid": "6fede7ee-5d18-42f8-9512-8196163a602c",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 70,
"height": 68,
"rawWidth": 70,
"rawHeight": 68,
"borderTop": 20,
"borderBottom": 20,
"borderLeft": 20,
"borderRight": 20,
"subMetas": {}
}
}
}

View File

@ -0,0 +1,3 @@
{
"__type__": "cc.SpriteAtlas"
}

View File

@ -0,0 +1,21 @@
{
"ver": "1.2.1",
"uuid": "76968ccc-ba08-4541-80aa-bed393f89576",
"maxWidth": 1024,
"maxHeight": 1024,
"padding": 0,
"allowRotation": true,
"forceSquared": false,
"powerOfTwo": true,
"algorithm": "MaxRects",
"format": "png",
"quality": 80,
"contourBleed": true,
"paddingBleed": true,
"filterUnused": true,
"packable": false,
"premultiplyAlpha": false,
"filterMode": "bilinear",
"platformSettings": {},
"subMetas": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,36 @@
{
"ver": "2.3.5",
"uuid": "eba1cad0-8aee-4fda-ba7b-5e4aa31e56af",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 75,
"height": 66,
"platformSettings": {},
"subMetas": {
"Logo": {
"ver": "1.0.4",
"uuid": "43ed9d70-c4fe-4fb1-b81b-fdbe794d59c7",
"rawTextureUuid": "eba1cad0-8aee-4fda-ba7b-5e4aa31e56af",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 75,
"height": 66,
"rawWidth": 75,
"rawHeight": 66,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,36 @@
{
"ver": "2.3.5",
"uuid": "c72c5ef8-5ea4-4780-bed8-203dc05e146a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2,
"height": 2,
"platformSettings": {},
"subMetas": {
"Mask": {
"ver": "1.0.4",
"uuid": "56e3565c-5c4b-4adc-ad62-67f183ad524c",
"rawTextureUuid": "c72c5ef8-5ea4-4780-bed8-203dc05e146a",
"trimType": "custom",
"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": {}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -213,7 +213,7 @@
"__id__": 1
},
"_children": [],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 6
@ -284,8 +284,8 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "0",
"_N$string": "0",
"_string": "",
"_N$string": "",
"_fontSize": 60,
"_lineHeight": 60,
"_enableWrapText": true,

File diff suppressed because it is too large Load Diff

View File

@ -45,7 +45,7 @@ export default class AvatarPanel extends UIPanel {
protected ImplementInitial(...initData: any[]): void {
let self: this = this;
this.Main = initData[0];
this._avatars = this.Main.config.Avatars;
this._avatars = this.Main.Config.Avatars;
let btnItem: cc.Node = cc.instantiate(this.BtnItem);
btnItem.active = false;
// 載入兔兔設定 更新UI

View File

@ -1,5 +1,6 @@
import AvatarPanel from "../AvatarPanel/AvatarPanel";
import CSMessage from "../Common/Message/CSMessage";
import { CoroutineV2 } from "../Engine/CatanEngine/CoroutineV2/CoroutineV2";
import HoldButton from "../Engine/Component/Button/HoldButton";
import LocalStorageData from "../Engine/Data/LocalStorageData";
@ -13,7 +14,7 @@ import { GameRecord, MemberData, ScoreResult } from "./MemberData";
import RecordManager from "./RecordManager";
const { ccclass, property } = cc._decorator;
/** 最上層彈跳試窗與各場景間傳參數(因為熱更新APP在LOGING才能加入) */
@ccclass
export class Badminton extends cc.Component {
//#region property
@ -75,13 +76,13 @@ export class Badminton extends cc.Component {
public CurMemberList: string[] = [];
/** 預設球員(塞空格) */
public defaultMember: MemberData = new MemberData("那個");
public DefaultMember: MemberData = new MemberData("那個");
/** RecordManager */
public record: RecordManager = new RecordManager(this);
public Record: RecordManager = new RecordManager(this);
/** ConfigManager */
public config: ConfigManager = new ConfigManager(this);
public Config: ConfigManager = new ConfigManager(this);
//#endregion
@ -92,16 +93,18 @@ export class Badminton extends cc.Component {
private _m_teamList: cc.Node[] = [];
/** 各玩家分數比賽次數記錄 */
private _dictionary: Map<string, ScoreResult> = new Map<string, ScoreResult>();
private _m_results: Map<string, ScoreResult> = new Map<string, ScoreResult>();
/** 比賽歷史記錄(記錄每場次的參賽玩家組合與順序) [{time,team:[[name1,name2],[name3,name4]],type,score:[t1,t2] },] */
private _m_history: GameRecord[] = [];
private _isLoopStartDistribution: boolean = false;
//#endregion
//#region get set
public static get Today(): string { return NodePackageManager.Instance.Dayjs().format("yyyyMMdd"); }
public static get Today(): string { return NodePackageManager.Instance.Dayjs().format("YYYYMMDD"); }
public get TeamCount(): number { return this._m_teamList.length; }
@ -115,11 +118,12 @@ export class Badminton extends cc.Component {
protected onLoad(): void {
Badminton._instance = this;
let self: this = this;
new NodePackageManager();
new LocalStorageData();
let AsyncFunction: () => IterableIterator<any> = function* (): IterableIterator<any> {
yield CoroutineV2.Parallel(
self.config.Init(),
self.record.Init(),
self.Config.Init(),
self.Record.Init(),
).Start();
CoroutineV2.Parallel(
self.Lobby.Show(),
@ -137,6 +141,12 @@ export class Badminton extends cc.Component {
CoroutineV2.Single(AsyncFunction()).Start();
}
protected update(dt: number): void {
if (this._isLoopStartDistribution) {
this.OnClickStartDistribution();
}
}
public *Show(): IterableIterator<any> {
CoroutineV2.Single(this.ScoreBoard.Hide()).Start();
this._initUI();
@ -182,7 +192,7 @@ export class Badminton extends cc.Component {
item.node.getChildByName("Btn_Del").on("click", () => { this.OnDelMember(idx); }, this);
let picObj: cc.Node = item.node.getChildByName("Avatar").getChildByName("Pic");
if (picObj != null) {
picObj.getComponent(cc.Sprite).spriteFrame = this.config.GetAvatarPicById(this.TeamMemberList[idx].AvatarId);
picObj.getComponent(cc.Sprite).spriteFrame = this.Config.GetAvatarPicById(this.TeamMemberList[idx].AvatarId);
picObj.parent.getComponent(HoldButton).OnInvoke.AddListener(() => { this.OnChangeAvatar(+idx); });
picObj.parent.on("click", () => {
item.isChecked = !item.isChecked;
@ -255,6 +265,22 @@ export class Badminton extends cc.Component {
}
}
public OnClickStartDistribution(): void {
this.CurMemberList.Clear();
let chkMemberList: string[] = [];
for (let member of this._m_toggleList) {
if (member.isChecked) {
chkMemberList.push(member.node.getChildByName("Name").getComponent(cc.Label).string);
}
}
chkMemberList = this.GetListRandomize(chkMemberList);
this._updateTeamShow(chkMemberList);
}
public OnClickLoopStartDistribution(): void {
this._isLoopStartDistribution = !this._isLoopStartDistribution;
}
public GetMemberListFromTeamView(): string[] {
let chkMemberList: string[] = [];
for (let i: number = 0; i < this._m_teamList.length; i++) {
@ -319,7 +345,7 @@ export class Badminton extends cc.Component {
team.getChildByName("Member_" + (j + 1)).getChildByName("Name").getComponent(cc.Label).string = name;
team.getChildByName("Member_" + (j + 1)).getComponent(cc.Sprite).enabled = name !== this.GetDefaultMemberName();
team.getChildByName("Member_" + (j + 1)).getComponent(cc.Sprite).spriteFrame = this.config.GetAvatarPicByName(name);
team.getChildByName("Member_" + (j + 1)).getComponent(cc.Sprite).spriteFrame = this.Config.GetAvatarPicByName(name);
team.active = true;
}
}
@ -330,12 +356,19 @@ export class Badminton extends cc.Component {
team.getChildByName("Member_1").getChildByName("Name").getComponent(cc.Label).string = name_1;
team.getChildByName("Member_2").getChildByName("Name").getComponent(cc.Label).string = name_2;
team.getChildByName("Member_1").getComponent(cc.Sprite).enabled = true;
team.getChildByName("Member_1").getComponent(cc.Sprite).spriteFrame = this.config.GetAvatarPicByName(name_1);
team.getChildByName("Member_1").getComponent(cc.Sprite).spriteFrame = this.Config.GetAvatarPicByName(name_1);
team.getChildByName("No").getComponent(cc.Label).string = (index + 1).toString();
team.active = true;
}
}
public OnClickCleanTeam(): void {
for (let obj of this._m_toggleList) {
obj.isChecked = false;
this._onChangeSelMember(obj);
}
}
public OnDelMember(index: number): void {
let viewTeamList: string[] = this.GetMemberListFromTeamView();
let player: MemberData = this.TeamMemberList[index];
@ -349,562 +382,173 @@ export class Badminton extends cc.Component {
}
}
public GetListRandomize(list: any[]): any[] {
list.sort(function (): number {
return (0.5 - Math.random());
});
return list;
}
public OnClickAddMember(): void {
let newName: string = this.inputNameText.string;
if (String.IsNullOrWhiteSpace(newName)) {
return;
}
let members: string[] = this.TeamMemberList.map(m => m.Name);
if (members.includes(newName)) {
CSMessage.CreateYesMsg(newName + "已經在名單內");
return;
}
this.TeamMemberList.push(new MemberData(newName));
this.inputNameText.string = "";
let viewTeamList: string[] = this.GetMemberListFromTeamView();
this._initUI();
this._updateTeamShow(viewTeamList);
this._updateGameResult();
}
public OnChangeAvatar(index: number): void {
CoroutineV2.Single(this.AvatarPanel.Show(this.TeamMemberList[index])).Start();
}
public LoadStatus(): void {
// console.log("LoadStatus ======= ");
// try {
// let members: string[] = this.TeamMemberList.map(m => Object.values(m)[0]);
// var str_member = PlayerPrefs.GetString("member", "[]");
// var str_avatar = PlayerPrefs.GetString("avatar", "[]");
// List < string > member_list = ((List<object>)MiniJSON.Json.Deserialize(str_member)).ConvertAll((val) => ((string)val).Trim());
// List < int > avatar_list = ((List<object>)MiniJSON.Json.Deserialize(str_avatar)).ConvertAll((val) => (int)(long)val);
// for (int i = 0; i < member_list.Count; i++)
// {
// string member = member_list[i];
// if (!members.Contains(member)) {
// if (member != GetDefaultMemberName()) {
// teamMemberList.Add(new MemberData() { name = member, avatarId = avatar_list[i] });
// }
// }
// else {
// teamMemberList.Find((m) => m.name == member).avatarId = avatar_list[i];
// }
// }
// curMemberList.Clear();
// foreach(Toggle member in m_toggleList) { member.isOn = false; }
// curMemberList = member_list.ConvertAll(v => v);
// //curMemberList = member_list;
// InitUI();
public SaveStatus(): void {
// member
let member_list: string[] = this.GetMemberListFromTeamView();
LocalStorageData.Instance.Member = member_list;
// for (int i = 0; i < member_list.Count; i++)
// {
// string member = member_list[i];
// int index = members.IndexOf(member);
// if (index != -1) {
// m_toggleList[index].isOn = true;
// }
// else {
// // 那個
// }
// }
// UpdateTeamShow(member_list);
// //updateCurSelMember();
// LoadScoreResult();
// voicePanel.SetProps(MiniJSON.Json.Deserialize(PlayerPrefs.GetString("voice", "null")) as Dictionary<string, object>);
// UpdateGameResult();
// }
// catch (System.Exception err)
// {
// Debug.Log(err);
// }
let avatar_list: number[] = member_list.map(m => this.Config.GetAvatarDataByName(m).ID);
LocalStorageData.Instance.Avatar = avatar_list;
LocalStorageData.Instance.IsSingleMode = this.ScoreBoard.isSingleMode ? 1 : 0;
let selected_list: string[] = this.ScoreBoard.selectedList;
LocalStorageData.Instance.Selected = selected_list;
let firstTeam: number = this.ScoreBoard.firstTeam;
LocalStorageData.Instance.FirstTeam = firstTeam;
// TODO ScoreBoard
// let score_list = this.ScoreBoard.GetScoreWinList();
// LocalStorageData.Instance.Score = score_list;
let result_dict: Map<string, Object> = new Map<string, Object>();
this._m_results.forEach((item: ScoreResult, key: string, map: Map<string, ScoreResult>) => {
let obj: Object = {
win: item.Win,
total: item.Total,
};
result_dict.set(key, obj);
});
LocalStorageData.Instance.Results = result_dict;
// // 增加紀錄日期
LocalStorageData.Instance.Date = Badminton.Today;
if (this.HistoryPanel != null) {
// 增加隊伍歷史紀錄
// 格式 json: {"日期":[玩家1,玩家2,...],"日期":[玩家1,玩家2,...]}
let history_dict: Map<string, string[]> = this.HistoryPanel.History;
LocalStorageData.Instance.HistoryTeam = history_dict;
}
}
public LoadStatus(): void {
console.log("LoadStatus ======= ");
try {
let members: string[] = this.TeamMemberList.map(m => m.Name);
let member_list: string[] = LocalStorageData.Instance.Member;
let avatar_list: number[] = LocalStorageData.Instance.Avatar;
for (let i: number = 0; i < member_list.length; i++) {
let member: string = member_list[i];
if (!members.includes(member)) {
if (member !== this.GetDefaultMemberName()) {
this.TeamMemberList.push(new MemberData(member, avatar_list[i]));
}
} else {
this.TeamMemberList.find((m) => m.Name === member).AvatarId = avatar_list[i];
}
}
this.CurMemberList.Clear();
for (const members of this._m_toggleList) {
members.isChecked = false;
}
this.CurMemberList = member_list.Copy();
this._initUI();
for (let i: number = 0; i < member_list.length; i++) {
let member: string = member_list[i];
let index: number = members.indexOf(member);
if (index !== -1) {
this._m_toggleList[index].isChecked = true;
this._onChangeSelMember(this._m_toggleList[index]);
} else {
// 那個
}
}
this._updateTeamShow(member_list);
this._loadScoreResult();
// TODO voicePanel
// voicePanel.SetProps(MiniJSON.Json.Deserialize(PlayerPrefs.GetString("voice", "null")) as Dictionary<string, object>);
this._updateGameResult();
} catch (err: any) {
console.log(err);
}
}
private _loadScoreResult(): void {
let self: this = this;
this.ScoreBoard.isSingleMode = LocalStorageData.Instance.IsSingleMode === 1;
let selected_list: string[] = LocalStorageData.Instance.Selected;
if (selected_list.length > 0) {
// TODO ScoreBoard
// this.ScoreBoard.ResetScore();
// this.ScoreBoard.SetPlayerList(selected_list);
let firstTeam: number = LocalStorageData.Instance.FirstTeam;
this.ScoreBoard.firstTeam = firstTeam;
// TODO ScoreBoard
// if (firstTeam !== -1) {
// let score_list: number[] = LocalStorageData.Instance.Score;
// this.ScoreBoard.SetScoreWinList(score_list);
// }
}
this._m_results.clear();
let result_list: Map<string, Object> = LocalStorageData.Instance.Results;
if (result_list.size > 0) {
result_list.forEach((item: Object, key: string) => {
let val: Object = item;
let result: ScoreResult = new ScoreResult(+item["win"], +item["total"]);
self._m_results.set(key, result);
this.Config.GetMemberDataByName(key).Score = result;
});
}
}
private _updateGameResult(): void {
let self: this = this;
this._m_toggleList.forEach((member: cc.Toggle, index: number, array: cc.Toggle[]) => {
if (self._m_results.has(member.node.Find("Name").getComponent(cc.Label).string)) {
let result: ScoreResult = self._m_results.get(member.node.Find("Name").getComponent(cc.Label).string);
member.node.Find("Score").getComponent(cc.Label).string = "" + result.Total;
} else {
member.node.Find("Score").getComponent(cc.Label).string = "";
}
});
}
public OnClickClearAllGameResult(): void {
this._m_results.clear();
this._m_history.Clear();
this._updateGameResult();
// 清除計分後 寫入紀錄
this.SaveStatus();
}
//#endregion
public Log(a: any, b: any): void {
console.log(b);
}
}
// //#region 初始化
// onLoad(): void {
// Badminton._instance = this;
// this.ElementCommonUI = this.getComponent(CommonElementUI);
// this.LastScene = SceneName.Loading;
// this.NowScene = SceneName.Login;
// this._cachErrorHandler();
// this._initialEngine();
// }
// onDestroy(): void {
// Badminton._instance = null;
// }
// private _initialEngine(): void {
// if (cc.sys.isBrowser) {
// this._createIframeCloseBtn();
// }
// cc.game.addPersistRootNode(this.node);
// // 多点触摸事件屏蔽
// cc.macro.ENABLE_MULTI_TOUCH = false;
// // WEBVIEW
// this._setWeb();
// //
// CSResource.Initialize();
// CSMessage.Initialize(this.SourceMessage, this.MessageContent);
// if (cc.sys.isBrowser) {
// this.node.removeComponent(cc.Mask);
// }
// // MASK
// let maskNode: cc.Node = null;
// if (this.ElementCommonUI.DelayLoadMask) {
// maskNode = cc.instantiate(this.ElementCommonUI.DelayLoadMask);
// this.Masks.addChild(maskNode, 0, "DelayLoadMask");
// }
// if (this.ElementCommonUI.LoginLoadMask) {
// maskNode = cc.instantiate(this.ElementCommonUI.LoginLoadMask);
// this.Masks.addChild(maskNode, 0, "LoginLoadMask");
// }
// CSMask.Initialize(this.Masks);
// // 所有專案共用
// new LocalStorageData();
// new ScreenResize();
// new CSAudio();
// // 同類型專案共用
// new UserStorageData();
// new UserData();
// // 同類型專案各取所需(只接DispatchCallback)
// new (require("../../ElementUI/DataReceived/BadmintonData") as typeof
// import("../../ElementUI/DataReceived/BadmintonData")).default();
// new (require("../../ElementUI/DataReceived/GameCheckData") as typeof
// import("../../ElementUI/DataReceived/GameCheckData")).default();
// // 監聽
// UIManager.DireEvent.AddCallback(this._changeDire, this);
// ScreenResize.Instance.AddEven();
// }
// public CheckAddEven(): void {
// this.ElementCommonUI.RemoveAllClickEffect();
// if (cc.Canvas.instance && !cc.Canvas.instance.node.hasEventListener(cc.Node.EventType.TOUCH_START)) {
// cc.Canvas.instance.node.on(cc.Node.EventType.TOUCH_START, this.ElementCommonUI.ShowClickEffect, this.ElementCommonUI, true);
// cc.Canvas.instance.node.on(cc.Node.EventType.TOUCH_END, this.ElementCommonUI.ShowClickEffect, this.ElementCommonUI, true);
// cc.Canvas.instance.node.on(cc.Node.EventType.TOUCH_CANCEL, this.ElementCommonUI.ShowClickEffect, this.ElementCommonUI, true);
// }
// }
// private _changeDire(param: any[] = null): void {
// if (!this.node) {
// return;
// }
// this.node.setPosition(ScreenResize.CanvasSize[ScreenResize.IsPortrait].x / 2, ScreenResize.CanvasSize[ScreenResize.IsPortrait].y / 2);
// this.node.SetSizeDelta(ScreenResize.CanvasSize[ScreenResize.IsPortrait]);
// //this.WebContent.node.SetSizeDelta(cc.v2(ScreenResize.CanvasSize[ScreenResize.IsPortrait].x + 0, ScreenResize.CanvasSize[ScreenResize.IsPortrait].y + 0));
// if (!CC_PREVIEW && CC_DEBUG && this.LogContent) {
// this.LogContent.SetSizeDelta(ScreenResize.CanvasSize[ScreenResize.IsPortrait]);
// this.LogContent.getComponentInChildren(cc.EditBox).node.setPosition(-ScreenResize.CanvasSize[ScreenResize.IsPortrait].x / 2, -ScreenResize.CanvasSize[ScreenResize.IsPortrait].y / 2);
// this.LogContent.getComponentInChildren(cc.EditBox).node.SetSizeDelta(cc.v2(ScreenResize.CanvasSize[ScreenResize.IsPortrait].x - 200, ScreenResize.CanvasSize[ScreenResize.IsPortrait].y));
// this.LogContent.getChildByName("CLOSE").setPosition(ScreenResize.CanvasSize[ScreenResize.IsPortrait].x / 2 - 100, ScreenResize.CanvasSize[ScreenResize.IsPortrait].y / 2 - 100);
// this.LogContent.getChildByName("CLEAR").setPosition(ScreenResize.CanvasSize[ScreenResize.IsPortrait].x / 2 - 100, ScreenResize.CanvasSize[ScreenResize.IsPortrait].y / 2 - 300);
// }
// this.ElementContent.scale = (ScreenResize.IsPortrait == 1) ? 1 : UIManager.ScreenScale;
// Badminton.DataReceivedEvent.DispatchCallback([Badminton.DataType.ChangeDire]);
// }
// private _cachErrorHandler(): void {
// if (!this.LogContent) {
// return;
// }
// this.LogContent.active = false;
// this.LogContent.getComponentInChildren(cc.EditBox).string = "";
// if (CC_PREVIEW || !CC_DEBUG) {
// return;
// }
// let self = this;
// if (cc.sys.isNative) {
// let __handler
// if (window['__errorHandler']) {
// __handler = window['__errorHandler']
// }
// window['__errorHandler'] = function (...args) {
// self._cachError(...args);
// if (__handler) {
// __handler(...args)
// }
// }
// }
// if (cc.sys.isBrowser) {
// let __handler;
// if (window.onerror) {
// __handler = window.onerror
// }
// window.onerror = function (...args) {
// self._cachError(...args);
// if (__handler) {
// __handler(...args)
// }
// }
// }
// cc.error = (msg: any, ...subst: any[]) => {
// console.error(msg, ...subst);
// this._cachError(msg, ...subst);
// }
// }
// private _cachError(...args): void {
// this.LogContent.active = true;
// if (args && args[0]) {
// for (let con of args) {
// Badminton.Instance.LogContent.getComponentInChildren(cc.EditBox).string += "\n" + con;
// }
// }
// }
// public CloseLogPanel(): void {
// this.LogContent.active = false;
// }
// public ClearLogPanel(): void {
// this.LogContent.getComponentInChildren(cc.EditBox).string = "";
// }
// //#endregion
// //#region WEBVIEW
// private _setWeb(): void {
// /*this.WebContent.node.active = false;
// if (cc.sys.isNative) {
// this.WebContent.setJavascriptInterfaceScheme(this.SCHEME);
// this.WebContent.setOnJSCallback(this._webViewCallback.bind(this));
// if (cc.sys.isBrowser) {
// window["closeWebContent"] = this._closeWebContent.bind(this);
// window.addEventListener('message', function (e) {
// cc.log("cocos log1=" + e.data);
// window["closeWebContent"](e);
// });
// }
// } else {
// window["closeWebContent"] = this._closeWebContent.bind(this);
// window.addEventListener('message', function (e) {
// cc.log("cocos log1=" + e.data);
// window["closeWebContent"](e);
// });
// }*/
// }
// private _closeWebContent(e, url): void {
// /*this.WebContent.node.active = false;
// cc.log("cocos log2=" + e.data);
// */
// }
// private _webViewCallback(target, url): void {
// /*
// // webview target
// let str: string = url.replace(this.SCHEME + '://', '');
// cc.log(str);
// this.WebContent.node.active = false;
// */
// }
// public OpenWebPage(url: string): void {
// /*this.WebContent.node.active = true;
// let checkUrl: string = BusinessTypeSetting.UsePatch + "closePage.html?" + url + "&v=" + Date.now();
// this.WebContent.url = checkUrl;
// */
// }
// private _createIframeCloseBtn(): void {
// let currentDiv = document.getElementById("ScreenRotation");
// var historyBTn = document.createElement("input");
// historyBTn.setAttribute("type", "button");
// historyBTn.setAttribute("id", "historyBtn");
// historyBTn.setAttribute("class", "closeBtn");
// historyBTn.setAttribute("onclick", "javascript:(()=>{var ifr=document.querySelector('#historyIfr');ifr.parentNode.removeChild(ifr);var ifrBtn= document.querySelector('#historyBtn');ifrBtn.style.visibility = 'hidden';document.querySelector('#ifrDiv').style.visibility='hidden';})()");
// if (!BusinessTypeSetting.CheckOnServer) {
// historyBTn.setAttribute("style", "background:url(" + BusinessTypeSetting.UsePatch + BusinessTypeSetting.FolderUrlImg + "historyBtn.png);z-index:1100;top:80%;left:90%;position:fixed;overflow:unset;width:40px;height:40px;;-webkit-appearance: none;background-position: center;background-size: 100%;background-repeat: no-repeat;visibility: visible;border-width:0;background-color: rgba(0,0,0,0);outline: none;");
// }
// historyBTn.textContent = "X";
// historyBTn.style.visibility = "hidden";
// document.body.insertBefore(historyBTn, currentDiv);
// let ifrDiv = document.createElement("div");
// ifrDiv.setAttribute("id", "ifrDiv");
// ifrDiv.setAttribute("class", "scroll-wrapper");
// ifrDiv.setAttribute("style", "position:fixed;width:100%;height:100%;z-index: 1000;overflow-y: scroll;overflow-x: hidden;-webkit-overflow-scrolling: touch;margin:0;");
// ifrDiv.style.visibility = "hidden";
// document.body.insertBefore(ifrDiv, currentDiv);
// }
// public CreateIframePage(urlStr: string): void {
// let historyIfr = document.createElement("iframe");
// historyIfr.setAttribute("id", "historyIfr");
// historyIfr.setAttribute("src", urlStr);
// historyIfr.setAttribute("frameborder", "0");
// historyIfr.setAttribute("style", "width:100%;height:100%;z-index: 1000;;");
// let ifrDiv = document.getElementById("ifrDiv");
// ifrDiv.appendChild(historyIfr);
// ifrDiv.style.visibility = "visible";
// let historyBTn = document.getElementById("historyBtn");
// historyBTn.style.visibility = "visible";
// }
// //#endregion
// //#region 網路相關
// /**連線(目前沒有重連機制) */
// public * ConnectAsync(host: string, port: number) {
// var url = "https://api.ipify.org/?format=json";
// var xhr = new XMLHttpRequest();
// let ip: string = "";
// xhr.onreadystatechange = function () {
// if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) {
// ip = JSON.parse(xhr.responseText)["ip"];
// }
// };
// xhr.open("GET", url, true);
// xhr.send();
// cc.log("[事件]準備連線...");
// while (ip == "") {
// yield null;
// }
// this._conn = new NetConnector(host, port, ip);
// this._conn.OnDataReceived.AddCallback(this._onNetDataReceived, this);
// this._conn.OnDisconnected.AddCallback(this._onNetDisconnected, this);
// this._conn.OnLoadUIMask.AddCallback(this._oOnLoadUIMask, this);
// NetManager.Initialize(this._conn);
// cc.log("[事件]連線中...");
// // 同個connector要再次連線, 可以不用叫CasinoNetManager.Initialize(), 但要先叫CasinoNetManager.Disconnect()
// yield NetManager.ConnectAsync();
// cc.log(String.Format("[事件]連線狀態: {0}", NetManager.IsConnected));
// }
// private _onNetDisconnected() {
// cc.log("[事件] 收到連線中斷事件");
// if (CSAudio.Instance) {
// CSAudio.Instance.StopMusic();
// }
// this._conn.OnDataReceived.RemoveAllCallbacks();
// Badminton.Instance.LastPlayGameID = 0;
// // UIManager.DireEvent.RemoveAllCallbacks();
// cc.view.setResizeCallback(null);
// Badminton.DataReceivedEvent.DispatchCallback([Badminton.DataType.NetDisconnected]);
// }
// private _onNetDataReceived(resp: INetResponse<any>) {
// //cc.log(`[事件] 收到server呼叫: ${resp.Method}(${JSON.stringify(resp.Data)}), 狀態: ${resp.Status}`);
// Badminton.DataReceivedEvent.DispatchCallback([Badminton.DataType.ServerData, resp]);
// }
// private _oOnLoadUIMask(value: boolean) {
// //cc.log(`[事件] LoadUIMask: ${value}`);
// if (value) {
// CSMask.ShowMask(CSMask.MaskType.DelayLoadMask);
// } else {
// CSMask.HideMask(CSMask.MaskType.DelayLoadMask);
// }
// }
// //#endregion
// //#region 硬幣特效
// @property({ displayName: "硬幣數量", type: cc.Integer })
// public CoinAmount: number = 0;
// @property({ displayName: "硬幣飛行路徑", type: cc.Node })
// public CoinPathPoint: cc.Node[] = [];
// @property({ displayName: "硬幣飛行時間", type: cc.Float })
// public FlyCoinTime: number = 0;
// @property({ type: cc.Float })
// public CircleMin: number = 0;
// @property({ type: cc.Float })
// public CircleMax: number = 0;
// @property({ type: cc.Float })
// public CircleTime: number = 0;
// @property({ type: cc.Float })
// public CircleDelayRange: number = 0;
// @property({ type: cc.Float })
// public FadeOutTime: number = 0;
// public PlayCoinEffect(data: any[]): void {
// CoroutineV2.Serial(
// this.FlyMoneyEffect(data[0]),
// this.UpdateMoney(data[1])
// ).Start();
// }
// private *UpdateMoney(money: number): IterableIterator<any> {
// UserData.Instance.Money += money;
// }
// public *FlyMoneyEffect(StartPos: cc.Vec2): IterableIterator<any> {
// for (let i: number = 0; i < this.CoinAmount; i++) {
// let coinInfo: CoinEffectInfo = new CoinEffectInfo();
// coinInfo.StartPos = StartPos;
// let normalized: cc.Vec2 = new cc.Vec2(Math.random(), Math.random());
// coinInfo.SecondPos = StartPos.add(normalized.mul(RandomEx.GetInt(this.CircleMin, this.CircleMax)));
// let date: Date = new Date();
// let sec: number = date.getTime() / 1000;
// coinInfo.StartTime = sec;
// coinInfo.DelayTime = this.CircleDelayRange * Math.random();
// coinInfo.FadeOutTime = this.FadeOutTime;
// CoroutineV2.Single(this._coinFly(coinInfo)).Start();
// }
// yield CoroutineV2.WaitTime(this.FlyCoinTime).Start();
// }
// private *_coinFly(coin: CoinEffectInfo): IterableIterator<any> {
// let date: Date = new Date();
// let sec: number = date.getTime() / 1000;
// // 算延遲起動
// while (sec - coin.StartTime < coin.DelayTime) {
// let newDate: Date = new Date();
// sec = newDate.getTime() / 1000;
// yield null;
// }
// coin.GO = this.node.ExAddChild(this.ElementCommonUI.PrefabCoinEffect);
// coin.GO.SetWorldPosition(coin.StartPos);
// coin.GO.ExSetOrderOverTheObj(this.ElementCommonUI.node);
// // 延遲結束更新開始時間
// coin.StartTime += coin.DelayTime;
// // 正式開始飛
// while (sec - coin.StartTime <= this.FlyCoinTime) {
// let newDate: Date = new Date();
// sec = newDate.getTime() / 1000;
// // 正規化
// let t: number = (sec - coin.StartTime) / this.FlyCoinTime;
// let newPos: cc.Vec2 = new cc.Vec2();
// if (!this.IsInGame) {
// if (this.CoinPathPoint[0] != null && this.CoinPathPoint[1] != null) {
// newPos = Bezier.GetPoint(coin.StartPos, coin.SecondPos, this.CoinPathPoint[0].GetWorldPosition(), this.CoinPathPoint[1].GetWorldPosition(), t);
// } else {
// return;
// }
// } else {
// if (this.CoinPathPoint[2] != null && this.CoinPathPoint[3] != null) {
// newPos = Bezier.GetPoint(coin.StartPos, coin.SecondPos, this.CoinPathPoint[2].GetWorldPosition(), this.CoinPathPoint[3].GetWorldPosition(), t);
// } else {
// return;
// }
// }
// let dir: cc.Vec2 = newPos.sub(coin.GO.GetWorldPosition());
// let angle: number = Math.round(Math.atan2(dir.y, dir.x) * 57.29578);
// coin.GO.angle = angle;
// coin.GO.SetWorldPosition(newPos);
// yield null;
// }
// coin.GO.destroy();
// }
// //#endregion
// //#region 切換場景
// public *RunSwichScene(sceneName: string, scene: cc.Scene = null): IterableIterator<any> {
// let source: any;
// if (!scene) {
// source = yield* AssetBundleMamagerV2.Instance.GetBundleSource(sceneName, sceneName, "scene");
// } else {
// source = scene;
// }
// if (!source) {
// cc.warn("cannot finc scene.");
// return;
// }
// this.LastScene = this.NowScene;
// this.NowScene = sceneName;
// switch (sceneName) {
// case SceneName.Lobby:
// CSMask.HideMask(CSMask.MaskType.LoginLoadMask);
// CSMask.ShowMask(CSMask.MaskType.LoginLoadMask);
// ScreenResize.PL = 1;
// ScreenResize.IsPortrait = ScreenResize.PL;
// break;
// case SceneName.Login:
// ScreenResize.PL = 1;
// ScreenResize.IsPortrait = ScreenResize.PL;
// break;
// default:
// // 遊戲
// this.NowScene = SceneName.Game;
// break;
// }
// cc.director.runSceneImmediate(source);
// }
// //#endregion
// //#region DownloadForm Function
// /**
// * 載入外載表設定檔
// * @param formtype FormType
// */
// public *DownloadForm(formtype: DownloadForm.FormType): IterableIterator<any> {
// if (DownloadForm.DownloadFormData.DownloadSuccess.has(formtype)) {
// console.warn(`CSSettingsV3 ${formtype} 已經載過`);
// return;
// }
// DownloadForm.DownloadFormData.DownloadSuccess.set(formtype, true);
// let needForm: string[] = DownloadForm.DownloadFormData[`${formtype}Form`];
// let parallel: Iterator<any, any, undefined>[] = [];
// for (let i: number = 0; i < needForm.length; i++) {
// parallel.push(this.DownloadFormSetting(needForm[i]));
// }
// // set Form
// yield CoroutineV2.Parallel(...parallel).Start();
// }
// /**
// * 載入外載表設定檔
// * @param formname 設定檔名稱
// */
// public *DownloadFormSetting(formname: string): IterableIterator<any> {
// let fileUrl: string = `${formname}.json`;
// fileUrl = BusinessTypeSetting.UsePatch + BusinessTypeSetting.FolderUrlJson + fileUrl;
// fileUrl = fileUrl + "?v=" + Date.now();
// let isdownloading: boolean = true;
// cc.assetManager.loadRemote(fileUrl, (err, res) => {
// if (err == null) {
// res.name = formname;
// TableManager.AddJsonAsset(<cc.JsonAsset>res);
// cc.assetManager.cacheManager?.removeCache(res.nativeUrl);
// } else {
// console.error(`[Error] ${formname}.json載入失敗`);
// }
// isdownloading = false;
// });
// while (isdownloading) {
// yield null;
// }
// }
// //#endregion
// }
// /** S2CEvent類型 */
// export enum S2CEventType {
// /** SlotIn */
// SlotIn,
// /** CardUse */
// CardUse
// }
// export class CoinEffectInfo {
// public StartPos: cc.Vec2;
// /** 往外噴的點位 */
// public SecondPos: cc.Vec2;
// public GO: cc.Node;
// public StartTime: number;
// public DelayTime: number;
// public FadeOutTime: number;
// }
// export module Badminton {
// export enum DataType {
// ServerData,
// ChangeDire,
// NetDisconnected,
// }
// }
// export default Badminton;
// export enum SceneName {
// Loading = "SplashScreen",
// Login = "Login",
// Lobby = "Lobby",
// Game = "Game_"
// }
// //#region DownloadForm
// export module DownloadForm {
// export enum FormType {
// Bag = "Bag",
// Bingo = "Bingo",
// Five = "Five",
// Operation = "Operation"
// }
// export class DownloadFormData {
// /** 已下載的表 */
// public static DownloadSuccess: Map<string, boolean> = new Map<string, boolean>();
// /** Bag需要的表(xxxx.json) */
// public static BagForm: string[] = ["packet", "composite", "itemmoney"];
// public static BingoForm: string[] = ["bingo"];
// public static FiveForm: string[] = ["five"];
// public static OperationForm: string[] = ["operation"];
// }
// }
// //#endregion

View File

@ -113,7 +113,7 @@ export default class ConfigManager {
return teamMemberList[i];
}
}
return this.Main.defaultMember;
return this.Main.DefaultMember;
}
public GetAvatarDataByName(playerName: string): AvatarData {

View File

@ -97,6 +97,11 @@ export class ScoreResult {
public Win: number;
public Total: number;
constructor(win: number, total: number) {
this.Win = win;
this.Total = total;
}
}
/**

12
assets/Script/Common.meta Normal file
View File

@ -0,0 +1,12 @@
{
"ver": "1.1.2",
"uuid": "4dfc6711-68fb-40cc-98e7-02f5182f23c2",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.2",
"uuid": "bb9ff296-9ba2-4946-8d9f-423fdeb6ef39",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,29 @@
import CSMessage from "../Message/CSMessage";
const { ccclass, property } = cc._decorator;
@ccclass
export class MainControl extends cc.Component {
//#region property
@property({ displayName: "訊息窗位置", type: cc.Node })
public MessageContent: cc.Node = null;
@property({ displayName: "MessageNormal", type: cc.Prefab })
public SourceMessage: cc.Prefab = null;
//#endregion
//#region 初始化
onLoad(): void {
// MainControl._instance = this;
this._initialEngine();
}
private _initialEngine(): void {
CSMessage.Initialize(this.SourceMessage, this.MessageContent);
}
//#endregion
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.8",
"uuid": "ec0e4b2c-5018-4f84-9062-70403d8383e1",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.2",
"uuid": "a77a0b3c-4746-4581-aa25-10cd2a95ce30",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,51 @@
// import CSSettingsV3 from "../../FormTable/CSSettingsV3";
import { MessageNormal, MessageNormalData } from "./MessageNormal";
/** 訊息框相關 */
export default class CSMessage {
private static _sourceUI: cc.Prefab;
private static _parent: cc.Node;
public static Initialize(sourceUI: cc.Prefab, parent: cc.Node): void {
this._sourceUI = sourceUI;
this._parent = parent;
}
/** 一個按鈕的訊息框 */
public static CreateYesMsg(content: string, yesCallback: () => void = null, enterStr: string = null): void {
// enterStr = enterStr ? enterStr : CSSettingsV3.prototype.CommonString(3);
enterStr = enterStr ? enterStr : "確定";
let data: MessageNormalData = {
content: content,
isShowCancel: false,
yesCallback: yesCallback,
noCallback: null,
enterName: enterStr,
cancelName: null
};
MessageNormal.Create(this._sourceUI, this._parent, data);
}
/** 兩個按鈕的訊息框 */
public static CreateYesNoMsg(content: string, yesCallback: () => void = null, noCallback: () => void = null, enterStr: string = null, cancelStr: string = null): void {
// enterStr = enterStr ? enterStr : CSSettingsV3.prototype.CommonString(3);
// cancelStr = cancelStr ? cancelStr : CSSettingsV3.prototype.CommonString(4);
enterStr = enterStr ? enterStr : "確定";
cancelStr = cancelStr ? cancelStr : "取消";
let data: MessageNormalData = {
content: content,
isShowCancel: true,
yesCallback: yesCallback,
noCallback: noCallback,
enterName: enterStr,
cancelName: cancelStr
};
MessageNormal.Create(this._sourceUI, this._parent, data);
}
/** 網路錯誤訊息 */
public static NetError(method: string, state: number, str: string = ""): void {
let error: string = String.Format("[{0}] state:{1} {2}", method, state, str);
cc.warn("網路錯誤訊息: ", error);
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.8",
"uuid": "3f92822f-2324-4f9f-9480-0c1a5b16815f",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -0,0 +1,71 @@
import { CoroutineV2 } from "../../Engine/CatanEngine/CoroutineV2/CoroutineV2";
import UIPanel from "../../Engine/Component/UIPanel/UIPanel";
const { ccclass, property } = cc._decorator;
export interface MessageNormalData {
content: string;
// title: string;
isShowCancel: boolean;
yesCallback: () => void;
noCallback: () => void;
enterName: string;
cancelName: string;
}
@ccclass
export class MessageNormal extends UIPanel {
@property({ displayName: "訊息內容", type: cc.Label })
public Content: cc.Label = null;
// @property({ displayName: "標題", type: cc.Label })
// public Title: cc.Label = null;
@property({ displayName: "確定鈕", type: cc.Button })
public EnterBtn: cc.Button = null;
@property({ displayName: "取消鈕", type: cc.Button })
public CancalBtn: cc.Button = null;
@property({ displayName: "確定鈕文字", type: cc.Label })
public EnterText: cc.Label = null;
@property({ displayName: "取消鈕文字", type: cc.Label })
public CancalText: cc.Label = null;
private _data: MessageNormalData;
protected ImplementInitial(...initData: any[]): void {
this._data = initData[0];
this.Content.string = this._data.content;
// this.Title.string = this._data.title;
if (this._data.enterName) {
this.EnterText.string = this._data.enterName;
} else {
this._data.enterName = "";
}
this.EnterText.string = this._data.enterName;
if (this._data.cancelName) {
this.CancalText.string = this._data.cancelName;
} else {
this.CancalText.string = "";
}
this.CancalBtn.node.active = this._data.isShowCancel;
}
public OnEnter(): void {
if (this._data.yesCallback) {
this._data.yesCallback();
}
this.node.destroy();
}
public OnCancel(): void {
if (this._data.noCallback) {
this._data.noCallback();
}
this.node.destroy();
}
public static Create(sourceUI: cc.Prefab, parent: cc.Node, data: MessageNormalData): void {
let node: cc.Node = parent.ExAddChild(sourceUI);
let script: MessageNormal = node.getComponent(MessageNormal);
script.Initial(data);
CoroutineV2.Single(script.Show()).Start();
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.8",
"uuid": "539c898e-ee41-414a-a279-7ec1a8a9f5be",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -1,16 +1,25 @@
interface StringConstructor {
IsNullOrEmpty: (value: string) => boolean;
Format: (format: string, ...args: any[]) => string;
IsNullOrWhiteSpace: (input: string) => boolean;
}
String.IsNullOrEmpty = function (value: string): boolean {
return value === undefined || value === null || value.trim() === '';
return value === undefined || value === null || value.trim() === "";
};
String.Format = function (format: string, ...args: any[]): string {
return format.replace(/{(\d+)}/g, (match, index) => {
let value = args[index];
if (value === null || value === undefined) return '';
return '' + value;
if (value === null || value === undefined) { return ""; }
return "" + value;
});
}
};
String.IsNullOrWhiteSpace = function (input: string): boolean {
if (typeof input === "undefined" || input == null) {
return true;
}
return input.replace(/\s/g, "").length < 1;
};

View File

@ -10,9 +10,30 @@ export default class LocalStorageData {
}
// =======================================================================================
// public get GameConfig(): string { return cc.sys.localStorage.getItem("GameConfig"); }
// public set GameConfig(value: string) { cc.sys.localStorage.setItem("GameConfig", value); }
public get Date(): string { return cc.sys.localStorage.getItem("date"); }
public set Date(value: string) { cc.sys.localStorage.setItem("date", value); }
public get AvatarSettings(): string { return cc.sys.localStorage.getItem("AvatarSettings"); }
public set AvatarSettings(value: string) { cc.sys.localStorage.setItem("AvatarSettings", value); }
public get Member(): string[] { return cc.sys.localStorage.getItem("member") ? JSON.parse(cc.sys.localStorage.getItem("member")) : []; }
public set Member(value: string[]) { cc.sys.localStorage.setItem("member", JSON.stringify(value)); }
public get Avatar(): number[] { return cc.sys.localStorage.getItem("avatar") ? JSON.parse(cc.sys.localStorage.getItem("avatar")) : []; }
public set Avatar(value: number[]) { cc.sys.localStorage.setItem("avatar", JSON.stringify(value)); }
public get IsSingleMode(): number { return cc.sys.localStorage.getItem("isSingleMode") ? +cc.sys.localStorage.getItem("isSingleMode") : 0; }
public set IsSingleMode(value: number) { cc.sys.localStorage.setItem("isSingleMode", value.toString()); }
public get Selected(): string[] { return cc.sys.localStorage.getItem("selected") ? JSON.parse(cc.sys.localStorage.getItem("selected")) : []; }
public set Selected(value: string[]) { cc.sys.localStorage.setItem("selected", JSON.stringify(value)); }
public get FirstTeam(): number { return cc.sys.localStorage.getItem("firstTeam") ? +cc.sys.localStorage.getItem("firstTeam") : -1; }
public set FirstTeam(value: number) { cc.sys.localStorage.setItem("firstTeam", value.toString()); }
public get Score(): number[] { return cc.sys.localStorage.getItem("score") ? JSON.parse(cc.sys.localStorage.getItem("score")) : []; }
public set Score(value: number[]) { cc.sys.localStorage.setItem("score", JSON.stringify(value)); }
public get Results(): Map<string, Object> { return cc.sys.localStorage.getItem("results") ? new Map(JSON.parse(cc.sys.localStorage.getItem("results"))) : new Map<string, Object>(); }
public set Results(value: Map<string, Object>) { cc.sys.localStorage.setItem("results", JSON.stringify(Array.from(value.entries()))); }
public get HistoryTeam(): Map<string, string[]> { return cc.sys.localStorage.getItem("historyTeam") ? new Map(JSON.parse(cc.sys.localStorage.getItem("historyTeam"))) : new Map<string, string[]>(); }
public set HistoryTeam(value: Map<string, string[]>) { cc.sys.localStorage.setItem("historyTeam", JSON.stringify(Array.from(value.entries()))); }
}

View File

@ -20,6 +20,8 @@ declare interface Array<T> {
* @param call Callback function.
*/
AddListener(call: Function): void;
/** 深拷貝 */
Copy(): any[];
}
Array.prototype.ExRemoveAt || Object.defineProperty(Array.prototype, "ExRemoveAt", {
@ -93,3 +95,10 @@ Array.prototype.AddListener || Object.defineProperty(Array.prototype, "AddListen
this.push(EventHandler);
}
});
Array.prototype.Copy || Object.defineProperty(Array.prototype, "Copy", {
enumerable: false,
value: function (): any[] {
return Array.from(this);
}
});

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.2",
"uuid": "a726d04f-4b2c-4e8f-9160-ef0fb6d11625",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,10 @@
export module ObjectEx {
/**
*
*/
export function Copy(any: any): any {
return JSON.parse(JSON.stringify(any));
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.8",
"uuid": "8d75fc79-4886-48fc-8350-e2f3ae19a079",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -5,6 +5,20 @@ const { ccclass, property } = cc._decorator;
/** HistoryPanel */
@ccclass
export default class HistoryPanel extends UIPanel {
//#region get set
public get History(): Map<string, string[]> { return this._m_history; }
private _m_history: Map<string, string[]> = new Map<string, string[]>();
//#endregion
//#region Lifecycle
protected *ImplementReadyShow(...param: any[]): IterableIterator<any> {
cc.log("HistoryPanel ImplementReadyShow");
}
//#endregion
//#region Custom

View File

@ -6,7 +6,19 @@ const { ccclass, property } = cc._decorator;
@ccclass
export default class ScoreBoard extends UIPanel {
//#region OnClick
//#region public
public isSingleMode: boolean = false;
public firstTeam: number = 0;
public selectedList: string[] = [];
//#endregion
//#region Lifecycle
protected *ImplementReadyShow(...param: any[]): IterableIterator<any> {
cc.log("ScoreBoard ImplementReadyShow");
}
//#endregion
}

42
package-lock.json generated Normal file
View File

@ -0,0 +1,42 @@
{
"name": "Badminton-Scoreboard",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"dependencies": {
"dayjs": "^1.11.1",
"typescript": "^4.6.4"
}
},
"node_modules/dayjs": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.1.tgz",
"integrity": "sha512-ER7EjqVAMkRRsxNCC5YqJ9d9VQYuWdGt7aiH2qA5R5wt8ZmWaP2dLUSIK6y/kVzLMlmh1Tvu5xUf4M/wdGJ5KA=="
},
"node_modules/typescript": {
"version": "4.6.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz",
"integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
}
},
"dependencies": {
"dayjs": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.1.tgz",
"integrity": "sha512-ER7EjqVAMkRRsxNCC5YqJ9d9VQYuWdGt7aiH2qA5R5wt8ZmWaP2dLUSIK6y/kVzLMlmh1Tvu5xUf4M/wdGJ5KA=="
},
"typescript": {
"version": "4.6.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz",
"integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg=="
}
}
}

6
package.json Normal file
View File

@ -0,0 +1,6 @@
{
"dependencies": {
"dayjs": "^1.11.1",
"typescript": "^4.6.4"
}
}

View File

@ -0,0 +1,311 @@
//desktop
var isMobile = navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i) != null;
var isiPad = navigator.userAgent.match(/iPad/i) != null;
var isiPhone = navigator.userAgent.match(/iPhone|iPod/i) != null;
//baidu
var isBaidu = navigator.userAgent.match('baidu') != null;
//QQ browser
var isQQ = navigator.userAgent.match('MQQBrowser') != null;
//Saferi Browser
var isFirefox = navigator.userAgent.match('FxiOS') != null;
// UC Browser
var isUC = navigator.userAgent.indexOf("UCBrowser") != -1;
// Chrome 1+
var isChrome = navigator.userAgent.match('CriOS') != null;
//xiaomi
var isXiaomi = navigator.userAgent.match('XiaoMi') != null;
var isLine = navigator.userAgent.match('Line') != null;
// Safari 3.0+ "[object HTMLElementConstructor]"
var isSafari = navigator.userAgent.match('Safari') && !isBaidu && !isFirefox && !isQQ && !isChrome && !isUC && !isXiaomi;
var isAndroid = /android/i.test(navigator.userAgent || navigator.vendor || window.opera);
var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
// iPhone X、iPhone XS
var isIPhoneX = /iphone/gi.test(window.navigator.userAgent) && window.devicePixelRatio && window.devicePixelRatio === 3 && window.screen.width === 375 && window.screen.height === 812;
// iPhone XS Max
var isIPhoneXSMax = /iphone/gi.test(window.navigator.userAgent) && window.devicePixelRatio && window.devicePixelRatio === 3 && window.screen.width === 414 && window.screen.height === 896;
// iPhone XR
var isIPhoneXR = /iphone/gi.test(window.navigator.userAgent) && window.devicePixelRatio && window.devicePixelRatio === 2 && window.screen.width === 414 && window.screen.height === 896;
// iPhone SE
var isIPhoneSE = /iphone/gi.test(window.navigator.userAgent) && window.devicePixelRatio && window.devicePixelRatio === 2 && window.screen.width === 320 && window.screen.height === 568;
/**解析網址參數 */
var requests = GetUrlRequest();
/**放置LOGO圖 */
var a = SetLogo();
function preventDefault(e) {
e = e || window.event;
if (e.preventDefault) {
e.preventDefault();
}
e.returnValue = false;
}
function nopreventDefault(e) {
e = e || window.event;
if (e.preventDefault) {
e.preventDefault();
}
e.returnValue = true;
}
function requestFullScreen() {
let el = window.document.body;
let rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen;
if (typeof rfs != "undefined" && rfs) {
rfs.call(el);
}
}
function cancelFullScreen() {
let el = window.document;
let rfs = el.exitFullscreen || el.mozCancelFullScreen || el.webkitExitFullscreen || el.msExitFullscreen;
if (typeof rfs != "undefined" && rfs) {
rfs.call(el);
}
}
function isiPhoneX() {
var t = window.devicePixelRatio || 1,
e = {
width: window.screen.width * t,
height: window.screen.height * t
};
return iOS && 1125 === e.width && 2436 === e.height;
}
function SetLogo() {
var lan = "zh-ch";
if (requests["language"]) {
lan = requests["language"];
}
var splash = document.getElementById("splash");
if (!requests["logo"]) {
splash.className = "default" + " L " + lan + " L pos";
} else {
splash.className = "default_" + requests["logo"] + " L pos";
}
}
function GetUrlRequest() {
var url = window.location.search;
var theRequest = [];
if (url.indexOf("?") != -1) {
var str = url.substr(1);
var strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
}
return theRequest;
}
function CheckWebPageBack() {
if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)) { // IE
if (history.length > 0) {
window.history.go(-1);
} else {
window.close();
}
} else {
//非IE瀏覽器
if (navigator.userAgent.indexOf('Firefox') >= 0 ||
navigator.userAgent.indexOf('Opera') >= 0 ||
navigator.userAgent.indexOf('Safari') >= 0 ||
navigator.userAgent.indexOf('Chrome') >= 0 ||
navigator.userAgent.indexOf('WebKit') >= 0) {
if (window.history.length > 2) {
window.history.go(-1);
} else {
window.close();
}
} else {
//未知的瀏覽器
if (history.length > 1) {
window.history.go(-1);
} else {
window.close();
}
}
}
}
/**網頁的RESIZE判斷 */
/*window.onresize = function () {
cc.view.setResizeCallback(this.checkGameCanvasWH());
}*/
/**複寫達到功能縮放到一定程度不再縮放(尚未使用此功能) */
function overrideSetDesignResolutionSize(width, height, resolutionPolicy) {
if (!(width > 0 || height > 0)) {
cc.logID(2200);
return;
}
cc.view.setResolutionPolicy(resolutionPolicy);
var policy = cc.view._resolutionPolicy;
policy && policy.preApply(this);
cc.sys.isMobile && cc.view._adjustViewportMeta();
cc.view._orientationChanging = true;
cc.view._resizing || cc.view._initFrameSize();
if (!policy) {
cc.logID(2201);
return;
}
cc.view._originalDesignResolutionSize.width = cc.view._designResolutionSize.width = width;
cc.view._originalDesignResolutionSize.height = cc.view._designResolutionSize.height = height;
var result = policy.apply(cc.view, cc.view._designResolutionSize);
if (result.scale && 2 === result.scale.length) {
cc.view._scaleX = result.scale[0] <= 1 ? result.scale[0] : 1;
cc.view._scaleY = result.scale[1] <= 1 ? result.scale[1] : 1;
}
if (result.viewport) {
result.viewport.width = result.viewport.width <= width ? result.viewport.width : width;
result.viewport.height = result.viewport.height <= height ? result.viewport.height : height;
var vp = cc.view._viewportRect,
vb = cc.view._visibleRect,
rv = result.viewport;
vp.x = rv.x;
vp.y = rv.y;
vp.width = rv.width;
vp.height = rv.height;
vb.x = 0;
vb.y = 0;
vb.width = rv.width / cc.view._scaleX;
vb.height = rv.height / cc.view._scaleY;
}
policy.postApply(cc.view);
cc.winSize.width = cc.view._visibleRect.width;
cc.winSize.height = cc.view._visibleRect.height;
cc.visibleRect && cc.visibleRect.init(cc.view._visibleRect);
cc.renderer.updateCameraViewport();
this.emit("design-resolution-changed");
}
/**改變CANVAS尺寸後要維持2的倍率.不然容易在縮放網頁時出現圖片接縫(顯示卡繪圖因素) */
function checkGameCanvasWH() {
/*if (document.getElementById("GameCanvas").width > 1422) {
document.getElementById("GameCanvas").width = 1422;
document.getElementById("GameCanvas").style.width = "1422px";
}*/
if (document.getElementById("GameCanvas").width % 2 != 0) {
document.getElementById("GameCanvas").width -= 1;
}
/*if (document.getElementById("GameCanvas").height > 800) {
document.getElementById("GameCanvas").height = 800;
document.getElementById("GameCanvas").style.height = "800px";
}*/
if (document.getElementById("GameCanvas").height % 2 != 0) {
document.getElementById("GameCanvas").height -= 1;
}
}
window.addEventListener('load', function () {
if (!iOS && !isAndroid) {
return;
}
if (isiPhoneX()) {
var r = document.querySelector("meta[name=viewport]");
r.setAttribute("content", "width=device-width,user-scalable=no,initial-scale=1, minimum-scale=1,maximum-scale=1,viewport-fit=cover")
}
//SetSwipe();
if (isAndroid) {
document.body.addEventListener('touchmove', function (e) {
e.preventDefault();
}, {
passive: false
});
requestFullScreen();
} else if (iOS) {
/*if (window.addEventListener) {
window.addEventListener('scroll', onScrollEvent, false);
} else {
window.attachEvent('onscroll', onScrollEvent);
}
onScrollEvent();*/
}
//alert(window.navigator.userAgent)
if (isUC) {
alert("亲爱的玩家您好:\n建议您使用chrome或safari浏览器以获得最佳游戏体验。")
}
}, false);
function SetSwipe() {
var lan = "zh-ch";
if (requests["language"]) {
lan = requests["language"];
}
if (isAndroid) {
var fullScreenClick = document.getElementById("FullScreenClick");
fullScreenClick.className = "default " + lan + " pos";
} else if (iOS) {
var fullScreenSwipe = document.getElementById("FullScreenSwipe");
fullScreenSwipe.className = "default " + lan + " pos";
}
}
function isFullScreen() {
if (isLine) {
return true;
}
if (iOS) {
/*if (isPortraitMode()) {
return window.innerHeight > document.documentElement.clientHeight;
} else {
return window.innerHeight >= document.documentElement.clientHeight;
}*/
} else {
var doc = window.document;
var isFullScreen = !(!doc.fullscreenElement && !doc.mozFullScreenElement && !doc.webkitFullscreenElement && !doc.msFullscreenElement);
return isFullScreen;
}
}
function onScrollEvent() {
if (isFullScreen()) {
displayGame();
} else {
displayFinger();
}
setTimeout(function () {
window.scrollTo(0, 0);
window.scroll(0, 0);
if (document.documentElement.scrollTop) {
document.documentElement.scrollTop = 0;
}
if (document.body.scrollTop) {
document.body.scrollTop = 0;
}
}, 200);
}
function displayFinger() {
document.getElementById("ScreenRotation").style.display = "none";
/*if (isAndroid) {
document.getElementById("FullScreenClick").style.display = "block";
} else if (iOS) {
document.getElementById("FullScreenSwipe").style.display = "block";
}*/
}
function displayGame() {
document.getElementById("ScreenRotation").style.display = "none";
if (isAndroid) {
document.getElementById("FullScreenClick").style.display = "none";
} else if (iOS) {
document.getElementById("FullScreenSwipe").style.display = "none";
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,132 @@
(function () {
'use strict';
var splash = document.getElementById('splash');
var progressBar = splash.querySelector('.progress-bar span');
splash.style.display = 'block';
progressBar.style.width = '0%';
function expoOut(t, b, c, d) {
return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
}
var canvas = document.getElementById('GameCanvas');
window.onload = function () {
if (window.__quick_compile_engine__) {
window.__quick_compile_engine__.load(onload);
} else {
onload();
}
};
function onload() {
// socket
// =======================
// Receives a refresh event from the editor, which triggers the reload of the page
var socket = window.io();
socket.on('browser:reload', function () {
window.location.reload();
});
socket.on('browser:confirm-reload', function () {
var r = confirm('Reload?');
if (r) {
window.location.reload();
}
});
// init engine
// =======================
var engineInited = false;
var onStart = function () {
cc.view.enableRetina(true);
cc.view.resizeWithBrowserSize(true);
cc.director.once("EVENT_AFTER_SCENE_READY", function () {
splash.style.display = 'none';
});
cc.game.pause();
// init assets
engineInited = true;
cc.assetManager.loadAny({
url: 'preview-scene.json',
__isNative__: false
}, null, function (finish, totalCount) {
var percent = expoOut(finish, 0, 100, totalCount) / 2;
if (progressBar) {
progressBar.style.width = percent.toFixed(2) + '%';
}
}, function (err, sceneAsset) {
if (err) {
console.error(err.message, err.stack);
return;
}
var scene = sceneAsset.scene;
scene._name = sceneAsset._name;
cc.assetManager.dependUtil._depends.add(scene._id, cc.assetManager.dependUtil._depends.get('preview-scene.json'));
cc.director.runSceneImmediate(scene, function () {
// play game
cc.game.resume();
console.log(scene._name.substring(0,4))
if(scene._name!="Demo" && scene._name.substring(0,4)!="Slot"){
cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () {
cc.director.emit('EVENT_AFTER_SCENE_READY');
});
}
});
});
// purge
//noinspection JSUnresolvedVariable
_CCSettings = undefined;
};
var option = {
id: canvas,
debugMode: _CCSettings.debug ? cc.debug.DebugMode.INFO : cc.debug.DebugMode.ERROR,
showFPS: _CCSettings.debug,
frameRate: 60,
groupList: _CCSettings.groupList,
collisionMatrix: _CCSettings.collisionMatrix,
};
cc.assetManager.init({
importBase: 'assets/others/import',
nativeBase: 'assets/others/native'
});
let {
RESOURCES,
INTERNAL,
MAIN
} = cc.AssetManager.BuiltinBundleName;
var bundleRoot = [INTERNAL];
_CCSettings.hasResourcesBundle && bundleRoot.push(RESOURCES);
var count = 0;
function cb(err) {
if (err) return console.error(err);
count++;
if (count === bundleRoot.length + 1) {
cc.assetManager.loadBundle(MAIN, function (err) {
if (!err) cc.game.run(option, onStart);
});
}
}
// load plugins
cc.assetManager.loadScript(_CCSettings.jsList.map(function (x) {
return '/plugins/' + x;
}), cb);
// load bundles
for (let i = 0; i < bundleRoot.length; i++) {
cc.assetManager.loadBundle('assets/' + bundleRoot[i], cb);
}
}
})();

View File

@ -0,0 +1,124 @@
html {
-ms-touch-action: none;
}
body, canvas, div {
display: block;
outline: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
-khtml-user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
/* Remove spin of input type number */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
/* display: none; <- Crashes Chrome on hover */
-webkit-appearance: none;
margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
}
body {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 0;
border: 0;
margin: 0;
cursor: default;
color: #888;
background-color: #000;
text-align: center;
font-family: Helvetica, Verdana, Arial, sans-serif;
display: flex;
flex-direction: column;
/* fix bug: https://github.com/cocos-creator/2d-tasks/issues/791 */
/* overflow cannot be applied in Cocos2dGameContainer,
otherwise child elements will be hidden when Cocos2dGameContainer rotated 90 deg */
overflow: hidden;
}
#Cocos2dGameContainer {
position: absolute;
margin: 0;
left: 0px;
top: 0px;
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-align: center;
-webkit-box-pack: center;
}
canvas {
background-color: rgba(0, 0, 0, 0);
}
a:link, a:visited {
color: #666;
}
a:active, a:hover {
color: #666;
}
p.header {
font-size: small;
}
p.footer {
font-size: x-small;
}
#splash {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-size: 45%;
}
.progress-bar {
position: absolute;
left: 27.5%;
top: 80%;
height: 3px;
padding: 2px;
width: 45%;
border-radius: 7px;
box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;
}
.progress-bar span {
display: block;
height: 100%;
border-radius: 3px;
transition: width .4s ease-in-out;
background-color: #3dc5de;
}
.stripes span {
background-size: 30px 30px;
background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,
transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,
transparent 75%, transparent);
animation: animate-stripes 1s linear infinite;
}
@keyframes animate-stripes {
0% {background-position: 0 0;} 100% {background-position: 60px 0;}
}

View File

@ -0,0 +1,215 @@
html,
body,
form {
width: 100%;
margin: 0 auto;
padding: 0;
top: 0;
overflow: hidden;
-webkit-overflow-scrolling: touch;
}
#background-img {
position: absolute;
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
top: 0;
bottom: -10%;
left: 0;
right: 0;
}
#Cocos2dGameContainer {
margin: 0 auto;
position: fixed;
left: 0;
top: 0;
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-align: center;
-webkit-box-pack: center;
-webkit-overflow-scrolling: touch;
z-index: 990;
}
.closeBtn {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/historyBtn.png);
z-index: 1100;
top: 80%;
left: 90%;
position: fixed;
overflow: unset;
width: 40px;
height: 40px;
-webkit-appearance: none;
background-position: center;
background-size: 100%;
background-repeat: no-repeat;
visibility: visible;
border-width: 0;
background-color: rgba(0, 0, 0, 0);
outline: none;
}
.progress-bar {
background-color: #1a1a1a;
position: absolute;
left: 25%;
top: 68%;
height: 15px;
padding: 5px;
width: 50%;
border-radius: 5px;
box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;
}
/**LOGO*/
#splash.L.default_1 {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_1.png);
}
#splash.L.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_en.jpg);
}
#splash.L.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_zh-ch.jpg);
}
#splash.L.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_zh-tw.jpg);
}
/**新增語系圖請加在POS前*/
#splash.L.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 50%;
background-position-y: 30%;
z-index: 998;
}
/**手機選轉螢幕動畫*/
#ScreenRotation {
margin: 0 auto;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
}
/**直轉橫*/
#ScreenRotation.PtoL.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_en.gif);
}
#ScreenRotation.PtoL.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_zh-ch.gif);
}
#ScreenRotation.PtoL.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_zh-tw.gif);
}
/**新增語系圖請加在POS前*/
#ScreenRotation.PtoL.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 80%;
}
/**橫轉直*/
#ScreenRotation.LtoP.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_en.gif);
}
#ScreenRotation.LtoP.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_zh-ch.gif);
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 25%;
}
#ScreenRotation.LtoP.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_zh-tw.gif);
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 25%;
}
/**新增語系圖請加在POS前*/
#ScreenRotation.LtoP.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 25%;
}
/**手機點擊螢幕動畫*/
#FullScreenClick {
margin: 0 auto;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
}
#FullScreenClick.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_en.gif);
}
#FullScreenClick.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_zh-ch.gif);
}
#FullScreenClick.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_zh-tw.gif);
}
/**新增語系圖請加在POS前*/
#FullScreenClick.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 20%;
}
/**手機上滑全螢幕動畫*/
#FullScreenSwipe.default {
margin: 0 auto;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_en.gif);
}
#FullScreenSwipe.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_zh-ch.gif);
}
#FullScreenSwipe.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_zh-tw.gif);
}
/**新增語系圖請加在POS前*/
#FullScreenSwipe.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 20%;
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,76 @@
# ccc-devtools
Cocos Creator 网页调试工具,运行时查看、修改节点树,实时更新节点属性,可视化缓存资源。
## 功能
- 场景节点树实时显示,节点、组件属性实时显示更改
![preview](./screenshots/preview1.gif)
- 可视化缓存资源
![preview](./screenshots/preview2.png)
- 标记场景中节点位置
![preview](./screenshots/preview3.png)
- 输出节点、组件引用到控制台
![preview](./screenshots/preview4.png)
- cc控制台功能扩展
![preview](./screenshots/preview5.png)
## 全局使用
1. 点击 Creator 右上角进入编辑器 resources 目录,再依次进入`static/preview-templates`目录
![t1](./screenshots/t1.png)
2. 根据creator版本将本项目对应分支clone到上面的目录下**如果使用下载压缩包的方式记得把后缀名-branchname去掉**
![t2](./screenshots/t2.png)
3. 打开 `index.jade`,找到 `body` 将中间部分替换为 `include ./ccc-devtools/index.html`**注意用tab键对齐**
![t3](./screenshots/t3.png)
## 项目使用
Cocos Creator 从 v2.2 开始新增了自定义网页预览功能。
1. 重复上面的操作步骤,将修改后的 `preview-templates` 目录拷贝到项目根目录
2. 将 `ccc-devtools/index.html` 里所有引用的资源路径 `app/editor/static/preview-templates/ccc-devtools/...` 替换为 `ccc-devtools/...`
3. 重启 Cocos Creator
## 自定义
- 本项目使用了 vue 和 vuetify可根据 [vuetify 文档](https://vuetifyjs.com/en/getting-started/quick-start/) 对页面进行修改
- 节点、组件显示属性可在 `config.js` 里配置,目前支持 textnumbertextareacolorbool 几种类型
## 需求、更新
https://github.com/potato47/ccc-devtools
如果没有更改源码,可直接在目录下 git pull
论坛讨论地址https://forum.cocos.com/t/creator-20190201/71578
## 贡献指南
- 版本号命名规则 https://semver.org/lang/zh-CN/ ,简单来讲新功能第二位加一修复bug第三位加一
- 如果新增功能请在README中添加预览截图说明
- 记得更新version.json中的版本号
## 前人种树
- https://github.com/vuejs/vue
- https://github.com/vuetifyjs/vuetify

View File

@ -0,0 +1,409 @@
(function () {
'use strict';
// init device resolutions
var devices = [
{ name: 'Apple iPhone 5', width: 320, height: 568, ratio: 2 },
{ name: 'Apple iPhone 6', width: 375, height: 667, ratio: 2 },
{ name: 'Apple iPhone 6 Plus', width: 414, height: 736, ratio: 3 },
{ name: 'Apple iPhone 7', width: 375, height: 667, ratio: 2 },
{ name: 'Apple iPhone 7 Plus', width: 414, height: 736, ratio: 3 },
{ name: 'Apple iPhone X', width: 375, height: 812, ratio: 3 },
{ name: 'Apple iPad', width: 1024, height: 768, ratio: 2 },
{ name: 'Apple iPad Air 2', width: 768, height: 1024, ratio: 2 },
{ name: 'Apple iPad Pro 10.5-inch', width: 834, height: 1112, ratio: 2 },
{ name: 'Apple iPad Pro 12.9-inch', width: 1024, height: 1366, ratio: 2 },
{ name: 'Huawei P9', width: 540, height: 960, ratio: 2 },
{ name: 'Huawei Mate9 Pro', width: 720, height: 1280, ratio: 2 },
{ name: 'Google Nexus 5', width: 360, height: 640, ratio: 3 },
{ name: 'Google Nexus 5X', width: 411, height: 731, ratio: 2.625 },
{ name: 'Google Nexus 6', width: 412, height: 732, ratio: 3.5 },
{ name: 'Google Nexus 7', width: 960, height: 600, ratio: 2 },
];
function setCSSChecked (element, checked) {
if (checked) {
element.classList.add('checked');
}
else {
element.classList.remove('checked');
}
return checked;
}
function refreshPauseBtnState () {
if (cc.game.isPaused()) {
btnPause.style.borderTopRightRadius = '0';
btnPause.style.borderBottomRightRadius = '0';
btnStep.style.borderTopLeftRadius = '0';
btnStep.style.borderBottomLeftRadius = '0';
btnStep.style.display = '';
setCSSChecked(btnPause, true);
}
else {
btnPause.style.borderTopRightRadius = '';
btnPause.style.borderBottomRightRadius = '';
btnStep.style.borderTopLeftRadius = '';
btnStep.style.borderBottomLeftRadius = '';
btnStep.style.display = 'none';
setCSSChecked(btnPause, false);
}
}
var isMobile = function () {
var check = false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true;})(navigator.userAgent||navigator.vendor||window.opera);
return check;
};
// init toolbar
// =======================
var designWidth = _CCSettings.designWidth;
var designHeight = _CCSettings.designHeight;
var rotated = false;
// var paused = false;
var canvas = document.getElementById('GameCanvas');
var btnRotate = document.getElementById('btn-rotate');
var optsDevice = document.getElementById('opts-device');
var btnPause = document.getElementById('btn-pause');
var btnStep = document.getElementById('btn-step');
var optsDebugMode = document.getElementById('opts-debug-mode');
var btnShowFPS = document.getElementById('btn-show-fps');
var inputSetFPS = document.getElementById('input-set-fps');
var btnRecompile = document.getElementById('btn-recompile');
devices.forEach( function ( info, idx ) {
var opt = document.createElement('option');
opt.value = idx+1;
opt.text = info.name;
optsDevice.add( opt, null );
});
// coockie
// =======================
function setCookie (name, value, days) {
days = days || 30; //cookie will be saved for 30 days
var expires = new Date();
expires.setTime(expires.getTime() + days*24*60*60*1000);
document.cookie = name + '='+ encodeURIComponent(value) + ';expires=' + expires.toGMTString();
}
function getCookie (name) {
var arr = document.cookie.match(new RegExp('(^| )' + name + '=([^;]*)(;|$)'));
if(arr !== null) return (arr[2]);
return null;
}
function isFullScreen () {
var toolbar = document.getElementsByClassName('toolbar')[0];
return getComputedStyle(toolbar).display === 'none';
}
function getEmulatedScreenSize () {
var w, h;
var idx = optsDevice.value;
if ( idx === '0' ) {
w = designWidth;
h = designHeight;
}
else {
var info = devices[parseInt(idx) - 1];
w = info.width;
h = info.height;
}
return {
width: rotated ? h : w,
height: rotated ? w : h
};
}
function showSplash () {
var size = isFullScreen() ? document.documentElement.getBoundingClientRect() : getEmulatedScreenSize();
var splash = document.getElementById('splash');
var progressBar = splash.querySelector('.progress-bar span');
splash.style.display = 'block';
progressBar.style.width = '0%';
var div = document.getElementById('GameDiv');
if (div) {
div.style.visibility = 'visible';
}
if ( !isMobile() ) {
// make the splash screen in center
canvas.width = size.width;
canvas.height = size.height;
}
}
function expoOut(t, b, c, d) {
return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
}
// init options
function initPreviewOptions () {
var defaultDevice = getCookie('device');
var defaultRotate = getCookie('rotate');
var hasDefaultDevice = defaultDevice !== null;
var hasDefaultRotate = defaultRotate !== null;
if (hasDefaultDevice) {
optsDevice.value = parseInt(defaultDevice);
}
if (hasDefaultRotate && defaultRotate === 'true') {
rotated = !rotated;
setCSSChecked(btnRotate, rotated);
}
optsDebugMode.value = getCookie('debugMode') || '1';
setCSSChecked(btnShowFPS, getCookie('showFPS') === 'true');
inputSetFPS.value = '60';
showSplash();
}
initPreviewOptions();
window.onload = function () {
if (window.__quick_compile_engine__) {
window.__quick_compile_engine__.load(onload);
}
else {
onload();
}
};
function onload () {
// socket
// =======================
// jshint camelcase:false
var socket = window.__socket_io__();
socket.on('browser:reload', function () {
window.location.reload();
});
socket.on('browser:confirm-reload', function () {
var r = confirm( 'Reload?' );
if ( r ) {
window.location.reload();
}
});
function updateResolution () {
var size = isFullScreen() ? document.documentElement.getBoundingClientRect() : getEmulatedScreenSize();
var gameDiv = document.getElementById('GameDiv');
gameDiv.style.width = size.width + 'px';
gameDiv.style.height = size.height + 'px';
cc.view.setCanvasSize(size.width, size.height);
}
// init rotate button
btnRotate.addEventListener('click', function () {
rotated = !rotated;
setCSSChecked(btnRotate, rotated);
setCookie('rotate', rotated.toString());
updateResolution();
});
optsDevice.addEventListener( 'change', function () {
var idx = optsDevice.value;
setCookie('device', idx.toString());
updateResolution();
});
// init debug modes
optsDebugMode.addEventListener('change', function (event) {
var value = event.target.value;
setCookie('debugMode', value);
cc.debug._resetDebugSetting(parseInt(value));
});
// init pause button
btnPause.addEventListener('click', function () {
var shouldPause = !cc.game.isPaused();
if (shouldPause) {
cc.game.pause();
}
else {
cc.game.resume();
}
refreshPauseBtnState();
});
// init recompile button
btnRecompile.addEventListener('click', function () {
var url = window.location.href + 'update-db';
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState === 4 && xmlHttp.status === 200) {
document.getElementById('recompiling').style.display = 'block';
}
};
xmlHttp.open("GET", url, true); // true for asynchronous
xmlHttp.send(null);
});
// init step button
btnStep.addEventListener('click', function () {
cc.game.step();
});
// init show fps, true by default
btnShowFPS.addEventListener('click', function () {
var show = !cc.debug.isDisplayStats();
cc.debug.setDisplayStats(show);
setCSSChecked(btnShowFPS, show);
setCookie('showFPS', show.toString());
});
// init set fps
inputSetFPS.addEventListener('change', function (event) {
var fps = parseInt(inputSetFPS.value);
if (isNaN(fps)) {
fps = 60;
inputSetFPS.value = fps.toString();
}
cc.game.setFrameRate(fps);
});
// init engine
// =======================
var engineInited = false;
if (isFullScreen()) {
window.addEventListener('resize', updateResolution);
}
var showFPS = getCookie('showFPS');
// FPS is on by default
showFPS = showFPS === null ? true : showFPS === 'true';
var onStart = function () {
// resize canvas
if (!isFullScreen()) {
updateResolution();
}
cc.view.enableRetina(true);
cc.view.resizeWithBrowserSize(true);
// Loading splash scene
var splash = document.getElementById('splash');
var progressBar = splash.querySelector('.progress-bar span');
showSplash();
cc.director.once("EVENT_AFTER_SCENE_READY", function () {
splash.style.display = 'none';
checkEmptyScene();
});
cc.game.pause();
// init assets
engineInited = true;
cc.assetManager.loadAny({url: 'preview-scene.json', __isNative__: false }, null, function (finish, totalCount) {
var percent = expoOut(finish, 0, 100, totalCount) / 2;
if (progressBar) {
progressBar.style.width = percent.toFixed(2) + '%';
}
}, function (err, sceneAsset) {
if (err) {
console.error(err.message, err.stack);
return;
}
var scene = sceneAsset.scene;
scene._name = sceneAsset._name;
// HACK: Change key to uuid from url
cc.assetManager.dependUtil._depends.add(scene._id, cc.assetManager.dependUtil._depends.get('preview-scene.json'));
cc.director.runSceneImmediate(scene, function () {
// play game
cc.game.resume();
if(scene._name!="Demo" && scene._name.substring(0,4)!="Slot"){
cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () {
cc.director.emit('EVENT_AFTER_SCENE_READY');
});
}
});
});
// purge
//noinspection JSUnresolvedVariable
_CCSettings = undefined;
};
var option = {
id: canvas,
debugMode: parseInt(optsDebugMode.value),
showFPS: showFPS,
frameRate: parseInt(inputSetFPS.value),
groupList: _CCSettings.groupList,
collisionMatrix: _CCSettings.collisionMatrix,
};
cc.assetManager.init({
importBase: 'assets/others/import',
nativeBase: 'assets/others/native'
});
var RESOURCES = cc.AssetManager.BuiltinBundleName.RESOURCES;
var INTERNAL = cc.AssetManager.BuiltinBundleName.INTERNAL;
var MAIN = cc.AssetManager.BuiltinBundleName.MAIN;
var bundleRoot = [INTERNAL];
_CCSettings.hasResourcesBundle && bundleRoot.push(RESOURCES);
var count = 0;
function cb (err) {
if (err) return console.error(err);
count++;
if (count === bundleRoot.length + 1) {
cc.assetManager.loadBundle(MAIN, function (err) {
if (!err) cc.game.run(option, onStart);
});
}
}
// load plugins
cc.assetManager.loadScript(_CCSettings.jsList.map(function (x) { return '/plugins/' + x; }), cb);
// load bundles
for (var i = 0; i < bundleRoot.length; i++) {
cc.assetManager.loadBundle(bundleRoot[i], cb);
}
};
function checkEmptyScene () {
var scene = cc.director.getScene();
if (scene) {
if (scene.children.length > 1) {
return;
}
if (scene.children.length === 1) {
var node = scene.children[0];
if (node.children.length > 0) {
return;
}
if (node._components.length > 1) {
return;
}
if (node._components.length > 0 && !(node._components[0] instanceof cc.Canvas)) {
return;
}
}
}
document.getElementById('bulletin').style.display = 'block';
document.getElementById('sceneIsEmpty').style.display = 'block';
}
})();

View File

@ -0,0 +1,193 @@
#background-img {
position: absolute;
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
top: 0;
bottom: -10%;
left: 0;
right: 0;
}
.closeBtn {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/historyBtn.png);
z-index: 1100;
top: 80%;
left: 90%;
position: fixed;
overflow: unset;
width: 40px;
height: 40px;
-webkit-appearance: none;
background-position: center;
background-size: 100%;
background-repeat: no-repeat;
visibility: visible;
border-width: 0;
background-color: rgba(0, 0, 0, 0);
outline: none;
}
.progress-bar {
background-color: #1a1a1a;
position: absolute;
left: 25%;
top: 68%;
height: 15px;
padding: 5px;
width: 50%;
border-radius: 5px;
box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;
}
/**LOGO*/
#splash.L.default_1 {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_1.png);
}
#splash.L.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_en.jpg);
}
#splash.L.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_zh-ch.jpg);
}
#splash.L.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_zh-tw.jpg);
}
/**新增語系圖請加在POS前*/
#splash.L.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 50%;
background-position-y: 30%;
z-index: 998;
}
/**手機選轉螢幕動畫*/
#ScreenRotation {
margin: 0 auto;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
}
/**直轉橫*/
#ScreenRotation.PtoL.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_en.gif);
}
#ScreenRotation.PtoL.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_zh-ch.gif);
}
#ScreenRotation.PtoL.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_zh-tw.gif);
}
/**新增語系圖請加在POS前*/
#ScreenRotation.PtoL.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 80%;
}
/**橫轉直*/
#ScreenRotation.LtoP.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_en.gif);
}
#ScreenRotation.LtoP.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_zh-ch.gif);
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 25%;
}
#ScreenRotation.LtoP.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_zh-tw.gif);
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 25%;
}
/**新增語系圖請加在POS前*/
#ScreenRotation.LtoP.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 25%;
}
/**手機點擊螢幕動畫*/
#FullScreenClick {
margin: 0 auto;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
}
#FullScreenClick.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_en.gif);
}
#FullScreenClick.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_zh-ch.gif);
}
#FullScreenClick.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_zh-tw.gif);
}
/**新增語系圖請加在POS前*/
#FullScreenClick.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 20%;
}
/**手機上滑全螢幕動畫*/
#FullScreenSwipe.default {
margin: 0 auto;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_en.gif);
}
#FullScreenSwipe.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_zh-ch.gif);
}
#FullScreenSwipe.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_zh-tw.gif);
}
/**新增語系圖請加在POS前*/
#FullScreenSwipe.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 20%;
}

View File

@ -0,0 +1,54 @@
const NEX_CONFIG = {
nodeSchema: {
node2d: {
title: 'Node',
key: 'cc.Node',
rows: [
{ name: 'Name', key: 'name', type: 'text' },
{ name: 'X', key: 'x', type: 'number' },
{ name: 'Y', key: 'y', type: 'number' },
{ name: 'Width', key: 'width', type: 'number' },
{ name: 'Height', key: 'height', type: 'number' },
{ name: 'Angle', key: 'angle', type: 'number' },
{ name: 'ScaleX', key: 'scaleX', type: 'number' },
{ name: 'ScaleY', key: 'scaleY', type: 'number' },
{ name: 'Opacity', key: 'opacity', type: 'number' },
{ name: 'Color', key: 'hex_color', type: 'color' },
{ name: 'Group', key: 'group', type: 'text' },
]
},
node3d: {
title: 'Node',
key: 'cc.Node',
rows: [
// TODO:
]
},
},
componentsSchema: {
'cc.Camera': {
title: 'cc.Camera',
key: 'cc.Camera',
rows: [
{ name: 'Zoom Ratio', key: 'zoomRatio', type: 'number' },
{ name: 'Depth', key: 'depth', type: 'number' },
{ name: 'Bacground Color', key: 'hex_backgroundColor', rawKey: 'backgroundColor', type: 'color' },
{ name: 'Align with Screen', key: 'alignWithScreen', type: 'bool' },
]
},
'cc.Sprite': {
key: 'cc.Sprite',
title: 'cc.Sprite',
rows: []
},
'cc.Label': {
title: 'cc.Label',
key: 'cc.Label',
rows: [
{ name: 'String', key: 'string', type: 'textarea' },
{ name: 'Font Size', key: 'fontSize', type: 'number' },
{ name: 'Line Height', key: 'lineHeight', type: 'number' },
]
}
}
}

View File

@ -0,0 +1,266 @@
<link href="ccc-devtools/libs/css/materialdesignicons.min.css" rel="stylesheet"
type="text/css">
<link href="ccc-devtools/libs/css/vuetify.min.css" rel="stylesheet" type="text/css">
<style>
html {
overflow-y: auto;
}
</style>
<v-app id="app">
<v-app-bar app clipped-left color="gray" dense v-if="isShowTop">
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
<div id="recompiling"><span>Recompiling...</span></div>
<v-spacer></v-spacer>
<div class="toolbar">
<div class="item">
<select id="opts-device">
<option value="0">Default</option>
</select>
</div>
<div class="item">
<v-btn id="btn-rotate" small height="25"><span style="color: #aaa;">Rotate</span></v-btn>
</div>
<span style="font-size: small;display: none;" class="item">Debug Mode:</span>
<div class="item" style="display: none;">
<select id="opts-debug-mode">
<option value="0">None</option>
<option value="1">Info</option>
<option value="2">Warn</option>
<option value="3">Error</option>
<option value="4">Info For Web Page</option>
<option value="5">Warn For Web Page</option>
<option value="6">Error For Web Page</option>
</select>
</div>
<div class="item">
<v-btn id="btn-show-fps" small height="25"><span style="color: #aaa;">Show FPS</span></v-btn>
</div>
<div class="item">
<span style="font-size: small;color: #aaa;" class="item">FPS:</span><input id="input-set-fps"
type="number" />
</div>
<div style="margin-right: 0px;" class="item">
<v-btn id="btn-pause" small height="25"><span style="color: #aaa;">Pause</span></v-btn>
</div>
<div class="item">
<v-btn id="btn-step" style="display: none;" small height="25">
<span style="color: #aaa;">Step</span>
</v-btn>
</div>
<div class="item">
<v-btn id="btn-recompile" small height="25"><span style="color: #aaa;">Recompile</span></v-btn>
</div>
<v-icon @click="openCocosDocs" small>mdi-cloud-search</v-icon>
<v-icon @click="openCocosForum" small>mdi-forum</v-icon>
<v-icon @click="openCacheDialog" small>mdi-table</v-icon>
<v-icon @click="openGithub" small>mdi-home</v-icon>
</div>
</v-app-bar>
<div v-if="!isShowTop">
<div id="recompiling"><span>Recompiling...</span></div>
<div class="toolbar">
<div class="item">
<select id="opts-device">
<option value="0">Default</option>
</select>
</div>
<div class="item">
<v-btn id="btn-rotate" small height="25"><span style="color: #aaa;">Rotate</span></v-btn>
</div>
<span style="font-size: small;display: none;" class="item">Debug Mode:</span>
<div class="item" style="display: none;">
<select id="opts-debug-mode">
<option value="0">None</option>
<option value="1">Info</option>
<option value="2">Warn</option>
<option value="3">Error</option>
<option value="4">Info For Web Page</option>
<option value="5">Warn For Web Page</option>
<option value="6">Error For Web Page</option>
</select>
</div>
<div class="item">
<v-btn id="btn-show-fps" small height="25"><span style="color: #aaa;">Show FPS</span></v-btn>
</div>
<div class="item">
<span style="font-size: small;color: #aaa;" class="item">FPS:</span><input id="input-set-fps"
type="number" />
</div>
<div style="margin-right: 0px;" class="item">
<v-btn id="btn-pause" small height="25"><span style="color: #aaa;">Pause</span></v-btn>
</div>
<div class="item">
<v-btn id="btn-step" style="display: none;" small height="25">
<span style="color: #aaa;">Step</span>
</v-btn>
</div>
<div class="item">
<v-btn id="btn-recompile" small height="25"><span style="color: #aaa;">Recompile</span></v-btn>
</div>
</div>
</div>
<v-navigation-drawer v-model="drawer" app clipped fixed width="512" v-if="isShowTop">
<v-container style="height: 50%;overflow: auto;">
<v-text-field v-model="treeSearchText" dense label="Search Node or Component" dark flat solo-inverted
hide-details clearable clear-icon="mdi-close-circle-outline"></v-text-field>
<v-treeview :items="treeData" item-key="id" dense activatable :search="treeSearchText"
:active.sync="selectedNodes">
<template v-slot:label="{ item, active }">
<label v-if="item.active" style="color: white;">{{ item.name }}</label>
<label v-else style="color: gray;">{{ item.name }}</label>
</template>
</v-treeview>
</v-container>
<v-container style="border-top: 2px solid darkgray;height: 50%;overflow-y: auto;">
<template v-if="selectedNode">
<!-- Node -->
<table style="width: 100%;color: white;" border="1">
<thead>
<tr>
<th colspan="2" style="text-align: left; padding: 10px;">
<div class="float-left" style="display:inline-flex;">
<v-simple-checkbox v-model="selectedNode.active"></v-simple-checkbox>
<span style="margin-left: 10px;">{{ nodeSchema.title }}</span>
</div>
<div class="float-right">
<v-icon style="margin-left: 10px;margin-right: 10px;" @click="drawNodeRect()">
mdi-adjust</v-icon>
<v-icon @click="outputNodeHandler()">mdi-send</v-icon>
</div>
</th>
</tr>
</thead>
<tbody>
<!-- config.js[node2d] -->
<tr v-for="row in nodeSchema.rows" :key="row.key">
<td style="padding: 10px;width: 40%;">{{ row.name }}</td>
<td style="width: 60%;">
<v-color-picker v-if="row.type == 'color'" class="ma-2" canvas-height="80" width="259"
v-model="selectedNode[row.key]"></v-color-picker>
<v-simple-checkbox v-else-if="row.type == 'bool'" v-model="selectedNode[row.key]"
style="padding: 10px;width: 100%;"></v-simple-checkbox>
<input v-else :type="row.type" v-model="selectedNode[row.key]"
style="padding: 10px;width: 100%;"></input>
</td>
</tr>
</tbody>
</table>
<!-- Components -->
<table v-for="component in componentsSchema" style="width: 100%;color: white;" border="1">
<thead>
<tr>
<th colspan="2" style="text-align: left; padding: 10px;">
<div class="float-left" style="display:inline-flex;">
<v-simple-checkbox v-model="selectedNode[component.key].enabled">
</v-simple-checkbox>
<span style="margin-left: 10px;">{{ component.title }}</span>
</div>
<div class="float-right">
<v-icon @click="outputComponentHandler(component.key)">mdi-send</v-icon>
</div>
</th>
</tr>
</thead>
<tbody>
<tr v-for="row in component.rows" :key="row.key">
<!-- config.js[componentsSchema] -->
<td style="padding: 10px;width: 40%;">{{ row.name }}</td>
<td style="width: 60%;">
<v-color-picker v-if="row.type == 'color'"
class="ma-2"
canvas-height="80" width="259"
v-model="selectedNode[component.key][row.key]">
</v-color-picker>
<textarea v-else-if="row.type == 'textarea'" rows="1"
v-model="selectedNode[component.key][row.key]"
style="padding: 10px;width: 100%;">
</textarea>
<v-simple-checkbox v-else-if="row.type == 'bool'"
v-model="selectedNode[component.key][row.key]"
style="padding: 10px;width: 100%;">
</v-simple-checkbox>
<input v-else-if ="row.type == 'object_number'"
v-model.number="selectedNode[component.key][row.parentKey][row.key]"
style="padding: 10px;width: 100%;"
@input="onSubPropInput( selectedNode[component.key], row)">
</input>
<input v-else :type="row.type"
v-model="selectedNode[component.key][row.key]"
style="padding: 10px;width: 100%;">
</input>
</td>
</tr>
</tbody>
</table>
</template>
</v-container>
</v-navigation-drawer>
<v-content>
<v-container fill-height>
<div id="content" class="content">
<div class="contentWrap">
<div id="GameDiv" class="wrapper">
<div id="background-img"></div>
<canvas id="GameCanvas"></canvas>
<div id="splash">
<div class="progress-bar stripes"><span></span></div>
</div>
<div id="bulletin">
<div id="sceneIsEmpty" class="inner">预览场景中啥都没有,加点什么,或在编辑器中打开其它场景吧</div>
</div>
</div>
</div>
</div>
</v-container>
</v-content>
<v-dialog v-model="cacheDialog" persistent scrollable>
<v-card>
<v-card-title>
{{ cacheTitle }}
<v-spacer></v-spacer>
<v-text-field v-model="cacheSearchText" append-icon="mdi-magnify" label="Search" single-line
hide-details>
</v-text-field>
</v-card-title>
<v-divider></v-divider>
<v-card-text>
<v-data-table :headers="cacheHeaders" :items="cacheData" :search="cacheSearchText" :sort-by="['size']"
:sort-desc="[true]" :footer-props="{
showFirstLastPage: true,
firstIcon: 'mdi-chevron-double-left',
lastIcon: 'mdi-chevron-double-right',
}">
<template v-slot:item.size="{ item }">
{{ item.size == -1 ? '_' : (item.size +'MB') }}
</template>
<template v-slot:item.preview="{ item }">
<div style="height: 60px;display: flex;align-items: center;">
<img :src="window.location.protocol + '//' + window.location.host + '/' + item.preview"
style="max-height: 60px;max-width: 120px;" v-if="item.preview">
<template v-else>_</template>
</div>
</template>
</v-data-table>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-btn color="blue darken-1" text @click="cacheDialog = false">Close</v-btn>
<v-spacer></v-spacer>
<v-switch v-model="cacheOnlyTexture" label="只显示纹理"></v-switch>
</v-card-actions>
</v-card>
</v-dialog>
</v-app>
<script src="ccc-devtools/libs/js/vue.min.js"></script>
<script src="ccc-devtools/libs/js/vuetify.js"></script>
<script src="ccc-devtools/config.js"></script>
<script src="ccc-devtools/libs/js/cc-console-utils.js"></script>
<script src="ccc-devtools/preview.js"></script>

View File

@ -0,0 +1,249 @@
<link href="app/editor/static/preview-templates/ccc-devtools/libs/css/materialdesignicons.min.css" rel="stylesheet"
type="text/css">
<link href="app/editor/static/preview-templates/ccc-devtools/libs/css/vuetify.min.css" rel="stylesheet" type="text/css">
<style>
html {
overflow-y: auto;
}
</style>
<v-app id="app">
<v-app-bar app clipped-left color="gray" dense v-if="isShowTop">
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
<div id="recompiling"><span>Recompiling...</span></div>
<v-spacer></v-spacer>
<div class="toolbar">
<div class="item">
<select id="opts-device">
<option value="0">Default</option>
</select>
</div>
<div class="item">
<v-btn id="btn-rotate" small height="25"><span style="color: #aaa;">Rotate</span></v-btn>
</div>
<span style="font-size: small;display: none;" class="item">Debug Mode:</span>
<div class="item" style="display: none;">
<select id="opts-debug-mode">
<option value="0">None</option>
<option value="1">Info</option>
<option value="2">Warn</option>
<option value="3">Error</option>
<option value="4">Info For Web Page</option>
<option value="5">Warn For Web Page</option>
<option value="6">Error For Web Page</option>
</select>
</div>
<div class="item">
<v-btn id="btn-show-fps" small height="25"><span style="color: #aaa;">Show FPS</span></v-btn>
</div>
<div class="item">
<span style="font-size: small;color: #aaa;" class="item">FPS:</span><input id="input-set-fps"
type="number" />
</div>
<div style="margin-right: 0px;" class="item">
<v-btn id="btn-pause" small height="25"><span style="color: #aaa;">Pause</span></v-btn>
</div>
<div class="item">
<v-btn id="btn-step" style="display: none;" small height="25">
<span style="color: #aaa;">Step</span>
</v-btn>
</div>
<div class="item">
<v-btn id="btn-recompile" small height="25"><span style="color: #aaa;">Recompile</span></v-btn>
</div>
<v-icon @click="openCocosDocs" small>mdi-cloud-search</v-icon>
<v-icon @click="openCocosForum" small>mdi-forum</v-icon>
<v-icon @click="openCacheDialog" small>mdi-table</v-icon>
<v-icon @click="openGithub" small>mdi-home</v-icon>
</div>
</v-app-bar>
<div v-if="!isShowTop">
<div id="recompiling"><span>Recompiling...</span></div>
<div class="toolbar">
<div class="item">
<select id="opts-device">
<option value="0">Default</option>
</select>
</div>
<div class="item">
<v-btn id="btn-rotate" small height="25"><span style="color: #aaa;">Rotate</span></v-btn>
</div>
<span style="font-size: small;display: none;" class="item">Debug Mode:</span>
<div class="item" style="display: none;">
<select id="opts-debug-mode">
<option value="0">None</option>
<option value="1">Info</option>
<option value="2">Warn</option>
<option value="3">Error</option>
<option value="4">Info For Web Page</option>
<option value="5">Warn For Web Page</option>
<option value="6">Error For Web Page</option>
</select>
</div>
<div class="item">
<v-btn id="btn-show-fps" small height="25"><span style="color: #aaa;">Show FPS</span></v-btn>
</div>
<div class="item">
<span style="font-size: small;color: #aaa;" class="item">FPS:</span><input id="input-set-fps"
type="number" />
</div>
<div style="margin-right: 0px;" class="item">
<v-btn id="btn-pause" small height="25"><span style="color: #aaa;">Pause</span></v-btn>
</div>
<div class="item">
<v-btn id="btn-step" style="display: none;" small height="25">
<span style="color: #aaa;">Step</span>
</v-btn>
</div>
<div class="item">
<v-btn id="btn-recompile" small height="25"><span style="color: #aaa;">Recompile</span></v-btn>
</div>
</div>
</div>
<v-navigation-drawer v-model="drawer" app clipped fixed width="512" v-if="isShowTop">
<v-container style="height: 50%;overflow: auto;">
<v-text-field v-model="treeSearchText" dense label="Search Node or Component" dark flat solo-inverted
hide-details clearable clear-icon="mdi-close-circle-outline"></v-text-field>
<v-treeview :items="treeData" item-key="id" dense activatable :search="treeSearchText"
:active.sync="selectedNodes">
<template v-slot:label="{ item, active }">
<label v-if="item.active" style="color: white;">{{ item.name }}</label>
<label v-else style="color: gray;">{{ item.name }}</label>
</template>
</v-treeview>
</v-container>
<v-container style="border-top: 2px solid darkgray;height: 50%;overflow-y: auto;">
<template v-if="selectedNode">
<!-- Node -->
<table style="width: 100%;color: white;" border="1">
<thead>
<tr>
<th colspan="2" style="text-align: left; padding: 10px;">
<div class="float-left" style="display:inline-flex;">
<v-simple-checkbox v-model="selectedNode.active"></v-simple-checkbox>
<span style="margin-left: 10px;">{{ nodeSchema.title }}</span>
</div>
<div class="float-right">
<v-icon style="margin-left: 10px;margin-right: 10px;" @click="drawNodeRect()">
mdi-adjust</v-icon>
<v-icon @click="outputNodeHandler()">mdi-send</v-icon>
</div>
</th>
</tr>
</thead>
<tbody>
<tr v-for="row in nodeSchema.rows" :key="row.key">
<td style="padding: 10px;width: 40%;">{{ row.name }}</td>
<td style="width: 60%;">
<v-color-picker v-if="row.type == 'color'" class="ma-2" canvas-height="80" width="259"
v-model="selectedNode[row.key]"></v-color-picker>
<v-simple-checkbox v-else-if="row.type == 'bool'" v-model="selectedNode[row.key]"
style="padding: 10px;width: 100%;"></v-simple-checkbox>
<input v-else :type="row.type" v-model="selectedNode[row.key]"
style="padding: 10px;width: 100%;"></input>
</td>
</tr>
</tbody>
</table>
<!-- Components -->
<table v-for="component in componentsSchema" style="width: 100%;color: white;" border="1">
<thead>
<tr>
<th colspan="2" style="text-align: left; padding: 10px;">
<div class="float-left" style="display:inline-flex;">
<v-simple-checkbox v-model="selectedNode[component.key].enabled">
</v-simple-checkbox>
<span style="margin-left: 10px;">{{ component.title }}</span>
</div>
<div class="float-right">
<v-icon @click="outputComponentHandler(component.key)">mdi-send</v-icon>
</div>
</th>
</tr>
</thead>
<tbody>
<tr v-for="row in component.rows" :key="row.key">
<td style="padding: 10px;width: 40%;">{{ row.name }}</td>
<td style="width: 60%;">
<v-color-picker v-if="row.type == 'color'" class="ma-2" canvas-height="80" width="259"
v-model="selectedNode[component.key][row.key]"></v-color-picker>
<textarea v-else-if="row.type == 'textarea'" rows="1"
v-model="selectedNode[component.key][row.key]" style="padding: 10px;width: 100%;">
</textarea>
<v-simple-checkbox v-else-if="row.type == 'bool'"
v-model="selectedNode[component.key][row.key]" style="padding: 10px;width: 100%;">
</v-simple-checkbox>
<input v-else :type="row.type" v-model="selectedNode[component.key][row.key]"
style="padding: 10px;width: 100%;"></input>
</td>
</tr>
</tbody>
</table>
</template>
</v-container>
</v-navigation-drawer>
<v-content>
<v-container fill-height>
<div id="content" class="content">
<div class="contentWrap">
<div id="GameDiv" class="wrapper"><canvas id="GameCanvas"></canvas>
<div id="splash">
<div class="progress-bar stripes"><span></span></div>
</div>
<div id="bulletin">
<div id="sceneIsEmpty" class="inner">预览场景中啥都没有,加点什么,或在编辑器中打开其它场景吧</div>
</div>
</div>
</div>
</div>
</v-container>
</v-content>
<v-dialog v-model="cacheDialog" persistent scrollable>
<v-card>
<v-card-title>
{{ cacheTitle }}
<v-spacer></v-spacer>
<v-text-field v-model="cacheSearchText" append-icon="mdi-magnify" label="Search" single-line
hide-details>
</v-text-field>
</v-card-title>
<v-divider></v-divider>
<v-card-text>
<v-data-table :headers="cacheHeaders" :items="cacheData" :search="cacheSearchText" :sort-by="['size']"
:sort-desc="[true]" :footer-props="{
showFirstLastPage: true,
firstIcon: 'mdi-chevron-double-left',
lastIcon: 'mdi-chevron-double-right',
}">
<template v-slot:item.size="{ item }">
{{ item.size == -1 ? '_' : (item.size +'MB') }}
</template>
<template v-slot:item.preview="{ item }">
<div style="height: 60px;display: flex;align-items: center;">
<img :src="window.location.protocol + '//' + window.location.host + '/' + item.preview"
style="max-height: 60px;max-width: 120px;" v-if="item.preview">
<template v-else>_</template>
</div>
</template>
</v-data-table>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-btn color="blue darken-1" text @click="cacheDialog = false">Close</v-btn>
<v-spacer></v-spacer>
<v-switch v-model="cacheOnlyTexture" label="只显示纹理"></v-switch>
</v-card-actions>
</v-card>
</v-dialog>
</v-app>
<script src="app/editor/static/preview-templates/ccc-devtools/libs/js/vue.min.js"></script>
<script src="app/editor/static/preview-templates/ccc-devtools/libs/js/vuetify.js"></script>
<script src="app/editor/static/preview-templates/ccc-devtools/config.js"></script>
<script src="app/editor/static/preview-templates/ccc-devtools/libs/js/cc-console-utils.js"></script>
<script src="app/editor/static/preview-templates/ccc-devtools/preview.js"></script>

View File

@ -0,0 +1,336 @@
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2rmat('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,165 @@
const initConsoleUtil = function () {
if (cc.tree) return;
cc.tree = function (key) {
let index = key || 0;
let treeNode = function (node) {
let nameStyle =
`color: ${node.parent === null || node.activeInHierarchy ? 'green' : 'grey'}; font-size: 14px;font-weight:bold`;
let propStyle =
`color: black; background: lightgrey;margin-left: 5px;border-radius:3px;padding: 0 3px;font-size: 10px;font-weight:bold`;
let indexStyle =
`color: orange; background: black;margin-left: 5px;border-radius:3px;padding:0 3px;fonrt-size: 10px;font-weight:bold;`
let nameValue = `%c${node.name}`;
let propValue =
`%c${node.x.toFixed(0) + ',' + node.y.toFixed(0) + ',' + node.width.toFixed(0) + ',' + node.height.toFixed(0) + ',' + node.scale.toFixed(1)}`
let indexValue = `%c${index++}`;
if (node.childrenCount > 0) {
console.groupCollapsed(nameValue + propValue + indexValue, nameStyle,
propStyle, indexStyle);
for (let i = 0; i < node.childrenCount; i++) {
treeNode(node.children[i]);
}
console.groupEnd();
} else {
console.log(nameValue + propValue + indexValue, nameStyle, propStyle,
indexStyle);
}
}
if (key) {
let node = cc.cat(key);
index = node['tempIndex'];
treeNode(node);
} else {
let scene = cc.director.getScene();
treeNode(scene);
}
return '属性依次为x,y,width,height,scale.使用cc.cat(id)查看详细属性.';
}
cc.cat = function (key) {
let index = 0;
let target;
let sortId = function (node) {
if (target) return;
if (cc.js.isNumber(key)) {
if (key === index++) {
target = node;
return;
}
} else {
if (key.toLowerCase() === node.name.toLowerCase()) {
target = node;
return;
} else {
index++;
}
}
if (node.childrenCount > 0) {
for (let i = 0; i < node.childrenCount; i++) {
sortId(node.children[i]);
}
}
}
let scene = cc.director.getScene();
sortId(scene);
target['tempIndex'] = cc.js.isNumber(key) ? key : index;
return target;
}
cc.list = function (key) {
let targets = [];
let step = function (node) {
if (node.name.toLowerCase().indexOf(key.toLowerCase()) > -1) {
targets.push(node);
}
if (node.childrenCount > 0) {
for (let i = 0; i < node.childrenCount; i++) {
step(node.children[i]);
}
}
}
let scene = cc.director.getScene();
step(scene);
if (targets.length === 1) {
return targets[0];
} else {
return targets;
}
}
cc.where = function (key) {
let target = key.name ? key : cc.cat(key);
if (!target) {
return null;
}
let rect = target.getBoundingBoxToWorld();
let bgNode = new cc.Node();
let graphics = bgNode.addComponent(cc.Graphics);
let scene = cc.director.getScene();
scene.addChild(bgNode);
bgNode.position = rect.center;
bgNode.group = target.group;
bgNode.zIndex = cc.macro.MAX_ZINDEX;
let isZeroSize = rect.width === 0 || rect.height === 0;
if (isZeroSize) {
graphics.circle(0, 0, 100);
graphics.fillColor = cc.Color.GREEN;
graphics.fill();
} else {
bgNode.width = rect.width;
bgNode.height = rect.height;
graphics.rect(-bgNode.width / 2, -bgNode.height / 2, bgNode.width, bgNode.height);
graphics.fillColor = new cc.Color().fromHEX('#E91E6390');
graphics.fill();
}
setTimeout(() => {
if (cc.isValid(bgNode)) {
bgNode.destroy();
}
}, 2000);
return target;
}
cc.cache = function () {
let rawCacheData = cc.assetManager.assets._map;
let cacheData = [];
let totalTextureSize = 0;
for (let k in rawCacheData) {
let item = rawCacheData[k];
if (item.type !== 'js' && item.type !== 'json') {
let itemName = '_';
let preview = '';
let content = item.__classname__;
let formatSize = -1;
if (item.type === 'png' || item.type === 'jpg') {
let texture = rawCacheData[k.replace('.' + item.type, '.json')];
if (texture && texture._owner && texture._owner._name) {
itemName = texture._owner._name;
preview = texture.content.url;
}
} else {
if (item.name) {
itemName = item.name;
} else if (item._owner) {
itemName = (item._owner && item._owner.name) || '_';
}
if (content === 'cc.Texture2D') {
preview = item.nativeUrl;
let textureSize = item.width * item.height * ((item._native === '.jpg' ? 3 : 4) / 1024 / 1024);
totalTextureSize += textureSize;
// sizeStr = textureSize.toFixed(3) + 'M';
formatSize = Math.round(textureSize * 1000) / 1000;
} else if (content === 'cc.SpriteFrame') {
preview = item._texture.nativeUrl;
}
}
cacheData.push({
queueId: item.queueId,
type: content,
name: itemName,
preview: preview,
id: item._uuid,
size: formatSize
});
}
}
let cacheTitle = `缓存 [文件总数:${cacheData.length}][纹理缓存:${totalTextureSize.toFixed(2) + 'M'}]`;
return [cacheData, cacheTitle];
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,192 @@
const app = new Vue({
el: '#app',
vuetify: new Vuetify({
theme: { dark: true }
}),
data: {
isShowTop: true,
drawer: false,
cacheDialog: false,
cacheTitle: '',
cacheHeaders: [
{ text: 'Type', value: 'type' },
{ text: 'Name', value: 'name' },
{ text: 'Preivew', value: 'preview' },
{ text: 'ID', value: 'id' },
{ text: 'Size', value: 'size' },
],
cacheRawData: [],
cacheData: [],
cacheSearchText: null,
cacheOnlyTexture: true,
treeData: [],
selectedNodes: [],
intervalId: -1,
treeSearchText: null,
nodeSchema: {},
componentsSchema: [],
},
created() {
if (window.innerHeight === window.outerHeight) { // 手机端chrome device模式
this.isShowTop = false;
}
this.waitCCInit().then(() => {
if (this.isShowTop) {
this.startUpdateTree();
}
initConsoleUtil();
});
},
watch: {
cacheOnlyTexture() {
this.updateCacheData();
}
},
computed: {
treeFilter() {
return (item, search, textKey) => item[textKey].indexOf(search) > -1;
},
selectedNode() {
if (!this.selectedNodes.length) return undefined
let node = getNodeById(this.selectedNodes[0]);
if (node) {
if (!node.hex_color) {
cc.js.getset(node, 'hex_color', () => {
return '#' + node.color.toHEX('#rrggbb');
}, (hex) => {
node.color = new cc.Color().fromHEX(hex);
}, false, true);
}
let superPreLoad = node._onPreDestroy;
node._onPreDestroy = () => {
superPreLoad.apply(node);
if (this.selectedNodes.length > 0 && this.selectedNodes[0] === node._id) {
this.selectedNodes.pop();
}
}
this.nodeSchema = NEX_CONFIG.nodeSchema.node2d;
let componentsSchema = [];
for (let component of node._components) {
let schema = NEX_CONFIG.componentsSchema[component.__classname__];
if (schema) {
node[schema.key] = node.getComponent(schema.key);
for (let i = 0; i < schema.rows.length; i++) {
if (schema.rows[i].type === 'color') {
if (!node[schema.key][schema.rows[i].key]) {
cc.js.getset(node[schema.key], schema.rows[i].key, () => {
return '#' + node.getComponent(schema.key)[schema.rows[i].rawKey].toHEX('#rrggbb');
}, (hex) => {
node.getComponent(schema.key)[schema.rows[i].rawKey] = new cc.Color().fromHEX(hex);
}, false, true);
}
}
}
} else {
schema = {
title: component.__classname__,
key: component.__classname__
};
node[schema.key] = node.getComponent(schema.key);
}
componentsSchema.push(schema);
}
this.componentsSchema = componentsSchema;
}
return node;
},
},
methods: {
waitCCInit() {
return new Promise((resolve, reject) => {
let id = setInterval(() => {
if (window.cc) {
resolve();
clearInterval(id);
}
}, 500);
});
},
refreshTree: function () {
if (!this.$data.drawer || !window.cc || !cc.director.getScene() || !cc.director.getScene().children) return;
this.$data.treeData = getChildren(cc.director.getScene());
},
startUpdateTree: function () {
this.$data.intervalId = setInterval(() => {
this.refreshTree();
}, 200);
},
stopUpdateTree: function () {
clearInterval(this.$data.intervalId);
},
outputNodeHandler(id) {
let i = 1;
while (window['temp' + i] !== undefined) {
i++;
}
window['temp' + i] = this.selectedNode;
console.log('temp' + i);
console.log(window['temp' + i]);
},
outputComponentHandler(component) {
let i = 1;
while (window['temp' + i] !== undefined) {
i++;
}
window['temp' + i] = this.selectedNode.getComponent(component);
console.log('temp' + i);
console.log(window['temp' + i]);
},
drawNodeRect() {
cc.where(this.selectedNode);
},
updateCacheData() {
if (this.$data.cacheOnlyTexture) {
this.$data.cacheData = this.$data.cacheRawData.filter(item => item.type === 'cc.Texture2D');
} else {
this.$data.cacheData = this.$data.cacheRawData;
}
},
openCacheDialog() {
[this.$data.cacheRawData, this.$data.cacheTitle] = cc.cache();
this.updateCacheData();
this.$data.cacheDialog = true;
},
openGithub() {
window.open('https://github.com/potato47/ccc-devtools');
},
openCocosForum() {
window.open('https://forum.cocos.com/');
},
openCocosDocs() {
window.open('https://docs.cocos.com/');
}
}
});
function getChildren(node) {
return node.children.map(child => {
let children = (child.children && child.children.length > 0) ? getChildren(child) : [];
return { id: child._id, name: child.name, active: child.activeInHierarchy, children };
});
}
function getNodeById(id) {
let target;
const search = function (node) {
if (node._id === id) {
target = node;
return;
}
if (node.childrenCount) {
for (let i = 0; i < node.childrenCount; i++) {
if (!target) {
search(node.children[i]);
}
}
}
}
const scene = cc.director.getScene();
search(scene);
return target;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Some files were not shown because too many files have changed in this diff Show More