mirror of
https://github.com/zhitaocai/CocosCreator-Multi-resolution-Adapter.git
synced 2026-05-06 22:26:49 +08:00
初步加入背景适配场景和组件脚本
This commit is contained in:
67
.gitignore
vendored
Normal file
67
.gitignore
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# Fireball Projects
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
library/
|
||||
temp/
|
||||
local/
|
||||
build/
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# Logs and databases
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# files for debugger
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
*.sln
|
||||
*.csproj
|
||||
*.pidb
|
||||
*.unityproj
|
||||
*.suo
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# OS generated files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
.DS_Store
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# exvim files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
*UnityVS.meta
|
||||
*.err
|
||||
*.err.meta
|
||||
*.exvim
|
||||
*.exvim.meta
|
||||
*.vimentry
|
||||
*.vimentry.meta
|
||||
*.vimproject
|
||||
*.vimproject.meta
|
||||
.vimfiles.*/
|
||||
.exvim.*/
|
||||
quick_gen_project_*_autogen.bat
|
||||
quick_gen_project_*_autogen.bat.meta
|
||||
quick_gen_project_*_autogen.sh
|
||||
quick_gen_project_*_autogen.sh.meta
|
||||
.exvim.app
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# webstorm files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
.idea/
|
||||
|
||||
#//////////////////////////
|
||||
# VS Code
|
||||
#//////////////////////////
|
||||
|
||||
.vscode/
|
||||
4
.prettierrc
Normal file
4
.prettierrc
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"printWidth": 150,
|
||||
"tabWidth": 4
|
||||
}
|
||||
7
assets/Scene.meta
Normal file
7
assets/Scene.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "0fc6f5a8-e63f-443e-9dee-61b58f3d00ab",
|
||||
"isSubpackage": false,
|
||||
"subpackageName": "",
|
||||
"subMetas": {}
|
||||
}
|
||||
947
assets/Scene/VerticalScene.fire
Normal file
947
assets/Scene/VerticalScene.fire
Normal file
@@ -0,0 +1,947 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.SceneAsset",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"scene": {
|
||||
"__id__": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Scene",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 22
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_level": 0,
|
||||
"_components": [],
|
||||
"_prefab": null,
|
||||
"_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,
|
||||
"y": 0
|
||||
},
|
||||
"_scale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0.4469148552288864,
|
||||
"y": 0.4469148552288864,
|
||||
"z": 1
|
||||
},
|
||||
"_quat": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_zIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"autoReleaseAssets": false,
|
||||
"_id": "c977690b-8aaf-42cf-b711-59442ee83f1b"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Canvas",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 3
|
||||
},
|
||||
{
|
||||
"__id__": 5
|
||||
},
|
||||
{
|
||||
"__id__": 8
|
||||
},
|
||||
{
|
||||
"__id__": 11
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_level": 0,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 21
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_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
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 360,
|
||||
"y": 640,
|
||||
"z": 0
|
||||
},
|
||||
"_scale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_rotationX": 0,
|
||||
"_rotationY": 0,
|
||||
"_quat": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_zIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": "05MxOWXwNJIriGEe44ZR9J"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Main Camera",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_level": 1,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 4
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_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
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_scale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_rotationX": 0,
|
||||
"_rotationY": 0,
|
||||
"_quat": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_zIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": "7b5z/6VpxIi7jI2phz2Uc2"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Camera",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_enabled": true,
|
||||
"_cullingMask": 4294967295,
|
||||
"_clearFlags": 7,
|
||||
"_backgroundColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_depth": -1,
|
||||
"_zoomRatio": 1,
|
||||
"_targetTexture": null,
|
||||
"_id": "69E9P7YWZBFK3maNp9Ozyc"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Bg",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_level": 1,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 6
|
||||
},
|
||||
{
|
||||
"__id__": 7
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_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
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_scale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_rotationX": 0,
|
||||
"_rotationY": 0,
|
||||
"_quat": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_zIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": "00hMzjLJRIorX8p5r2F544"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_enabled": true,
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "d850b577-9bd2-4846-a1fa-69294d397da5"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_state": 0,
|
||||
"_atlas": null,
|
||||
"_id": "83+sH98lJCBKaFLBHkURD1"
|
||||
},
|
||||
{
|
||||
"__type__": "c9395A23IBAn5BEQV28rsN+",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_enabled": true,
|
||||
"_id": "4eE3gaHrJJhZIs/mzcEHHE"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "FadeTitle",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_level": 1,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 9
|
||||
},
|
||||
{
|
||||
"__id__": 10
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 79,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 480,
|
||||
"height": 82
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 368.6,
|
||||
"z": 0
|
||||
},
|
||||
"_scale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_rotationX": 0,
|
||||
"_rotationY": 0,
|
||||
"_quat": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_zIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": "16Ykf2yclH8Z7swvA9OXUg"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 8
|
||||
},
|
||||
"_enabled": true,
|
||||
"alignMode": 1,
|
||||
"_target": null,
|
||||
"_alignFlags": 1,
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": 0.18,
|
||||
"_bottom": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": false,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 0,
|
||||
"_originalHeight": 0,
|
||||
"_id": "65uKTKNmlORLYbOSPWr0ns"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 8
|
||||
},
|
||||
"_enabled": true,
|
||||
"_srcBlendFactor": 1,
|
||||
"_dstBlendFactor": 771,
|
||||
"_useOriginalSize": false,
|
||||
"_string": "假装游戏标题",
|
||||
"_N$string": "假装游戏标题",
|
||||
"_fontSize": 80,
|
||||
"_lineHeight": 82,
|
||||
"_enableWrapText": true,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_batchAsBitmap": false,
|
||||
"_N$horizontalAlign": 1,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 0,
|
||||
"_id": "ecUfZ8Ku1N1pTIopAwsOJI"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "ProgressBarContent",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 12
|
||||
},
|
||||
{
|
||||
"__id__": 18
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_level": 1,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 20
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 504,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -462,
|
||||
"z": 0
|
||||
},
|
||||
"_scale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_rotationX": 0,
|
||||
"_rotationY": 0,
|
||||
"_quat": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_zIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": "caiUFNOvlF2KQ7YLRMsnEb"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "ProgressBar",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 11
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 13
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_level": 2,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 15
|
||||
},
|
||||
{
|
||||
"__id__": 16
|
||||
},
|
||||
{
|
||||
"__id__": 17
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 504,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_scale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_rotationX": 0,
|
||||
"_rotationY": 0,
|
||||
"_quat": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_zIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": "1fxNPYUB1GnbxReH1g4+n3"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Bar",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_level": 0,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 14
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 0,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0.5
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -252,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_scale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_rotationX": 0,
|
||||
"_rotationY": 0,
|
||||
"_quat": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_zIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": "2dYcuyWjtL0Kq9tg9q5WG/"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_enabled": true,
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "67e68bc9-dad5-4ad9-a2d8-7e03d458e32f"
|
||||
},
|
||||
"_type": 1,
|
||||
"_sizeMode": 0,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_state": 0,
|
||||
"_atlas": null,
|
||||
"_id": "894BELoZtLf5Sl375N4yAa"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_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": 504,
|
||||
"_originalHeight": 100,
|
||||
"_id": "9dqDhSxCtOIpOqZuL5J43o"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_enabled": true,
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "88e79fd5-96b4-4a77-a1f4-312467171014"
|
||||
},
|
||||
"_type": 1,
|
||||
"_sizeMode": 0,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_state": 0,
|
||||
"_atlas": null,
|
||||
"_id": "9a/a/W/E1CNYxMqcpBLGVc"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.ProgressBar",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_enabled": true,
|
||||
"_N$totalLength": 504,
|
||||
"_N$barSprite": {
|
||||
"__id__": 14
|
||||
},
|
||||
"_N$mode": 0,
|
||||
"_N$progress": 0,
|
||||
"_N$reverse": false,
|
||||
"_id": "c2PXFlsbNCwIA4ZV0H2Wjy"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "ProgressLabel",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 11
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_level": 2,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 19
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 213,
|
||||
"b": 7,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 160,
|
||||
"height": 40
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_scale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_rotationX": 0,
|
||||
"_rotationY": 0,
|
||||
"_quat": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_zIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": "dccc9f5mhHsLKuy2I2zC4W"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 18
|
||||
},
|
||||
"_enabled": true,
|
||||
"_srcBlendFactor": 1,
|
||||
"_dstBlendFactor": 771,
|
||||
"_useOriginalSize": false,
|
||||
"_string": "正在加载",
|
||||
"_N$string": "正在加载",
|
||||
"_fontSize": 40,
|
||||
"_lineHeight": 40,
|
||||
"_enableWrapText": true,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_batchAsBitmap": false,
|
||||
"_N$horizontalAlign": 1,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 0,
|
||||
"_id": "c6Hh3TPzFEyZc2hR4H15mb"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 11
|
||||
},
|
||||
"_enabled": true,
|
||||
"alignMode": 1,
|
||||
"_target": null,
|
||||
"_alignFlags": 44,
|
||||
"_left": 0.15,
|
||||
"_right": 0.15,
|
||||
"_top": 0,
|
||||
"_bottom": 0.1,
|
||||
"_verticalCenter": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_isAbsLeft": false,
|
||||
"_isAbsRight": false,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": false,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 0,
|
||||
"_originalHeight": 0,
|
||||
"_id": "cdtV3p3LVOA4v41AfH17U+"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Canvas",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"_designResolution": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 720,
|
||||
"height": 1280
|
||||
},
|
||||
"_fitWidth": true,
|
||||
"_fitHeight": true,
|
||||
"_id": "3fs5SbD+JGH6O1UoQLroCI"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "VerticalSceneControl",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_level": 1,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 23
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_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
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_scale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_rotationX": 0,
|
||||
"_rotationY": 0,
|
||||
"_quat": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_zIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": "d2ALOm3OdDS4/YT9Vd/GLf"
|
||||
},
|
||||
{
|
||||
"__type__": "29806sWIPNL6JQ7uEF5tzjC",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 22
|
||||
},
|
||||
"_enabled": true,
|
||||
"progressBar": {
|
||||
"__id__": 17
|
||||
},
|
||||
"progressLabel": {
|
||||
"__id__": 19
|
||||
},
|
||||
"_id": "99E0j9ARFIzaAvB4+EW7Q0"
|
||||
}
|
||||
]
|
||||
7
assets/Scene/VerticalScene.fire.meta
Normal file
7
assets/Scene/VerticalScene.fire.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.0",
|
||||
"uuid": "c977690b-8aaf-42cf-b711-59442ee83f1b",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
7
assets/Script.meta
Normal file
7
assets/Script.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "42c2acb2-2b47-47ed-803e-adc8182352cd",
|
||||
"isSubpackage": false,
|
||||
"subpackageName": "",
|
||||
"subMetas": {}
|
||||
}
|
||||
7
assets/Script/MultiResolution.meta
Normal file
7
assets/Script/MultiResolution.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "fbc0a715-220e-4cc7-a4e7-d74a392ded89",
|
||||
"isSubpackage": false,
|
||||
"subpackageName": "",
|
||||
"subMetas": {}
|
||||
}
|
||||
55
assets/Script/MultiResolution/BackgroundAdapter.ts
Normal file
55
assets/Script/MultiResolution/BackgroundAdapter.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
/**
|
||||
* @classdesc 背景自适应所有分辨率的脚本
|
||||
* @author caizhitao
|
||||
* @version 0.1.0
|
||||
* @since 2018-11-30
|
||||
* @description
|
||||
*
|
||||
* 用法:
|
||||
*
|
||||
* 1. 将本组件挂载在节点上即可
|
||||
*
|
||||
* 注意:
|
||||
*
|
||||
* 1. 挂载这个脚本的节点不能加入Widget组件,不然这个适配是没有效果的
|
||||
* 2. 目前只支持 SHOW_ALL 模式下的背景缩放适配,不支持其他模式的背景缩放
|
||||
*
|
||||
* @example
|
||||
```
|
||||
// e.g.
|
||||
// 设置 SHOW_ALL 模式的参考代码
|
||||
cc.view.setDesignResolutionSize(720, 1280, cc.ResolutionPolicy.SHOW_ALL);
|
||||
```
|
||||
*/
|
||||
|
||||
@ccclass
|
||||
export default class BackgroundAdapter extends cc.Component {
|
||||
onLoad() {
|
||||
// if (CC_DEBUG) {
|
||||
// cc.log("调整前");
|
||||
// cc.log(`屏幕分辨率: ${cc.view.getCanvasSize().width} x ${cc.view.getCanvasSize().height}`);
|
||||
// cc.log(`视图窗口可见区域分辨率: ${cc.view.getVisibleSize().width} x ${cc.view.getVisibleSize().height}`);
|
||||
// cc.log(`视图中边框尺寸: ${cc.view.getFrameSize().width} x ${cc.view.getFrameSize().height}`);
|
||||
// cc.log(`设备或浏览器像素比例: ${cc.view.getDevicePixelRatio()}`);
|
||||
// cc.log(`画布X:设计X=${cc.view.getScaleX()} ,画布Y:设计Y=${cc.view.getScaleY()}`);
|
||||
// cc.log(`节点宽高: ${this.node.width} x ${this.node.height}`);
|
||||
// cc.log(`节点缩放: ${this.node.scaleX} x ${this.node.scaleY}`);
|
||||
// }
|
||||
|
||||
// 1. 先找到 SHOW_ALL 模式适配之后,本节点的实际宽高以及初始缩放值
|
||||
let srcScaleForShowAll = Math.min(cc.view.getCanvasSize().width / this.node.width, cc.view.getCanvasSize().height / this.node.height);
|
||||
let realWidth = this.node.width * srcScaleForShowAll;
|
||||
let realHeight = this.node.height * srcScaleForShowAll;
|
||||
|
||||
// 2. 基于第一步的数据,再做尺寸适配
|
||||
this.node.scale = Math.max(cc.view.getCanvasSize().width / realWidth, cc.view.getCanvasSize().height / realHeight);
|
||||
|
||||
// if (CC_DEBUG) {
|
||||
// cc.log(`节点在SHOW_ALL模式下展示的宽高: ${realWidth} x ${realHeight}`);
|
||||
// cc.log(`节点在SHOW_ALL模式下展示的缩放: ${srcScaleForShowAll}`);
|
||||
// cc.log(`节点在SHOW_ALL模式下还需要进行的缩放: ${this.node.scale} 才能达到全屏`);
|
||||
// }
|
||||
}
|
||||
}
|
||||
9
assets/Script/MultiResolution/BackgroundAdapter.ts.meta
Normal file
9
assets/Script/MultiResolution/BackgroundAdapter.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "c9395036-dc80-409f-9044-415dbcaec37e",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
58
assets/Script/MultiResolution/ContentAdapter.ts
Normal file
58
assets/Script/MultiResolution/ContentAdapter.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
/**
|
||||
* @classdesc 游戏主内容节点自适应所有分辨率的脚本
|
||||
* @author caizhitao
|
||||
* @version 0.1.0
|
||||
* @since 2018-11-30
|
||||
* @description
|
||||
*
|
||||
* 用法:
|
||||
* 1. 将本组件挂载在节点上即可
|
||||
*
|
||||
* 适配原理:
|
||||
* 1. 将游戏主内容节点的宽高调整为画布的大小,以进行Size适配
|
||||
*
|
||||
* 注意:
|
||||
* 1. 挂载这个脚本的节点不能加入Widget组件,不然这个适配是没有效果的
|
||||
* 2. 目前只支持 SHOW_ALL 模式下的背景缩放适配,不支持其他模式的背景缩放
|
||||
*
|
||||
* @example
|
||||
```
|
||||
// e.g.
|
||||
// 设置 SHOW_ALL 模式的参考代码
|
||||
cc.view.setDesignResolutionSize(720, 1280, cc.ResolutionPolicy.SHOW_ALL);
|
||||
```
|
||||
*/
|
||||
@ccclass
|
||||
export default class ContentAdapter extends cc.Component {
|
||||
onLoad() {
|
||||
// if (CC_DEBUG) {
|
||||
// cc.log("调整前");
|
||||
// cc.log(`屏幕分辨率: ${cc.view.getCanvasSize().width} x ${cc.view.getCanvasSize().height}`);
|
||||
// cc.log(`视图窗口可见区域分辨率: ${cc.view.getVisibleSize().width} x ${cc.view.getVisibleSize().height}`);
|
||||
// cc.log(`视图中边框尺寸: ${cc.view.getFrameSize().width} x ${cc.view.getFrameSize().height}`);
|
||||
// cc.log(`设备或浏览器像素比例: ${cc.view.getDevicePixelRatio()}`);
|
||||
// cc.log(`节点宽高: ${this.node.width} x ${this.node.height}`);
|
||||
// }
|
||||
|
||||
// 1. 先找到 SHOW_ALL 模式适配之后,本节点的实际宽高以及初始缩放值
|
||||
let srcScaleForShowAll = Math.min(cc.view.getCanvasSize().width / this.node.width, cc.view.getCanvasSize().height / this.node.height);
|
||||
let realWidth = this.node.width * srcScaleForShowAll;
|
||||
let realHeight = this.node.height * srcScaleForShowAll;
|
||||
|
||||
// 2. 基于第一步的数据,再做节点宽高适配
|
||||
this.node.width = this.node.width * (cc.view.getCanvasSize().width / realWidth);
|
||||
this.node.height = this.node.height * (cc.view.getCanvasSize().height / realHeight);
|
||||
|
||||
// if (CC_DEBUG) {
|
||||
// cc.log(`节点在SHOW_ALL模式下展示的宽高: ${realWidth} x ${realHeight}`);
|
||||
// cc.log(`节点在SHOW_ALL模式下展示的缩放: ${srcScaleForShowAll}`);
|
||||
// cc.log(
|
||||
// `节点在SHOW_ALL模式下做全屏处理后的实际宽高(${cc.view.getCanvasSize().width}x${
|
||||
// cc.view.getCanvasSize().height
|
||||
// })等价于于原节点的宽高(${this.node.width}x${this.node.height})`
|
||||
// );
|
||||
// }
|
||||
}
|
||||
}
|
||||
9
assets/Script/MultiResolution/ContentAdapter.ts.meta
Normal file
9
assets/Script/MultiResolution/ContentAdapter.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "4010d888-4746-4c84-9d7f-77efb7bd0f18",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
152
assets/Script/MultiResolution/MultiResoultionCompat.ts
Normal file
152
assets/Script/MultiResolution/MultiResoultionCompat.ts
Normal file
@@ -0,0 +1,152 @@
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class MultiResolutionCompat extends cc.Component {
|
||||
static DEFAULT_RESOLUTION_WIDTH = 720;
|
||||
static DEFAULT_RESOLUTION_HEIGHT = 1280;
|
||||
|
||||
// @property({
|
||||
// tooltip: "设计分辨率的宽度"
|
||||
// })
|
||||
// designResolutionWidth: number = MultiResolutionCompat.DEFAULT_RESOLUTION_WIDTH;
|
||||
|
||||
// @property({
|
||||
// tooltip: "设计分辨率的高度"
|
||||
// })
|
||||
// designResolutionHeight: number = MultiResolutionCompat.DEFAULT_RESOLUTION_HEIGHT;
|
||||
|
||||
onLoad() {
|
||||
// 第一种:全屏拉伸,iPhoneX或平板类的会拉伸变形
|
||||
// cc.view.setDesignResolutionSize(720, 1280, cc.ResolutionPolicy.EXACT_FIT);
|
||||
|
||||
// 第二种:1比1显示,iPhoneX上下有黑边、平板左右有黑边,但不会变形(推荐)
|
||||
// cc.view.setDesignResolutionSize(720, 1280, cc.ResolutionPolicy.EXACT_FIT);
|
||||
// var canvasSize = cc.view.getCanvasSize();
|
||||
// var proportion = canvasSize.width / canvasSize.height;
|
||||
// if (proportion >= 0.6) {
|
||||
// cc.view.setDesignResolutionSize(720, 1280, cc.ResolutionPolicy.FIXED_HEIGHT);
|
||||
// } else {
|
||||
// cc.view.setDesignResolutionSize(720, 1280, cc.ResolutionPolicy.FIXED_WIDTH);
|
||||
// }
|
||||
|
||||
// // 第三种:按照官方说明的设计分辨率宽高比和屏幕分辨率宽高比来适配
|
||||
// let canvasSize = cc.view.getCanvasSize();
|
||||
// let screenResolution = canvasSize.width / canvasSize.height;
|
||||
// let designResolutionWidth = 720;
|
||||
// let designResolutionHeight = 1280;
|
||||
// let designResolution = designResolutionWidth / designResolutionHeight;
|
||||
// if (CC_DEBUG) {
|
||||
// cc.log(`设计分辨率(${designResolutionWidth}x${designResolutionHeight}) 宽高比:${designResolution}`);
|
||||
// cc.log(`屏幕分辨率(${canvasSize.width}x${canvasSize.height}) 宽高比:${screenResolution}`);
|
||||
// if (designResolution > screenResolution) {
|
||||
// cc.log(
|
||||
// `设计分辨率缩放至于屏幕分辨率等高后的分辨率 (${designResolutionWidth * (canvasSize.height / designResolutionHeight)}x${
|
||||
// canvasSize.height
|
||||
// })`
|
||||
// );
|
||||
// cc.log("设计分辨率宽高比大于屏幕分辨率,按照官方说法,此时应该采用(Fit Height),实际应用后,会裁剪掉游戏左右两边的部分内容");
|
||||
// } else if (designResolution < screenResolution) {
|
||||
// cc.log(
|
||||
// `设计分辨率缩放至于屏幕分辨率等宽后的分辨率 (${canvasSize.width}x${designResolutionHeight *
|
||||
// (canvasSize.width / designResolutionWidth)})`
|
||||
// );
|
||||
// cc.log("设计分辨率宽高比小于屏幕分辨率,按照官方说法,此时应该采用(Fit Width),实际应用后,会裁剪掉游戏上下两边的部分内容");
|
||||
// } else {
|
||||
// cc.log("设计分辨率宽高比等于屏幕分辨率");
|
||||
// }
|
||||
// }
|
||||
// if (designResolution > screenResolution) {
|
||||
// cc.view.setDesignResolutionSize(
|
||||
// designResolutionWidth,
|
||||
// designResolutionHeight,
|
||||
// cc.ResolutionPolicy.FIXED_HEIGHT
|
||||
// );
|
||||
// } else {
|
||||
// cc.view.setDesignResolutionSize(
|
||||
// designResolutionWidth,
|
||||
// designResolutionHeight,
|
||||
// cc.ResolutionPolicy.FIXED_WIDTH
|
||||
// );
|
||||
// }
|
||||
|
||||
// 第四种:直接等比例缩放至屏幕上宽高最短的那条边,后续控制背景拉伸
|
||||
cc.view.setDesignResolutionSize(
|
||||
MultiResolutionCompat.DEFAULT_RESOLUTION_WIDTH,
|
||||
MultiResolutionCompat.DEFAULT_RESOLUTION_HEIGHT,
|
||||
cc.ResolutionPolicy.SHOW_ALL
|
||||
);
|
||||
|
||||
// this.node.scale = 1.1
|
||||
// this.node.position = cc.v2(0, -100)
|
||||
// this.node.position = this.node.position.sub(cc.v2(0, 100))
|
||||
// if (CC_DEBUG) {
|
||||
// cc.log(`屏幕分辨率: ${cc.view.getCanvasSize().width} x ${cc.view.getCanvasSize().height}`);
|
||||
// cc.log(`视图窗口可见区域分辨率: ${cc.view.getVisibleSize().width} x ${cc.view.getVisibleSize().height}`);
|
||||
// cc.log(`视图中边框尺寸: ${cc.view.getFrameSize().width} x ${cc.view.getFrameSize().height}`);
|
||||
// cc.log(`设备或浏览器像素比例: ${cc.view.getDevicePixelRatio()}`);
|
||||
// cc.log("调整前");
|
||||
// cc.log(`节点宽高: ${this.node.width} x ${this.node.height}`);
|
||||
// cc.log(`节点缩放: ${this.node.scaleX} x ${this.node.scaleY}`);
|
||||
// }
|
||||
// if (cc.view.getCanvasSize().width > cc.view.getCanvasSize().height) {
|
||||
// this.backgroundNode.scale = cc.view.getCanvasSize().width / 720;
|
||||
// } else {
|
||||
// this.backgroundNode.scale = cc.view.getCanvasSize().height / 1280;
|
||||
// }
|
||||
// if (CC_DEBUG) {
|
||||
// cc.log("调整后");
|
||||
// cc.log(`节点宽高: ${this.node.width} x ${this.node.height}`);
|
||||
// cc.log(`节点缩放: ${this.node.scaleX} x ${this.node.scaleY}`);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算当前游戏设计分辨率在ShowAll模式适配后,设计分辨率做出的缩放值
|
||||
*/
|
||||
static getShowAllModelScale(): number {
|
||||
return Math.min(
|
||||
cc.view.getCanvasSize().width / this.DEFAULT_RESOLUTION_WIDTH,
|
||||
cc.view.getCanvasSize().height / this.DEFAULT_RESOLUTION_HEIGHT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算当前游戏设计分辨率在ShowAll模式适配后,设计分辨率下的界面的实际高度
|
||||
*/
|
||||
static getShowAllModelRealHeight(): number {
|
||||
return this.DEFAULT_RESOLUTION_HEIGHT * this.getShowAllModelScale();
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算当前游戏设计分辨率在ShowAll模式适配后,设计分辨率下的界面的实际宽度
|
||||
*/
|
||||
static getShowAllModelRealWidth(): number {
|
||||
return this.DEFAULT_RESOLUTION_WIDTH * this.getShowAllModelScale();
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算当前游戏设计分辨率在ShowAll模式适配后,上下边界的黑边之和的总高度
|
||||
*/
|
||||
static getShowAllModelVerticalBorderHeight(): number {
|
||||
return cc.view.getCanvasSize().height - this.getShowAllModelRealHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算当前游戏设计分辨率在ShowAll模式适配后,左右边界的黑边之和的总宽度
|
||||
*/
|
||||
static getShowAllModelHorizontalBorderWidth(): number {
|
||||
return cc.view.getCanvasSize().width - this.getShowAllModelRealWidth();
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算当前游戏设计分辨率在ShowAll模式适配后,传入来的原始坐标在ShowAll模式下的「贴近屏幕底部」实际坐标值
|
||||
*/
|
||||
static getShowAllModelNodePositionCloseToBottom(nodePosInDesign: cc.Vec2): cc.Vec2 {
|
||||
let srcScaleForShowAll = MultiResolutionCompat.getShowAllModelScale();
|
||||
let bottomBorderHeightInCanvas = MultiResolutionCompat.getShowAllModelVerticalBorderHeight() / 2;
|
||||
let srcNodePosYInCanvas = nodePosInDesign.y * srcScaleForShowAll;
|
||||
let finalNodePosYInCanvas = srcNodePosYInCanvas - bottomBorderHeightInCanvas;
|
||||
let nodePosYInDesign = finalNodePosYInCanvas / srcScaleForShowAll;
|
||||
return cc.v2(nodePosInDesign.x, nodePosYInDesign);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "b6c425b3-eb8b-4361-8a94-0546c2d98456",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
25
assets/Script/VerticalSceneControl.ts
Normal file
25
assets/Script/VerticalSceneControl.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class VerticalSceneControl extends cc.Component {
|
||||
@property(cc.ProgressBar)
|
||||
progressBar: cc.ProgressBar = null;
|
||||
|
||||
@property(cc.Label)
|
||||
progressLabel: cc.Label = null;
|
||||
|
||||
start() {
|
||||
this.progressBar.node.width = this.progressBar.node.getParent().width;
|
||||
this.progressBar.node.height = this.progressBar.node.getParent().height;
|
||||
this.progressBar.totalLength = this.progressBar.node.width;
|
||||
this.progressBar.progress = 0;
|
||||
this.schedule(() => {
|
||||
// 无限重置
|
||||
if (this.progressBar.progress > 1) {
|
||||
this.progressBar.progress = 0;
|
||||
}
|
||||
this.progressBar.progress = this.progressBar.progress + 0.01;
|
||||
this.progressLabel.string = `正在加载 ${Math.floor(this.progressBar.progress * 100)}%`;
|
||||
}, 0.1);
|
||||
}
|
||||
}
|
||||
9
assets/Script/VerticalSceneControl.ts.meta
Normal file
9
assets/Script/VerticalSceneControl.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "29806b16-20f3-4be8-943b-b84179b738c2",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
7
assets/Texture.meta
Normal file
7
assets/Texture.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "c109b66d-9830-46f7-a5a3-294992abb2bb",
|
||||
"isSubpackage": false,
|
||||
"subpackageName": "",
|
||||
"subMetas": {}
|
||||
}
|
||||
BIN
assets/Texture/bg_720x1280_1.jpg
Normal file
BIN
assets/Texture/bg_720x1280_1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 168 KiB |
31
assets/Texture/bg_720x1280_1.jpg.meta
Normal file
31
assets/Texture/bg_720x1280_1.jpg.meta
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"ver": "2.2.0",
|
||||
"uuid": "53debd90-6354-4b15-a66c-00a5e900cfcd",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"subMetas": {
|
||||
"bg_720x1280_1": {
|
||||
"ver": "1.0.3",
|
||||
"uuid": "6f1f9eef-632c-458d-bc78-a489b5352130",
|
||||
"rawTextureUuid": "53debd90-6354-4b15-a66c-00a5e900cfcd",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 720,
|
||||
"height": 1280,
|
||||
"rawWidth": 720,
|
||||
"rawHeight": 1280,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
assets/Texture/bg_720x1280_2.jpg
Normal file
BIN
assets/Texture/bg_720x1280_2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 264 KiB |
31
assets/Texture/bg_720x1280_2.jpg.meta
Normal file
31
assets/Texture/bg_720x1280_2.jpg.meta
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"ver": "2.2.0",
|
||||
"uuid": "d7d333e7-5fb1-446c-b8b3-126dd1d6b2dd",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"subMetas": {
|
||||
"bg_720x1280_2": {
|
||||
"ver": "1.0.3",
|
||||
"uuid": "d850b577-9bd2-4846-a1fa-69294d397da5",
|
||||
"rawTextureUuid": "d7d333e7-5fb1-446c-b8b3-126dd1d6b2dd",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 720,
|
||||
"height": 1280,
|
||||
"rawWidth": 720,
|
||||
"rawHeight": 1280,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
24564
creator.d.ts
vendored
Normal file
24564
creator.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
15
jsconfig.json
Normal file
15
jsconfig.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"module": "commonjs",
|
||||
"experimentalDecorators": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
".vscode",
|
||||
"library",
|
||||
"local",
|
||||
"settings",
|
||||
"temp"
|
||||
]
|
||||
}
|
||||
4
project.json
Normal file
4
project.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"engine": "cocos-creator-js",
|
||||
"packages": "packages"
|
||||
}
|
||||
34
settings/project.json
Normal file
34
settings/project.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"start-scene": "current",
|
||||
"group-list": [
|
||||
"default"
|
||||
],
|
||||
"collision-matrix": [
|
||||
[
|
||||
true
|
||||
]
|
||||
],
|
||||
"excluded-modules": [],
|
||||
"last-module-event-record-time": 0,
|
||||
"design-resolution-width": 960,
|
||||
"design-resolution-height": 640,
|
||||
"fit-width": false,
|
||||
"fit-height": true,
|
||||
"use-project-simulator-setting": false,
|
||||
"simulator-orientation": false,
|
||||
"use-customize-simulator": false,
|
||||
"simulator-resolution": {
|
||||
"width": 960,
|
||||
"height": 640
|
||||
},
|
||||
"facebook": {
|
||||
"enable": false,
|
||||
"appID": "",
|
||||
"live": {
|
||||
"enable": false
|
||||
},
|
||||
"audience": {
|
||||
"enable": false
|
||||
}
|
||||
}
|
||||
}
|
||||
78
settings/services.json
Normal file
78
settings/services.json
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"services": [
|
||||
{
|
||||
"service_id": "235",
|
||||
"service_name": "Cocos Analytics",
|
||||
"service_desc": "提供最核心最基本的数据、标准化界面功能简洁易用、数据准确性最好",
|
||||
"service_title": "精准了解游戏的新增、活跃、留存、付费等数据",
|
||||
"service_icon": "https://account.cocos.com/client/3f8f31ccf66995e183044f167c092395.png",
|
||||
"service_guide_url": "https://analytics.cocos.com/docs/",
|
||||
"service_sample_url": "https://github.com/cocos-creator/tutorial-dark-slash",
|
||||
"service_dev_url": "http://analytics.cocos.com/realtime/jump_to/<app_id>",
|
||||
"service_type": "3",
|
||||
"service_type_zh": "公司和个人游戏",
|
||||
"support_platform": [
|
||||
"Android",
|
||||
"iOS",
|
||||
"HTML5"
|
||||
],
|
||||
"package_download_url": "http://download.cocos.com/CocosServices/plugins/service-analytics/1.0.0_1.0.5.zip",
|
||||
"package_version_desc": "",
|
||||
"service_component_name": "service-analytics",
|
||||
"package_versions": [
|
||||
"1.0.0_1.0.5"
|
||||
],
|
||||
"build_platform": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"service_id": "241",
|
||||
"service_name": "Matchvs",
|
||||
"service_desc": "通过SDK接入快速实现联网功能、帧同步、国内外多节点、服务器独立部署、gameServer自定义游戏服务端逻辑。\n技术支持群QQ群:450335262",
|
||||
"service_title": "专业成熟的移动游戏联网与服务端解决方案",
|
||||
"service_icon": "https://account.cocos.com/client/14406719a07eb3d714d36e5edc6e06fa.png",
|
||||
"service_guide_url": "http://doc.matchvs.com/QuickStart/QuickStart-CocosCreator",
|
||||
"service_sample_url": "http://www.matchvs.com/serviceCourse",
|
||||
"service_dev_url": "http://www.matchvs.com/cocosLogin",
|
||||
"service_type": "2",
|
||||
"service_type_zh": "仅支持公司游戏",
|
||||
"support_platform": [
|
||||
"Android",
|
||||
"iOS",
|
||||
"HTML5"
|
||||
],
|
||||
"package_download_url": "http://download.cocos.com/CocosServices/plugins/service-matchvs/1.0.5_3.7.7.3.zip",
|
||||
"package_version_desc": "",
|
||||
"service_component_name": "service-matchvs",
|
||||
"package_versions": [
|
||||
],
|
||||
"build_platform": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"service_id": "7",
|
||||
"service_name": "AnySDK",
|
||||
"service_desc": "800+渠道、支持多平台多引擎、安全稳定的本地打包工具。技术支持:https://forum.cocos.com/c/anysdk",
|
||||
"service_title": "游戏快速接入第三方SDK的解决方案",
|
||||
"service_icon": "https://account.cocos.com/client/3ba1fcf9029140cf08d95813e387d04a.png",
|
||||
"service_guide_url": "http://docs.anysdk.com",
|
||||
"service_sample_url": "http://github.com/AnySDK",
|
||||
"service_dev_url": "http://dev.anysdk.com",
|
||||
"service_type": "2",
|
||||
"service_type_zh": "仅支持公司游戏",
|
||||
"support_platform": [
|
||||
"Android",
|
||||
"iOS",
|
||||
"HTML5"
|
||||
],
|
||||
"package_download_url": "http://download.cocos.com/CocosServices/plugins/service-anysdk/1.0.0_2.2.5.zip",
|
||||
"package_version_desc": "",
|
||||
"service_component_name": "service-anysdk",
|
||||
"package_versions": [
|
||||
"1.0.0_2.2.5"
|
||||
],
|
||||
"build_platform": [
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
17
tsconfig.json
Normal file
17
tsconfig.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [ "dom", "es5", "es2015.promise" ],
|
||||
"target": "es5",
|
||||
"experimentalDecorators": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"library",
|
||||
"local",
|
||||
"temp",
|
||||
"build",
|
||||
"settings"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user