This commit is contained in:
pan@work
2024-09-05 10:54:28 +08:00
parent b80d2ff36e
commit d2a6ab3dce
17 changed files with 1792 additions and 2921 deletions

View File

@@ -62,12 +62,6 @@ export class Role extends ecs.Entity {
this.hero_init(uuid,node)
}
move(target: Vec3) {
var move = this.get(MoveToComp) || this.add(MoveToComp);
move.target = target;
move.node = this.MonsterView.node;
move.speed = 300;
}
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
var mv = node.getComponent(MonsterViewComp)!;
var buff =node.getComponent(MonsterBuffComp)!;
@@ -91,6 +85,12 @@ export class Role extends ecs.Entity {
this.add(mv);
this.add(buff);
}
move(target: Vec3) {
var move = this.get(MoveToComp) || this.add(MoveToComp);
move.target = target;
move.node = this.MonsterView.node;
move.speed = 300;
}
}

View File

@@ -44,6 +44,7 @@ export class SingletonModuleComp extends ecs.Comp {
/**heros 数据 */
heros:any = [];
skills:any = []
sk_info:any = []
monsters_dead:any = []
heros_dead:any = []
least_hp_monster_eid:number=0;

View File

@@ -21,34 +21,61 @@ sp_name : 预制体名称
path: 图片地址
*/
export const SkillSet={
1001:{uuid: 1001,path: "1001",type: 1,level: 1,name: "火球术",sp_name:"fire",dis:720,count:1,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
1002:{uuid: 1002,path: "1002",type: 1,level: 1,name: "寒冰箭",sp_name:"ice",dis:720,count:1,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
4011:{uuid: 4011,path: "1011",type: 1,level: 3,name: "火焰风暴",sp_name:"fire",dis:720,count:5,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
4012:{uuid: 4012,path: "1012",type: 1,level: 3,name: "冰晶风暴",sp_name:"ice",dis:720,count:5,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
9001:{uuid: 9001,path: "1001",type: 1,level: 1,name: "基础攻击1",sp_name:"base",dis:720,count:1,atk:0,hp:0,shield:0,sd:10,cd:3,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:450,},
9002:{uuid: 9002,path: "1001",type: 1,level: 1,name: "基础攻击2",sp_name:"base2",dis:720,count:1,atk:0,hp:0,shield:0,sd:10,cd:3,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:450,},
9003:{uuid: 9003,path: "1001",type: 2,level: 1,name: "基础攻击3",sp_name:"base3",dis:720,count:1,atk:0,hp:0,shield:0,sd:10,cd:3,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:450,},
1001:{uuid: 1001,path: "1001",type: 1,level: 1,name: "火球术",sp_name:"fire",info:"释放一个火球术攻击敌人",
dis:720,count:1,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
1002:{uuid: 1002,path: "1002",type: 1,level: 1,name: "寒冰箭",sp_name:"ice",info:"释放一个寒冰箭攻击敌人",
dis:720,count:1,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
4011:{uuid: 4011,path: "1011",type: 1,level: 3,name: "火焰风暴",sp_name:"fire",info:"释放多个个火球术攻击敌人",
dis:720,count:5,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
4012:{uuid: 4012,path: "1012",type: 1,level: 3,name: "冰晶风暴",sp_name:"ice",info:"释放多个个寒冰箭攻击敌人",
dis:720,count:5,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
9001:{uuid: 9001,path: "1001",type: 1,level: 1,name: "魔法波动",sp_name:"base",info:"释放一个魔法球攻击敌人",
dis:720,count:1,atk:0,hp:0,shield:0,sd:10,cd:3,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:450,},
9002:{uuid: 9002,path: "1001",type: 1,level: 1,name: "魔法波动",sp_name:"base2",info:"释放一个魔法球攻击敌人",
dis:720,count:1,atk:0,hp:0,shield:0,sd:10,cd:3,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:450,},
9003:{uuid: 9003,path: "1001",type: 2,level: 1,name: "魔法波动",sp_name:"base3",info:"释放一个魔法球攻击敌人",
dis:720,count:1,atk:0,hp:0,shield:0,sd:10,cd:3,bsd:10,bcd:1,sk_uuid:1001,sk_count:0,speed:450,},
6001:{uuid: 6001,path: "6001",type: 92,level: 1,name: "普通单手剑",sp_name:"",dis:720,count:1,atk:10,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6002:{uuid: 6002,path: "6002",type: 93,level: 3,name: "精致单手剑",sp_name:"",dis:720,count:1,atk:10,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6003:{uuid: 6003,path: "6003",type: 94,level: 3,name: "魔法单手剑",sp_name:"",dis:720,count:1,atk:10,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6004:{uuid: 6004,path: "6004",type: 92,level: 1,name: "普通木盾",sp_name:"",dis:720,count:1,atk:0,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6005:{uuid: 6005,path: "6005",type: 93,level: 3,name: "精致钢盾",sp_name:"",dis:720,count:1,atk:0,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6006:{uuid: 6006,path: "6006",type: 94,level: 3,name: "魔法盾",sp_name:"",dis:720,count:1,atk:0,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6101:{uuid: 6101,path: "6101",type: 91,level: 1,name: "初级药水",sp_name:"",dis:720,count:1,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6102:{uuid: 6102,path: "6102",type: 93,level: 3,name: "高级药水",sp_name:"",dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6103:{uuid: 6103,path: "6103",type: 94,level: 3,name: "活力药水",sp_name:"",dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6210:{uuid: 6210,path: "6210",type: 92,level: 3,name: "普通攻击石",sp_name:"",dis:720,count:1,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6211:{uuid: 6211,path: "6211",type: 93,level: 4,name: "特效攻击石",sp_name:"",dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6212:{uuid: 6212,path: "6212",type: 94,level: 4,name: "精炼攻击石",sp_name:"",dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6213:{uuid: 6213,path: "6213",type: 92,level: 3,name: "普通生命石",sp_name:"",dis:720,count:1,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6214:{uuid: 6214,path: "6214",type: 93,level: 4,name: "特效生命石",sp_name:"",dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6215:{uuid: 6215,path: "6215",type: 94,level: 4,name: "精炼生命石",sp_name:"",dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6216:{uuid: 6216,path: "6216",type: 92,level: 3,name: "普通全能石",sp_name:"",dis:720,count:1,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6217:{uuid: 6217,path: "6217",type: 93,level: 4,name: "特效全能石",sp_name:"",dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6218:{uuid: 6218,path: "6218",type: 94,level: 4,name: "精炼全能石",sp_name:"",dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6001:{uuid: 6001,path: "6001",type: 92,level: 1,name: "普通单手剑",sp_name:"",
dis:720,count:1,atk:10,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6002:{uuid: 6002,path: "6002",type: 93,level: 3,name: "精致单手剑",sp_name:"",
dis:720,count:1,atk:10,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6003:{uuid: 6003,path: "6003",type: 94,level: 3,name: "魔法单手剑",sp_name:"",
dis:720,count:1,atk:10,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6004:{uuid: 6004,path: "6004",type: 92,level: 1,name: "普通木盾",sp_name:"",
dis:720,count:1,atk:0,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6005:{uuid: 6005,path: "6005",type: 93,level: 3,name: "精致钢盾",sp_name:"",
dis:720,count:1,atk:0,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6006:{uuid: 6006,path: "6006",type: 94,level: 3,name: "魔法盾",sp_name:"",
dis:720,count:1,atk:0,hp:0,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6101:{uuid: 6101,path: "6101",type: 91,level: 1,name: "初级药水",sp_name:"",
dis:720,count:1,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6102:{uuid: 6102,path: "6102",type: 93,level: 3,name: "高级药水",sp_name:"",
dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6103:{uuid: 6103,path: "6103",type: 94,level: 3,name: "活力药水",sp_name:"",
dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6210:{uuid: 6210,path: "6210",type: 92,level: 3,name: "普通攻击石",sp_name:"",
dis:720,count:1,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6211:{uuid: 6211,path: "6211",type: 93,level: 4,name: "特效攻击石",sp_name:"",
dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6212:{uuid: 6212,path: "6212",type: 94,level: 4,name: "精炼攻击石",sp_name:"",
dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6213:{uuid: 6213,path: "6213",type: 92,level: 3,name: "普通生命石",sp_name:"",
dis:720,count:1,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6214:{uuid: 6214,path: "6214",type: 93,level: 4,name: "特效生命石",sp_name:"",
dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6215:{uuid: 6215,path: "6215",type: 94,level: 4,name: "精炼生命石",sp_name:"",
dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6216:{uuid: 6216,path: "6216",type: 92,level: 3,name: "普通全能石",sp_name:"",
dis:720,count:1,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6217:{uuid: 6217,path: "6217",type: 93,level: 4,name: "特效全能石",sp_name:"",
dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
6218:{uuid: 6218,path: "6218",type: 94,level: 4,name: "精炼全能石",sp_name:"",
dis:720,count:1,atk:0,hp:50,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:350, },
}
export const AllItems={
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "72cf6d53-03ee-4f9d-aefc-0f164cbeddb2",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,50 @@
import { instantiate, Prefab, Vec3 } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { InfoBoxCom } from "./InfoBoxCom";
import { smc } from "../common/SingletonModuleComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
/** InfoBox 模块 */
@ecs.register(`InfoBox`)
export class InfoBox extends ecs.Entity {
/** ---------- 数据层 ---------- */
// InfoBoxModel!: InfoBoxModelComp;
/** ---------- 业务层 ---------- */
// InfoBoxBll!: InfoBoxBllComp;
/** ---------- 视图层 ---------- */
InfoBoxView!: InfoBoxCom
/** 实始添加的数据层组件 */
protected init() {
// this.addComponents<ecs.Comp>();
}
load(pos: Vec3 = Vec3.ZERO,uuid:number=101,prefab_path:string) {
var path = "game/gui/"+prefab_path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
var scene = smc.map.MapView.scene;
node.parent = scene.SkillLayer!.node!;
node.setPosition(pos)
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
// const url = 'game/heros/player';
// resources.load(url, SpriteAtlas, (err: any, atlas) => {
// const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(RoleSet[uuid].path);
// });
// var rv = node.getComponent(MonsterViewComp)!;
// this.add(rv);
var mv = node.getComponent(InfoBoxCom)!;
this.add(mv);
}
/** 模块资源释放 */
destroy() {
// 注: 自定义释放逻辑,视图层实现 ecs.IComp 接口的 ecs 组件需要手动释放
this.remove(InfoBoxCom);
super.destroy();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "b64b5d93-6a68-402a-a7ab-bf89db4a153b",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,43 @@
import { _decorator ,Node} from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('InfoBoxCom')
@ecs.register('InfoBox', false)
export class InfoBoxCom extends CCComp {
@property(Node)
n_name:Node =null!
@property(Node)
n_hp:Node =null!
@property(Node)
n_atk:Node =null!
@property(Node)
n_info:Node =null!
@property(Node)
n_atk_cd:Node =null!
@property(Node)
n_skillcd:Node =null!
n_type:number=0; // 0:技能 1 精灵
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
console.log("InfoBoxCom start");
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "20c2c0dd-188e-41da-b74e-fdacae24b337",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -87,6 +87,7 @@ export class Initialize extends ecs.Entity {
queue.complete = () => {
smc.heros = HeroSet;
smc.skills=SkillSet;
var uic: UICallbacks = {
onAdded: (node: Node, params: any) => {
var comp = node.getComponent(LoadingViewComp) as ecs.Comp;

View File

@@ -1,4 +1,4 @@
import { _decorator ,Label,NodeEventType,EventTouch} from "cc";
import { _decorator ,Label,NodeEventType,EventTouch,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 { data } from "../data/data";
@@ -12,6 +12,7 @@ import { Hero } from "./Hero";
import { MonsterViewComp } from "./MonsterViewComp";
import { MapMonsterComp } from "../map/MapMonsterComp";
import { MapSkillComp } from "../map/MapSkillComp";
import { InfoBox } from "../gui/InfoBox";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -60,6 +61,8 @@ export class HeroCardViewComp extends CCComp {
onTouchMove(event: EventTouch) {
let delta = event.getDelta();
this.node.setPosition(this.node.position.x+delta.x,this.node.position.y+delta.y);
let parent = this.node.parent.parent
parent.getChildByName("item_box").active=true
}
onTouchEnd(){
if(this.node.position.y-this.pos_y > 150){
@@ -67,6 +70,9 @@ export class HeroCardViewComp extends CCComp {
}else{
this.node.setPosition(this.pos_x,this.pos_y);
}
let parent = this.node.parent.parent
parent.getChildByName("item_box").active=false
}
private do_active_card_eid(event: string, args: any) {
@@ -80,8 +86,9 @@ export class HeroCardViewComp extends CCComp {
// console.log(this.node.getChildByName("active"),this.node.getChildByName("use"), this.node.getChildByName("bag"))
// let use = this.node.getChildByName("use")
// let bag = this.node.getChildByName("bag")
let active = this.node.getChildByName("active")
active.active = !active.active
// let active = this.node.getChildByName("active")
// active.active = !active.active
// use.active = !use.active
// bag.active = !bag.active
// this.alive=!this.alive
@@ -93,14 +100,15 @@ export class HeroCardViewComp extends CCComp {
}
no_active(){
let active = this.node.getChildByName("active")
// let use = this.node.getChildByName("use")
// let bag = this.node.getChildByName("bag")
active.active = false
this.node.setScale(1,1)
// let active = this.node.getChildByName("active")
// // let use = this.node.getChildByName("use")
// // let bag = this.node.getChildByName("bag")
// active.active = false
// this.node.setScale(1,1)
// use.active = false
// bag.active = false
}
doit(){
// this.do_active()
smc.vm_data.cards.eid = this.ent.eid;