商品页初步完成

This commit is contained in:
2024-12-16 10:51:51 +08:00
parent 73ad199bfc
commit b9a188a7bb
12 changed files with 28937 additions and 14254 deletions

View File

@@ -101,7 +101,6 @@ export class SingletonModuleComp extends ecs.Comp {
gems:0,
energy:0,
},
items:{
1001:{num:1000,x1:1,x10:0},
1002:{num:1000,x1:2,x10:0},
@@ -121,6 +120,10 @@ export class SingletonModuleComp extends ecs.Comp {
1016:{num:1000,x1:0,x10:0},
9001:{num:854587,x1:9999,x10:0},
},
free:{ cost:0,num:3,buy:3,},
goods1:{ cost:2000,num:3,buy:3,},
goods2:{ cost:3000,num:4,buy:3,},
goods3:{ cost:4000,num:5,buy:3,},
};
vmAdd() {

View File

@@ -47,59 +47,46 @@ export class CardControllerComp extends CCComp {
}
page_init(){
this.node.getChildByName("mission_home").active=true;
this.node.getChildByName("hero_home").setPosition(v3(1000,this.node.getChildByName("hero_home").position.y))
this.node.getChildByName("shop_home").setPosition(v3(1000,this.node.getChildByName("shop_home").position.y))
this.node.getChildByName("battle_home").setPosition(v3(1000,this.node.getChildByName("battle_home").position.y))
this.node.getChildByName("skill_home").setPosition(v3(1000,this.node.getChildByName("skill_home").position.y))
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("mission").active = false;
}
bar_change(e:any,args:any){
console.log("bar_change",args)
this.node.getChildByName("mission_home").active=true;
this.node.getChildByName("bar").active=true;
this.bbg.setPosition(v3(this.bbg_x[2],this.bbg_y))
this.node.getChildByName("mission").active = false;
this.node.getChildByName("hero_home").setPosition(v3(2000,this.node.getChildByName("hero_home").position.y))
this.node.getChildByName("shop_home").setPosition(v3(2000,this.node.getChildByName("shop_home").position.y))
this.node.getChildByName("battle_home").setPosition(v3(2000,this.node.getChildByName("battle_home").position.y))
this.node.getChildByName("skill_home").setPosition(v3(2000,this.node.getChildByName("skill_home").position.y))
this.node.getChildByName("hero_home").active = false
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
switch(args){
case "hero":
this.node.getChildByName("hero_home").setPosition(v3(0,this.node.getChildByName("hero_home").position.y))
this.node.getChildByName("hero_home").active = true
this.bbg.setPosition(v3(this.bbg_x[1],this.bbg_y))
break;
case "shop":
this.node.getChildByName("shop_home").setPosition(v3(0,this.node.getChildByName("shop_home").position.y))
this.node.getChildByName("shop_home").active = true
this.bbg.setPosition(v3(this.bbg_x[0],this.bbg_y))
break;
case "battle":
// this.node.getChildByName("battle_home").setPosition(v3(0,this.node.getChildByName("battle_home").position.y))
// this.bbg.setPosition(v3(this.bbg_x[4],this.bbg_y))
oops.gui.toast("暂未开放")
// case "battle":
// 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").setPosition(v3(0,this.node.getChildByName("skill_home").position.y))
this.node.getChildByName("skill_home").active = true
this.bbg.setPosition(v3(this.bbg_x[3],this.bbg_y))
break;
break;
case "home":
this.node.getChildByName("mission_home").active = true
this.bbg.setPosition(v3(this.bbg_x[2],this.bbg_y))
break;
}
}
mission_start(){
this.node.getChildByName("bar").active=false;
this.node.getChildByName("mission_home").active=false;
this.node.getChildByName("mission").active = true;
smc.mission.play = true;
// oops.message.dispatchEvent("mission_start")
}
to_mission(){
this.bar_change(null,"home")
this.node.getChildByName("bar").active=true;
// tween(this.bbg).to(0.1,{Position:v3(this.bbg_x[2],this.bbg_y)}).start()
this.bbg.setPosition(this.bbg_x[2],this.bbg_y)
}
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();

View File

@@ -28,6 +28,7 @@ import { MSkillComp } from "./MSkillComp";
import { Monster } from "../hero/Mon";
import { UIID } from "../common/config/GameUIConfig";
import { CardControllerComp } from "./CardController";
import { MissionHomeComp } from "./MissionHomeComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -115,9 +116,14 @@ export class MissionComp extends CCComp {
rewards[i].ItemComp.reset()
rewards[i].ItemComp.ent.destroy()
}
this.to_mission_home()
}
to_mission_home(){
let home =this.node.parent.getComponent(CardControllerComp);
let mission_home=home.node.getChildByName("mission_home").getComponent(MissionHomeComp)
home.bar_change(null,"home")
home.node.getChildByName("bar").active=true;
mission_home.load_ui_heros()
}
mission_init(){
//局内数据初始化

View File

@@ -9,6 +9,8 @@ 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";
const { ccclass, property } = _decorator;
@@ -35,8 +37,8 @@ export class MissionHomeComp extends CCComp {
this.load_skill_card()
this.select_skill()
}
start_mission(e:any,args:any) {
console.log("mission home start_mission")
start_mission() {
console.log("mission_home : start_mission")
for(let i=0;i<this.heros.length;i++){
this.heros[i].to_destroy()
}
@@ -48,9 +50,16 @@ export class MissionHomeComp extends CCComp {
{uuid:0,px:0},
{uuid:0,px:100},
]
if(args!=0){
this.load_ui_heros()
}
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;
this.node.active=false;
}
load_hero_card(){
let hc:number =HeroList.length
@@ -125,7 +134,6 @@ export class MissionHomeComp extends CCComp {
}
show_heros(){
this.node.getChildByName("heros").setPosition(0,290)
}

View File

@@ -0,0 +1,41 @@
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 { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { UIID } from "../common/config/GameUIConfig";
import { Items } from "../common/config/Items";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('ShopHomeComp')
@ecs.register('ShopHomeComp', false)
export class ShopHomeComp extends CCComp {
/** 视图层逻辑代码分离演示 */
start() {
}
item_show(e:any,val:any){
oops.gui.open(UIID.ItemInfo, Items[val]);
}
get_free(){
console.log("免费领取")
}
get_goods1(){
console.log("购买商品1")
}
get_goods2(){
console.log("购买商品2")
}
get_goods3(){
console.log("购买商品3")
}
get_goods4(){
console.log("购买商品4")
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "08123a0b-18dd-4dcb-8f8b-17664ff1ec67",
"files": [],
"subMetas": {},
"userData": {}
}