Updated TouchEventsManager to support input from Keyboard as well as an additional atk btn.

This commit is contained in:
genxium
2022-11-20 18:53:33 +08:00
parent 971f6461ab
commit 52480ab29f
36 changed files with 1612 additions and 892 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"width":128,"imagePath":"SoldierElf_tex.png","height":128,"name":"SoldierElf","SubTexture":[{"frameHeight":45,"y":1,"frameX":0,"width":34,"frameY":0,"height":44,"name":"cape","frameWidth":34,"x":70},{"width":10,"y":107,"height":14,"name":"shouder_l","x":74},{"width":11,"y":107,"height":14,"name":"forearm_l","x":61},{"width":15,"y":93,"height":16,"name":"hand_l","x":1},{"width":30,"y":61,"height":30,"name":"weapon_hand_l","x":1},{"width":8,"y":101,"height":11,"name":"thigh_l","x":86},{"width":12,"y":93,"height":17,"name":"calf_l","x":18},{"width":20,"y":113,"height":8,"name":"foot_l","x":39},{"width":28,"y":61,"height":31,"name":"pelvis","x":33},{"width":8,"y":88,"height":11,"name":"thigh_r","x":77},{"width":12,"y":88,"height":17,"name":"calf_r","x":63},{"width":20,"y":113,"height":8,"name":"foot_r","x":17},{"width":13,"y":94,"height":12,"name":"shouder_r","x":45},{"width":67,"y":1,"height":58,"name":"chest","x":1},{"width":11,"y":94,"height":17,"name":"forearm_r","x":32},{"width":14,"y":111,"height":13,"name":"hand_r","x":1},{"frameHeight":39,"y":47,"frameX":-2,"width":34,"frameY":0,"height":39,"name":"we_bl_4_f_1","frameWidth":36,"x":70}]}
{"width":128,"SubTexture":[{"frameWidth":34,"y":1,"frameHeight":45,"width":34,"frameX":0,"height":44,"name":"cape","frameY":0,"x":70},{"width":10,"y":107,"height":14,"name":"shouder_l","x":74},{"width":11,"y":107,"height":14,"name":"forearm_l","x":61},{"width":15,"y":93,"height":16,"name":"hand_l","x":1},{"width":30,"y":61,"height":30,"name":"weapon_hand_l","x":1},{"width":8,"y":88,"height":11,"name":"thigh_l","x":77},{"width":12,"y":93,"height":17,"name":"calf_l","x":18},{"width":20,"y":113,"height":8,"name":"foot_l","x":39},{"width":28,"y":61,"height":31,"name":"pelvis","x":33},{"width":8,"y":101,"height":11,"name":"thigh_r","x":86},{"width":12,"y":88,"height":17,"name":"calf_r","x":63},{"width":20,"y":113,"height":8,"name":"foot_r","x":17},{"width":13,"y":94,"height":12,"name":"shouder_r","x":45},{"width":67,"y":1,"height":58,"name":"chest","x":1},{"width":11,"y":94,"height":17,"name":"forearm_r","x":32},{"width":14,"y":111,"height":13,"name":"hand_r","x":1},{"frameWidth":36,"y":47,"frameHeight":39,"width":34,"frameX":-2,"height":39,"name":"we_bl_4_f_1","frameY":0,"x":70}],"height":128,"name":"SoldierElf","imagePath":"SoldierElf_tex.png"}

View File

@@ -1,7 +1,7 @@
{
"ver": "1.0.0",
"uuid": "24d7bb8f-577c-4e5d-b730-56613ca8685d",
"atlasJson": "{\"width\":128,\"imagePath\":\"SoldierElf_tex.png\",\"height\":128,\"name\":\"SoldierElf\",\"SubTexture\":[{\"frameHeight\":45,\"y\":1,\"frameX\":0,\"width\":34,\"frameY\":0,\"height\":44,\"name\":\"cape\",\"frameWidth\":34,\"x\":70},{\"width\":10,\"y\":107,\"height\":14,\"name\":\"shouder_l\",\"x\":74},{\"width\":11,\"y\":107,\"height\":14,\"name\":\"forearm_l\",\"x\":61},{\"width\":15,\"y\":93,\"height\":16,\"name\":\"hand_l\",\"x\":1},{\"width\":30,\"y\":61,\"height\":30,\"name\":\"weapon_hand_l\",\"x\":1},{\"width\":8,\"y\":101,\"height\":11,\"name\":\"thigh_l\",\"x\":86},{\"width\":12,\"y\":93,\"height\":17,\"name\":\"calf_l\",\"x\":18},{\"width\":20,\"y\":113,\"height\":8,\"name\":\"foot_l\",\"x\":39},{\"width\":28,\"y\":61,\"height\":31,\"name\":\"pelvis\",\"x\":33},{\"width\":8,\"y\":88,\"height\":11,\"name\":\"thigh_r\",\"x\":77},{\"width\":12,\"y\":88,\"height\":17,\"name\":\"calf_r\",\"x\":63},{\"width\":20,\"y\":113,\"height\":8,\"name\":\"foot_r\",\"x\":17},{\"width\":13,\"y\":94,\"height\":12,\"name\":\"shouder_r\",\"x\":45},{\"width\":67,\"y\":1,\"height\":58,\"name\":\"chest\",\"x\":1},{\"width\":11,\"y\":94,\"height\":17,\"name\":\"forearm_r\",\"x\":32},{\"width\":14,\"y\":111,\"height\":13,\"name\":\"hand_r\",\"x\":1},{\"frameHeight\":39,\"y\":47,\"frameX\":-2,\"width\":34,\"frameY\":0,\"height\":39,\"name\":\"we_bl_4_f_1\",\"frameWidth\":36,\"x\":70}]}",
"atlasJson": "{\"width\":128,\"SubTexture\":[{\"frameWidth\":34,\"y\":1,\"frameHeight\":45,\"width\":34,\"frameX\":0,\"height\":44,\"name\":\"cape\",\"frameY\":0,\"x\":70},{\"width\":10,\"y\":107,\"height\":14,\"name\":\"shouder_l\",\"x\":74},{\"width\":11,\"y\":107,\"height\":14,\"name\":\"forearm_l\",\"x\":61},{\"width\":15,\"y\":93,\"height\":16,\"name\":\"hand_l\",\"x\":1},{\"width\":30,\"y\":61,\"height\":30,\"name\":\"weapon_hand_l\",\"x\":1},{\"width\":8,\"y\":88,\"height\":11,\"name\":\"thigh_l\",\"x\":77},{\"width\":12,\"y\":93,\"height\":17,\"name\":\"calf_l\",\"x\":18},{\"width\":20,\"y\":113,\"height\":8,\"name\":\"foot_l\",\"x\":39},{\"width\":28,\"y\":61,\"height\":31,\"name\":\"pelvis\",\"x\":33},{\"width\":8,\"y\":101,\"height\":11,\"name\":\"thigh_r\",\"x\":86},{\"width\":12,\"y\":88,\"height\":17,\"name\":\"calf_r\",\"x\":63},{\"width\":20,\"y\":113,\"height\":8,\"name\":\"foot_r\",\"x\":17},{\"width\":13,\"y\":94,\"height\":12,\"name\":\"shouder_r\",\"x\":45},{\"width\":67,\"y\":1,\"height\":58,\"name\":\"chest\",\"x\":1},{\"width\":11,\"y\":94,\"height\":17,\"name\":\"forearm_r\",\"x\":32},{\"width\":14,\"y\":111,\"height\":13,\"name\":\"hand_r\",\"x\":1},{\"frameWidth\":36,\"y\":47,\"frameHeight\":39,\"width\":34,\"frameX\":-2,\"height\":39,\"name\":\"we_bl_4_f_1\",\"frameY\":0,\"x\":70}],\"height\":128,\"name\":\"SoldierElf\",\"imagePath\":\"SoldierElf_tex.png\"}",
"texture": "050fb016-1a1f-4341-8367-283bfeddc4a8",
"subMetas": {}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -0,0 +1,7 @@
{
"ver": "1.0.1",
"uuid": "f1176719-d1d6-4af5-89c6-ddff16ab85fd",
"isSubpackage": false,
"subpackageName": "",
"subMetas": {}
}

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 @@
{"width":128,"SubTexture":[{"frameWidth":23,"y":44,"frameHeight":22,"width":22,"frameX":-1,"height":22,"name":"biu","frameY":0,"x":53},{"width":9,"y":68,"height":14,"name":"rightArm","x":76},{"frameWidth":29,"y":35,"frameHeight":32,"width":26,"frameX":-1,"height":32,"name":"yinmoqe00","frameY":0,"x":89},{"width":34,"y":1,"height":41,"name":"body","x":53},{"width":9,"y":44,"height":13,"name":"rightShoulder","x":77},{"width":19,"y":50,"height":18,"name":"rightFrontArm","x":23},{"width":14,"y":70,"height":14,"name":"rightHand","x":23},{"width":12,"y":68,"height":12,"name":"leftArm","x":62},{"width":13,"y":73,"height":12,"name":"leftShoulder","x":1},{"width":20,"y":50,"height":21,"name":"leftFrontArm","x":1},{"width":33,"y":1,"height":32,"name":"head","x":89},{"width":50,"y":1,"height":47,"name":"head2","x":1},{"width":16,"y":68,"height":14,"name":"leftHand","x":44},{"frameWidth":8,"y":59,"frameHeight":8,"width":4,"frameX":-1,"height":4,"name":"huomiao01","frameY":-2,"x":77}],"height":128,"name":"SoldierFireGhost","imagePath":"SoldierFireGhost_tex.png"}

View File

@@ -0,0 +1,7 @@
{
"ver": "1.0.0",
"uuid": "4a9187d5-a9ad-4464-a03c-d2f3cc277051",
"atlasJson": "{\"width\":128,\"SubTexture\":[{\"frameWidth\":23,\"y\":44,\"frameHeight\":22,\"width\":22,\"frameX\":-1,\"height\":22,\"name\":\"biu\",\"frameY\":0,\"x\":53},{\"width\":9,\"y\":68,\"height\":14,\"name\":\"rightArm\",\"x\":76},{\"frameWidth\":29,\"y\":35,\"frameHeight\":32,\"width\":26,\"frameX\":-1,\"height\":32,\"name\":\"yinmoqe00\",\"frameY\":0,\"x\":89},{\"width\":34,\"y\":1,\"height\":41,\"name\":\"body\",\"x\":53},{\"width\":9,\"y\":44,\"height\":13,\"name\":\"rightShoulder\",\"x\":77},{\"width\":19,\"y\":50,\"height\":18,\"name\":\"rightFrontArm\",\"x\":23},{\"width\":14,\"y\":70,\"height\":14,\"name\":\"rightHand\",\"x\":23},{\"width\":12,\"y\":68,\"height\":12,\"name\":\"leftArm\",\"x\":62},{\"width\":13,\"y\":73,\"height\":12,\"name\":\"leftShoulder\",\"x\":1},{\"width\":20,\"y\":50,\"height\":21,\"name\":\"leftFrontArm\",\"x\":1},{\"width\":33,\"y\":1,\"height\":32,\"name\":\"head\",\"x\":89},{\"width\":50,\"y\":1,\"height\":47,\"name\":\"head2\",\"x\":1},{\"width\":16,\"y\":68,\"height\":14,\"name\":\"leftHand\",\"x\":44},{\"frameWidth\":8,\"y\":59,\"frameHeight\":8,\"width\":4,\"frameX\":-1,\"height\":4,\"name\":\"huomiao01\",\"frameY\":-2,\"x\":77}],\"height\":128,\"name\":\"SoldierFireGhost\",\"imagePath\":\"SoldierFireGhost_tex.png\"}",
"texture": "700d963b-2192-4219-a066-8be5b3db7453",
"subMetas": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@@ -0,0 +1,34 @@
{
"ver": "2.3.3",
"uuid": "700d963b-2192-4219-a066-8be5b3db7453",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"platformSettings": {},
"subMetas": {
"SoldierFireGhost_tex": {
"ver": "1.0.4",
"uuid": "8ef8a6b3-0bac-4cf1-bba0-ab090f4d9e52",
"rawTextureUuid": "700d963b-2192-4219-a066-8be5b3db7453",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -2.5,
"offsetY": 21,
"trimX": 1,
"trimY": 1,
"width": 121,
"height": 84,
"rawWidth": 128,
"rawHeight": 128,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.2" tiledversion="1.2.3" orientation="orthogonal" renderorder="right-down" width="64" height="64" tilewidth="16" tileheight="16" infinite="0" nextlayerid="2" nextobjectid="8">
<map version="1.2" tiledversion="1.2.3" orientation="orthogonal" renderorder="right-down" width="64" height="64" tilewidth="16" tileheight="16" infinite="0" nextlayerid="2" nextobjectid="12">
<tileset firstgid="1" source="tiles0.tsx"/>
<tileset firstgid="65" source="tiles1.tsx"/>
<layer id="1" name="Ground" width="64" height="64">
@@ -61,5 +61,29 @@
</properties>
<polyline points="0,0 -191.667,0.666667 -191.667,17.3333 -0.715174,17.3333"/>
</object>
<object id="8" x="-9.33333" y="-13.3333">
<properties>
<property name="boundary_type" value="barrier"/>
</properties>
<polyline points="0,0 0,18.6667 1041.33,21.3333 1041.33,-1.33333"/>
</object>
<object id="9" x="-9.33333" y="1014.67">
<properties>
<property name="boundary_type" value="barrier"/>
</properties>
<polyline points="0,0 0,18.6667 1041.33,21.3333 1041.33,-1.33333"/>
</object>
<object id="10" x="-14" y="-40">
<properties>
<property name="boundary_type" value="barrier"/>
</properties>
<polyline points="0,0 4,1110 24,1110 24,-8"/>
</object>
<object id="11" x="1014" y="-42">
<properties>
<property name="boundary_type" value="barrier"/>
</properties>
<polyline points="0,0 4,1110 24,1110 24,-8"/>
</object>
</objectgroup>
</map>

View File

@@ -53,9 +53,15 @@ message PlayerDownsyncMeta {
double colliderRadius = 6;
}
message InputFrameDecoded {
int32 dx = 1;
int32 dy = 2;
int32 btnALevel = 3;
}
message InputFrameUpsync {
int32 inputFrameId = 1;
int32 encodedDir = 6;
uint64 encoded = 2;
}
message InputFrameDownsync {

View File

@@ -33,14 +33,14 @@
"_active": true,
"_components": [
{
"__id__": 14
"__id__": 19
},
{
"__id__": 15
"__id__": 20
}
],
"_prefab": {
"__id__": 16
"__id__": 21
},
"_opacity": 255,
"_color": {
@@ -484,15 +484,82 @@
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
"_children": [
{
"__id__": 12
},
{
"__id__": 15
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 18
},
"_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.Node",
"_name": "SoldierElf",
"_objFlags": 0,
"_parent": {
"__id__": 11
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 13
}
],
"_prefab": {
"__id__": 13
"__id__": 14
},
"_opacity": 255,
"_color": {
@@ -546,7 +613,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
"__id__": 12
},
"_enabled": true,
"_materials": [
@@ -581,6 +648,132 @@
"_N$enableBatch": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "59bff7a2-23e1-4d69-bce7-afb37eae196a"
},
"fileId": "3fs20Yd8dIO68/1Wx2oVLh",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "SoldierFireGhost",
"_objFlags": 0,
"_parent": {
"__id__": 11
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 16
}
],
"_prefab": {
"__id__": 17
},
"_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__": "dragonBones.ArmatureDisplay",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 15
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_armatureName": "SoldierFireGhost",
"_animationName": "Idle1",
"_preCacheMode": 0,
"_cacheMode": 0,
"playTimes": -1,
"premultipliedAlpha": false,
"_armatureKey": "36230012-8df3-4e85-afad-76ec47d0e4d7#4a9187d5-a9ad-4464-a03c-d2f3cc277051",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "36230012-8df3-4e85-afad-76ec47d0e4d7"
},
"_N$dragonAtlasAsset": {
"__uuid__": "4a9187d5-a9ad-4464-a03c-d2f3cc277051"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 8,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
"_N$enableBatch": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "59bff7a2-23e1-4d69-bce7-afb37eae196a"
},
"fileId": "a8ZUEyoP1Ec5azSkL7Z/9h",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {

View File

@@ -80,20 +80,20 @@
],
"_active": true,
"_components": [
{
"__id__": 31
},
{
"__id__": 32
},
{
"__id__": 33
},
{
"__id__": 34
},
{
"__id__": 35
},
{
"__id__": 36
},
{
"__id__": 37
},
{
"__id__": 38
}
],
"_prefab": null,
@@ -234,7 +234,7 @@
"__id__": 7
},
{
"__id__": 33
"__id__": 30
}
],
"_prefab": null,
@@ -323,7 +323,7 @@
"__id__": 17
},
"countdownLabel": {
"__id__": 26
"__id__": 23
},
"resultPanelPrefab": {
"__uuid__": "c4cfe3bd-c59e-4d5b-95cb-c933b120e184"
@@ -354,13 +354,13 @@
},
"_children": [
{
"__id__": 27
"__id__": 24
}
],
"_active": true,
"_components": [
{
"__id__": 32
"__id__": 29
}
],
"_prefab": null,
@@ -422,14 +422,11 @@
{
"__id__": 12
},
{
"__id__": 22
},
{
"__id__": 8
},
{
"__id__": 25
"__id__": 22
}
],
"_active": true,
@@ -525,7 +522,7 @@
"array": [
0,
0,
210.4441731196186,
239.32248305180272,
0,
0,
0,
@@ -1027,111 +1024,6 @@
"_N$affectedByScale": false,
"_id": "f6GkgYwn9JvKLqbGG1zmeD"
},
{
"__type__": "cc.Node",
"_name": "KeyboardControlsMount",
"_objFlags": 0,
"_parent": {
"__id__": 9
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 23
},
{
"__id__": 24
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-341.33333,
-640,
0,
0,
0,
0,
1,
0.66667,
0.66667,
0.66667
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "e6nL+1zEhLmLSaT8R/9UgD"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_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,
"_N$cacheMode": 0,
"_id": "9cS5BRd+NKJIvGQiojJtIs"
},
{
"__type__": "4561aFzv9JPZLe6iIzODk2d",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
},
"_enabled": true,
"_id": "5ahzSYC8pCCLVPCBYyCRfZ"
},
{
"__type__": "cc.Node",
"_name": "CountdownSeconds",
@@ -1143,7 +1035,7 @@
"_active": true,
"_components": [
{
"__id__": 26
"__id__": 23
}
],
"_prefab": null,
@@ -1199,7 +1091,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
"__id__": 22
},
"_enabled": true,
"_materials": [
@@ -1233,16 +1125,16 @@
},
"_children": [
{
"__id__": 28
"__id__": 25
}
],
"_active": true,
"_components": [
{
"__id__": 30
"__id__": 27
},
{
"__id__": 31
"__id__": 28
}
],
"_prefab": null,
@@ -1298,13 +1190,13 @@
"_name": "Joystick",
"_objFlags": 0,
"_parent": {
"__id__": 27
"__id__": 24
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 29
"__id__": 26
}
],
"_prefab": null,
@@ -1360,7 +1252,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 28
"__id__": 25
},
"_enabled": true,
"_materials": [
@@ -1394,7 +1286,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 27
"__id__": 24
},
"_enabled": true,
"_materials": [
@@ -1428,7 +1320,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 27
"__id__": 24
},
"_enabled": true,
"alignMode": 0,
@@ -1590,11 +1482,12 @@
"zoomingListenerNode": {
"__id__": 5
},
"actionBtnListenerNode": null,
"stickhead": {
"__id__": 28
"__id__": 25
},
"base": {
"__id__": 27
"__id__": 24
},
"joyStickEps": 0.1,
"magicLeanLowerBound": 0.414,

View File

@@ -440,7 +440,7 @@
"array": [
0,
0,
210.4441731196186,
239.32248305180272,
0,
0,
0,

View File

@@ -77,20 +77,20 @@
],
"_active": true,
"_components": [
{
"__id__": 19
},
{
"__id__": 20
},
{
"__id__": 21
},
{
"__id__": 22
},
{
"__id__": 23
},
{
"__id__": 24
},
{
"__id__": 25
},
{
"__id__": 26
}
],
"_prefab": null,
@@ -262,8 +262,6 @@
"controlledCharacterPrefab": {
"__uuid__": "59bff7a2-23e1-4d69-bce7-afb37eae196a"
},
"player1Prefab": null,
"player2Prefab": null,
"joystickInputControllerNode": {
"__id__": 7
},
@@ -279,9 +277,6 @@
"forceBigEndianFloatingNumDecoding": false,
"renderFrameIdLagTolerance": 4,
"jigglingEps1D": 0.001,
"keyboardInputControllerNode": {
"__id__": 11
},
"_id": "4b+kZ46VhC0LCBixXEK2dk"
},
{
@@ -293,13 +288,13 @@
},
"_children": [
{
"__id__": 16
"__id__": 13
}
],
"_active": true,
"_components": [
{
"__id__": 21
"__id__": 18
}
],
"_prefab": null,
@@ -358,14 +353,11 @@
"__id__": 9
},
"_children": [
{
"__id__": 11
},
{
"__id__": 7
},
{
"__id__": 14
"__id__": 11
}
],
"_active": true,
@@ -461,7 +453,7 @@
"array": [
0,
0,
210.4441731196186,
239.32248305180272,
0,
0,
0,
@@ -520,111 +512,6 @@
"_alignWithScreen": true,
"_id": "50qiPTLS9NhbPa+JZU0jOP"
},
{
"__type__": "cc.Node",
"_name": "KeyboardControlsMount",
"_objFlags": 0,
"_parent": {
"__id__": 8
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 12
},
{
"__id__": 13
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-341.33333,
-640,
0,
0,
0,
0,
1,
0.66667,
0.66667,
0.66667
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "e6nL+1zEhLmLSaT8R/9UgD"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_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,
"_N$cacheMode": 0,
"_id": "9cS5BRd+NKJIvGQiojJtIs"
},
{
"__type__": "4561aFzv9JPZLe6iIzODk2d",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_id": "5ahzSYC8pCCLVPCBYyCRfZ"
},
{
"__type__": "cc.Node",
"_name": "CountdownSeconds",
@@ -636,7 +523,7 @@
"_active": true,
"_components": [
{
"__id__": 15
"__id__": 12
}
],
"_prefab": null,
@@ -692,7 +579,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
"__id__": 11
},
"_enabled": true,
"_materials": [
@@ -726,16 +613,16 @@
},
"_children": [
{
"__id__": 17
"__id__": 14
}
],
"_active": true,
"_components": [
{
"__id__": 19
"__id__": 16
},
{
"__id__": 20
"__id__": 17
}
],
"_prefab": null,
@@ -791,13 +678,13 @@
"_name": "Joystick",
"_objFlags": 0,
"_parent": {
"__id__": 16
"__id__": 13
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 18
"__id__": 15
}
],
"_prefab": null,
@@ -853,7 +740,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
"__id__": 14
},
"_enabled": true,
"_materials": [
@@ -887,7 +774,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
"__id__": 13
},
"_enabled": true,
"_materials": [
@@ -921,7 +808,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
"__id__": 13
},
"_enabled": true,
"alignMode": 0,
@@ -1056,10 +943,10 @@
"__id__": 3
},
"stickhead": {
"__id__": 17
"__id__": 14
},
"base": {
"__id__": 16
"__id__": 13
},
"joyStickEps": 0.1,
"magicLeanLowerBound": 0.414,

View File

@@ -16,13 +16,20 @@ cc.Class({
},
ctor() {
this.speciesName = null;
},
setSpecies(speciesName) {
this.speciesName = speciesName;
this.effAnimNode = this.animNode.getChildByName(this.speciesName);
this.animComp = this.effAnimNode.getComponent(dragonBones.ArmatureDisplay);
this.animComp.playAnimation(ATK_CHARACTER_STATE.Idle1[1]);
this.effAnimNode.active = true;
},
onLoad() {
BaseCharacter.prototype.onLoad.call(this);
this.characterState = ATK_CHARACTER_STATE.Idle1[0];
this.animComp = this.animNode.getComponent(dragonBones.ArmatureDisplay);
this.animComp.playAnimation(ATK_CHARACTER_STATE.Idle1[1]);
},
scheduleNewDirection(newScheduledDirection, forceAnimSwitch) {

View File

@@ -1,69 +0,0 @@
cc.Class({
extends: cc.Component,
properties: {},
setInputControls: function() {
const self = this;
// add keyboard event listener
// When there is a key being pressed down, judge if it's the designated directional button and set up acceleration in the corresponding direction
cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, function(event) {
switch (event.keyCode) {
case cc.macro.KEY.w:
self.activeDirection.dPjY = +1.0;
break;
case cc.macro.KEY.s:
self.activeDirection.dPjY = -1.0;
break;
case cc.macro.KEY.a:
self.activeDirection.dPjX = -2.0;
break;
case cc.macro.KEY.d:
self.activeDirection.dPjX = +2.0;
break;
default:
break;
}
}, self.node);
// when releasing the button, stop acceleration in this direction
cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP, function(event) {
switch (event.keyCode) {
case cc.macro.KEY.w:
if (+1.0 == self.activeDirection.dPjY) {
self.activeDirection.dPjY = 0.0;
}
break;
case cc.macro.KEY.s:
if (-1.0 == self.activeDirection.dPjY) {
self.activeDirection.dPjY = 0.0;
}
break;
case cc.macro.KEY.a:
if (-2.0 == self.activeDirection.dPjX) {
self.activeDirection.dPjX = 0.0;
}
break;
case cc.macro.KEY.d:
if (+2.0 == self.activeDirection.dPjX) {
self.activeDirection.dPjX = 0.0;
}
break;
default:
break;
}
}, self.node);
},
// LIFE-CYCLE CALLBACKS:
onLoad() {
// Properties deliberately hidden from GUI panel.
this.activeDirection = {
dPjY: 0.0,
dPjX: 0.0
};
this.setInputControls();
}
});

View File

@@ -1,9 +0,0 @@
{
"ver": "1.0.5",
"uuid": "4561a173-bfd2-4f64-b7ba-888cce0e4d9d",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -163,8 +163,8 @@ cc.Class({
return [previousSelfInput, existingInputFrame.inputList[joinIndex - 1]];
}
const prefabbedInputList = (null == previousInputFrameDownsyncWithPrediction ? new Array(self.playerRichInfoDict.size).fill(0) : previousInputFrameDownsyncWithPrediction.inputList.slice());
const discreteDir = self.ctrl.getDiscretizedDirection();
prefabbedInputList[(joinIndex - 1)] = discreteDir.encodedIdx;
const currSelfInput = self.ctrl.getEncodedInput();
prefabbedInputList[(joinIndex - 1)] = currSelfInput;
const prefabbedInputFrameDownsync = {
inputFrameId: inputFrameId,
inputList: prefabbedInputList,
@@ -173,7 +173,7 @@ cc.Class({
self.dumpToInputCache(prefabbedInputFrameDownsync); // A prefabbed inputFrame, would certainly be adding a new inputFrame to the cache, because server only downsyncs "all-confirmed inputFrames"
return [previousSelfInput, discreteDir.encodedIdx];
return [previousSelfInput, currSelfInput];
},
shouldSendInputFrameUpsyncBatch(prevSelfInput, currSelfInput, lastUpsyncInputFrameId, currInputFrameId) {
@@ -204,7 +204,7 @@ cc.Class({
} else {
const inputFrameUpsync = {
inputFrameId: i,
encodedDir: inputFrameDownsync.inputList[self.selfPlayerInfo.joinIndex - 1],
encoded: inputFrameDownsync.inputList[self.selfPlayerInfo.joinIndex - 1],
};
inputFrameUpsyncBatch.push(inputFrameUpsync);
}
@@ -338,7 +338,7 @@ cc.Class({
window.mapIns = self;
window.forceBigEndianFloatingNumDecoding = self.forceBigEndianFloatingNumDecoding;
self.showCriticalCoordinateLabels = true;
self.showCriticalCoordinateLabels = false;
console.warn("+++++++ Map onLoad()");
window.handleClientSessionError = function() {
@@ -754,12 +754,12 @@ cc.Class({
const self = this;
const newPlayerNode = cc.instantiate(self.controlledCharacterPrefab)
const playerScriptIns = newPlayerNode.getComponent("ControlledCharacter");
if (1 == joinIndex) {
newPlayerNode.color = cc.Color.RED;
}
if (2 == joinIndex) {
newPlayerNode.color = cc.Color.BLUE;
playerScriptIns.animNode.scaleX = (-1.0);
playerScriptIns.setSpecies("SoldierElf");
} else if (2 == joinIndex) {
playerScriptIns.setSpecies("SoldierFireGhost");
playerScriptIns.animComp.node.scaleX = (-1.0);
}
const wpos = self.virtualGridToWorldPos(vx, vy);
@@ -1039,8 +1039,7 @@ cc.Class({
const playerCollider = collisionSysMap.get(collisionPlayerIndex);
const player = currRenderFrame.players[playerId];
const encodedInput = inputList[joinIndex - 1];
const decodedInput = self.ctrl.decodeDirection(encodedInput);
const decodedInput = self.ctrl.decodeInput(inputList[joinIndex - 1]);
// console.log(`Got non-zero inputs for playerId=${playerId}, decodedInput=${JSON.stringify(decodedInput)} @currRenderFrame.id=${currRenderFrame.id}, delayedInputFrame.id=${delayedInputFrame.id}`);
/*

View File

@@ -6,13 +6,6 @@ const OnlineMap = require('./Map');
cc.Class({
extends: OnlineMap,
properties: {
keyboardInputControllerNode: {
type: cc.Node,
default: null
},
},
onDestroy() {
console.warn("+++++++ Map onDestroy()");
},
@@ -21,6 +14,12 @@ cc.Class({
const self = this;
const newPlayerNode = cc.instantiate(self.controlledCharacterPrefab)
const playerScriptIns = newPlayerNode.getComponent("ControlledCharacter");
if (1 == joinIndex) {
playerScriptIns.setSpecies("SoldierElf");
} else if (2 == joinIndex) {
playerScriptIns.setSpecies("SoldierFireGhost");
playerScriptIns.animComp.node.scaleX = (-1.0);
}
const wpos = self.virtualGridToWorldPos(vx, vy);
newPlayerNode.setPosition(cc.v2(wpos[0], wpos[1]));
@@ -150,9 +149,10 @@ cc.Class({
players: {
10: {
id: 10,
joinIndex: 2,
virtualGridX: 0,
virtualGridY: 0,
speed: 2*self.worldToVirtualGridRatio,
speed: 2 * self.worldToVirtualGridRatio,
dir: {
dx: 0,
dy: 0

View File

@@ -94,6 +94,12 @@ cc.Class({
onLoad() {
this.cachedStickHeadPosition = cc.v2(0.0, 0.0);
this.cachedBtnUpLevel = 0;
this.cachedBtnDownLevel = 0;
this.cachedBtnLeftLevel = 0;
this.cachedBtnRightLevel = 0;
this.cachedBtnALevel = 0;
this.canvasNode = this.mapNode.parent;
this.mainCameraNode = this.canvasNode.getChildByName("Main Camera"); // Cannot drag and assign the `mainCameraNode` from CocosCreator EDITOR directly, otherwise it'll cause an infinite loading time, till v2.1.0.
this.mainCamera = this.mainCameraNode.getComponent(cc.Camera);
@@ -143,6 +149,51 @@ cc.Class({
self._touchEndEvent(event);
});
zoomingListenerNode.inTouchPoints = new Map();
// Setup keyboard controls for the ease of attach debugging
cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, function(evt) {
switch (evt.keyCode) {
case cc.macro.KEY.w:
self.cachedBtnUpLevel = 1;
break;
case cc.macro.KEY.s:
self.cachedBtnDownLevel = 1;
break;
case cc.macro.KEY.a:
self.cachedBtnLeftLevel = 1;
break;
case cc.macro.KEY.d:
self.cachedBtnRightLevel = 1;
break;
case cc.macro.KEY.h:
self.cachedBtnALevel = 1;
break;
default:
break;
}
}, this);
cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP, function(evt) {
switch (evt.keyCode) {
case cc.macro.KEY.w:
self.cachedBtnUpLevel = 0;
break;
case cc.macro.KEY.s:
self.cachedBtnDownLevel = 0;
break;
case cc.macro.KEY.a:
self.cachedBtnLeftLevel = 0;
break;
case cc.macro.KEY.d:
self.cachedBtnRightLevel = 0;
break;
case cc.macro.KEY.h:
self.cachedBtnALevel = 0;
break;
default:
break;
}
}, this);
},
_isMapOverMoved(mapTargetPos) {
@@ -239,7 +290,6 @@ cc.Class({
// TODO: Handle single-finger-click event.
} while (false);
this.cachedStickHeadPosition = cc.v2(0.0, 0.0);
for (let touch of event._touches) {
if (touch) {
theListenerNode.inTouchPoints.delete(touch._id);
@@ -252,7 +302,42 @@ cc.Class({
update(dt) {
if (this.inMultiTouch) return;
if (true != this.initialized) return;
const self = this;
// Keyboard takes top priority
let keyboardDiffVec = cc.v2(0, 0);
if (1 == this.cachedBtnUpLevel) {
if (1 == this.cachedBtnLeftLevel) {
keyboardDiffVec = cc.v2(-1.0, +1.0);
} else if (1 == this.cachedBtnRightLevel) {
keyboardDiffVec = cc.v2(+1.0, +1.0);
} else {
keyboardDiffVec = cc.v2(0.0, +1.0);
}
} else if (1 == this.cachedBtnDownLevel) {
if (1 == this.cachedBtnLeftLevel) {
keyboardDiffVec = cc.v2(-1.0, -1.0);
} else if (1 == this.cachedBtnRightLevel) {
keyboardDiffVec = cc.v2(+1.0, -1.0);
} else {
keyboardDiffVec = cc.v2(0.0, -1.0);
}
} else if (1 == this.cachedBtnLeftLevel) {
keyboardDiffVec = cc.v2(-1.0, 0.0);
} else if (1 == this.cachedBtnRightLevel) {
keyboardDiffVec = cc.v2(+1.0, 0.0);
}
if (0 != keyboardDiffVec.x || 0 != keyboardDiffVec.y) {
this.cachedStickHeadPosition = keyboardDiffVec.mul(this.maxHeadDistance / keyboardDiffVec.mag());
}
this.stickhead.setPosition(this.cachedStickHeadPosition);
const translationListenerNode = (self.translationListenerNode ? self.translationListenerNode : self.mapNode);
if (0 == translationListenerNode.inTouchPoints.size
&&
(0 == keyboardDiffVec.x && 0 == keyboardDiffVec.y)
) {
this.cachedStickHeadPosition = cc.v2(0, 0); // Important reset!
}
},
discretizeDirection(continuousDx, continuousDy, eps) {
@@ -312,18 +397,23 @@ cc.Class({
return ret;
},
decodeDirection(encodedDirection) {
const mapped = window.DIRECTION_DECODER[encodedDirection];
if (null == mapped) {
console.error("Unexpected encodedDirection = ", encodedDirection);
}
return {
dx: mapped[0],
dy: mapped[1],
};
getEncodedInput() {
const discretizedDir = this.discretizeDirection(this.stickhead.x, this.stickhead.y, this.joyStickEps).encodedIdx; // There're only 9 dirs, thus using only the lower 4-bits
const btnALevel = (this.cachedBtnALevel << 4);
return (btnALevel + discretizedDir);
},
getDiscretizedDirection() {
return this.discretizeDirection(this.cachedStickHeadPosition.x, this.cachedStickHeadPosition.y, this.joyStickEps);
}
decodeInput(encodedInput) {
const encodedDirection = (encodedInput & 0xf);
const mappedDirection = window.DIRECTION_DECODER[encodedDirection];
if (null == mappedDirection) {
console.error("Unexpected encodedDirection = ", encodedDirection);
}
const btnALevel = ((encodedInput >> 4) & 1);
return {
dx: mappedDirection[0],
dy: mappedDirection[1],
a: btnALevel,
};
},
});