复制的数据 删除后的 代码需要注意

This commit is contained in:
2024-09-24 16:20:06 +08:00
parent 61a1188865
commit ecc7ba9621
9 changed files with 4477 additions and 3626 deletions

View File

@@ -28,17 +28,17 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 525 "__id__": 514
}, },
{ {
"__id__": 527 "__id__": 516
}, },
{ {
"__id__": 529 "__id__": 518
} }
], ],
"_prefab": { "_prefab": {
"__id__": 531 "__id__": 520
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -197,17 +197,17 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 518 "__id__": 507
}, },
{ {
"__id__": 520 "__id__": 509
}, },
{ {
"__id__": 522 "__id__": 511
} }
], ],
"_prefab": { "_prefab": {
"__id__": 524 "__id__": 513
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -251,29 +251,29 @@
"__id__": 8 "__id__": 8
}, },
{ {
"__id__": 487 "__id__": 476
}, },
{ {
"__id__": 491 "__id__": 480
}, },
{ {
"__id__": 497 "__id__": 486
}, },
{ {
"__id__": 503 "__id__": 492
}, },
{ {
"__id__": 509 "__id__": 498
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 515 "__id__": 504
} }
], ],
"_prefab": { "_prefab": {
"__id__": 517 "__id__": 506
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -315,28 +315,25 @@
"_children": [ "_children": [
{ {
"__id__": 9 "__id__": 9
},
{
"__id__": 467
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 478 "__id__": 467
}, },
{ {
"__id__": 480 "__id__": 469
}, },
{ {
"__id__": 482 "__id__": 471
}, },
{ {
"__id__": 484 "__id__": 473
} }
], ],
"_prefab": { "_prefab": {
"__id__": 486 "__id__": 475
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -10903,150 +10900,6 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.Node",
"_objFlags": 0,
"_parent": {
"__id__": 8
},
"_prefab": {
"__id__": 468
},
"__editorExtras__": {}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 467
},
"asset": {
"__uuid__": "dc0b56d7-c633-4cd2-a6ff-8fa2d7456d9d",
"__expectedType__": "cc.Prefab"
},
"fileId": "5bChJGE9BD55+nIimwyIR0",
"instance": {
"__id__": 469
},
"targetOverrides": null
},
{
"__type__": "cc.PrefabInstance",
"fileId": "52NF+SA89HDLiKbfjbyaq1",
"prefabRootNode": {
"__id__": 1
},
"mountedChildren": [],
"mountedComponents": [],
"propertyOverrides": [
{
"__id__": 470
},
{
"__id__": 472
},
{
"__id__": 473
},
{
"__id__": 474
},
{
"__id__": 475
},
{
"__id__": 477
}
],
"removedComponents": []
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 471
},
"propertyPath": [
"_name"
],
"value": "top_inf"
},
{
"__type__": "cc.TargetInfo",
"localID": [
"5bChJGE9BD55+nIimwyIR0"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 471
},
"propertyPath": [
"_lpos"
],
"value": {
"__type__": "cc.Vec3",
"x": -348.33,
"y": 502.03099999999995,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 471
},
"propertyPath": [
"_lrot"
],
"value": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 471
},
"propertyPath": [
"_euler"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 476
},
"propertyPath": [
"_top"
],
"value": -502.031
},
{
"__type__": "cc.TargetInfo",
"localID": [
"9bz4UgZhdBKpjjgS+PZG/n"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 476
},
"propertyPath": [
"_left"
],
"value": -348.33
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -11057,7 +10910,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 479 "__id__": 468
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -11085,7 +10938,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 481 "__id__": 470
}, },
"bgImg": { "bgImg": {
"__id__": 464 "__id__": 464
@@ -11106,7 +10959,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 483 "__id__": 472
}, },
"light": { "light": {
"__uuid__": "319c7eb8-9826-48b6-81e4-82559dbf82a8", "__uuid__": "319c7eb8-9826-48b6-81e4-82559dbf82a8",
@@ -11128,7 +10981,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 485 "__id__": 474
}, },
"start_p": { "start_p": {
"__id__": 454 "__id__": 454
@@ -11164,11 +11017,11 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 488 "__id__": 477
} }
], ],
"_prefab": { "_prefab": {
"__id__": 490 "__id__": 479
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -11205,11 +11058,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 487 "__id__": 476
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 489 "__id__": 478
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -11252,14 +11105,14 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 492 "__id__": 481
}, },
{ {
"__id__": 494 "__id__": 483
} }
], ],
"_prefab": { "_prefab": {
"__id__": 496 "__id__": 485
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -11296,11 +11149,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 491 "__id__": 480
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 493 "__id__": 482
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -11324,11 +11177,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 491 "__id__": 480
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 495 "__id__": 484
}, },
"_id": "" "_id": ""
}, },
@@ -11361,14 +11214,14 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 498 "__id__": 487
}, },
{ {
"__id__": 500 "__id__": 489
} }
], ],
"_prefab": { "_prefab": {
"__id__": 502 "__id__": 491
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -11405,11 +11258,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 497 "__id__": 486
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 499 "__id__": 488
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -11433,11 +11286,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 497 "__id__": 486
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 501 "__id__": 490
}, },
"_id": "" "_id": ""
}, },
@@ -11470,14 +11323,14 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 504 "__id__": 493
}, },
{ {
"__id__": 506 "__id__": 495
} }
], ],
"_prefab": { "_prefab": {
"__id__": 508 "__id__": 497
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -11514,11 +11367,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 503 "__id__": 492
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 505 "__id__": 494
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -11542,11 +11395,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 503 "__id__": 492
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 507 "__id__": 496
}, },
"_id": "" "_id": ""
}, },
@@ -11579,14 +11432,14 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 510 "__id__": 499
}, },
{ {
"__id__": 512 "__id__": 501
} }
], ],
"_prefab": { "_prefab": {
"__id__": 514 "__id__": 503
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -11623,11 +11476,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 509 "__id__": 498
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 511 "__id__": 500
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -11651,11 +11504,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 509 "__id__": 498
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 513 "__id__": 502
}, },
"light": { "light": {
"__uuid__": "319c7eb8-9826-48b6-81e4-82559dbf82a8", "__uuid__": "319c7eb8-9826-48b6-81e4-82559dbf82a8",
@@ -11690,7 +11543,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 516 "__id__": 505
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -11731,7 +11584,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 519 "__id__": 508
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -11759,7 +11612,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 521 "__id__": 510
}, },
"camera": { "camera": {
"__id__": 3 "__id__": 3
@@ -11768,22 +11621,22 @@
"__id__": 7 "__id__": 7
}, },
"mapLayer": { "mapLayer": {
"__id__": 480 "__id__": 469
}, },
"floorLayer": { "floorLayer": {
"__id__": 487 "__id__": 476
}, },
"entityLayer": { "entityLayer": {
"__id__": 500 "__id__": 489
}, },
"entityLayer1": { "entityLayer1": {
"__id__": 494 "__id__": 483
}, },
"entityLayer2": { "entityLayer2": {
"__id__": 506 "__id__": 495
}, },
"SkillLayer": { "SkillLayer": {
"__id__": 512 "__id__": 501
}, },
"isFollowPlayer": true, "isFollowPlayer": true,
"_id": "" "_id": ""
@@ -11802,7 +11655,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 523 "__id__": 512
}, },
"_id": "" "_id": ""
}, },
@@ -11833,7 +11686,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 526 "__id__": 515
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -11861,7 +11714,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 528 "__id__": 517
}, },
"_cameraComponent": { "_cameraComponent": {
"__id__": 3 "__id__": 3
@@ -11883,7 +11736,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 530 "__id__": 519
}, },
"_alignFlags": 45, "_alignFlags": 45,
"_target": null, "_target": null,
@@ -11921,9 +11774,6 @@
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": [ "nestedPrefabInstanceRoots": [
{
"__id__": 467
},
{ {
"__id__": 454 "__id__": 454
} }

File diff suppressed because it is too large Load Diff

View File

@@ -79,8 +79,17 @@ export class SingletonModuleComp extends ecs.Comp {
mission:{ mission:{
once:6, //每波刷新怪物数量 once:6, //每波刷新怪物数量
total:120, //总怪物数 total:120, //总怪物数
reward:12, //怪物死亡奖励数量 reward:5, //怪物死亡奖励数量
reward_num:0, //怪物死亡数 reward_num:0, //怪物死亡数
coin:600,
coin_add:1,
coin_reward_add:1,
normal_cost:10,
better_cost:20,
best_cost:30,
normal_lv:1,
better_lv:1,
best_lv:1,
t_damge:0, t_damge:0,
t_dps:0, t_dps:0,
h_dps:0, h_dps:0,
@@ -130,7 +139,7 @@ export class SingletonModuleComp extends ecs.Comp {
3:{bonus:3,lv:0,lv_max:5,info:"英雄攻击加速",name:""}, 3:{bonus:3,lv:0,lv_max:5,info:"英雄攻击加速",name:""},
4:{bonus:3,lv:0,lv_max:5,info:"英雄技能cd加速",name:""}, 4:{bonus:3,lv:0,lv_max:5,info:"英雄技能cd加速",name:""},
5:{bonus:3,lv:0,lv_max:5,info:"英雄技能效果加强",name:""}, 5:{bonus:3,lv:0,lv_max:5,info:"英雄技能效果加强",name:""},
6:{bonus:3,lv:0,lv_max:5,info:"",name:""}, 6:{bonus:3,lv:0,lv_max:5,info:"铜币收益增加",name:""},
7:{bonus:3,lv:0,lv_max:5,info:"",name:""}, 7:{bonus:3,lv:0,lv_max:5,info:"",name:""},
8:{bonus:3,lv:0,lv_max:5,info:"",name:""}, 8:{bonus:3,lv:0,lv_max:5,info:"",name:""},
9:{bonus:3,lv:0,lv_max:5,info:"",name:""}, 9:{bonus:3,lv:0,lv_max:5,info:"",name:""},

View File

@@ -1,64 +1,10 @@
export const RewardSet={ export const RewardSet={
1:[ 1:[
{uuid: 5001,path: "5001",type: 1,lv: 1,name: "攻击强化1",info:"佣兵攻击提升10%",atk:10,hp:0,atk_cd:0,}, {uuid: 5001,path: "5001",type: 1,lv: 1,name: "攻击强化1",info:"佣兵攻击提升10%",atk:10,hp:0,atk_cd:0,coin:0,},
{uuid: 5002,path: "5002",type: 1,lv: 1,name: "攻速强化1",info:"佣兵攻击速度提升10%",atk:0,hp:0,atk_cd:10,}, {uuid: 5002,path: "5002",type: 1,lv: 1,name: "攻速强化1",info:"佣兵攻击速度提升10%",atk:0,hp:0,atk_cd:10,coin:0,},
{uuid: 5003,path: "5003",type: 1,lv: 1,name: "生命强化1",info:"佣兵生命值10%",atk:0,hp:20,atk_cd:0,}, {uuid: 5003,path: "5003",type: 1,lv: 1,name: "生命强化1",info:"佣兵生命值10%",atk:0,hp:20,atk_cd:0,coin:0,},
{uuid: 5004,path: "5004",type: 1,lv: 1,name: "铜币收益",info:"铜币收益 + 10%",atk:0,hp:20,atk_cd:0,coin:30,},
], ],
2:[
{uuid: 5001,path: "5001",type: 1,lv: 2,name: "攻击强化2",info:"佣兵攻击速度提升15%",atk:15,hp:0,atk_cd:0,},
{uuid: 5002,path: "5002",type: 1,lv: 2,name: "攻速强化2",info:"佣兵攻击速度提升15%",atk:0,hp:0,atk_cd:15,},
{uuid: 5003,path: "5003",type: 1,lv: 2,name: "生命强化2",info:"佣兵生命值30%",atk:0,hp:30,atk_cd:0,},
],
3:[
{uuid: 5001,path: "5001",type: 1,lv: 2,name: "攻击强化2",info:"佣兵攻击速度提升15%",atk:15,hp:0,atk_cd:0,},
{uuid: 5002,path: "5002",type: 1,lv: 2,name: "攻速强化2",info:"佣兵攻击速度提升15%",atk:0,hp:0,atk_cd:15,},
{uuid: 5003,path: "5003",type: 1,lv: 2,name: "生命强化2",info:"佣兵生命值30%",atk:0,hp:30,atk_cd:0,},
],
4:[
{uuid: 5001,path: "5001",type: 1,lv: 2,name: "攻击强化2",info:"佣兵攻击速度提升15%",atk:15,hp:0,atk_cd:0,},
{uuid: 5002,path: "5002",type: 1,lv: 2,name: "攻速强化2",info:"佣兵攻击速度提升15%",atk:0,hp:0,atk_cd:15,},
{uuid: 5003,path: "5003",type: 1,lv: 2,name: "生命强化2",info:"佣兵生命值30%",atk:0,hp:30,atk_cd:0,},
],
5:[
{uuid: 5001,path: "5001",type: 1,lv: 2,name: "攻击强化2",info:"佣兵攻击速度提升15%",atk:15,hp:0,atk_cd:0,},
{uuid: 5002,path: "5002",type: 1,lv: 2,name: "攻速强化2",info:"佣兵攻击速度提升15%",atk:0,hp:0,atk_cd:15,},
{uuid: 5003,path: "5003",type: 1,lv: 2,name: "生命强化2",info:"佣兵生命值30%",atk:0,hp:30,atk_cd:0,},
],
6:[
{uuid: 5001,path: "5001",type: 1,lv: 2,name: "攻击强化2",info:"佣兵攻击速度提升15%",atk:15,hp:0,atk_cd:0,},
{uuid: 5002,path: "5002",type: 1,lv: 2,name: "攻速强化2",info:"佣兵攻击速度提升15%",atk:0,hp:0,atk_cd:15,},
{uuid: 5003,path: "5003",type: 1,lv: 2,name: "生命强化2",info:"佣兵生命值30%",atk:0,hp:30,atk_cd:0,},
],
7:[
{uuid: 5001,path: "5001",type: 1,lv: 2,name: "攻击强化2",info:"佣兵攻击速度提升15%",atk:15,hp:0,atk_cd:0,},
{uuid: 5002,path: "5002",type: 1,lv: 2,name: "攻速强化2",info:"佣兵攻击速度提升15%",atk:0,hp:0,atk_cd:15,},
{uuid: 5003,path: "5003",type: 1,lv: 2,name: "生命强化2",info:"佣兵生命值30%",atk:0,hp:30,atk_cd:0,},
],
8:[
{uuid: 5001,path: "5001",type: 1,lv: 2,name: "攻击强化2",info:"佣兵攻击速度提升15%",atk:15,hp:0,atk_cd:0,},
{uuid: 5002,path: "5002",type: 1,lv: 2,name: "攻速强化2",info:"佣兵攻击速度提升15%",atk:0,hp:0,atk_cd:15,},
{uuid: 5003,path: "5003",type: 1,lv: 2,name: "生命强化2",info:"佣兵生命值30%",atk:0,hp:30,atk_cd:0,},
],
9:[
{uuid: 5001,path: "5001",type: 1,lv: 2,name: "攻击强化2",info:"佣兵攻击速度提升15%",atk:15,hp:0,atk_cd:0,},
{uuid: 5002,path: "5002",type: 1,lv: 2,name: "攻速强化2",info:"佣兵攻击速度提升15%",atk:0,hp:0,atk_cd:15,},
{uuid: 5003,path: "5003",type: 1,lv: 2,name: "生命强化2",info:"佣兵生命值30%",atk:0,hp:30,atk_cd:0,},
],
10:[
{uuid: 5001,path: "5001",type: 1,lv: 2,name: "攻击强化2",info:"佣兵攻击速度提升15%",atk:15,hp:0,atk_cd:0,},
{uuid: 5002,path: "5002",type: 1,lv: 2,name: "攻速强化2",info:"佣兵攻击速度提升15%",atk:0,hp:0,atk_cd:15,},
{uuid: 5003,path: "5003",type: 1,lv: 2,name: "生命强化2",info:"佣兵生命值30%",atk:0,hp:30,atk_cd:0,},
],
11:[
{uuid: 5001,path: "5001",type: 1,lv: 2,name: "攻击强化2",info:"佣兵攻击速度提升15%",atk:15,hp:0,atk_cd:0,},
{uuid: 5002,path: "5002",type: 1,lv: 2,name: "攻速强化2",info:"佣兵攻击速度提升15%",atk:0,hp:0,atk_cd:15,},
{uuid: 5003,path: "5003",type: 1,lv: 2,name: "生命强化2",info:"佣兵生命值30%",atk:0,hp:30,atk_cd:0,},
],
12:[
{uuid: 5001,path: "5001",type: 1,lv: 2,name: "攻击强化2",info:"佣兵攻击速度提升15%",atk:15,hp:0,atk_cd:0,},
{uuid: 5002,path: "5002",type: 1,lv: 2,name: "攻速强化2",info:"佣兵攻击速度提升15%",atk:0,hp:0,atk_cd:15,},
{uuid: 5003,path: "5003",type: 1,lv: 2,name: "生命强化2",info:"佣兵生命值30%",atk:0,hp:30,atk_cd:0,},
]
} }

View File

@@ -387,7 +387,7 @@ export class HeroViewComp extends CCComp {
in_atk(dt: number) { in_atk(dt: number) {
if(this.atk_time >= this.atk_cd*smc.vm_data.mission.hero.atk_cd){ if(this.atk_time >= this.atk_cd/smc.vm_data.mission.hero.atk_cd){
if(this.is_atking){ if(this.is_atking){
this.atk_time = 0; this.atk_time = 0;
// console.log("atk_cd:"+this.atk_cd); // console.log("atk_cd:"+this.atk_cd);
@@ -425,7 +425,6 @@ export class HeroViewComp extends CCComp {
this.hp_max_add() this.hp_max_add()
this.hp += hp; this.hp += hp;
this.hp_max += hp; this.hp_max += hp;
console.log("hp_max:"+this.hp_max+":"+hp+":"+this.hp)
let hp_progress= this.hp/this.hp_max; let hp_progress= this.hp/this.hp_max;
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress; this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
} }

View File

@@ -0,0 +1,455 @@
import { _decorator,Button,EventHandler,EventTouch,Label,NodeEventType,resources,Sprite,SpriteAtlas,v3 } 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 { smc } from "../common/SingletonModuleComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
import { SkillSet } from "../common/config/SkillSet";
import { HeroModelComp } from "../hero/HeroModelComp";
import { RewardSet } from "../common/config/RewardSet";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('CardControllerComp')
@ecs.register('CardController', false)
export class CardControllerComp extends CCComp {
card_level:number = 1;
in_load:boolean = false
touch_time:number = 0
in_touch:boolean = false
cards:any = {
1:{uuid:1101,type:1,lv:0,cost:0,alive:false},
2:{uuid:1102,type:1,lv:0,cost:0,alive:false},
3:{uuid:1103,type:1,lv:0,cost:0,alive:false},
4:{uuid:1104,type:1,lv:0,cost:0,alive:false},
5:{uuid:1105,type:1,lv:0,cost:0,alive:false},
6:{uuid:1106,type:1,lv:0,cost:0,alive:false},
}
rewards:any = {
1:{uuid: 5001,path: "5001",type: 1,lv: 1,name: "",info:"",atk:0,hp:0,atk_cd:0,},
2:{uuid: 5001,path: "5001",type: 1,lv: 1,name: "",info:"",atk:0,hp:0,atk_cd:0,},
3:{uuid: 5001,path: "5001",type: 1,lv: 1,name: "",info:"",atk:0,hp:0,atk_cd:0,},
}
rewards_set:any = []
reward_lv = 0;
protected onLoad(): void {
oops.message.on("do_reward", this.do_reward, this);
let card1 = this.node.getChildByName("cards").getChildByName("card1");
let card2 = this.node.getChildByName("cards").getChildByName("card2");
let card3 = this.node.getChildByName("cards").getChildByName("card3");
let card4 = this.node.getChildByName("cards").getChildByName("card4");
let card5 = this.node.getChildByName("cards").getChildByName("card5");
let card6 = this.node.getChildByName("cards").getChildByName("card6");
// info_button.on(NodeEventType.TOUCH_START, this.onTouchMove, this);
// info_button.on(NodeEventType.TOUCH_MOVE, this.onTouchMove, this);
card1.on(NodeEventType.TOUCH_START, this.touch1, this);
card1.on(NodeEventType.TOUCH_MOVE, this.touch1, this);
card2.on(NodeEventType.TOUCH_START, this.touch2, this);
card2.on(NodeEventType.TOUCH_MOVE, this.touch2, this);
card3.on(NodeEventType.TOUCH_START, this.touch3, this);
card3.on(NodeEventType.TOUCH_MOVE, this.touch3, this);
card4.on(NodeEventType.TOUCH_START, this.touch4, this);
card4.on(NodeEventType.TOUCH_MOVE, this.touch4, this);
card5.on(NodeEventType.TOUCH_START, this.touch5, this);
card5.on(NodeEventType.TOUCH_MOVE, this.touch5, this);
card6.on(NodeEventType.TOUCH_START, this.touch6, this);
card6.on(NodeEventType.TOUCH_MOVE, this.touch6, this);
card1.on(NodeEventType.TOUCH_END, this.end1, this);
card1.on(NodeEventType.TOUCH_CANCEL, this.end1, this);
card2.on(NodeEventType.TOUCH_END, this.end2, this);
card2.on(NodeEventType.TOUCH_CANCEL, this.end2, this);
card3.on(NodeEventType.TOUCH_END, this.end3, this);
card3.on(NodeEventType.TOUCH_CANCEL, this.end3, this);
card4.on(NodeEventType.TOUCH_END, this.end4, this);
card4.on(NodeEventType.TOUCH_CANCEL, this.end4, this);
card5.on(NodeEventType.TOUCH_END, this.end5, this);
card5.on(NodeEventType.TOUCH_CANCEL, this.end5, this);
card6.on(NodeEventType.TOUCH_END, this.end6, this);
card6.on(NodeEventType.TOUCH_CANCEL, this.end6, this);
}
start() {
this.load_cards()
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
touch1(event: EventTouch) {
this.in_touch=true
if(this.in_load)return
if(!this.cards[1].alive)return
this.show_info(this.cards[1].uuid,this.cards[1].type)
}
touch2(event: EventTouch) {
this.in_touch=true
if(this.in_load)return
if(!this.cards[2].alive)return
this.show_info(this.cards[2].uuid,this.cards[2].type)
}
touch3(event: EventTouch) {
this.in_touch=true
if(this.in_load)return
if(!this.cards[3].alive)return
this.show_info(this.cards[3].uuid,this.cards[3].type)
}
touch4(event: EventTouch) {
this.in_touch=true
if(this.in_load)return
if(!this.cards[4].alive)return
this.show_info(this.cards[4].uuid,this.cards[4].type)
}
touch5(event: EventTouch) {
this.in_touch=true
if(this.in_load)return
if(!this.cards[5].alive)return
this.show_info(this.cards[5].uuid,this.cards[5].type)
}
touch6(event: EventTouch) {
this.in_touch=true
if(this.in_load)return
if(!this.cards[6].alive)return
this.show_info(this.cards[6].uuid,this.cards[6].type)
}
end1(event: EventTouch) {
this.onTouchEnd(1)
}
end2(event: EventTouch) {
this.onTouchEnd(2)
}
end3(event: EventTouch) {
this.onTouchEnd(3)
}
end4(event: EventTouch) {
this.onTouchEnd(4)
}
end5(event: EventTouch) {
this.onTouchEnd(5)
}
end6(event: EventTouch) {
this.onTouchEnd(6)
}
show_info(uuid:number,type:number){
// console.log("show_info",uuid)
let node =this.node.getChildByName("item_box")
if(type == 2){
smc.vm_data.item_box.info = smc.items[uuid].info
smc.vm_data.item_box.name = smc.items[uuid].name
smc.vm_data.item_box.skillcd = smc.items[uuid].cd
smc.vm_data.item_box.skillsd = smc.items[uuid].sd
smc.vm_data.item_box.atk = smc.items[uuid].atk
smc.vm_data.item_box.hp = smc.items[uuid].hp
smc.vm_data.item_box.shield = smc.items[uuid].shield
node.active=true
if(smc.items[uuid].shield > 0){
node.getChildByName("data").getChildByName("shield").active=true
}
if(smc.items[uuid].hp > 0){
node.getChildByName("data").getChildByName("hp").active=true
}
}
}
onTouchEnd(index:number){
if(this.touch_time < 0.2){
this.use_card(index)
}
this.in_touch=false
this.touch_time = 0
let node = this.node.getChildByName("item_box")
node.active=false
node.getChildByName("data").getChildByName("shield").active=false
node.getChildByName("data").getChildByName("hp").active=false
}
shuaxin(dt: number) {
smc.vm_data.shuaxin.min += smc.vm_data.shuaxin.speed*dt;
if (smc.vm_data.shuaxin.min >= smc.vm_data.shuaxin.max) {
smc.vm_data.shuaxin.min = 0;
this.load_cards()
}
}
// cards_update(){
// if(smc.vm_data.gold.min >= smc.vm_data.cards.up_cost){
// smc.vm_data.gold.min -= smc.vm_data.cards.up_cost;
// smc.vm_data.cards.level += 1;
// smc.vm_data.gold.max +=2;
// smc.vm_data.cards.up_cost += 2
// if(smc.vm_data.cards.level >= smc.vm_data.cards.level_max){
// smc.vm_data.cards.level = smc.vm_data.cards.level_max;
// smc.vm_data.cards.up_cost = 11
// }
// console.log("card _level:"+this.card_level+"cost:"+smc.vm_data.cards.up_cost)
// }else{
// oops.gui.toast("金币不够");
// }
// }
palyer_ref(){
if (this.in_load) {
return
}
if((smc.vm_data.shuaxin.max-smc.vm_data.shuaxin.min) < 0.5 ){
oops.gui.toast("马上就要刷新了")
return
}
if(smc.vm_data.shuaxin.min < 0.5){
oops.gui.toast("不要刷新太快哦")
return
}
if (smc.vm_data.gold.min < smc.vm_data.cards.ref_cost) {
oops.gui.toast("金币不足")
return
}
smc.vm_data.gold.min -= smc.vm_data.cards.ref_cost;
this.load_cards()
smc.vm_data.shuaxin.min = -5
if(smc.vm_data.shuaxin.min <=0 ){
smc.vm_data.shuaxin.min = 0
}
}
load_cards() {
this.in_load = true
let card:any=null
for (let index = 1; index <= 6; index++) {
card=RandomManager.instance.getRandomByObjectList(smc.cards, 1);
this.cards[index].uuid=card[0].uuid
this.cards[index].type=card[0].type
let url: string = "";
let pathName: string = "";
let name: string = "";
let level: number = 0;
let cost: number = 0;
let { uuid, type } = card[0];
url = "game/hero/hero_icon";
({ uuid: pathName, name, level ,cost} = smc.heros[uuid]);
this.cards[index].lv=level
this.cards[index].cost = cost
let node=this.node.getChildByName('cards').getChildByName('card'+index)
node.getChildByName('cost').getComponent(Label).string=cost.toString()
node.getChildByName('lv').getChildByName('lv').getComponent(Label).string=level.toString()
node.getChildByName('name').getComponent(Label).string=name
// const sprite = node.getChildByName("item").getComponent(Sprite);
// console.log(this['card'+index],url,pathName,sprite)
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("item").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
this.cards[index].alive=true
}
// for (let index = 5; index <= 6; index++) {
// card=RandomManager.instance.getRandomByObjectList(smc.item_list, 1);
// this.cards[index].uuid=card[0].uuid
// this.cards[index].type=card[0].type
// let url: string = "";
// let pathName: string = "";
// let name: string = "";
// let level: number = 0;
// let { uuid, type } = card[0];
// url = "game/heros/skill";
// ({ path: pathName, name, level } = smc.items[uuid]);
// this.cards[index].lv=level
// let node=this.node.getChildByName('cards').getChildByName('card'+index)
// node.getChildByName('cost').getComponent(Label).string=level.toString()
// node.getChildByName('name').getComponent(Label).string=name
// // const sprite = node.getChildByName("item").getComponent(Sprite);
// // console.log(this['card'+index],url,pathName,sprite)
// resources.load(url, SpriteAtlas, (err: any, atlas) => {
// const sprite = node.getChildByName("item").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(pathName);
// });
// this.cards[index].alive=true
// }
// console.log("cards:",this.cards)
this.in_load = false
}
remove_card(index:number){
this.cards[index].alive=false
this.cards[index].uuid=0
this.cards[index].type=0
this.cards[index].lv=0
let url: string = "gui/gui";
let pathName: string = "129";
let node=this.node.getChildByName('cards').getChildByName('card'+index)
node.getChildByName('cost').getComponent(Label).string=""
node.getChildByName('name').getComponent(Label).string=""
// const sprite = node.getChildByName("item").getComponent(Sprite);
// console.log(this['card'+index],url,pathName,sprite)
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("item").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
}
use_card(index: number){
this.check_card(index)
// console.log("cards:",this.cards)
}
check_card(index:number){
// let heros = ecs.query(ecs.allOf(HeroModelComp))
// let heross= ecs.query(ecs.allOf(MonsterViewComp))
// console.log("heross",heross)
// if(heros.length >= 4&&this.cards[index].type == 1){
// oops.gui.toast("英雄数量达到上限");
// return;
// }
if(!this.cards[index].alive) {
// console.log("card_index:",index,"card_alive:",this.cards[index].alive)
return;
};
if(smc.vm_data.gold.min >= this.cards[index].cost){
this.cards[index].alive=false
this.do_use_card(index)
}else{
oops.gui.toast("金币不够");
}
}
do_use_card(index:number){
this.cards[index].alive=false
smc.vm_data.gold.min -= this.cards[index].cost;
oops.message.dispatchEvent("do_add_hero", { uuid: this.cards[index].uuid });
// switch (this.cards[index].type) {
// case 1:
// oops.message.dispatchEvent("do_add_hero", { uuid: this.cards[index].uuid });
// break;
// case 2:
// oops.message.dispatchEvent("do_use_item", { uuid: this.cards[index].uuid });
// break;
// case 3:
// oops.message.dispatchEvent("do_use_item", { uuid: this.cards[index].uuid });
// break;
// }
this.remove_card(index)
}
do_reward(){
smc.vm_data.game_pause = true;
this.reward_lv+=1
this.rewards_set=RewardSet[this.reward_lv]
let i=RandomManager.instance.getRandomInt(0,this.rewards_set.length-1, 1)
console.log("rewards:",i)
this.rewards[1]=this.rewards_set[i]
this.rewards_set.splice(i,1)
i=RandomManager.instance.getRandomInt(0,this.rewards_set.length-1, 1)
console.log("rewards:",i)
this.rewards[2]=this.rewards_set[i]
this.rewards_set.splice(i,1)
i=RandomManager.instance.getRandomInt(0,this.rewards_set.length-1, 1)
console.log("rewards:",i)
this.rewards[3]=this.rewards_set[i]
this.rewards_set=[]
console.log("rewards:",this.rewards)
let re1=this.node.getChildByName('rewards').getChildByName('reward1')
let re2=this.node.getChildByName('rewards').getChildByName('reward2')
let re3=this.node.getChildByName('rewards').getChildByName('reward3')
re1.getChildByName('name').getComponent(Label).string=this.rewards[1].name
re2.getChildByName('name').getComponent(Label).string=this.rewards[2].name
re3.getChildByName('name').getComponent(Label).string=this.rewards[3].name
re1.getChildByName('info').getComponent(Label).string=this.rewards[1].info
re2.getChildByName('info').getComponent(Label).string=this.rewards[2].info
re3.getChildByName('info').getComponent(Label).string=this.rewards[3].info
resources.load("gui/rewards", SpriteAtlas, (err: any, atlas) => {
let pathName: string = this.rewards[1].path;
let node=re1.getChildByName('icon')
node.getComponent(Sprite).spriteFrame = atlas.getSpriteFrame(pathName);
pathName=this.rewards[2].path;
node=re2.getChildByName('icon')
node.getComponent(Sprite).spriteFrame = atlas.getSpriteFrame(pathName);
pathName=this.rewards[3].path;
node=re3.getChildByName('icon')
node.getComponent(Sprite).spriteFrame = atlas.getSpriteFrame(pathName);
})
this.node.getChildByName('rewards').active = true;
}
colse_reward(value:number){
this.node.getChildByName('rewards').active = false;
smc.vm_data.game_pause = false;
let reward=this.rewards[value]
if(reward.type==1){
if(reward.atk > 0){
smc.vm_data.mission.hero.atk += reward.atk / 100
}
if(reward.atk_cd > 0){
smc.vm_data.mission.hero.atk_cd -= reward.atk_cd/100
}
if(reward.hp > 0){
smc.vm_data.mission.hero.hp += reward.hp / 100;
this.add_hero_hp_max(reward.hp / 100)
}
}
}
do_reward_1(){
this.colse_reward(1)
}
do_reward_2(){
this.colse_reward(2)
}
do_reward_3(){
this.colse_reward(3)
}
add_hero_hp_max(hp:number){
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
if (heros.length > 0) {
for (let i = 0; i < heros.length; i++) {
let hero = heros[i];
if(!hero.HeroView) continue
hero.HeroView.add_hp_max(Math.floor(hero.HeroView.hp_max*hp))
}
}
}
protected update(dt: number): void {
if(smc.vm_data.game_over||smc.vm_data.game_pause){
return
}
this.shuaxin(dt)
// this.gold_add(dt)
if(this.in_touch){
this.touch_time+=dt
}
}
gold_add(dt: number) {
smc.vm_data.gold.time += dt;
if (smc.vm_data.gold.time >= smc.vm_data.gold.cd) {
smc.vm_data.gold.min += 1;
smc.vm_data.gold.time = 0;
}
}
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -0,0 +1,12 @@
{
"ver": "1.0.1",
"importer": "*",
"imported": true,
"uuid": "b0775aa0-5d18-4b68-86b5-670c42953a0e",
"files": [
".json",
".ots"
],
"subMetas": {},
"userData": {}
}

View File

@@ -13,8 +13,6 @@ const { ccclass, property } = _decorator;
@ccclass('CardControllerComp') @ccclass('CardControllerComp')
@ecs.register('CardController', false) @ecs.register('CardController', false)
export class CardControllerComp extends CCComp { export class CardControllerComp extends CCComp {
card_level:number = 1; card_level:number = 1;
in_load:boolean = false in_load:boolean = false
@@ -37,122 +35,14 @@ export class CardControllerComp extends CCComp {
reward_lv = 0; reward_lv = 0;
protected onLoad(): void { protected onLoad(): void {
oops.message.on("do_reward", this.do_reward, this); oops.message.on("do_reward", this.do_reward, this)
let card1 = this.node.getChildByName("cards").getChildByName("card1");
let card2 = this.node.getChildByName("cards").getChildByName("card2");
let card3 = this.node.getChildByName("cards").getChildByName("card3");
let card4 = this.node.getChildByName("cards").getChildByName("card4");
let card5 = this.node.getChildByName("cards").getChildByName("card5");
let card6 = this.node.getChildByName("cards").getChildByName("card6");
// info_button.on(NodeEventType.TOUCH_START, this.onTouchMove, this);
// info_button.on(NodeEventType.TOUCH_MOVE, this.onTouchMove, this);
card1.on(NodeEventType.TOUCH_START, this.touch1, this);
card1.on(NodeEventType.TOUCH_MOVE, this.touch1, this);
card2.on(NodeEventType.TOUCH_START, this.touch2, this);
card2.on(NodeEventType.TOUCH_MOVE, this.touch2, this);
card3.on(NodeEventType.TOUCH_START, this.touch3, this);
card3.on(NodeEventType.TOUCH_MOVE, this.touch3, this);
card4.on(NodeEventType.TOUCH_START, this.touch4, this);
card4.on(NodeEventType.TOUCH_MOVE, this.touch4, this);
card5.on(NodeEventType.TOUCH_START, this.touch5, this);
card5.on(NodeEventType.TOUCH_MOVE, this.touch5, this);
card6.on(NodeEventType.TOUCH_START, this.touch6, this);
card6.on(NodeEventType.TOUCH_MOVE, this.touch6, this);
card1.on(NodeEventType.TOUCH_END, this.end1, this);
card1.on(NodeEventType.TOUCH_CANCEL, this.end1, this);
card2.on(NodeEventType.TOUCH_END, this.end2, this);
card2.on(NodeEventType.TOUCH_CANCEL, this.end2, this);
card3.on(NodeEventType.TOUCH_END, this.end3, this);
card3.on(NodeEventType.TOUCH_CANCEL, this.end3, this);
card4.on(NodeEventType.TOUCH_END, this.end4, this);
card4.on(NodeEventType.TOUCH_CANCEL, this.end4, this);
card5.on(NodeEventType.TOUCH_END, this.end5, this);
card5.on(NodeEventType.TOUCH_CANCEL, this.end5, this);
card6.on(NodeEventType.TOUCH_END, this.end6, this);
card6.on(NodeEventType.TOUCH_CANCEL, this.end6, this);
} }
start() { start() {
this.load_cards()
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
} }
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
touch1(event: EventTouch) {
this.in_touch=true
if(this.in_load)return
if(!this.cards[1].alive)return
this.show_info(this.cards[1].uuid,this.cards[1].type)
}
touch2(event: EventTouch) {
this.in_touch=true
if(this.in_load)return
if(!this.cards[2].alive)return
this.show_info(this.cards[2].uuid,this.cards[2].type)
}
touch3(event: EventTouch) {
this.in_touch=true
if(this.in_load)return
if(!this.cards[3].alive)return
this.show_info(this.cards[3].uuid,this.cards[3].type)
}
touch4(event: EventTouch) {
this.in_touch=true
if(this.in_load)return
if(!this.cards[4].alive)return
this.show_info(this.cards[4].uuid,this.cards[4].type)
}
touch5(event: EventTouch) {
this.in_touch=true
if(this.in_load)return
if(!this.cards[5].alive)return
this.show_info(this.cards[5].uuid,this.cards[5].type)
}
touch6(event: EventTouch) {
this.in_touch=true
if(this.in_load)return
if(!this.cards[6].alive)return
this.show_info(this.cards[6].uuid,this.cards[6].type)
}
end1(event: EventTouch) {
this.onTouchEnd(1)
}
end2(event: EventTouch) {
this.onTouchEnd(2)
}
end3(event: EventTouch) {
this.onTouchEnd(3)
}
end4(event: EventTouch) {
this.onTouchEnd(4)
}
end5(event: EventTouch) {
this.onTouchEnd(5)
}
end6(event: EventTouch) {
this.onTouchEnd(6)
}
show_info(uuid:number,type:number){ show_info(uuid:number,type:number){
// console.log("show_info",uuid) // console.log("show_info",uuid)
let node =this.node.getChildByName("item_box") let node =this.node.getChildByName("item_box")
@@ -173,199 +63,37 @@ export class CardControllerComp extends CCComp {
} }
} }
} }
onTouchEnd(index:number){
if(this.touch_time < 0.2){
this.use_card(index)
}
this.in_touch=false
this.touch_time = 0
let node = this.node.getChildByName("item_box")
node.active=false
node.getChildByName("data").getChildByName("shield").active=false
node.getChildByName("data").getChildByName("hp").active=false
}
shuaxin(dt: number) {
smc.vm_data.shuaxin.min += smc.vm_data.shuaxin.speed*dt;
if (smc.vm_data.shuaxin.min >= smc.vm_data.shuaxin.max) {
smc.vm_data.shuaxin.min = 0;
this.load_cards()
}
}
// cards_update(){
// if(smc.vm_data.gold.min >= smc.vm_data.cards.up_cost){
// smc.vm_data.gold.min -= smc.vm_data.cards.up_cost;
// smc.vm_data.cards.level += 1;
// smc.vm_data.gold.max +=2;
// smc.vm_data.cards.up_cost += 2
// if(smc.vm_data.cards.level >= smc.vm_data.cards.level_max){
// smc.vm_data.cards.level = smc.vm_data.cards.level_max;
// smc.vm_data.cards.up_cost = 11
// }
// console.log("card _level:"+this.card_level+"cost:"+smc.vm_data.cards.up_cost)
// }else{
// oops.gui.toast("金币不够");
// }
// }
palyer_ref(){
if (this.in_load) {
return
}
if((smc.vm_data.shuaxin.max-smc.vm_data.shuaxin.min) < 0.5 ){
oops.gui.toast("马上就要刷新了")
return
}
if(smc.vm_data.shuaxin.min < 0.5){
oops.gui.toast("不要刷新太快哦")
return
}
if (smc.vm_data.gold.min < smc.vm_data.cards.ref_cost) {
oops.gui.toast("金币不足")
return
}
smc.vm_data.gold.min -= smc.vm_data.cards.ref_cost;
this.load_cards()
smc.vm_data.shuaxin.min = -5
if(smc.vm_data.shuaxin.min <=0 ){
smc.vm_data.shuaxin.min = 0
}
}
load_cards() {
this.in_load = true
let card:any=null
for (let index = 1; index <= 6; index++) {
card=RandomManager.instance.getRandomByObjectList(smc.cards, 1);
this.cards[index].uuid=card[0].uuid
this.cards[index].type=card[0].type
let url: string = "";
let pathName: string = "";
let name: string = "";
let level: number = 0;
let cost: number = 0;
let { uuid, type } = card[0];
url = "game/hero/hero_icon";
({ uuid: pathName, name, level ,cost} = smc.heros[uuid]);
this.cards[index].lv=level
this.cards[index].cost = cost
let node=this.node.getChildByName('cards').getChildByName('card'+index)
node.getChildByName('cost').getComponent(Label).string=cost.toString()
node.getChildByName('lv').getChildByName('lv').getComponent(Label).string=level.toString()
node.getChildByName('name').getComponent(Label).string=name
// const sprite = node.getChildByName("item").getComponent(Sprite);
// console.log(this['card'+index],url,pathName,sprite)
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("item").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
this.cards[index].alive=true
}
// for (let index = 5; index <= 6; index++) {
// card=RandomManager.instance.getRandomByObjectList(smc.item_list, 1);
// this.cards[index].uuid=card[0].uuid
// this.cards[index].type=card[0].type
// let url: string = "";
// let pathName: string = "";
// let name: string = "";
// let level: number = 0;
// let { uuid, type } = card[0];
// url = "game/heros/skill";
// ({ path: pathName, name, level } = smc.items[uuid]);
// this.cards[index].lv=level
// let node=this.node.getChildByName('cards').getChildByName('card'+index)
// node.getChildByName('cost').getComponent(Label).string=level.toString()
// node.getChildByName('name').getComponent(Label).string=name
// // const sprite = node.getChildByName("item").getComponent(Sprite);
// // console.log(this['card'+index],url,pathName,sprite)
// resources.load(url, SpriteAtlas, (err: any, atlas) => {
// const sprite = node.getChildByName("item").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(pathName);
// });
// this.cards[index].alive=true
// }
// console.log("cards:",this.cards)
this.in_load = false
}
remove_card(index:number){
this.cards[index].alive=false
this.cards[index].uuid=0
this.cards[index].type=0
this.cards[index].lv=0
let url: string = "gui/gui";
let pathName: string = "129";
let node=this.node.getChildByName('cards').getChildByName('card'+index)
node.getChildByName('cost').getComponent(Label).string=""
node.getChildByName('name').getComponent(Label).string=""
// const sprite = node.getChildByName("item").getComponent(Sprite);
// console.log(this['card'+index],url,pathName,sprite)
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("item").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
}
normal_call(){
use_card(index: number){ if(smc.vm_data.mission.coin >= smc.vm_data.mission.normal_cost){
this.check_card(index) smc.vm_data.mission.coin -= smc.vm_data.mission.normal_cost
// console.log("cards:",this.cards) oops.message.dispatchEvent("normal_call");
}
check_card(index:number){
// let heros = ecs.query(ecs.allOf(HeroModelComp))
// let heross= ecs.query(ecs.allOf(MonsterViewComp))
// console.log("heross",heross)
// if(heros.length >= 4&&this.cards[index].type == 1){
// oops.gui.toast("英雄数量达到上限");
// return;
// }
if(!this.cards[index].alive) {
// console.log("card_index:",index,"card_alive:",this.cards[index].alive)
return;
};
if(smc.vm_data.gold.min >= this.cards[index].cost){
this.cards[index].alive=false
this.do_use_card(index)
}else{ }else{
oops.gui.toast("币不够"); oops.gui.toast("币不够");
} }
} }
do_use_card(index:number){
this.cards[index].alive=false
smc.vm_data.gold.min -= this.cards[index].cost;
oops.message.dispatchEvent("do_add_hero", { uuid: this.cards[index].uuid });
// switch (this.cards[index].type) {
// case 1:
// oops.message.dispatchEvent("do_add_hero", { uuid: this.cards[index].uuid });
// break;
// case 2:
// oops.message.dispatchEvent("do_use_item", { uuid: this.cards[index].uuid });
// break;
// case 3:
// oops.message.dispatchEvent("do_use_item", { uuid: this.cards[index].uuid });
// break;
// }
this.remove_card(index)
}
do_reward(){ do_reward(){
smc.vm_data.game_pause = true; smc.vm_data.game_pause = true;
this.reward_lv+=1 this.reward_lv+=1
this.rewards_set=RewardSet[this.reward_lv] this.rewards_set=JSON.parse(JSON.stringify(RewardSet[1]));
let i=RandomManager.instance.getRandomInt(0,this.rewards_set.length-1, 1) // console.log("rewards_set:",this.rewards_set,RewardSet[1])
console.log("rewards:",i) let i=RandomManager.instance.getRandomInt(0,this.rewards_set.length-1, 2)
this.rewards[1]=this.rewards_set[i] this.rewards[1]=this.rewards_set[i]
this.rewards_set.splice(i,1) this.rewards_set.splice(i,1)
i=RandomManager.instance.getRandomInt(0,this.rewards_set.length-1, 1) // console.log("rewards:",i,this.rewards_set)
console.log("rewards:",i) i=RandomManager.instance.getRandomInt(0,this.rewards_set.length-1, 2)
this.rewards[2]=this.rewards_set[i] this.rewards[2]=this.rewards_set[i]
this.rewards_set.splice(i,1) this.rewards_set.splice(i,1)
i=RandomManager.instance.getRandomInt(0,this.rewards_set.length-1, 1) // console.log("rewards:",i,this.rewards_set)
console.log("rewards:",i) i=RandomManager.instance.getRandomInt(0,this.rewards_set.length-1, 2)
this.rewards[3]=this.rewards_set[i] this.rewards[3]=this.rewards_set[i]
this.rewards_set=[] this.rewards_set=[]
console.log("rewards:",this.rewards) // console.log("rewards:",i,this.rewards,this.rewards_set)
let re1=this.node.getChildByName('rewards').getChildByName('reward1') let re1=this.node.getChildByName('rewards').getChildByName('reward1')
let re2=this.node.getChildByName('rewards').getChildByName('reward2') let re2=this.node.getChildByName('rewards').getChildByName('reward2')
let re3=this.node.getChildByName('rewards').getChildByName('reward3') let re3=this.node.getChildByName('rewards').getChildByName('reward3')
@@ -398,17 +126,13 @@ export class CardControllerComp extends CCComp {
smc.vm_data.game_pause = false; smc.vm_data.game_pause = false;
let reward=this.rewards[value] let reward=this.rewards[value]
if(reward.type==1){ if(reward.type==1){
if(reward.atk > 0){
smc.vm_data.mission.hero.atk += reward.atk / 100 smc.vm_data.mission.hero.atk += reward.atk / 100
} smc.vm_data.mission.hero.atk_cd += reward.atk_cd/100
if(reward.atk_cd > 0){
smc.vm_data.mission.hero.atk_cd -= reward.atk_cd/100
}
if(reward.hp > 0){
smc.vm_data.mission.hero.hp += reward.hp / 100; smc.vm_data.mission.hero.hp += reward.hp / 100;
this.add_hero_hp_max(reward.hp / 100) this.add_hero_hp_max(reward.hp / 100)
} smc.vm_data.mission.coin_reward_add += reward.coin / 100
} }
console.log("card mission",smc.vm_data.mission)
} }
do_reward_1(){ do_reward_1(){
this.colse_reward(1) this.colse_reward(1)
@@ -433,18 +157,15 @@ export class CardControllerComp extends CCComp {
if(smc.vm_data.game_over||smc.vm_data.game_pause){ if(smc.vm_data.game_over||smc.vm_data.game_pause){
return return
} }
this.shuaxin(dt) this.coin_add(dt)
// this.gold_add(dt)
if(this.in_touch){
this.touch_time+=dt
}
} }
gold_add(dt: number) { coin_add(dt: number) {
smc.vm_data.gold.time += dt; smc.vm_data.gold.time += dt;
if (smc.vm_data.gold.time >= smc.vm_data.gold.cd) { if (smc.vm_data.gold.time >= smc.vm_data.gold.cd) {
smc.vm_data.gold.min += 1; let coin =(smc.vm_data.mission.coin_add*smc.vm_data.mission.coin_reward_add*(1+smc.vm_data.talent[6].bonus*smc.vm_data.talent[6].lv)).toFixed(0)
smc.vm_data.mission.coin += parseFloat(coin)
smc.vm_data.gold.time = 0; smc.vm_data.gold.time = 0;
} }
} }

View File

@@ -53,7 +53,9 @@ export class MapMonsterComp extends CCComp {
onLoad(){ onLoad(){
// 监听全局事件 // 监听全局事件
oops.message.on("other_add_monster", this.on_other_add_monster, this); oops.message.on("other_add_monster", this.on_other_add_monster, this);
oops.message.on("do_add_hero", this.on_do_add_hero, this); oops.message.on("do_add_hero", this.on_do_add_hero, this);
oops.message.on("normal_call", this.on_normal_call, this);
} }
start() { start() {
// this.scene = this.getComponent(MapViewScene); // this.scene = this.getComponent(MapViewScene);
@@ -99,6 +101,10 @@ export class MapMonsterComp extends CCComp {
// } // }
// this.shuaxin(dt) // this.shuaxin(dt)
} }
on_normal_call(){
let hero:any =RandomManager.instance.getRandomByObjectList(smc.cards, 1);
this.addHero(hero[0].uuid)
}
monster_refresh(){ monster_refresh(){
if (this.setp_num <= 0){ if (this.setp_num <= 0){
return return