手动控制spine 动画

This commit is contained in:
2024-07-19 17:11:19 +08:00
parent f34018ac59
commit d80f16a0f7
22 changed files with 675 additions and 1221 deletions

View File

@@ -1 +1,278 @@
{"animator":"1.0.0","mainStateMachine":{"layerPos":[56.40011519631385,88.05260631659786],"layerScale":1.2000000000000002,"anyStatePos":[-300,300],"subStates":["Idle","Walk","Attack","Hit","Run","Jump"],"subStateMachines":[]},"subStateMachines":[],"defaultState":"Idle","anyState":{"transitions":[{"toState":"Hit","hasExitTime":false,"conditions":[{"param":"Hit","value":0,"logic":0}]},{"toState":"Attack","hasExitTime":false,"conditions":[{"param":"Attack","value":0,"logic":0}]}]},"states":[{"position":[-300,-120],"upStateMachine":"BaseLayer","state":"Idle","motion":"cocos_anim_idle","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"Walk","hasExitTime":false,"conditions":[{"param":"Speed","value":1,"logic":0}]},{"toState":"Run","hasExitTime":false,"conditions":[{"param":"Speed","value":2,"logic":4}]},{"toState":"Jump","hasExitTime":false,"conditions":[{"param":"Jump","value":0,"logic":0}]}]},{"position":[150,-120],"upStateMachine":"BaseLayer","state":"Walk","motion":"cocos_anim_walk","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"Idle","hasExitTime":false,"conditions":[{"param":"Speed","value":0,"logic":0}]},{"toState":"Run","hasExitTime":false,"conditions":[{"param":"Speed","value":2,"logic":4}]},{"toState":"Jump","hasExitTime":false,"conditions":[{"param":"Jump","value":0,"logic":0}]}]},{"position":[150,90],"upStateMachine":"BaseLayer","state":"Attack","motion":"cocos_anim_attack","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"Idle","hasExitTime":true,"conditions":[]}]},{"position":[-300,90],"upStateMachine":"BaseLayer","state":"Hit","motion":"cocos_anim_squat","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"Idle","hasExitTime":true,"conditions":[]}]},{"position":[150,-300],"upStateMachine":"BaseLayer","state":"Run","motion":"cocos_anim_run","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"Walk","hasExitTime":false,"conditions":[{"param":"Speed","value":0,"logic":2},{"param":"Speed","value":2,"logic":3}]},{"toState":"Idle","hasExitTime":false,"conditions":[{"param":"Speed","value":0,"logic":0}]},{"toState":"Jump","hasExitTime":false,"conditions":[{"param":"Jump","value":0,"logic":0}]}]},{"position":[-300,-300],"upStateMachine":"BaseLayer","state":"Jump","motion":"cocos_anim_jump","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"Idle","hasExitTime":true,"conditions":[]}]}],"parameters":[{"param":"Speed","type":2,"init":0},{"param":"Attack","type":3,"init":0},{"param":"Hit","type":3,"init":0},{"param":"Jump","type":3,"init":0}]}
{
"animator": "1.0.0",
"mainStateMachine": {
"layerPos": [
56.40011519631385,
88.05260631659786
],
"layerScale": 1.2000000000000002,
"anyStatePos": [
-300,
300
],
"subStates": [
"Idle",
"Walk",
"Attack",
"Hit",
"Run",
"Jump"
],
"subStateMachines": []
},
"subStateMachines": [],
"defaultState": "Idle",
"anyState": {
"transitions": [
{
"toState": "Hit",
"hasExitTime": false,
"conditions": [
{
"param": "Hit",
"value": 0,
"logic": 0
}
]
},
{
"toState": "Attack",
"hasExitTime": false,
"conditions": [
{
"param": "Attack",
"value": 0,
"logic": 0
}
]
}
]
},
"states": [
{
"position": [
-300,
-120
],
"upStateMachine": "BaseLayer",
"state": "Idle",
"motion": "cocos_anim_idle",
"speed": 1,
"multiplier": "",
"loop": true,
"transitions": [
{
"toState": "Walk",
"hasExitTime": false,
"conditions": [
{
"param": "Speed",
"value": 1,
"logic": 0
}
]
},
{
"toState": "Run",
"hasExitTime": false,
"conditions": [
{
"param": "Speed",
"value": 2,
"logic": 4
}
]
},
{
"toState": "Jump",
"hasExitTime": false,
"conditions": [
{
"param": "Jump",
"value": 0,
"logic": 0
}
]
}
]
},
{
"position": [
150,
-120
],
"upStateMachine": "BaseLayer",
"state": "Walk",
"motion": "cocos_anim_walk",
"speed": 1,
"multiplier": "",
"loop": true,
"transitions": [
{
"toState": "Idle",
"hasExitTime": false,
"conditions": [
{
"param": "Speed",
"value": 0,
"logic": 0
}
]
},
{
"toState": "Run",
"hasExitTime": false,
"conditions": [
{
"param": "Speed",
"value": 2,
"logic": 4
}
]
},
{
"toState": "Jump",
"hasExitTime": false,
"conditions": [
{
"param": "Jump",
"value": 0,
"logic": 0
}
]
}
]
},
{
"position": [
150,
90
],
"upStateMachine": "BaseLayer",
"state": "Attack",
"motion": "cocos_anim_attack",
"speed": 1,
"multiplier": "",
"loop": false,
"transitions": [
{
"toState": "Idle",
"hasExitTime": true,
"conditions": []
}
]
},
{
"position": [
-300,
90
],
"upStateMachine": "BaseLayer",
"state": "Hit",
"motion": "cocos_anim_squat",
"speed": 1,
"multiplier": "",
"loop": false,
"transitions": [
{
"toState": "Idle",
"hasExitTime": true,
"conditions": []
}
]
},
{
"position": [
150,
-300
],
"upStateMachine": "BaseLayer",
"state": "Run",
"motion": "cocos_anim_run",
"speed": 1,
"multiplier": "",
"loop": true,
"transitions": [
{
"toState": "Walk",
"hasExitTime": false,
"conditions": [
{
"param": "Speed",
"value": 0,
"logic": 2
},
{
"param": "Speed",
"value": 2,
"logic": 3
}
]
},
{
"toState": "Idle",
"hasExitTime": false,
"conditions": [
{
"param": "Speed",
"value": 0,
"logic": 0
}
]
},
{
"toState": "Jump",
"hasExitTime": false,
"conditions": [
{
"param": "Jump",
"value": 0,
"logic": 0
}
]
}
]
},
{
"position": [
-300,
-300
],
"upStateMachine": "BaseLayer",
"state": "Jump",
"motion": "cocos_anim_jump",
"speed": 1,
"multiplier": "",
"loop": false,
"transitions": [
{
"toState": "Idle",
"hasExitTime": true,
"conditions": []
}
]
}
],
"parameters": [
{
"param": "Speed",
"type": 2,
"init": 0
},
{
"param": "Attack",
"type": 3,
"init": 0
},
{
"param": "Hit",
"type": 3,
"init": 0
},
{
"param": "Jump",
"type": 3,
"init": 0
}
]
}

View File

@@ -1 +1,101 @@
{"animator":"1.0.0","mainStateMachine":{"layerPos":[56.40011519631385,88.05260631659786],"layerScale":1.2000000000000002,"anyStatePos":[-300,300],"subStates":["Idle","Walk","Attack"],"subStateMachines":[]},"subStateMachines":[],"defaultState":"Idle","anyState":{"transitions":[{"toState":"Attack","hasExitTime":false,"conditions":[{"param":"Attack","value":0,"logic":0}]}]},"states":[{"position":[-300,-120],"upStateMachine":"BaseLayer","state":"Idle","motion":"Stand","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"Walk","hasExitTime":false,"conditions":[{"param":"Speed","value":1,"logic":0}]}]},{"position":[150,-120],"upStateMachine":"BaseLayer","state":"Walk","motion":"Run","speed":1,"multiplier":"","loop":true,"transitions":[{"toState":"Idle","hasExitTime":false,"conditions":[{"param":"Speed","value":0,"logic":0}]}]},{"position":[-300,90],"upStateMachine":"BaseLayer","state":"Attack","motion":"Attack","speed":1,"multiplier":"","loop":false,"transitions":[{"toState":"Idle","hasExitTime":true,"conditions":[]}]}],"parameters":[{"param":"Speed","type":2,"init":0},{"param":"Attack","type":3,"init":0}]}
{
"defaultState": "idle",
"anyState": {
"transitions": [
{
"toState": "act1",
"hasExitTime": false,
"conditions": [
{
"param": "act1",
"value": 0,
"logic": 0
}
]
}
]
},
"states": [
{
"position": [
-300,
-120
],
"upStateMachine": "BaseLayer",
"state": "idle",
"motion": "idle",
"speed": 1,
"multiplier": "",
"loop": true,
"transitions": [
{
"toState": "move",
"hasExitTime": false,
"conditions": [
{
"param": "Speed",
"value": 1,
"logic": 0
}
]
}
]
},
{
"position": [
150,
-120
],
"upStateMachine": "BaseLayer",
"state": "move",
"motion": "Run",
"speed": 1,
"multiplier": "",
"loop": true,
"transitions": [
{
"toState": "idle",
"hasExitTime": false,
"conditions": [
{
"param": "Speed",
"value": 0,
"logic": 0
}
]
}
]
},
{
"position": [
-300,
90
],
"upStateMachine": "BaseLayer",
"state": "act1",
"motion": "act1",
"speed": 1,
"multiplier": "",
"loop": false,
"transitions": [
{
"toState": "idle",
"hasExitTime": true,
"conditions": []
}
]
}
],
"parameters": [
{
"param": "Speed",
"type": 2,
"init": 0
},
{
"param": "act1",
"type": 3,
"init": 0
}
]
}

View File

@@ -0,0 +1,154 @@
{
"animator": "1.0.0",
"mainStateMachine": {
"layerPos": [
0,
0
],
"layerScale": 1,
"anyStatePos": [
-660,
390
],
"subStates": [
"act1",
"idle",
"magic1",
"move"
],
"subStateMachines": []
},
"subStateMachines": [],
"defaultState": "idle",
"anyState": {
"transitions": []
},
"states": [
{
"position": [
-180,
420
],
"upStateMachine": "BaseLayer",
"state": "act1",
"motion": "act1",
"speed": 1,
"multiplier": "",
"loop": false,
"transitions": [
{
"toState": "idle",
"hasExitTime": true,
"conditions": []
}
]
},
{
"position": [
-390,
240
],
"upStateMachine": "BaseLayer",
"state": "idle",
"motion": "idle",
"speed": 1,
"multiplier": "",
"loop": true,
"transitions": [
{
"toState": "move",
"hasExitTime": false,
"conditions": [
{
"param": "act1",
"value": 0,
"logic": 0
}
]
},
{
"toState": "act1",
"hasExitTime": false,
"conditions": [
{
"param": "magic1",
"value": 0,
"logic": 0
}
]
},
{
"toState": "magic1",
"hasExitTime": false,
"conditions": [
{
"param": "move",
"value": 0,
"logic": 0
}
]
}
]
},
{
"position": [
60,
180
],
"upStateMachine": "BaseLayer",
"state": "magic1",
"motion": "magic1",
"speed": 1,
"multiplier": "",
"loop": false,
"transitions": [
{
"toState": "idle",
"hasExitTime": true,
"conditions": []
}
]
},
{
"position": [
-240,
0
],
"upStateMachine": "BaseLayer",
"state": "move",
"motion": "move",
"speed": 1,
"multiplier": "",
"loop": false,
"transitions": [
{
"toState": "idle",
"hasExitTime": true,
"conditions": []
}
]
}
],
"parameters": [
{
"param": "act1",
"type": 3,
"init": 0
},
{
"param": "magic1",
"type": 3,
"init": 0
},
{
"param": "move",
"type": 3,
"init": 0
},
{
"param": "idle",
"type": 3,
"init": 0
}
]
}

View File

@@ -0,0 +1,11 @@
{
"ver": "2.0.1",
"importer": "json",
"imported": true,
"uuid": "87e4e045-ac3f-421a-9569-ca46b8648e2a",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -1,342 +0,0 @@
huaxian.png
size: 566,1002
format: RGBA8888
filter: Linear,Linear
repeat: none
backAttack/1
rotate: true
xy: 371, 605
size: 105, 115
orig: 256, 256
offset: 77, 82
index: -1
backAttack/2
rotate: false
xy: 237, 385
size: 112, 96
orig: 256, 256
offset: 73, 84
index: -1
backAttack/3
rotate: true
xy: 2, 329
size: 110, 111
orig: 256, 256
offset: 70, 91
index: -1
backAttack/4
rotate: true
xy: 113, 101
size: 78, 108
orig: 256, 256
offset: 84, 93
index: -1
backAttack/5
rotate: false
xy: 466, 377
size: 97, 106
orig: 256, 256
offset: 64, 89
index: -1
backRun/1
rotate: false
xy: 336, 22
size: 103, 103
orig: 256, 256
offset: 83, 80
index: -1
backRun/2
rotate: true
xy: 2, 536
size: 102, 117
orig: 256, 256
offset: 81, 68
index: -1
backRun/3
rotate: false
xy: 111, 2
size: 100, 97
orig: 256, 256
offset: 71, 87
index: -1
backRun/4
rotate: true
xy: 223, 6
size: 101, 103
orig: 256, 256
offset: 75, 81
index: -1
backRun/5
rotate: true
xy: 465, 274
size: 101, 97
orig: 256, 256
offset: 96, 85
index: -1
backRun/6
rotate: true
xy: 2, 441
size: 93, 113
orig: 256, 256
offset: 101, 71
index: -1
backStand/1
rotate: true
xy: 453, 77
size: 91, 110
orig: 256, 256
offset: 83, 72
index: -1
backStand/2
rotate: true
xy: 121, 477
size: 92, 114
orig: 256, 256
offset: 82, 67
index: -1
backStand/3
rotate: true
xy: 228, 290
size: 93, 111
orig: 256, 256
offset: 81, 70
index: -1
backStand/4
rotate: true
xy: 341, 127
size: 93, 110
orig: 256, 256
offset: 80, 70
index: -1
backStand/5
rotate: true
xy: 341, 222
size: 90, 111
orig: 256, 256
offset: 84, 74
index: -1
backStand/6
rotate: true
xy: 228, 198
size: 90, 111
orig: 256, 256
offset: 84, 73
index: -1
positiveAttack/1
rotate: true
xy: 351, 314
size: 96, 112
orig: 256, 256
offset: 85, 83
index: -1
positiveAttack/2
rotate: true
xy: 2, 640
size: 113, 121
orig: 256, 256
offset: 67, 83
index: -1
positiveAttack/3
rotate: true
xy: 115, 284
size: 104, 111
orig: 256, 256
offset: 72, 83
index: -1
positiveAttack/4
rotate: true
xy: 237, 483
size: 83, 113
orig: 256, 256
offset: 87, 72
index: -1
positiveAttack/5
rotate: true
xy: 2, 21
size: 101, 107
orig: 256, 256
offset: 89, 67
index: -1
positiveRun/1
rotate: true
xy: 117, 390
size: 85, 112
orig: 256, 256
offset: 73, 68
index: -1
positiveRun/2
rotate: true
xy: 454, 170
size: 102, 110
orig: 256, 256
offset: 84, 71
index: -1
positiveRun/3
rotate: true
xy: 2, 226
size: 101, 111
orig: 256, 256
offset: 92, 72
index: -1
positiveRun/4
rotate: false
xy: 475, 485
size: 87, 112
orig: 256, 256
offset: 98, 68
index: -1
positiveRun/5
rotate: true
xy: 2, 124
size: 100, 109
orig: 256, 256
offset: 81, 71
index: -1
positiveRun/6
rotate: true
xy: 352, 412
size: 102, 112
orig: 256, 256
offset: 63, 70
index: -1
positiveStand/1
rotate: true
xy: 261, 749
size: 93, 122
orig: 256, 256
offset: 82, 59
index: -1
positiveStand/2
rotate: true
xy: 402, 829
size: 94, 122
orig: 256, 256
offset: 82, 59
index: -1
positiveStand/3
rotate: true
xy: 2, 755
size: 91, 123
orig: 256, 256
offset: 80, 60
index: -1
positiveStand/4
rotate: true
xy: 127, 678
size: 90, 122
orig: 256, 256
offset: 82, 60
index: -1
sideAttack/1
rotate: true
xy: 115, 181
size: 101, 109
orig: 256, 256
offset: 101, 86
index: -1
sideAttack/2
rotate: false
xy: 125, 571
size: 117, 105
orig: 256, 256
offset: 96, 91
index: -1
sideAttack/3
rotate: true
xy: 251, 674
size: 73, 118
orig: 256, 256
offset: 99, 79
index: -1
sideAttack/4
rotate: true
xy: 385, 712
size: 115, 119
orig: 256, 256
offset: 66, 77
index: -1
sideAttack/5
rotate: true
xy: 244, 568
size: 104, 114
orig: 256, 256
offset: 66, 79
index: -1
sideRun/1
rotate: true
xy: 360, 516
size: 87, 113
orig: 256, 256
offset: 72, 75
index: -1
sideRun/2
rotate: false
xy: 488, 599
size: 75, 111
orig: 256, 256
offset: 83, 78
index: -1
sideRun/3
rotate: true
xy: 226, 109
size: 87, 108
orig: 256, 256
offset: 77, 82
index: -1
sideRun/5
rotate: true
xy: 135, 770
size: 77, 124
orig: 256, 256
offset: 76, 79
index: -1
sideRun/6
rotate: true
xy: 275, 844
size: 80, 125
orig: 256, 256
offset: 79, 65
index: -1
sideStand/1
rotate: true
xy: 141, 926
size: 74, 135
orig: 256, 256
offset: 85, 65
index: -1
sideStand/2
rotate: true
xy: 278, 926
size: 74, 135
orig: 256, 256
offset: 85, 66
index: -1
sideStand/3
rotate: true
xy: 415, 925
size: 75, 134
orig: 256, 256
offset: 85, 66
index: -1
sideStand/4
rotate: true
xy: 2, 848
size: 75, 131
orig: 256, 256
offset: 85, 67
index: -1
sideStand/5
rotate: true
xy: 141, 849
size: 75, 132
orig: 256, 256
offset: 85, 66
index: -1
sideStand/6
rotate: true
xy: 2, 925
size: 75, 137
orig: 256, 256
offset: 85, 65
index: -1

View File

@@ -1,12 +0,0 @@
{
"ver": "1.0.1",
"importer": "*",
"imported": true,
"uuid": "11ddc41a-088b-469a-aad6-43824d5a38da",
"files": [
".atlas",
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -1,614 +0,0 @@
{
"skeleton": {
"hash": "/cSYbStzuBfw7XdYCxQMF4eFg5Y",
"spine": "3.8.99",
"x": -132.67,
"y": -88.29,
"width": 256,
"height": 256,
"images": "",
"audio": ""
},
"bones": [
{
"name": "root",
"x": -4.67,
"y": 39.71
}
],
"slots": [
{
"name": "1",
"bone": "root",
"attachment": "backRun/5"
}
],
"skins": [
{
"name": "default",
"attachments": {
"1": {
"backAttack/1": {
"width": 256,
"height": 256
},
"backAttack/2": {
"width": 256,
"height": 256
},
"backAttack/3": {
"width": 256,
"height": 256
},
"backAttack/4": {
"width": 256,
"height": 256
},
"backAttack/5": {
"width": 256,
"height": 256
},
"backRun/1": {
"width": 256,
"height": 256
},
"backRun/2": {
"width": 256,
"height": 256
},
"backRun/3": {
"width": 256,
"height": 256
},
"backRun/4": {
"width": 256,
"height": 256
},
"backRun/5": {
"width": 256,
"height": 256
},
"backRun/6": {
"width": 256,
"height": 256
},
"backStand/1": {
"width": 256,
"height": 256
},
"backStand/2": {
"width": 256,
"height": 256
},
"backStand/3": {
"width": 256,
"height": 256
},
"backStand/4": {
"width": 256,
"height": 256
},
"backStand/5": {
"width": 256,
"height": 256
},
"backStand/6": {
"width": 256,
"height": 256
},
"positiveAttack/1": {
"width": 256,
"height": 256
},
"positiveAttack/2": {
"width": 256,
"height": 256
},
"positiveAttack/3": {
"width": 256,
"height": 256
},
"positiveAttack/4": {
"width": 256,
"height": 256
},
"positiveAttack/5": {
"width": 256,
"height": 256
},
"positiveRun/1": {
"width": 256,
"height": 256
},
"positiveRun/2": {
"width": 256,
"height": 256
},
"positiveRun/3": {
"width": 256,
"height": 256
},
"positiveRun/4": {
"width": 256,
"height": 256
},
"positiveRun/5": {
"width": 256,
"height": 256
},
"positiveRun/6": {
"width": 256,
"height": 256
},
"positiveStand/1": {
"width": 256,
"height": 256
},
"positiveStand/2": {
"width": 256,
"height": 256
},
"positiveStand/3": {
"width": 256,
"height": 256
},
"positiveStand/4": {
"width": 256,
"height": 256
},
"sideAttack/1": {
"width": 256,
"height": 256
},
"sideAttack/2": {
"width": 256,
"height": 256
},
"sideAttack/3": {
"width": 256,
"height": 256
},
"sideAttack/4": {
"width": 256,
"height": 256
},
"sideAttack/5": {
"width": 256,
"height": 256
},
"sideRun/1": {
"width": 256,
"height": 256
},
"sideRun/2": {
"width": 256,
"height": 256
},
"sideRun/3": {
"width": 256,
"height": 256
},
"sideRun/5": {
"width": 256,
"height": 256
},
"sideRun/6": {
"width": 256,
"height": 256
},
"sideStand/1": {
"width": 256,
"height": 256
},
"sideStand/2": {
"width": 256,
"height": 256
},
"sideStand/3": {
"width": 256,
"height": 256
},
"sideStand/4": {
"width": 256,
"height": 256
},
"sideStand/5": {
"width": 256,
"height": 256
},
"sideStand/6": {
"width": 256,
"height": 256
}
}
}
}
],
"animations": {
"huaxian/backAttack": {
"slots": {
"1": {
"attachment": [
{
"name": "backAttack/1"
},
{
"time": 0.1333,
"name": "backAttack/2"
},
{
"time": 0.2667,
"name": "backAttack/3"
},
{
"time": 0.4,
"name": "backAttack/4"
},
{
"time": 0.5333,
"name": "backAttack/5"
},
{
"time": 0.6667,
"name": "backAttack/5"
}
]
}
},
"bones": {
"root": {
"translate": [
{
"x": -2.34,
"y": -11.68
}
]
}
}
},
"huaxian/backRun": {
"slots": {
"1": {
"attachment": [
{
"name": "backRun/1"
},
{
"time": 0.1333,
"name": "backRun/2"
},
{
"time": 0.2667,
"name": "backRun/3"
},
{
"time": 0.4,
"name": "backRun/4"
},
{
"time": 0.5333,
"name": "backRun/5"
},
{
"time": 0.6667,
"name": "backRun/6"
},
{
"time": 0.8,
"name": "backRun/6"
}
]
}
}
},
"huaxian/backStand": {
"slots": {
"1": {
"attachment": [
{
"name": "backStand/1"
},
{
"time": 0.3333,
"name": "backStand/2"
},
{
"time": 0.6667,
"name": "backStand/3"
},
{
"time": 1,
"name": "backStand/4"
},
{
"time": 1.3333,
"name": "backStand/5"
},
{
"time": 1.6667,
"name": "backStand/6"
},
{
"time": 2,
"name": "backStand/6"
}
]
}
},
"bones": {
"root": {
"translate": [
{
"x": 11.1,
"y": -2.92
}
]
}
}
},
"huaxian/positiveAttack": {
"slots": {
"1": {
"attachment": [
{
"name": "positiveAttack/1"
},
{
"time": 0.1333,
"name": "positiveAttack/2"
},
{
"time": 0.2667,
"name": "positiveAttack/3"
},
{
"time": 0.4,
"name": "positiveAttack/4"
},
{
"time": 0.5333,
"name": "positiveAttack/5"
},
{
"time": 0.6667,
"name": "positiveAttack/5"
}
]
}
},
"bones": {
"root": {
"translate": [
{
"x": 14.02,
"y": -12.26
}
]
}
}
},
"huaxian/positiveRun": {
"slots": {
"1": {
"attachment": [
{
"name": "positiveRun/1"
},
{
"time": 0.1333,
"name": "positiveRun/2"
},
{
"time": 0.2667,
"name": "positiveRun/3"
},
{
"time": 0.4,
"name": "positiveRun/4"
},
{
"time": 0.5333,
"name": "positiveRun/5"
},
{
"time": 0.6667,
"name": "positiveRun/6"
},
{
"time": 0.8,
"name": "positiveRun/6"
}
]
}
},
"bones": {
"root": {
"translate": [
{
"x": 4.67,
"y": 7.01
}
]
}
}
},
"huaxian/positiveStand": {
"slots": {
"1": {
"attachment": [
{
"name": "positiveStand/1"
},
{
"time": 0.3333,
"name": "positiveStand/2"
},
{
"time": 0.6667,
"name": "positiveStand/3"
},
{
"time": 1,
"name": "positiveStand/4"
},
{
"time": 1.3333,
"name": "positiveStand/4"
}
]
}
},
"bones": {
"root": {
"translate": [
{
"y": 8.76
}
]
}
}
},
"huaxian/sideAttack": {
"slots": {
"1": {
"attachment": [
{
"name": "sideAttack/1"
},
{
"time": 0.1333,
"name": "sideAttack/2"
},
{
"time": 0.2667,
"name": "sideAttack/3"
},
{
"time": 0.4,
"name": "sideAttack/4"
},
{
"time": 0.5333,
"name": "sideAttack/5"
},
{
"time": 0.6667,
"name": "sideAttack/5"
}
]
}
},
"bones": {
"root": {
"translate": [
{
"x": 3.5,
"y": -2.34
}
],
"scale": [
{
"x": -1
}
]
}
}
},
"huaxian/sideRun": {
"slots": {
"1": {
"attachment": [
{
"name": "sideRun/1"
},
{
"time": 0.1333,
"name": "sideRun/2"
},
{
"time": 0.2667,
"name": "sideRun/6"
},
{
"time": 0.4,
"name": "sideRun/5"
},
{
"time": 0.5333,
"name": "sideRun/3"
},
{
"time": 0.6667,
"name": "sideRun/3"
}
]
}
},
"bones": {
"root": {
"translate": [
{
"x": 7.01,
"y": 2.92
}
],
"scale": [
{
"x": -1
}
]
}
}
},
"huaxian/sideStand": {
"slots": {
"1": {
"attachment": [
{
"name": "sideStand/1"
},
{
"time": 0.3333,
"name": "sideStand/2"
},
{
"time": 0.6667,
"name": "sideStand/3"
},
{
"time": 1,
"name": "sideStand/4"
},
{
"time": 1.3333,
"name": "sideStand/5"
},
{
"time": 1.6667,
"name": "sideStand/6"
},
{
"time": 2,
"name": "sideStand/6"
}
]
}
},
"bones": {
"root": {
"translate": [
{
"x": 4.67,
"y": -4.09
}
],
"scale": [
{
"x": -1
}
]
}
}
}
}
}

View File

@@ -1,11 +0,0 @@
{
"ver": "1.2.6",
"importer": "spine-data",
"imported": true,
"uuid": "bccbd7aa-4908-42ed-9518-45a5824e9362",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 776 KiB

View File

@@ -1,70 +0,0 @@
{
"ver": "1.0.26",
"importer": "image",
"imported": true,
"uuid": "373c8512-cbee-4706-877d-1f9faeaa2a55",
"files": [
".json",
".png"
],
"subMetas": {
"huaxian": {
"ver": "1.0.4",
"uuid": "55603201-ec8b-4d7a-b1bd-4a435becdf6a",
"rawTextureUuid": "373c8512-cbee-4706-877d-1f9faeaa2a55",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 2,
"trimY": 2,
"width": 562,
"height": 998,
"rawWidth": 566,
"rawHeight": 1002,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {},
"importer": "*",
"imported": false,
"files": [],
"userData": {},
"displayName": "",
"id": "",
"name": ""
},
"6c48a": {
"importer": "texture",
"uuid": "373c8512-cbee-4706-877d-1f9faeaa2a55@6c48a",
"displayName": "huaxian",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "repeat",
"wrapModeT": "repeat",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "373c8512-cbee-4706-877d-1f9faeaa2a55",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "texture",
"redirect": "373c8512-cbee-4706-877d-1f9faeaa2a55@6c48a",
"fixAlphaTransparencyArtifacts": false
}
}

View File

@@ -3,13 +3,13 @@
"__type__": "cc.Prefab",
"_name": "own",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false,
"asyncLoadAssets": false
"persistent": false
},
{
"__type__": "cc.Node",
@@ -68,6 +68,7 @@
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
@@ -81,6 +82,7 @@
"__type__": "cc.Node",
"_name": "shader",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
@@ -116,6 +118,7 @@
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
@@ -129,6 +132,7 @@
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
@@ -156,6 +160,7 @@
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
@@ -204,12 +209,16 @@
"asset": {
"__id__": 0
},
"fileId": "66VNgwnoRDmprg2mtbH825"
"fileId": "66VNgwnoRDmprg2mtbH825",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "avatar",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
@@ -248,6 +257,7 @@
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
@@ -261,6 +271,7 @@
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 8
},
@@ -270,13 +281,13 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 256,
"height": 256
"width": 320,
"height": 320
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
"x": 0.53125,
"y": 0.53125
},
"_id": ""
},
@@ -288,6 +299,7 @@
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 8
},
@@ -305,23 +317,23 @@
"b": 255,
"a": 255
},
"loop": true,
"_timeScale": 1,
"_useTint": false,
"_preCacheMode": 1,
"_cacheMode": 1,
"_defaultCacheMode": 1,
"_debugBones": false,
"_debugSlots": false,
"_skeletonData": {
"__uuid__": "bccbd7aa-4908-42ed-9518-45a5824e9362",
"__uuid__": "52673d05-5225-4ac6-98e4-efe6494452ce",
"__expectedType__": "sp.SkeletonData"
},
"defaultSkin": "heath",
"defaultAnimation": "magic1",
"_premultipliedAlpha": false,
"defaultSkin": "default",
"defaultAnimation": "huaxian/positiveStand",
"_timeScale": 1,
"_preCacheMode": 1,
"_cacheMode": 1,
"_sockets": [],
"_useTint": false,
"_debugMesh": false,
"_debugBones": false,
"_debugSlots": false,
"_enableBatch": false,
"loop": true,
"_id": ""
},
{
@@ -332,6 +344,7 @@
"__type__": "eb846wnC9NNnIJh5u2Kw3mj",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 8
},
@@ -359,12 +372,16 @@
"asset": {
"__id__": 0
},
"fileId": "48a+Hx9oREoZ7vqKgprKhT"
"fileId": "48a+Hx9oREoZ7vqKgprKhT",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "top",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
@@ -404,6 +421,7 @@
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
@@ -417,6 +435,7 @@
"__type__": "cc.Node",
"_name": "lab_name",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 16
},
@@ -439,7 +458,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 17.119999999999997,
"y": 17.12,
"z": 0
},
"_lrot": {
@@ -455,6 +474,7 @@
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
@@ -468,6 +488,7 @@
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 17
},
@@ -477,8 +498,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 112.06,
"height": 34.239999999999995
"width": 112.05859375,
"height": 34.24
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -495,6 +516,7 @@
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 17
},
@@ -529,16 +551,30 @@
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 1,
"_id": "",
"_enableOutline": true,
"_outlineWidth": 2,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
}
},
"_outlineWidth": 2,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
@@ -548,6 +584,7 @@
"__type__": "cc.LabelOutline",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 17
},
@@ -569,12 +606,16 @@
"asset": {
"__id__": 0
},
"fileId": "31uZ7ewvdKoKWqTJ+narWR"
"fileId": "31uZ7ewvdKoKWqTJ+narWR",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 16
},
@@ -585,7 +626,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 34.239999999999995
"height": 34.24
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -602,6 +643,7 @@
"__type__": "cc.Layout",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 16
},
@@ -643,12 +685,16 @@
"asset": {
"__id__": 0
},
"fileId": "d6Y+tOem9EaKNOQr6QHMns"
"fileId": "d6Y+tOem9EaKNOQr6QHMns",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
@@ -676,6 +722,7 @@
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
@@ -693,20 +740,20 @@
"b": 255,
"a": 255
},
"loop": true,
"_timeScale": 1,
"_useTint": false,
"_preCacheMode": -1,
"_cacheMode": 0,
"_defaultCacheMode": 0,
"_debugBones": false,
"_debugSlots": false,
"_skeletonData": null,
"_premultipliedAlpha": true,
"defaultSkin": "",
"defaultAnimation": "",
"_premultipliedAlpha": true,
"_timeScale": 1,
"_preCacheMode": -1,
"_cacheMode": 0,
"_sockets": [],
"_useTint": false,
"_debugMesh": false,
"_debugBones": false,
"_debugSlots": false,
"_enableBatch": false,
"loop": true,
"_id": ""
},
{
@@ -717,6 +764,7 @@
"__type__": "9b561C/2tNGlbtkkgBnAepW",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
@@ -737,6 +785,7 @@
"__type__": "dce41bFTUxMzbef69z5vQ3c",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
@@ -754,6 +803,7 @@
"__type__": "60726sarbtIDJfLLE+75yKL",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
@@ -775,6 +825,8 @@
"asset": {
"__id__": 0
},
"fileId": "fdklpBwCBM/qJ4WFlQF3kT"
"fileId": "fdklpBwCBM/qJ4WFlQF3kT",
"instance": null,
"targetOverrides": null
}
]

View File

@@ -2,7 +2,7 @@
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "68312d09-31ea-4d07-854c-77577550d460",
"uuid": "63c02880-bda6-4370-bb22-46bf4f49bbfe",
"files": [
".json"
],

View File

@@ -318,8 +318,8 @@
"__uuid__": "52673d05-5225-4ac6-98e4-efe6494452ce",
"__expectedType__": "sp.SkeletonData"
},
"defaultSkin": "war",
"defaultAnimation": "magic1",
"defaultSkin": "heath",
"defaultAnimation": "idle",
"_premultipliedAlpha": false,
"_timeScale": 1,
"_preCacheMode": 1,
@@ -349,17 +349,11 @@
"__prefab": {
"__id__": 14
},
"AssetRawUrl": {
"__uuid__": "50147ed6-e9d8-4918-9335-9f22e6e3209d",
"__expectedType__": "cc.JsonAsset"
},
"PlayOnStart": true,
"AutoUpdate": true,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "1dfEZV+LtJ6pMM3O7GBe5I"
"fileId": "1917h/XdtMPqWpv2Qb0f6K"
},
{
"__type__": "cc.PrefabInfo",

View File

@@ -65,9 +65,6 @@ export class MapViewComp extends CCComp {
var test7 = ecs.getEntity<Role>(Role);
test7.load(this.aStarToVec3("360,-60"), true);
}
else {
this.scene.setPlayer(pos);
}
}
private aStarToVec3(str: string) {

View File

@@ -2,11 +2,8 @@ import { Camera, CCBoolean, Component, EventTouch, Node, screen, Size, Texture2D
import { oops } from "../../../../../extensions/oops-plugin-framework/assets/core/Oops";
import MapData from "./map/base/MapData";
import { MapLoadModel } from "./map/base/MapLoadModel";
import MapParams from "./map/base/MapParams";
import Charactor from "./map/charactor/Charactor";
import EntityLayer from "./map/layer/EntityLayer";
import MapLayer from "./map/layer/MapLayer";
import IRoadSeeker from "./map/road/IRoadSeeker";
import RoadNode from "./map/road/RoadNode";
const { ccclass, property } = _decorator;
@@ -39,24 +36,9 @@ export class MapViewScene extends Component {
ratio: Vec2 = new Vec2();
private _roadDic: { [key: string]: RoadNode } = {};
private _roadSeeker!: IRoadSeeker;
private _mapParams: MapParams | null = null;
private player: Charactor | null = null; // 主角玩家
private targetPos: Vec3 = new Vec3(); // 摄像机位置
private winSize!: Size; // 屏幕尺寸
private screenCenter: Vec3 = new Vec3(); // 屏幕中心位置
private boundary: Vec2 = new Vec2(); // 边界位置
setPlayer(value: Charactor | Vec3) {
if (value instanceof Charactor) {
this.enabled = true;
this.player = value;
}
else {
this.player!.pos = value;
}
}
onLoad() {
this.enabled = false;

View File

@@ -6,7 +6,6 @@
*/
import { Component, Node, _decorator } from 'cc';
import { Timer } from '../../../../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer';
import Charactor from '../charactor/Charactor';
const { ccclass, property } = _decorator;
@@ -21,15 +20,16 @@ export default class EntityLayer extends Component {
private timer: Timer = new Timer(0.2);
update(dt: number) {
if (this.timer.update(dt))
this.node.children.sort(this.zIndexSort);
this.timer.update(dt)
// if (this.timer.update(dt))
// this.node.children.sort(this.zIndexSort);
}
private zIndexSort(a: Node, b: Node) {
let a_zIndex = a.getComponent(Charactor)!.zIndex;
let b_zIndex = b.getComponent(Charactor)!.zIndex;
return a_zIndex - b_zIndex;
}
// private zIndexSort(a: Node, b: Node) {
// let a_zIndex = a.getComponent(Charactor)!.zIndex;
// let b_zIndex = b.getComponent(Charactor)!.zIndex;
// return a_zIndex - b_zIndex;
// }
public clear() {
this.node.children.forEach(n => {

View File

@@ -11,7 +11,6 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/O
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { UIID } from "../common/config/GameUIConfig";
import { smc } from "../common/SingletonModuleComp";
import Charactor from "../map/view/map/charactor/Charactor";
import { RoleModelComp } from "./model/RoleModelComp";
import { RoleSpine } from "./view/RoleSpine";
import { RoleViewComp } from "./view/RoleViewComp";
@@ -47,8 +46,6 @@ export class Role extends ecs.Entity {
this.add(mv);
var as = node.getComponent(RoleSpine);
// as.setSkin(skin);
// as.setPlayer(pos);
if (isMonster) {
node.setScale(-1, 1, 1);
}

View File

@@ -8,11 +8,11 @@
/** 角色动作名 */
export enum RoleAnimatorType {
/** 待机 */
Idle = "Idle",
idle = "idle",
/** 攻击 */
Attack = "Attack",
act1 = "act1",
/** 受击 */
Hurt = "Hurt",
magic1 = "magic1",
/** 死亡 */
Dead = "Dead"
move = "move"
}

View File

@@ -7,8 +7,6 @@
import { Color, Component, EventTouch, sp, Vec3, _decorator } from "cc";
import { LayerUtil } from "../../../../../extensions/oops-plugin-framework/assets/core/utils/LayerUtil";
import { smc } from "../../common/SingletonModuleComp";
import Charactor, { CharactorDirection, CharactorState } from "../../map/view/map/charactor/Charactor";
import { ICharactorClip } from "../../map/view/map/charactor/ICharactorClip";
import RoleSpineAnimator from "./RoleSpineAnimator";
const { ccclass, property } = _decorator;
@@ -17,55 +15,29 @@ const { ccclass, property } = _decorator;
* SPINE角色模型
*/
@ccclass('RoleSpine')
export class RoleSpine extends Component implements ICharactorClip {
export class RoleSpine extends Component {
@property({ type: RoleSpineAnimator, tooltip: '动画控制器' })
animator: RoleSpineAnimator = null!;
private spine!: sp.Skeleton;
private charactor!: Charactor;
onLoad() {
// 角色控制组件
// this.charactor = this.addComponent(Charactor)!;
this.initAnimator();
LayerUtil.setNodeLayer(LayerUtil.MAP, this.node);
this.idle();
}
/** 初始化动画 */
protected initAnimator() {
this.spine = this.animator.getComponent(sp.Skeleton)!;
this.spine.setSkin('war');
}
setPlayer(pos: Vec3) {
// var scene = smc.map.MapView.scene;
// this.node.parent = scene.entityLayer!.node!;
// this.charactor.clip = this;
// this.charactor.sceneMap = scene;
this.charactor.pos = pos;
this.charactor.updateZIndex();
}
setDirection(value: CharactorDirection): void {
if (value > 4) {
this.animator!.node.setScale(-1, 1, 1);
}
else {
this.animator!.node.setScale(1, 1, 1);
}
}
setState(value: CharactorState): void {
switch (value) {
case CharactorState.Idle:
this.idle();
break;
case CharactorState.Run:
this.walk();
break;
}
}
setSkin(value: string): void {
this.spine.setSkin(value);
}
@@ -89,10 +61,10 @@ export class RoleSpine extends Component implements ICharactorClip {
}
walk() {
this.animator!.setNumber("Speed", 1);
}
idle() {
this.animator!.setNumber("Speed", 0);
this.animator!.play("idle");
}
}

View File

@@ -4,9 +4,7 @@
* @LastEditors: dgflash
* @LastEditTime: 2022-08-04 15:26:38
*/
import { sp, _decorator } from "cc";
import AnimatorSpine from "../../../../../extensions/oops-plugin-framework/assets/libs/animator/AnimatorSpine";
import Charactor, { CharactorDirection } from "../../map/view/map/charactor/Charactor";
import { sp, _decorator ,Component} from "cc";
const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
@@ -16,24 +14,28 @@ const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
@ccclass
@disallowMultiple
@requireComponent(sp.Skeleton)
export default class RoleSpineAnimator extends AnimatorSpine {
private charactor!: Charactor;
private dir: CharactorDirection = CharactorDirection.bottom;
export default class RoleSpineAnimator extends Component {
private animName: string = "idle";
private loop: boolean = true;
start() {
this.charactor = this.node.parent!.getComponent(Charactor)!;
super.start();
console.log("RoleSpineAnimator start");
this.playAnimation(this.animName, this.loop);
}
lateUpdate(dt: number) {
if (this.dir != this.charactor.direction) {
this.dir = this.charactor.direction;
this.playAnimation(this.animName, this.loop);
}
this.playAnimation(this.animName, this.loop);
}
play(animName: string, loop: boolean) {
if (animName) {
this.animName = animName;
this.loop = loop;
}
else {
}
}
/**
* 播放动画
* @override
@@ -44,29 +46,9 @@ export default class RoleSpineAnimator extends AnimatorSpine {
if (animName) {
this.animName = animName;
this.loop = loop;
// animName = `huaxian/${this.getDirection(this.charactor.direction)}${animName}`;
this._spine.setAnimation(0, animName, loop);
}
else {
this._spine.clearTrack(0);
}
}
private getDirection(dir: CharactorDirection): string {
let dirName = "";
if (dir == CharactorDirection.up) {
dirName = "back";
}
else if (dir == CharactorDirection.bottom) {
dirName = "positive";
}
else if (dir == CharactorDirection.left || dir == CharactorDirection.left_up || dir == CharactorDirection.left_bottom) {
dirName = "side";
}
else if (dir == CharactorDirection.right || dir == CharactorDirection.right_up || dir == CharactorDirection.right_bottom) {
dirName = "side";
}
return dirName;
}
}

View File

@@ -8,7 +8,6 @@
import { Vec3, _decorator } from "cc";
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import Charactor from "../../map/view/map/charactor/Charactor";
import { RoleSpine } from "./RoleSpine";
const { ccclass, property } = _decorator;
@@ -20,12 +19,10 @@ export class RoleViewComp extends CCComp {
/** 角色动画 */
as: RoleSpine = null!;
/** 角色控制器 */
charactor: Charactor = null!;
/** 视图层逻辑代码分离演示 */
onLoad() {
this.as = this.getComponent(RoleSpine);
this.charactor = this.getComponent(Charactor);
}

View File

@@ -7,30 +7,18 @@
import { Component, v3, _decorator } from "cc";
import { smc } from "../../common/SingletonModuleComp";
import Charactor from "../../map/view/map/charactor/Charactor";
import MapRoadUtils from "../../map/view/map/road/MapRoadUtils";
import RoadNode from "../../map/view/map/road/RoadNode";
const { ccclass, property } = _decorator;
@ccclass('RoleViewOwn')
export class RoleViewOwn extends Component {
private charactor!: Charactor;
onLoad() {
this.charactor = this.getComponent(Charactor)!;
this.node.on(Charactor.NextRoadNode, this.onNextRoadNode, this);
}
private onNextRoadNode(rn: RoadNode) {
var key: string = rn.dx + "," + rn.dy;
var mv = smc.map.MapView;
var delivery = mv.deliverys.get(key);
if (delivery && mv.isTransfer == false) {
this.charactor.stop();
mv.transfer(delivery.toMapId, this.aStarToVec3(delivery.start));
}
}
private aStarToVec3(str: string) {
let array = str.split(",");