This commit is contained in:
2024-09-02 09:03:43 +08:00
parent 9028b86d4e
commit f367d1817a
27 changed files with 3953 additions and 3233 deletions

View File

@@ -19,8 +19,8 @@ const { ccclass, property } = _decorator;
@ccclass('Main')
export class Main extends Root {
start() {
if (DEBUG) profiler.showStats();
PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb
// if (DEBUG) profiler.showStats();
// PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb
// | EPhysics2DDrawFlags.Pair
// |EPhysics2DDrawFlags.CenterOfMass
// |EPhysics2DDrawFlags.Joint

View File

@@ -37,7 +37,7 @@ export class Role extends ecs.Entity {
}
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,uuid:number=101,skin:string="Character01") {
load(pos: Vec3 = Vec3.ZERO,uuid:number=101) {
// var path = "game/monster/"+prefab_path;
var path = "game/heros/role";
var prefab: Prefab = oops.res.get(path, Prefab)!;
@@ -46,7 +46,7 @@ export class Role extends ecs.Entity {
node.parent = scene.entityLayer!.node!;
// var as = node.getComponent(MonsterSpine);
node.setPosition(pos)
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
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);
@@ -54,8 +54,6 @@ export class Role extends ecs.Entity {
// sprite.spriteFrame = atlas.getSpriteFrame(RoleSet[uuid].path);
// });
var rv = node.getComponent(RoleViewComp)!;
rv.skin=skin
rv.setSkin()
this.add(rv);
this.hero_init(uuid,node)

View File

@@ -33,11 +33,11 @@ export class RoleSpine extends Component {
this.spine = this.animator.getComponent(sp.Skeleton)!;
}
atk() {
this.spine.setAnimation(0, "Throwing", false);
this.spine.setAnimation(0, "atk2", false);
}
magic() {
this.spine.setAnimation(0, "Hit", false);
this.spine.setAnimation(0, "max", false);
}
setSkin(value: string): void {
console.log("RoleSpine setSkin", value);

View File

@@ -15,7 +15,7 @@ const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
@disallowMultiple
@requireComponent(sp.Skeleton)
export default class RoleSpineAnimator extends Component {
private animName: string = "Idle";
private animName: string = "move";
private loop: boolean = true;
private spine!: sp.Skeleton;
start() {
@@ -32,8 +32,8 @@ export default class RoleSpineAnimator extends Component {
this.spine.setEndListener(trackEntry => {
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
// console.log("[track %s][animation %s] end.", trackEntry.trackIndex, animationName);
if (animationName == "Throwing"||animationName == "Hit") {
this.spine.setAnimation(0, "Idle", true);
if (animationName == "atk2" ||animationName == "magic"||animationName=="max") {
this.spine.setAnimation(0, "move", true);
}
});

View File

@@ -35,7 +35,7 @@ export class RoleViewComp extends CCComp {
hp_max:number = 1000;
power: number = 0;
stop_cd:number = 0;
atk_cd:number = 10;
atk_cd:number = 3;
atk:number = 10;
skill_uuid:number = 9003;
max_skill_uuid:number = 1001;
@@ -51,8 +51,8 @@ export class RoleViewComp extends CCComp {
// let x = RandomManager.instance.getRandomInt(1,9,2)
// this.as.setSkin("Character0"+x);
this.atk_time = new Timer(this.atk_cd);
// this.sprite = this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
// this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
this.sprite = this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
console.log("Role view start")
let collider = this.getComponent(Collider2D);
if (collider) {
@@ -113,16 +113,16 @@ export class RoleViewComp extends CCComp {
}
in_atked() {
// this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
// this.scheduleOnce(() => {
// this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
// }, 0.1);
var path = "game/skills/atked";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
let pos = v3(0,30)
node.setPosition(pos)
node.parent = this.node;
this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
this.scheduleOnce(() => {
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
}, 0.1);
// var path = "game/skills/atked";
// var prefab: Prefab = oops.res.get(path, Prefab)!;
// var node = instantiate(prefab);
// let pos = v3(0,30)
// node.setPosition(pos)
// node.parent = this.node;
}
hp_change(hp: number){
this.hp -= hp;

View File

@@ -12,18 +12,24 @@ export const CardList={
1:[
{uuid:1101,type:1},{uuid:1102,type:1},{uuid:1201,type:1},{uuid:1202,type:1},{uuid:1301,type:1},{uuid:1302,type:1},
{uuid:1001,type:2},{uuid:1002,type:2},
{uuid:6001,type:3},{uuid:6004,type:3},{uuid:6101,type:3},
],
2:[
{uuid:2101,type:1},{uuid:2102,type:1},{uuid:2201,type:1},{uuid:2202,type:1},{uuid:2301,type:1},{uuid:2302,type:1},
{uuid:1001,type:2},{uuid:1002,type:2},
{uuid:6001,type:3},{uuid:6004,type:3},{uuid:6101,type:3},
],
3:[
{uuid:3101,type:1},{uuid:3102,type:1},{uuid:3201,type:1},{uuid:3202,type:1},{uuid:3301,type:1},{uuid:3302,type:1},
{uuid:1001,type:2},{uuid:1002,type:2},
{uuid:1001,type:2},{uuid:1002,type:2},{uuid:4011,type:2},{uuid:4012,type:2},
{uuid:6001,type:3},{uuid:6004,type:3},{uuid:6101,type:3},{uuid:6002,type:3},{uuid:6003,type:3},{uuid:6005,type:3},{uuid:6006,type:3},{uuid:6102,type:3},{uuid:6103,type:3},
{uuid:6210,type:3},{uuid:6213,type:3},{uuid:6216,type:3},
],
4:[
{uuid:4101,type:1},{uuid:4102,type:1},{uuid:4201,type:1},{uuid:4202,type:1},{uuid:4301,type:1},{uuid:4302,type:1},
{uuid:1001,type:2},{uuid:1002,type:2},
{uuid:1001,type:2},{uuid:1002,type:2},{uuid:4011,type:2},{uuid:4012,type:2},
{uuid:6001,type:3},{uuid:6004,type:3},{uuid:6101,type:3},{uuid:6002,type:3},{uuid:6003,type:3},{uuid:6005,type:3},{uuid:6006,type:3},{uuid:6102,type:3},{uuid:6103,type:3},
{uuid:6210,type:3},{uuid:6213,type:3},{uuid:6216,type:3},{uuid:6211,type:3},{uuid:6212,type:3},{uuid:6214,type:3},{uuid:6215,type:3},{uuid:6217,type:3},{uuid:6218,type:3},
],
5:[{uuid:5001,type:1},{uuid:5002,type:1},{uuid:5003,type:1},{uuid:5004,type:1}],
// 1:[1101,1102,1103,1104,1105,1106,1201,1202,1203,1204,1205,1301,1302,1303,1304,],

View File

@@ -8,14 +8,12 @@ type
9 buff物品
91: 单体buff物品加最少血临时
92单体buff物品随机临时
93: 体buff物品,加最少血,永久
94单体buff物品随机永久
95: 群体buff物品临时
96: 群体buff物品永久
93: 体buff物品
94role buff
sd 卡片技能图标持续时间
cd 卡片技能释放本技能cd
count卡片1次释放本技能数
bsdbuff技能作用持续时间
bsdbuff技能作用持续时间 bsd=0 为永久
bcdbuff技能执行一次间隔
sk_uuid:子技能id
sk_count:子技能个数
@@ -31,13 +29,27 @@ export const SkillSet={
9001:{uuid: 9001,path: "1001",type: 1,level: 1,name: "基础攻击1",sp_name:"base",dis:70,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:70,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,},
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={
6001:{uuid: 6001,path: "6001",type: 92,level: 1,name: "单手剑",sp_name:"",dis:720,count:1,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6002:{uuid: 6002,path: "6002",type: 95,level: 3,name: "武器库",sp_name:"",dis:720,count:1,atk:10,hp:0,shield:0,sd:10,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6003:{uuid: 6003,path: "6003",type: 92,level: 1,name: "木盾",sp_name:"",dis:720,count:1,atk:0,hp:0,shield:0,sd:10,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6004:{uuid: 6004,path: "6004",type: 95,level: 3,name: "钢盾",sp_name:"",dis:720,count:1,atk:0,hp:0,shield:0,sd:10,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6101:{uuid: 6101,path: "6101",type: 92,level: 1,name: "初级治疗药水",sp_name:"",dis:720,count:1,atk:0,hp:30,shield:0,sd:10,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
6102:{uuid: 6102,path: "6102",type: 95,level: 3,name: "高级治疗药水",sp_name:"",dis:720,count:1,atk:0,hp:50,shield:0,sd:10,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:350,},
}

View File

@@ -44,7 +44,7 @@ export class MapViewComp extends CCComp {
load_role(){
let role = ecs.getEntity<Role>(Role);
let pos = v3(BoxSet.HERO_START-50,BoxSet.GAME_LINE)
role.load(pos,108,"Character07")
role.load(pos,108)
smc.Role=role
}
load_data(){

View File

@@ -11,6 +11,7 @@ import { BoxSet, GameSet } from "../common/config/BoxSet";
import { smc } from "../common/SingletonModuleComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { HeroModelComp } from "./HeroModelComp";
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -50,7 +51,7 @@ export class CSkillComp extends CCComp {
if(smc.skills[this.skill_uuid].type == 1){
this.shoot()
}
if(smc.skills[this.skill_uuid].type == 9){
if(smc.skills[this.skill_uuid].type > 90){
this.add_buff()
}
@@ -86,6 +87,17 @@ export class CSkillComp extends CCComp {
skill.load(pos,speed,dis,scale,this.node,this.skill_uuid,atk,angle,t_pos);
}
add_buff(){
// 1 远距离攻击,碰撞后 结束
// 2 远距离攻击,碰撞后 持续,直到技能结束
// 3 远距离攻击,碰撞后 持续,带击退功能
// 4 双技能技能1技能结束后触发2技能
// 5: 特殊技能,触发特殊弹窗选项
// 9 buff物品
// 91: 单体buff物品加最少血临时
// 92单体buff物品随机临时
// 93: 群体buff物品
// 94role 临时buff
// 95role 永久buff
let uuid= this.skill_uuid;
let atk:number=smc.Role.RoleView.atk
let args:any = {
@@ -94,19 +106,32 @@ export class CSkillComp extends CCComp {
shield:atk*GameSet.ATK_TO_SHIELD_RATIO,
}
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
let heros_hp:any=[]
let least_hp:number=999999
let t_hero:any= null
if (heros.length > 0) {
if(SkillSet[uuid].type==92){
heros[0].MonsterBuff.add_buff(uuid,args);
if(SkillSet[uuid].type==92){ //随机添加buff
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
console.log("i %%length:",i,heros.length)
heros[i].MonsterBuff.add_buff(uuid,args);
}else{
for (let i = 0; i < heros.length; i++) {
let hero = heros[i];
if(SkillSet[uuid].type==99){
// console.log(" CSkillComp hero",hero);
if(SkillSet[uuid].type==91){ //血量最少单体
console.log(" CSkillComp hero 91",hero,least_hp,t_hero);
if(hero.MonsterView.hp < least_hp){
least_hp = hero.MonsterView.hp
t_hero = hero
}
}else{ //群体
hero.MonsterBuff.add_buff(uuid,args);
}
}
}
if(t_hero){ //血量最少单体
t_hero.MonsterBuff.add_buff(uuid,args);
}
}
}

View File

@@ -52,9 +52,9 @@ export class HeroCard extends ecs.Entity {
break;
case 3:
default:
path = "game/heros/hero_card";
url = "game/heros/heros";
({ path: pathName, name, level } = smc.heros[uuid]);
path = "game/heros/item_card";
url = "game/heros/skill";
({ path: pathName, name, level } = smc.skills[uuid]);
}

View File

@@ -23,6 +23,7 @@ export class HeroCardViewComp extends CCComp {
pos_y:number = 0;
card_type:number = 1;
card_level:number = 1;
alive:boolean = false;
protected onLoad(): void {
this.node.on(NodeEventType.TOUCH_START, this.onTouchMove, this);
@@ -73,18 +74,26 @@ export class HeroCardViewComp extends CCComp {
}
do_active(){
// console.log(this.node.getChildByName("active"),this.node.getChildByName("use"), this.node.getChildByName("bag"))
let active = this.node.getChildByName("active")
// let active = this.node.getChildByName("active")
// let use = this.node.getChildByName("use")
// let bag = this.node.getChildByName("bag")
active.active = !active.active
// active.active = !active.active
// use.active = !use.active
// bag.active = !bag.active
this.alive=!this.alive
if(this.alive){
this.node.setScale(1.5,1.5,1)
}else{
this.node.setScale(1,1,0)
}
}
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)
// use.active = false
// bag.active = false
}
@@ -122,12 +131,12 @@ export class HeroCardViewComp extends CCComp {
}
}
do_use_card(){
switch (this.card_type) { // 添加括号并修正语法
switch (this.card_type) {
case 1:
oops.message.dispatchEvent("do_add_hero", { uuid: this.card_uid }); // 添加分号
oops.message.dispatchEvent("do_add_hero", { uuid: this.card_uid });
break;
case 2:
oops.message.dispatchEvent("do_use_skill", { uuid: this.card_uid }); // 添加分号
oops.message.dispatchEvent("do_use_skill", { uuid: this.card_uid });
// console.log("do_use_skill",this.card_uid)
break;
default:

View File

@@ -32,7 +32,7 @@ export default class MonsterSpineAnimator extends Component {
this.spine.setEndListener(trackEntry => {
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
// console.log("[track %s][animation %s] end.", trackEntry.trackIndex, animationName);
if (animationName == "atk" ||animationName == "magic"||animationName=="max") {
if (animationName == "atk2" ||animationName == "magic"||animationName=="max") {
this.spine.setAnimation(0, "move", true);
}
});

View File

@@ -87,6 +87,7 @@ export class MonsterViewComp extends CCComp {
} /** 视图层逻辑代码分离演示 */
start () {
this.sprite = this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
this.node.getChildByName("top").setScale(this.scale,1);
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
this.BoxRang.getComponent(BoxRangComp).box_group = this.box_group;
@@ -180,7 +181,7 @@ export class MonsterViewComp extends CCComp {
this.power = 0
}
let power_progress= this.power/this.power_max;
this.node.getChildByName("power").getComponent(ProgressBar)!.progress = power_progress;
this.node.getChildByName("top").getChildByName("power").getComponent(ProgressBar)!.progress = power_progress;
}
shoot(skill_uuid:number){
// console.log("monster shoot");
@@ -223,7 +224,7 @@ export class MonsterViewComp extends CCComp {
}
in_shield(){
let shield_progress= this.shield/this.shield_max;
this.node.getChildByName("shield").getComponent(ProgressBar)!.progress = shield_progress;
this.node.getChildByName("top").getChildByName("shield").getComponent(ProgressBar)!.progress = shield_progress;
// if(this.shield <= 0){
// this.node.getChildByName("shield").active=false
// }else{
@@ -245,7 +246,7 @@ export class MonsterViewComp extends CCComp {
this.hp = this.hp_max;
}
let hp_progress= this.hp/this.hp_max;
this.node.getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
if(this.hp <= 0){
this.dead();
this.is_dead = true;