手机测试卡,需要解决

This commit is contained in:
2025-01-22 16:59:23 +08:00
parent 2893050463
commit 43fbf30e46
38 changed files with 8865 additions and 47840 deletions

View File

@@ -1,5 +1,4 @@
import { _decorator, Component, instantiate, Label, Node, Prefab, ProgressBar, tween, v3, Vec3 } from 'cc';
import { HeroViewComp } from './HeroViewComp';
import { oops } from 'db://oops-framework/core/Oops';
import { ecs } from 'db://oops-framework/libs/ecs/ECS';
import { Tooltip } from '../skills/Tooltip';
@@ -10,7 +9,6 @@ const { ccclass, property } = _decorator;
@ccclass('BuffComp')
export class BuffComp extends Component {
heroView: any=null;
ap_node:any=null;
cd_node:any=null;
def_node:any=null;
@@ -33,7 +31,6 @@ export class BuffComp extends Component {
speek_time:number=0;
start() {
this.heroView = this.node.getComponent(HeroViewComp);
// this.buff_get("dodge")
// this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = false;
// this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = false;
@@ -56,16 +53,12 @@ export class BuffComp extends Component {
this.node.getChildByName("buff").active = false;
}
this.hp_show()
this.in_speek(deltaTime)
if(this.heroView.shield > 0){
this.node.getChildByName("shielded").active=true
}else{
this.node.getChildByName("shielded").active=false
}
}
show_shield(val:boolean){
this.node.getChildByName("shielded").active=val
}
buff_get(name:string){
var path = "game/skills/buffget/buffget";
var prefab: Prefab = oops.res.get(path, Prefab)!;
@@ -86,16 +79,7 @@ export class BuffComp extends Component {
this.node.getChildByName("buff").active = true;
}
hp_show(){
let hp_progress= this.heroView.hp/this.heroView.rhp_max;
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
if(this.heroView.is_boss) return
if(this.heroView.hp == this.heroView.rhp_max){
this.node.getChildByName("top").getChildByName("hp").active = false;
} else{
this.node.getChildByName("top").getChildByName("hp").active = true;
}
}
max_show(){
this.node.getChildByName("max").active=true
this.scheduleOnce(()=>{

View File

@@ -15,20 +15,21 @@ export class HeroCard extends ecs.Entity {
load(uuid:number=101,parent:any) {
// var path = "game/monster/"+prefab_path;
var path = "game/gui/hero_card";
// var icon_path = "game/heros/herois"
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
let slv = node.getChildByName("slv");
node.parent = parent;
// let slv = node.getChildByName("slv");
node.parent = parent;
var icon_path = "game/heros/herois"
node.getChildByName("name").getComponent(Label).string = HeroInfo[uuid].name
// resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
// const sprite = node.getChildByName("Mask").getChildByName("hero").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
// });
var path = "game/heros/uiheros/"+HeroInfo[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var snode = instantiate(prefab);
snode.parent = node.getChildByName("Mask")
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("Mask").getChildByName("hero").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
});
// var path = "game/heros/uiheros/"+HeroInfo[uuid].path;
// var prefab: Prefab = oops.res.get(path, Prefab)!;
// var snode = instantiate(prefab);
// snode.parent = node.getChildByName("Mask")
let hcc = node.getComponent(HeroCardComp)!;
hcc.h_uuid = uuid;
hcc.update_data();

View File

@@ -15,20 +15,21 @@ export class HeroSelect extends ecs.Entity {
load(uuid:number=101,parent:any) {
// var path = "game/monster/"+prefab_path;
var path = "game/gui/hero_set";
// var icon_path = "game/heros/herois"
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
let slv = node.getChildByName("slv");
// let slv = node.getChildByName("slv");
node.parent = parent;
var icon_path = "game/heros/herois"
node.getChildByName("name").getComponent(Label).string = HeroInfo[uuid].name
// resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
// const sprite = node.getChildByName("Mask").getChildByName("hero").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
// });
var path = "game/heros/uiheros/"+HeroInfo[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var snode = instantiate(prefab);
snode.parent = node.getChildByName("Mask")
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("Mask").getChildByName("hero").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
});
// var path = "game/heros/uiheros/"+HeroInfo[uuid].path;
// var prefab: Prefab = oops.res.get(path, Prefab)!;
// var snode = instantiate(prefab);
// snode.parent = node.getChildByName("Mask")
let hcc = node.getComponent(HeroSelectComp)!;
hcc.h_uuid = uuid;
hcc.update_data();

View File

@@ -1,7 +1,6 @@
import { _decorator, Color, Label, Sprite } 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 { MissionHomeComp } from "../map/MissionHomeComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { smc } from "../common/SingletonModuleComp";
import { ColorSet, GameSet } from "../common/config/BoxSet";
@@ -13,7 +12,6 @@ const { ccclass, property } = _decorator;
@ccclass('HeroSelectComp')
@ecs.register('HeroSelectComp', false)
export class HeroSelectComp extends CCComp {
mhc_home: MissionHomeComp = null!;
h_uuid: number = 0;
onLoad() {
oops.message.on("hero_set_select", this.check_show, this);
@@ -21,8 +19,6 @@ export class HeroSelectComp extends CCComp {
}
/** 视图层逻辑代码分离演示 */
start() {
this.mhc_home=this.node.parent.parent.parent.parent.getComponent(MissionHomeComp);
if(smc.fight_heros.indexOf(this.h_uuid)>=0){
this.show_bg(true)
}else{
@@ -33,7 +29,7 @@ export class HeroSelectComp extends CCComp {
if(smc.fight_heros.indexOf(this.h_uuid)>=0){
smc.fight_heros.splice(smc.fight_heros.indexOf(this.h_uuid),1)
this.show_bg(false)
this.mhc_home.cancel_hero(this.h_uuid)
oops.message.dispatchEvent("hero_card_cancel_select",{uuid:this.h_uuid})
return
}
if(smc.fight_heros.length>= GameSet.HERO_NUM){
@@ -41,7 +37,7 @@ export class HeroSelectComp extends CCComp {
return
}
smc.fight_heros.push(this.h_uuid)
this.mhc_home.select_hero(this.h_uuid)
oops.message.dispatchEvent("hero_card_select",{uuid:this.h_uuid})
this.show_bg(true)
}
check_show(event: string, args: any){

View File

@@ -173,8 +173,37 @@ export class HeroViewComp extends CCComp {
if(this.hp <= 0 ) return
if(skill.tg< 3) return
this.check_uatk(skill);
}
if(oCol.group == seCol.group&&oCol.tag==BoxSet.SKILL_TAG){
let skill = oCol.node.getComponent(SkillCom)!;
if(skill.tg==2||skill.tg==0){
this.do_buff(skill)
}
}
}
do_buff(skill:any){
if(SkillSet[skill.s_uuid].hp > 0){ //buff加血
// let increase_hp=Math.floor(skill.hp/(skill.in_time/skill.cd))
let increase_hp=Math.floor(skill.hp)
this.add_hp(increase_hp)
}
if(SkillSet[skill.s_uuid].apup > 0){ //buff加攻击
// let increase_atk=Math.floor(skill.apup/(skill.in_time/skill.cd))
let increase_atk=Math.floor(skill.apup)
this.add_ap(increase_atk)
}
if(SkillSet[skill.s_uuid].shield > 0){ //buff护盾
this.add_shield(skill.shield)
}
if(SkillSet[skill.s_uuid].mhp > 0){ //hp最大值
// console.log("do_buff mhp: ",skill.mhp/(skill.in_time/skill.cd))
this.add_hp_max(skill.mhp/(skill.in_time/skill.cd))
}
}
onEndContact (seCol: Collider2D, oCol: Collider2D) {
@@ -222,7 +251,7 @@ export class HeroViewComp extends CCComp {
this.check_atk_counts()
this.check_enemy_alive()
this.check_mission_buff()
this.hp_show()
if(this.ice_cd > 0){
this.ice_cd -=dt;
return
@@ -236,7 +265,16 @@ export class HeroViewComp extends CCComp {
this.in_atk(dt);
this.move(dt);
}
hp_show(){
let hp_progress= this.hp/this.rhp_max;
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
if(this.is_boss) return
if(this.hp == this.rhp_max){
this.node.getChildByName("top").getChildByName("hp").active = false;
} else{
this.node.getChildByName("top").getChildByName("hp").active = true;
}
}
//移动
move(dt: number){
if(this.stop_cd > 0||smc.mission.is_victory||smc.mission.is_defeat){
@@ -322,6 +360,7 @@ export class HeroViewComp extends CCComp {
this.check_debuff(skill,l_hp)
if(this.shield > 0){
this.shield -=1
if(this.shield == 0) this.BUFFCOMP.show_shield(false)
l_hp = 0
}
this.hp_less(l_hp,skill.is_crit);
@@ -737,7 +776,7 @@ export class HeroViewComp extends CCComp {
}
add_shield(shield:number){
this.shield =shield
console.log("shield:",shield);
if(this.shield>0) this.BUFFCOMP.show_shield(true)
}
// add_cd(cd: number){
// this.cd += this.cd*((100-cd)/100);