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

@@ -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;