技能继续

This commit is contained in:
2024-12-11 13:55:36 +08:00
parent 93e2f11274
commit eab71044d0
12 changed files with 703 additions and 1517 deletions

View File

@@ -4,7 +4,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
import { smc } from "../common/SingletonModuleComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
import { MSkills, MSkillset, MSlist, SkillSet } from "../common/config/SkillSet";
import { MSkillset, MSlist, SkillSet } from "../common/config/SkillSet";
import { HeroModelComp } from "../hero/HeroModelComp";
import { RewardSet } from "../common/config/RewardSet";
import { BoxSet, GameSet } from "../common/config/BoxSet";
@@ -22,8 +22,6 @@ import { BossList, MBSet, MissionNum, MissionSet, MonsetList } from "../common/c
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
import { HCard } from "./HCard";
import { HCardComp } from "./HCardComp";
import { MSkill } from "../skills/MSkill";
import { MSkillComp } from "../skills/MSkillComp";
import { VictoryComp } from "./VictoryComp";
import { ItemComp } from "./ItemComp";
const { ccclass, property } = _decorator;
@@ -111,12 +109,7 @@ export class MissionComp extends CCComp {
let heros:any= this.get_heros();;
let monsters:any= this.get_mons();
let hcards:any= ecs.query(ecs.allOf(HCardComp));
let mska:any= ecs.query(ecs.allOf(MSkillComp));
let res:any= ecs.query(ecs.allOf(ItemComp));
for(let i=0;i<mska.length;i++){
mska[i].MSkillComp.reset()
mska[i].MSkillComp.ent.destroy()
}
let rewards:any= ecs.query(ecs.allOf(ItemComp));
// let hcns=this.node.getChildByName("hcards")
// for(let i=0;i<hcns.children.length;i++){
// hcns.children[i].destroy()
@@ -133,9 +126,9 @@ export class MissionComp extends CCComp {
monsters[i].HeroView.reset()
monsters[i].HeroView.ent.destroy()
}
for(let i=0;i<res.length;i++){
res[i].ItemComp.reset()
res[i].ItemComp.ent.destroy()
for(let i=0;i<rewards.length;i++){
rewards[i].ItemComp.reset()
rewards[i].ItemComp.ent.destroy()
}
}
check_buff(){

View File

@@ -13,7 +13,7 @@ export class MSCard extends ecs.Entity {
protected init() {
// this.addComponents<ecs.Comp>();
}
load(uuid:number=1001,parent:any) {
load(uuid:number=1001,parent:any,zone:number=0) {
var path = "game/gui/MSCard";
// var icon_path = "game/heros/herois"
// resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
@@ -26,7 +26,8 @@ export class MSCard extends ecs.Entity {
node.parent = parent
var msc = node.getComponent(MSCardComp)!;
msc.s_uuid= uuid
if(smc.mskill==uuid) msc.is_selected=true
if(zone==1) {msc.is_update=true }else{msc.is_update=false}
if(zone==2) {msc.is_select=true}else{msc.is_select=false}
this.add(msc)
}
/** 模块资源释放 */

View File

@@ -1,6 +1,7 @@
import { _decorator } 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 { smc } from "../common/SingletonModuleComp";
const { ccclass, property } = _decorator;
@@ -9,19 +10,30 @@ const { ccclass, property } = _decorator;
@ecs.register('MSCardComp', false)
export class MSCardComp extends CCComp {
s_uuid: number = 0;
is_updated: boolean = false;
is_update: boolean = false;
is_select: boolean = false;
is_selected: boolean = false;
/** 视图层逻辑代码分离演示 */
start() {
console.log("MSCardComp start");
if(this.is_updated){ this.node.getChildByName("update").active=true }else{ this.node.getChildByName("update").active=false }
if(this.is_select){ this.node.getChildByName("select").active=true }else{ this.node.getChildByName("select").active=false }
if(this.is_selected){ this.node.getChildByName("selected").active=true }else{ this.node.getChildByName("selected").active=false }
if(this.is_update){
this.node.getChildByName("update").active=true
}else{
this.node.getChildByName("update").active=false
}
if(this.is_select){
this.node.getChildByName("set").active=true
this.update_select()
}else{
this.node.getChildByName("set").active=false
}
}
update_select(){
if(smc.mskill ==this.s_uuid){ this.node.getChildByName("btn").active=false }else{ this.node.getChildByName("btn").active=true }
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {

View File

@@ -7,6 +7,8 @@ import { UiHeroComp } from "../hero/UiHeroComp";
import { BoxSet } from "../common/config/BoxSet";
import { smc } from "../common/SingletonModuleComp";
import { HeroSelect } from "../hero/HeroSelect";
import { MSklist } from "../common/config/SkillSet";
import { MSCard } from "./MSCard";
const { ccclass, property } = _decorator;
@@ -28,7 +30,7 @@ export class MissionHomeComp extends CCComp {
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
this.loads()
this.load_hero_card()
this.load_ui_heros()
}
@@ -92,7 +94,7 @@ export class MissionHomeComp extends CCComp {
}
}
}
loads(){
load_hero_card(){
let hc:number =HeroList.length
let parent= this.node.getChildByName("heros").getChildByName("view").getChildByName("content")
let height=Math.ceil(hc / 4)*135
@@ -102,6 +104,16 @@ export class MissionHomeComp extends CCComp {
hcc.load(HeroList[i],parent)
}
}
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).width=height
for (let i = 0; i < ms_num; i++) {
let msc =ecs.getEntity<MSCard>(MSCard)
msc.load(HeroList[i],parent,1)
}
}
show_uiheros(){
}