界面调整 去掉技能大页面

This commit is contained in:
2024-12-18 15:58:44 +08:00
parent e7f5b44b1e
commit 25b8e384e7
16 changed files with 11112 additions and 7725 deletions

View File

@@ -50,7 +50,7 @@ export class CardControllerComp extends CCComp {
this.node.getChildByName("hero_home").active = false;
this.node.getChildByName("shop_home").active = false;
this.node.getChildByName("battle_home").active = false;
this.node.getChildByName("skill_home").active = false;
this.node.getChildByName("luck_home").active = false;
this.node.getChildByName("mission").active = false;
}
@@ -62,7 +62,7 @@ export class CardControllerComp extends CCComp {
this.node.getChildByName("mission_home").active = false
this.node.getChildByName("shop_home").active = false
this.node.getChildByName("battle_home").active = false
this.node.getChildByName("skill_home").active = false
this.node.getChildByName("luck_home").active = false
switch(args){
case "hero":
this.node.getChildByName("hero_home").active = true
@@ -76,8 +76,8 @@ export class CardControllerComp extends CCComp {
// this.node.getChildByName("battle_home").active = true
// this.bbg.setPosition(v3(this.bbg_x[4],this.bbg_y))
break;
case "skill":
this.node.getChildByName("skill_home").active = true
case "luck":
this.node.getChildByName("luck_home").active = true
this.bbg.setPosition(v3(this.bbg_x[3],this.bbg_y))
break;
case "home":

View File

@@ -178,7 +178,7 @@ export class HeroHomeComp extends CCComp {
this.update_data()
}
item_show(e:any,val:any){
oops.gui.open(UIID.ItemInfo, Items[val]);
oops.gui.open(UIID.ItemInfo, {uuid:val,type:0});
}
reset() {
this.node.destroy();

View File

@@ -16,6 +16,9 @@ export class Item extends ecs.Entity {
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.getChildByName("num").getComponent(Label).string = num.toString();
if(num==0){
node.getChildByName("num").getComponent(Label).string ="";
}
let url = "gui/items";
let pathName= Items[uuid].path;

View File

@@ -18,7 +18,7 @@ export class ItemComp extends CCComp {
}
show_info(){
oops.gui.open(UIID.ItemInfo, Items[this.i_uuid]);
oops.gui.open(UIID.ItemInfo, {uuid:this.i_uuid,type:0});
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */

View File

@@ -4,6 +4,8 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { UIID } from "../common/config/GameUIConfig";
import { Items } from "../common/config/Items";
import { SkillSet } from "../common/config/SkillSet";
import { HeroInfo, HeroSet } from "../common/config/heroSet";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -11,33 +13,63 @@ const { ccclass, property } = _decorator;
@ecs.register('ItemInfo', false)
export class ItemInfoComp extends CCComp {
onAdded(args: any) {
this.node.getChildByName("name").getComponent(Label).string=args.name
this.node.getChildByName("info").getComponent(Label).string=args.info
let url = "gui/items";
let pathName= args.path;
this.node.getChildByName("lv1").active = false;
this.node.getChildByName("lv2").active = false;
this.node.getChildByName("lv3").active = false;
this.node.getChildByName("lv4").active = false;
this.node.getChildByName("item").active = false;
this.node.getChildByName("skill").active = false;
this.node.getChildByName("hero").active = false;
if(args.type==0){
this.node.getChildByName("item").active = true;
this.node.getChildByName("name").getComponent(Label).string=Items[args.uuid].name
this.node.getChildByName("info").getComponent(Label).string=Items[args.uuid].info
let url = "gui/items";
let pathName= Items[args.uuid].path;
this.node.getChildByName("item").getChildByName("lv1").active = false;
this.node.getChildByName("item").getChildByName("lv2").active = false;
this.node.getChildByName("item").getChildByName("lv3").active = false;
this.node.getChildByName("item").getChildByName("lv4").active = false;
switch(Items[args.uuid].lv){
case 1:
this.node.getChildByName("lv1").active = true;
break;
case 2:
this.node.getChildByName("lv2").active = true;
break;
case 3:
this.node.getChildByName("lv3").active = true;
break;
case 4:
this.node.getChildByName("lv4").active = true;
break;
switch(Items[args.uuid].lv){
case 1:
this.node.getChildByName("item").getChildByName("lv1").active = true;
break;
case 2:
this.node.getChildByName("item").getChildByName("lv2").active = true;
break;
case 3:
this.node.getChildByName("item").getChildByName("lv3").active = true;
break;
case 4:
this.node.getChildByName("item").getChildByName("lv4").active = true;
break;
}
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("item").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
}
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
if(args.type==1){ //技能碎片
this.node.getChildByName("skill").active = true;
this.node.getChildByName("name").getComponent(Label).string=SkillSet[args.uuid].name+" 碎片"
this.node.getChildByName("info").getComponent(Label).string="「"+SkillSet[args.uuid].name+"」碎片,用于技能升星"
var icon_path = "game/skills/skill_icon"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("skill").getChildByName("skill").getChildByName("icon").getComponent(Sprite);
// console.log("update_data",atlas,sprite)
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[args.uuid].path);
});
}
if(args.type==2){ //英雄碎片
this.node.getChildByName("hero").active = true
this.node.getChildByName("name").getComponent(Label).string=HeroInfo[args.uuid].name+" 碎片"
this.node.getChildByName("info").getComponent(Label).string="「"+HeroInfo[args.uuid].name+"」碎片,用于英雄升星"
var icon_path = "game/heros/herois"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("hero").getChildByName("hero").getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[args.uuid].path);
});
}
}
private onTouchEnd(event: EventTouch) {

View File

@@ -22,21 +22,27 @@ export class MSCardComp extends CCComp {
/** 视图层逻辑代码分离演示 */
start() {
oops.message.on(GameEvent.MSSelected, this.update_select, this);
this.mhc=this.node.parent.parent.parent.parent.getComponent(MissionHomeComp)
console.log("MSCardComp start");
this.change()
}
change_set(){
this.is_update=!this.is_update
this.is_select=!this.is_select
this.change()
}
change(){
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_data(){
if(smc.skills[this.s_uuid].slv>=1) {this.node.getChildByName("slv").getChildByName("s1").active=true} else {this.node.getChildByName("slv").getChildByName("s1").active=false};
@@ -45,7 +51,7 @@ export class MSCardComp extends CCComp {
if(smc.skills[this.s_uuid].slv>=4) {this.node.getChildByName("slv").getChildByName("s4").active=true} else {this.node.getChildByName("slv").getChildByName("s4").active=false};
if(smc.skills[this.s_uuid].slv>=5) {this.node.getChildByName("slv").getChildByName("s5").active=true} else {this.node.getChildByName("slv").getChildByName("s5").active=false};
this.node.getChildByName("update").getChildByName("cost").getComponent(Label).string =smc.skills[this.s_uuid].num.toString()+ " / "+(SkillSet[this.s_uuid].upcost*(1+smc.skills[this.s_uuid].slv)).toString()
let sc= this.node.getChildByName("schip").getComponent(SChipComp)
let sc= this.node.getChildByName("update").getChildByName("schip").getComponent(SChipComp)
sc.update_data(this.s_uuid,0)
}
select(){

View File

@@ -11,6 +11,7 @@ import { MSklist, SkillSet } from "../common/config/SkillSet";
import { MSCard } from "./MSCard";
import { CardControllerComp } from "./CardController";
import { MissionComp } from "./MissionComp";
import { MSCardComp } from "./MSCardComp";
const { ccclass, property } = _decorator;
@@ -145,7 +146,23 @@ export class MissionHomeComp extends CCComp {
}
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();

View File

@@ -62,7 +62,7 @@ export class ShopHomeComp extends CCComp {
}
item_show(e:any,val:any){
oops.gui.open(UIID.ItemInfo, Items[val]);
oops.gui.open(UIID.ItemInfo, {uuid:val,type:0});
}
get_free(){
console.log("免费领取")

View File

@@ -104,7 +104,6 @@ export class VictoryComp extends CCComp {
item_show(e:any,val:any){
console.log("item_show",val)
oops.gui.open(UIID.ItemInfo, Items[val]);
}
protected onDestroy(): void {
console.log("释放胜利界面");