手机测试卡,需要解决

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

@@ -14,6 +14,8 @@ import { Talents } from "../common/config/TalentSet";
import { HeroViewComp } from "../hero/HeroViewComp";
import { Position } from "../../../../extensions/oops-plugin-framework/assets/libs/gui/badge/Badge";
import { MissionHomeComp } from "./MissionHomeComp";
import { GameEvent } from "../common/config/GameEvent";
import { MissionComp } from "./MissionComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -27,6 +29,7 @@ export class CardControllerComp extends CCComp {
bbg_x:any=[-300,-150,0,150,300]
protected onLoad(): void {
this.bbg=this.node.getChildByName("bar").getChildByName("bbg")
oops.message.on(GameEvent.MissionStart,this.mission_start,this)
}
start() {
this.bbg=this.node.getChildByName("bar").getChildByName("bbg")
@@ -53,6 +56,13 @@ export class CardControllerComp extends CCComp {
this.node.getChildByName("mission").active = false;
}
mission_start(){
this.node.getChildByName("bar").active=false;
let mission=this.node.getChildByName("mission").getComponent(MissionComp)
mission.node.active = true;
mission.mission_start()
smc.mission.play = true;
}
bar_change(e:any,args:any){
console.log("bar_change",args)
this.node.getChildByName("bar").active=true;

View File

@@ -15,19 +15,19 @@ export class HCard extends ecs.Entity {
}
load(uuid:number=1001,index:number=-1,parent:any) {
var path = "game/gui/hcard";
// var icon_path = "game/heros/herois"
// resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
// const sprite = node.getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
// });
var icon_path = "game/heros/herois"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
});
var prefab: Prefab = oops.res.get(path, Prefab)!;
console.log("load_hcard",prefab)
var node = instantiate(prefab);
node.parent = parent
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")
// 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")
var hcc = node.getComponent(HCardComp)!;
hcc.hi= index
this.add(hcc)

View File

@@ -7,13 +7,9 @@ import { UiHeroComp } from "../hero/UiHeroComp";
import { BoxSet, GameSet } from "../common/config/BoxSet";
import { smc } from "../common/SingletonModuleComp";
import { HeroSelect } from "../hero/HeroSelect";
import { MSklist, SkillSet } from "../common/config/SkillSet";
import { MSCard } from "./MSCard";
import { CardControllerComp } from "./CardController";
import { MissionComp } from "./MissionComp";
import { MSCardComp } from "./MSCardComp";
import { HeroSelectComp } from "../hero/HeroSelectComp";
import { MBSet } from "../common/config/MissionSet";
import { GameEvent } from "../common/config/GameEvent";
const { ccclass, property } = _decorator;
@@ -28,7 +24,10 @@ export class MissionHomeComp extends CCComp {
{uuid:0,px:-200},
{uuid:0,px:-300},
]
protected onLoad(): void {
oops.message.on("hero_card_select", this.select_hero, this);
oops.message.on("hero_card_cancel_select", this.cancel_hero, this);
}
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
@@ -40,7 +39,6 @@ export class MissionHomeComp extends CCComp {
this.init_buff()
}
start_mission() {
console.log("mission_home : start_mission")
if (this.heros.length <=0 ) {
oops.gui.toast("请先选择英雄")
return
@@ -54,16 +52,9 @@ export class MissionHomeComp extends CCComp {
{uuid:0,px:-200},
{uuid:0,px:-300},
]
let home =this.node.parent.getComponent(CardControllerComp);
home.node.getChildByName("bar").active=false;
let mission=home.node.getChildByName("mission").getComponent(MissionComp)
mission.node.active = true;
mission.mission_start()
smc.mission.play = true;
oops.message.dispatchEvent(GameEvent.MissionStart, {})
this.node.active=false;
}
init_buff(){
smc.vmdata.mission.ap_up=MBSet.ap_add*smc.vmdata.buff_num[0]/MBSet.ap_cost
@@ -112,42 +103,29 @@ export class MissionHomeComp extends CCComp {
}
}
load_skill_card(){
let ms_num:number =MSklist.length
let parent= this.node.getChildByName("skills").getChildByName("view").getChildByName("content")
let height=ms_num*135
parent.getComponent(UITransform).height=height
for (let i = 0; i < ms_num; i++) {
let msc =ecs.getEntity<MSCard>(MSCard)
msc.load(MSklist[i],parent,2)
}
}
load_ui_heros(){
for(let i=0;i<smc.fight_heros.length;i++){
this.select_hero(smc.fight_heros[i])
this.select_hero("local",{uuid:smc.fight_heros[i]})
}
}
select_skill(){
if(SkillSet[smc.mission.mskill]==undefined) return
var icon_path = "game/skills/skill_icon"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("msk").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[smc.mission.mskill].path);
});
}
select_hero(h_uuid:number){
select_hero(event:any,args:any){
console.log("select_hero",args.uuid)
for(let i=0;i<GameSet.HERO_NUM;i++){
if(this.heros_pos[i].uuid==0){
this.heros_pos[i].uuid=h_uuid
this.call_hero(h_uuid,i)
this.heros_pos[i].uuid=args.uuid
this.call_hero(args.uuid,i)
break
}
}
}
cancel_hero(h_uuid:number){
cancel_hero(event:any,args:any){
for(let i=0;i<GameSet.HERO_NUM;i++){
if(this.heros_pos[i].uuid==h_uuid){
if(this.heros_pos[i].uuid==args.uuid){
this.heros_pos[i].uuid=0
this.destory_hero(h_uuid)
this.destory_hero(args.uuid)
}
}
}
@@ -270,28 +248,7 @@ export class MissionHomeComp extends CCComp {
smc.vmdata.buff_num[4] -= MBSet.dodge_cost
smc.vmdata.mission.dodge_up=MBSet.dodge_add*smc.vmdata.buff_num[4]/MBSet.dodge_cost
}
show_skills(){
this.node.getChildByName("skills").setPosition(0,400)
}
hide_skills(){
this.node.getChildByName("skills").setPosition(0,-800)
let mscards:any= ecs.query(ecs.allOf(MSCardComp));
for(let i=0;i<mscards.length;i++){
mscards[i].MSCardComp.is_select=true
mscards[i].MSCardComp.is_update=false
mscards[i].MSCardComp.change()
}
this.node.getChildByName("skills").getChildByName("noset").active=false
this.node.getChildByName("skills").getChildByName("set").active=true
}
set_skills(){
let mscards:any= ecs.query(ecs.allOf(MSCardComp));
for(let i=0;i<mscards.length;i++){
mscards[i].MSCardComp.change_set()
}
this.node.getChildByName("skills").getChildByName("set").active=!this.node.getChildByName("skills").getChildByName("set").active
this.node.getChildByName("skills").getChildByName("noset").active=!this.node.getChildByName("skills").getChildByName("noset").active
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();