diff --git a/creator_project/assets/Fonts.meta b/creator_project/assets/Fonts.meta new file mode 100644 index 00000000..e7897066 --- /dev/null +++ b/creator_project/assets/Fonts.meta @@ -0,0 +1,5 @@ +{ + "ver": "1.0.1", + "uuid": "f82f7ebe-df7e-4210-86ba-c8284eceec44", + "subMetas": {} +} \ No newline at end of file diff --git a/creator_project/assets/Fonts/Marker Felt.ttf b/creator_project/assets/Fonts/Marker Felt.ttf new file mode 100644 index 00000000..3752ef31 Binary files /dev/null and b/creator_project/assets/Fonts/Marker Felt.ttf differ diff --git a/creator_project/assets/Fonts/Marker Felt.ttf.meta b/creator_project/assets/Fonts/Marker Felt.ttf.meta new file mode 100644 index 00000000..ceb4721d --- /dev/null +++ b/creator_project/assets/Fonts/Marker Felt.ttf.meta @@ -0,0 +1,5 @@ +{ + "ver": "1.0.0", + "uuid": "5fd4c05a-b83f-4d52-9f46-0ac57c930515", + "subMetas": {} +} \ No newline at end of file diff --git a/creator_project/assets/Fonts/arial.ttf b/creator_project/assets/Fonts/arial.ttf new file mode 100644 index 00000000..abc899cd Binary files /dev/null and b/creator_project/assets/Fonts/arial.ttf differ diff --git a/creator_project/assets/Fonts/arial.ttf.meta b/creator_project/assets/Fonts/arial.ttf.meta new file mode 100644 index 00000000..d93ec7bf --- /dev/null +++ b/creator_project/assets/Fonts/arial.ttf.meta @@ -0,0 +1,5 @@ +{ + "ver": "1.0.0", + "uuid": "64f5cc32-28f6-49d1-9d50-e6110acaf304", + "subMetas": {} +} \ No newline at end of file diff --git a/creator_project/assets/Texture.meta b/creator_project/assets/Texture.meta new file mode 100644 index 00000000..f483d198 --- /dev/null +++ b/creator_project/assets/Texture.meta @@ -0,0 +1,6 @@ +{ + "ver": "1.0.1", + "uuid": "7b81d4e8-ec84-4716-968d-500ac1d78a54", + "isGroup": false, + "subMetas": {} +} \ No newline at end of file diff --git a/creator_project/assets/Texture/Button_GreenSmall.png b/creator_project/assets/Texture/Button_GreenSmall.png new file mode 100644 index 00000000..218bf498 Binary files /dev/null and b/creator_project/assets/Texture/Button_GreenSmall.png differ diff --git a/creator_project/assets/Texture/Button_GreenSmall.png.meta b/creator_project/assets/Texture/Button_GreenSmall.png.meta new file mode 100644 index 00000000..9b7dca0d --- /dev/null +++ b/creator_project/assets/Texture/Button_GreenSmall.png.meta @@ -0,0 +1,30 @@ +{ + "ver": "1.0.0", + "uuid": "4e155528-a1bc-448a-b3c0-c5bf24faff3e", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "subMetas": { + "Button_GreenSmall": { + "ver": "1.0.3", + "uuid": "ef818655-f97e-4771-b29d-4de573feb41b", + "rawTextureUuid": "4e155528-a1bc-448a-b3c0-c5bf24faff3e", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 53, + "height": 53, + "rawWidth": 53, + "rawHeight": 53, + "borderTop": 8, + "borderBottom": 11, + "borderLeft": 11, + "borderRight": 11, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/creator_project/assets/Texture/Button_GreySmall.png b/creator_project/assets/Texture/Button_GreySmall.png new file mode 100644 index 00000000..85e4fd9a Binary files /dev/null and b/creator_project/assets/Texture/Button_GreySmall.png differ diff --git a/creator_project/assets/Texture/Button_GreySmall.png.meta b/creator_project/assets/Texture/Button_GreySmall.png.meta new file mode 100644 index 00000000..6bb4666f --- /dev/null +++ b/creator_project/assets/Texture/Button_GreySmall.png.meta @@ -0,0 +1,30 @@ +{ + "ver": "1.0.0", + "uuid": "8039dcf8-39c1-4e99-bec7-4c1a6b8d6866", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "subMetas": { + "Button_GreySmall": { + "ver": "1.0.3", + "uuid": "5a8bb27a-b99c-4a9b-8d8e-39fd0074d260", + "rawTextureUuid": "8039dcf8-39c1-4e99-bec7-4c1a6b8d6866", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 53, + "height": 53, + "rawWidth": 53, + "rawHeight": 53, + "borderTop": 11, + "borderBottom": 11, + "borderLeft": 11, + "borderRight": 11, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/creator_project/assets/Texture/HelloWorld.png b/creator_project/assets/Texture/HelloWorld.png new file mode 100644 index 00000000..21d43268 Binary files /dev/null and b/creator_project/assets/Texture/HelloWorld.png differ diff --git a/creator_project/assets/Texture/HelloWorld.png.meta b/creator_project/assets/Texture/HelloWorld.png.meta new file mode 100644 index 00000000..9c52a59e --- /dev/null +++ b/creator_project/assets/Texture/HelloWorld.png.meta @@ -0,0 +1,30 @@ +{ + "ver": "1.0.0", + "uuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "subMetas": { + "HelloWorld": { + "ver": "1.0.3", + "uuid": "31bc895a-c003-4566-a9f3-2e54ae1c17dc", + "rawTextureUuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 195, + "height": 270, + "rawWidth": 195, + "rawHeight": 270, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/creator_project/assets/Texture/grossini.png b/creator_project/assets/Texture/grossini.png new file mode 100755 index 00000000..fad80b8e Binary files /dev/null and b/creator_project/assets/Texture/grossini.png differ diff --git a/creator_project/assets/Texture/grossini.png.meta b/creator_project/assets/Texture/grossini.png.meta new file mode 100644 index 00000000..e06a320a --- /dev/null +++ b/creator_project/assets/Texture/grossini.png.meta @@ -0,0 +1,30 @@ +{ + "ver": "1.0.0", + "uuid": "d26156f2-f788-469b-98de-60e233925f89", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "subMetas": { + "grossini": { + "ver": "1.0.3", + "uuid": "0611428d-39f3-4ee6-a77f-f7437b1f7054", + "rawTextureUuid": "d26156f2-f788-469b-98de-60e233925f89", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": -1, + "trimX": 17, + "trimY": 7, + "width": 51, + "height": 109, + "rawWidth": 85, + "rawHeight": 121, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/creator_project/assets/Texture/singleColor.png b/creator_project/assets/Texture/singleColor.png new file mode 100644 index 00000000..ea5bd0b8 Binary files /dev/null and b/creator_project/assets/Texture/singleColor.png differ diff --git a/creator_project/assets/Texture/singleColor.png.meta b/creator_project/assets/Texture/singleColor.png.meta new file mode 100644 index 00000000..89cdf748 --- /dev/null +++ b/creator_project/assets/Texture/singleColor.png.meta @@ -0,0 +1,30 @@ +{ + "ver": "1.0.0", + "uuid": "a8027877-d8d6-4645-97a0-52d4a0123dba", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "subMetas": { + "singleColor": { + "ver": "1.0.3", + "uuid": "410fb916-8721-4663-bab8-34397391ace7", + "rawTextureUuid": "a8027877-d8d6-4645-97a0-52d4a0123dba", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 2, + "height": 2, + "rawWidth": 2, + "rawHeight": 2, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/creator_project/assets/scenes/CustomClassTest.meta b/creator_project/assets/scenes/CustomClassTest.meta new file mode 100644 index 00000000..34827610 --- /dev/null +++ b/creator_project/assets/scenes/CustomClassTest.meta @@ -0,0 +1,5 @@ +{ + "ver": "1.0.1", + "uuid": "50a63c6c-8082-489f-a895-a3030c544fc1", + "subMetas": {} +} \ No newline at end of file diff --git a/creator_project/assets/scenes/CustomClassTest/WelcomeScene.fire b/creator_project/assets/scenes/CustomClassTest/WelcomeScene.fire new file mode 100644 index 00000000..0094ad5b --- /dev/null +++ b/creator_project/assets/scenes/CustomClassTest/WelcomeScene.fire @@ -0,0 +1,864 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "", + "_objFlags": 0, + "_rawFiles": null, + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 4 + }, + { + "__id__": 7 + }, + { + "__id__": 9 + }, + { + "__id__": 17 + } + ], + "_tag": -1, + "_active": true, + "_components": [], + "_prefab": null, + "_id": "a930ad0a-317e-4044-bb32-b23d747e80bc", + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_cascadeOpacityEnabled": true, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 0, + "height": 0 + }, + "_localZOrder": 0, + "_globalZOrder": 0, + "_opacityModifyRGB": false, + "groupIndex": 0, + "autoReleaseAssets": false + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_tag": -1, + "_active": true, + "_components": [ + { + "__id__": 3 + } + ], + "_prefab": null, + "_id": "4011UGIm5Fd5D/SE2mToW3", + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_cascadeOpacityEnabled": true, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 960, + "height": 640 + }, + "_rotationX": 0, + "_rotationY": 0, + "_scaleX": 1, + "_scaleY": 1, + "_position": { + "__type__": "cc.Vec2", + "x": 480, + "y": 320 + }, + "_skewX": 0, + "_skewY": 0, + "_localZOrder": 0, + "_globalZOrder": 0, + "_opacityModifyRGB": false, + "groupIndex": 0 + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_designResolution": { + "__type__": "cc.Size", + "width": 960, + "height": 640 + }, + "_fitWidth": false, + "_fitHeight": true + }, + { + "__type__": "cc.Node", + "_name": "BackgroundLayer", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_tag": -1, + "_active": true, + "_components": [ + { + "__id__": 5 + }, + { + "__id__": 6 + } + ], + "_prefab": null, + "_id": "0fjN+nlJ9Pdp/twk8SCcnR", + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 34, + "g": 29, + "b": 29, + "a": 255 + }, + "_cascadeOpacityEnabled": true, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 960, + "height": 640 + }, + "_rotationX": 0, + "_rotationY": 0, + "_scaleX": 1, + "_scaleY": 1, + "_position": { + "__type__": "cc.Vec2", + "x": 480, + "y": 320 + }, + "_skewX": 0, + "_skewY": 0, + "_localZOrder": 0, + "_globalZOrder": 0, + "_opacityModifyRGB": false, + "groupIndex": 0 + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 4 + }, + "_enabled": true, + "_spriteFrame": { + "__uuid__": "9bbda31e-ad49-43c9-aaf2-f7d9896bac69" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_atlas": null + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 4 + }, + "_enabled": true, + "_layoutSize": { + "__type__": "cc.Size", + "width": 960, + "height": 640 + }, + "_resize": 0, + "_N$layoutType": 0, + "_N$padding": 0, + "_N$cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_N$startAxis": 0, + "_N$paddingLeft": 0, + "_N$paddingRight": 0, + "_N$paddingTop": 0, + "_N$paddingBottom": 0, + "_N$spacingX": 0, + "_N$spacingY": 0, + "_N$verticalDirection": 1, + "_N$horizontalDirection": 0 + }, + { + "__type__": "cc.Node", + "_name": "HelloWorldSprite", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_tag": -1, + "_active": true, + "_components": [ + { + "__id__": 8 + } + ], + "_prefab": null, + "_id": "caWho16nVHPbdo2ABAs21V", + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_cascadeOpacityEnabled": true, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 195, + "height": 270 + }, + "_rotationX": 0, + "_rotationY": 0, + "_scaleX": 1, + "_scaleY": 1, + "_position": { + "__type__": "cc.Vec2", + "x": 480, + "y": 320 + }, + "_skewX": 0, + "_skewY": 0, + "_localZOrder": 0, + "_globalZOrder": 0, + "_opacityModifyRGB": false, + "groupIndex": 0 + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 7 + }, + "_enabled": true, + "_spriteFrame": { + "__uuid__": "31bc895a-c003-4566-a9f3-2e54ae1c17dc" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_atlas": null + }, + { + "__type__": "cc.Node", + "_name": "Layer_CustomLayer_RootLayer", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 10 + }, + { + "__id__": 12 + } + ], + "_tag": -1, + "_active": true, + "_components": [], + "_prefab": null, + "_id": "b6qtMAI+VJPoqTiF/t6QK7", + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_cascadeOpacityEnabled": true, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 0, + "height": 0 + }, + "_rotationX": 0, + "_rotationY": 0, + "_scaleX": 1, + "_scaleY": 1, + "_position": { + "__type__": "cc.Vec2", + "x": 100, + "y": 320 + }, + "_skewX": 0, + "_skewY": 0, + "_localZOrder": 0, + "_globalZOrder": 0, + "_opacityModifyRGB": false, + "groupIndex": 0 + }, + { + "__type__": "cc.Node", + "_name": "LayerInfoLabel", + "_objFlags": 0, + "_parent": { + "__id__": 9 + }, + "_children": [], + "_tag": -1, + "_active": true, + "_components": [ + { + "__id__": 11 + } + ], + "_prefab": null, + "_id": "1bQ8FqrpVLEISuoJhEXEZD", + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_cascadeOpacityEnabled": true, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 278, + "height": 22 + }, + "_rotationX": 0, + "_rotationY": 0, + "_scaleX": 1, + "_scaleY": 1, + "_position": { + "__type__": "cc.Vec2", + "x": 75, + "y": 104 + }, + "_skewX": 0, + "_skewY": 0, + "_localZOrder": 0, + "_globalZOrder": 0, + "_opacityModifyRGB": false, + "groupIndex": 0 + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 10 + }, + "_enabled": true, + "_useOriginalSize": false, + "_actualFontSize": 22, + "_fontSize": 22, + "_lineHeight": 22, + "_enableWrapText": true, + "_N$file": { + "__uuid__": "5fd4c05a-b83f-4d52-9f46-0ac57c930515" + }, + "_isSystemFontUsed": false, + "_spacingX": 0, + "_N$string": "CustomLayer Created With Scene", + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 0 + }, + { + "__type__": "cc.Node", + "_name": "BackgroundImg", + "_objFlags": 0, + "_parent": { + "__id__": 9 + }, + "_children": [ + { + "__id__": 13 + } + ], + "_tag": -1, + "_active": true, + "_components": [ + { + "__id__": 15 + }, + { + "__id__": 16 + } + ], + "_prefab": null, + "_id": "25vbv9t5pE3qKHizdS6Jk/", + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 174, + "g": 241, + "b": 209, + "a": 255 + }, + "_cascadeOpacityEnabled": true, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 150, + "height": 150 + }, + "_rotationX": 0, + "_rotationY": 0, + "_scaleX": 1, + "_scaleY": 1, + "_position": { + "__type__": "cc.Vec2", + "x": 75, + "y": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_localZOrder": 0, + "_globalZOrder": 0, + "_opacityModifyRGB": false, + "groupIndex": 0 + }, + { + "__type__": "cc.Node", + "_name": "CharacterSprite", + "_objFlags": 0, + "_parent": { + "__id__": 12 + }, + "_children": [], + "_tag": -1, + "_active": true, + "_components": [ + { + "__id__": 14 + } + ], + "_prefab": null, + "_id": "7d0jT0hiRAmp6hcM9jaJaz", + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_cascadeOpacityEnabled": true, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 51, + "height": 109 + }, + "_rotationX": 0, + "_rotationY": 0, + "_scaleX": 1, + "_scaleY": 1, + "_position": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_localZOrder": 0, + "_globalZOrder": 0, + "_opacityModifyRGB": false, + "groupIndex": 0 + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 13 + }, + "_enabled": true, + "_spriteFrame": { + "__uuid__": "0611428d-39f3-4ee6-a77f-f7437b1f7054" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_atlas": null + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 12 + }, + "_enabled": true, + "_spriteFrame": { + "__uuid__": "9bbda31e-ad49-43c9-aaf2-f7d9896bac69" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_atlas": null + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 12 + }, + "_enabled": true, + "_layoutSize": { + "__type__": "cc.Size", + "width": 150, + "height": 150 + }, + "_resize": 0, + "_N$layoutType": 0, + "_N$padding": 0, + "_N$cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_N$startAxis": 0, + "_N$paddingLeft": 0, + "_N$paddingRight": 0, + "_N$paddingTop": 0, + "_N$paddingBottom": 0, + "_N$spacingX": 0, + "_N$spacingY": 0, + "_N$verticalDirection": 1, + "_N$horizontalDirection": 0 + }, + { + "__type__": "cc.Node", + "_name": "CreateLayerButton", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 18 + } + ], + "_tag": -1, + "_active": true, + "_components": [ + { + "__id__": 20 + }, + { + "__id__": 21 + } + ], + "_prefab": null, + "_id": "145T3hudlMVJrEF9XaCrwu", + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_cascadeOpacityEnabled": true, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 200, + "height": 50 + }, + "_rotationX": 0, + "_rotationY": 0, + "_scaleX": 1, + "_scaleY": 1, + "_position": { + "__type__": "cc.Vec2", + "x": 482, + "y": 147 + }, + "_skewX": 0, + "_skewY": 0, + "_localZOrder": 0, + "_globalZOrder": 0, + "_opacityModifyRGB": false, + "groupIndex": 0 + }, + { + "__type__": "cc.Node", + "_name": "CreateLayerLabel", + "_objFlags": 0, + "_parent": { + "__id__": 17 + }, + "_children": [], + "_tag": -1, + "_active": true, + "_components": [ + { + "__id__": 19 + } + ], + "_prefab": null, + "_id": "495XY1yddB9r+2P8L9Qo3j", + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_cascadeOpacityEnabled": true, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 190, + "height": 20 + }, + "_rotationX": 0, + "_rotationY": 0, + "_scaleX": 1, + "_scaleY": 1, + "_position": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_localZOrder": 0, + "_globalZOrder": 0, + "_opacityModifyRGB": false, + "groupIndex": 0 + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 18 + }, + "_enabled": true, + "_useOriginalSize": false, + "_actualFontSize": 20, + "_fontSize": 20, + "_lineHeight": 20, + "_enableWrapText": true, + "_N$file": { + "__uuid__": "5fd4c05a-b83f-4d52-9f46-0ac57c930515" + }, + "_isSystemFontUsed": false, + "_spacingX": 0, + "_N$string": "CREATE CUSTOM LAYER", + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 0 + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 17 + }, + "_enabled": true, + "_spriteFrame": { + "__uuid__": "ef818655-f97e-4771-b29d-4de573feb41b" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_atlas": null + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 17 + }, + "_enabled": true, + "transition": 2, + "pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "duration": 0.1, + "zoomScale": 1.2, + "clickEvents": [], + "_N$interactable": true, + "_N$enableAutoGrayEffect": true, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$disabledColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$normalSprite": { + "__uuid__": "ef818655-f97e-4771-b29d-4de573feb41b" + }, + "_N$pressedSprite": { + "__uuid__": "5a8bb27a-b99c-4a9b-8d8e-39fd0074d260" + }, + "pressedSprite": { + "__uuid__": "5a8bb27a-b99c-4a9b-8d8e-39fd0074d260" + }, + "_N$hoverSprite": null, + "hoverSprite": null, + "_N$disabledSprite": null, + "_N$target": { + "__id__": 17 + } + } +] \ No newline at end of file diff --git a/creator_project/assets/scenes/CustomClassTest/WelcomeScene.fire.meta b/creator_project/assets/scenes/CustomClassTest/WelcomeScene.fire.meta new file mode 100644 index 00000000..12dc6542 --- /dev/null +++ b/creator_project/assets/scenes/CustomClassTest/WelcomeScene.fire.meta @@ -0,0 +1,7 @@ +{ + "ver": "1.0.0", + "uuid": "a930ad0a-317e-4044-bb32-b23d747e80bc", + "asyncLoadAssets": false, + "autoReleaseAssets": false, + "subMetas": {} +} \ No newline at end of file diff --git a/creator_project/packages/creator-luacpp-support/reader/CocosObjectFactory.cpp b/creator_project/packages/creator-luacpp-support/reader/CocosObjectFactory.cpp new file mode 100644 index 00000000..2bd6a571 --- /dev/null +++ b/creator_project/packages/creator-luacpp-support/reader/CocosObjectFactory.cpp @@ -0,0 +1,11 @@ +#include "CocosObjectFactory.h" + +FACTORY_MAP CocosObject::factories; + +void CocosObject::registerFactory(const std::string& classname_str, CocosObjectFactory *factory) { + CocosObject::factories[classname_str] = factory; +} + +FACTORY_MAP CocosObject::getFactoryMap() { + return CocosObject::factories; +} \ No newline at end of file diff --git a/creator_project/packages/creator-luacpp-support/reader/CocosObjectFactory.h b/creator_project/packages/creator-luacpp-support/reader/CocosObjectFactory.h new file mode 100644 index 00000000..10cabb29 --- /dev/null +++ b/creator_project/packages/creator-luacpp-support/reader/CocosObjectFactory.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +class CocosObjectFactory; + +typedef std::map FACTORY_MAP; +class CocosObject { +private: + static FACTORY_MAP factories; + +public: + static void registerFactory(const std::string& classname_str, CocosObjectFactory *factory); + static FACTORY_MAP getFactoryMap(); +}; + +class CocosObjectFactory { +public: + virtual CocosObject* createFactoryNode() = 0; +}; \ No newline at end of file diff --git a/creator_project/packages/creator-luacpp-support/reader/CreatorReader.cpp b/creator_project/packages/creator-luacpp-support/reader/CreatorReader.cpp index 45989582..130f039c 100644 --- a/creator_project/packages/creator-luacpp-support/reader/CreatorReader.cpp +++ b/creator_project/packages/creator-luacpp-support/reader/CreatorReader.cpp @@ -28,6 +28,7 @@ #include "ui/RichtextStringVisitor.h" #include "ui/PageView.h" #include "collider/Collider.h" +#include "CocosObjectFactory.h" #include #include @@ -41,6 +42,8 @@ USING_NS_CCR; static void setSpriteQuad(V3F_C4B_T2F_Quad* quad, const cocos2d::Size& origSize, const int x, const int y, float x_factor, float y_factor); static void tileSprite(cocos2d::Sprite* sprite); +static ValueVector splitStringByDelimeter(std::string nodename, char delim); +static std::string toLowerCase(std::string stringToConvert); namespace { template @@ -386,18 +389,21 @@ cocos2d::Node* CreatorReader::createTree(const buffers::NodeTree* tree) const cocos2d::Node* child = createTree(childBuffer); if (child && node) { + // pabitra: It's better control for the user the get reference of the label node, + // than being added as a property of the Button. + // should adjust child's position except Button's label - if (parsing_button && dynamic_cast(child) != nullptr) - { - auto button = static_cast(node); - auto label = static_cast(child); - button->setTitleLabel(label); - } - else - { + // if (parsing_button && dynamic_cast(child) != nullptr) + // { + // auto button = static_cast(node); + // auto label = static_cast(child); + // button->setTitleLabel(label); + // } + // else + // { node->addChild(child); adjustPosition(child); - } + // } } } @@ -422,9 +428,23 @@ void CreatorReader::parseScene(cocos2d::Scene* scene, const buffers::Scene* scen cocos2d::Node* CreatorReader::createNode(const buffers::Node* nodeBuffer) const { - cocos2d::Node* node = cocos2d::Node::create(); - if (node) - parseNode(node, nodeBuffer); + const auto& name = nodeBuffer->name(); + std::string nodename = name->c_str(); + + const ValueVector& splits = splitStringByDelimeter(nodename, '_'); + std::string typeStr = toLowerCase(splits.at(0).asString()); + + cocos2d::Node* node = nullptr; + if (inspectForCustomClassFormat(typeStr) && splits.size() > 1) { + // getting the specific factory by passing string and creating object from it. + std::string classname = splits.at(1).asString(); + FACTORY_MAP factoryMap = CocosObject::getFactoryMap(); + CocosObjectFactory* factory = static_cast(factoryMap[classname]); + node = reinterpret_cast(factory->createFactoryNode()); + } else { + node = cocos2d::Node::create(); + } + if (node) parseNode(node, nodeBuffer); return node; } @@ -1454,6 +1474,15 @@ void CreatorReader::adjustPosition(cocos2d::Node* node) const } } +bool CreatorReader::inspectForCustomClassFormat(std::string nodename) const { + // split the nodename by delimeter (_) underscore, then check the first part as layer + const ValueVector& splits = splitStringByDelimeter(nodename, '_'); + if ((splits.size() > 0) && toLowerCase(splits.at(0).asString()) == "layer") { + return true; + } + return false; +} + // // Helper free functions // @@ -1537,3 +1566,20 @@ static void tileSprite(cocos2d::Sprite* sprite) // there should be a way to pass ownership so that it is not needed to copy them sprite->setPolygonInfo(poly); } + +ValueVector splitStringByDelimeter(std::string str, char delim) { + ValueVector res = ValueVectorNull; + std::ostringstream stream; + std::istringstream f(str); + std::string s; + + while (getline(f, s, delim)) { + res.push_back(cocos2d::Value(s)); + } + return res; +} + +std::string toLowerCase(std::string stringToConvert){ + std::transform(stringToConvert.begin(), stringToConvert.end(), stringToConvert.begin(), ::tolower); + return stringToConvert; +} diff --git a/creator_project/packages/creator-luacpp-support/reader/CreatorReader.h b/creator_project/packages/creator-luacpp-support/reader/CreatorReader.h index 3fc38d80..09d01815 100644 --- a/creator_project/packages/creator-luacpp-support/reader/CreatorReader.h +++ b/creator_project/packages/creator-luacpp-support/reader/CreatorReader.h @@ -35,8 +35,6 @@ #include "dragonbones/DragonBonesHeaders.h" #include "dragonbones/cocos2dx/CCDragonBonesHeaders.h" - - NS_CCR_BEGIN class CreatorReader: public cocos2d::Ref @@ -49,6 +47,53 @@ class CreatorReader: public cocos2d::Ref @return A `Scene*` */ cocos2d::Scene* getSceneGraph() const; + + /** + Returns the nodegraph contained in the .ccreator file for a particular node + @return A `T*` + */ + template + cocos2d::Node* getNodeGraph(const std::string& nodename) const { + // NOTE: + // Keep in mind that a layer is most of the required cross-scenes. + // + // Since, Cocos Creator packs everything in a .ccreator file, with Scene as the root node + // creating custom class objects for layers is not possible directly, like cocos reader + // where layers can be saved as a separate .csb file. + // So, we have to pass the node name of the file, that the custom class needs to be attached. + // Also, make the node standalone, remove it from it's parent. + + const void* buffer = _data.getBytes(); + + auto sceneGraph = buffers::GetSceneGraph(buffer); + auto nodeTree = sceneGraph->root(); + CCLOG("NodeTree: %p", nodeTree); + + cocos2d::Node* searchNode = nullptr; + cocos2d::Node* node = createTree(nodeTree); + + // pabitra: change in cocos2d-x, recursively iterates through the children + // to find the node with the name from the root node. + if (node) { + searchNode = node->getChildByName(nodename); + CC_ASSERT(searchNode); + if (searchNode) { + // NOTE: cleanup shouldn't remove the attached listeners and event dispatchers + // so it should always be removeFromParentAndCleanup(false); + searchNode->removeFromParentAndCleanup(false); + CC_ASSERT(dynamic_cast(searchNode)); // NOTE: shouldn't hit this assert, expect a clean cast. + } + } + + _animationManager->playOnLoad(); + + searchNode->addChild(_collisionManager); + searchNode->addChild(_animationManager); + + _collisionManager->start(); + + return searchNode; + } /** Return the AnimationManager. It is added as a child of the Scene to simplify the codes. @@ -74,6 +119,8 @@ class CreatorReader: public cocos2d::Ref */ void setup(); + bool inspectForCustomClassFormat(std::string nodename) const; + protected: CreatorReader(); ~CreatorReader(); @@ -81,7 +128,7 @@ class CreatorReader: public cocos2d::Ref cocos2d::Node* createTree(const buffers::NodeTree* treeBuffer) const; - cocos2d::Scene* createScene(const buffers::Scene* sceneBuffer) const; + virtual cocos2d::Scene* createScene(const buffers::Scene* sceneBuffer) const; void parseScene(cocos2d::Scene* scene, const buffers::Scene* sceneBuffer) const; cocos2d::Node* createNode(const buffers::Node* nodeBuffer) const;