This commit is contained in:
pan
2024-08-19 17:27:31 +08:00
parent 8f57f57c1d
commit 3994ba359a
14 changed files with 1081 additions and 524 deletions

View File

@@ -24,7 +24,7 @@ export class SingletonModuleComp extends ecs.Comp {
/**怪物数据 数组 */
monsters = []
/**heros 数据 */
heros = [];
heros:any = [];
monsters_in=[]
heros_in = []
monsters_dead = []
@@ -54,8 +54,8 @@ export class SingletonModuleComp extends ecs.Comp {
level:1,
level_max:4,
eid:0,
ref_cost:1,
up_cost:6,
ref_cost:2,
up_cost:4,
},
hp: {
min:20,
@@ -66,8 +66,8 @@ export class SingletonModuleComp extends ecs.Comp {
max: 30
},
gold: {
min: 10,
max: 10,
min: 3,
max: 3,
max_limit:10,
time:0,
cd:10,

View File

@@ -0,0 +1,35 @@
export const MissionNum = 3
export const Mission= {
// 1:[1101,1102,1201,1202,1301,1302,],
// 2:[2101,2102,2201,2202,2301,2302,],
// 3:[3101,3102,3201,3202,3301,3302,],
// 4:[4101,4102,4201,4202,4301,4302,],
// 5:[5001,5002,5003,5004],
// 1:[1101,1102,1103,1104,1105,1106,1201,1202,1203,1204,1205,1301,1302,1303,1304,],
// 2:[2101,2102,2103,2104,2105,2201,2202,2203,2204,2301,2302,2303,2304,2305,],
// 3:[3101,3102,3103,3104,3201,3202,3203,3204,3205,3301,3302,3303,3304,],
// 4:[4101,4102,4103,4104,4201,4202,4203,4204,4301,4302,4303,4304,],
// 5:[5001,5002,5003,5004],
1:{
1:[1101,1102,],
2:[1101,1102,2101,2102,],
3:[2101,2102,3101,3102,],
4:[3101,3102,4101,4102],
5:[5001],
},
2:{
1:[1201,1202,],
2:[1201,1202,2201,2202,],
3:[2201,2202,3201,3202,],
4:[3201,3202,4201,4202,],
5:[5003,5004],
},
3:{
1:[1301,1302,],
2:[1301,1302,2301,2302,],
3:[32301,2302,301,3302,],
4:[301,3302,4301,4302,],
5:[5002],
},
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "1a81eb9e-feb4-483f-a5c0-ca5f0b358627",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -11,6 +11,9 @@ import { AsyncQueue, NextFunction } from "../../../../extensions/oops-plugin-fra
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { UIID } from "../common/config/GameUIConfig";
import { LoadingViewComp } from "./view/LoadingViewComp";
import { smc } from "../common/SingletonModuleComp";
import { HeroList } from "../map/HeroList";
// import {data} from "../data/data";
/**
* 游戏进入初始化模块
@@ -20,6 +23,7 @@ import { LoadingViewComp } from "./view/LoadingViewComp";
@ecs.register(`Initialize`)
export class Initialize extends ecs.Entity {
LoadingView!: LoadingViewComp;
HeroList: HeroList;
// data:data=null!;
protected init() {
@@ -44,6 +48,9 @@ export class Initialize extends ecs.Entity {
queue.push(async (next: NextFunction, params: any, args: any) => {
// 加载多语言对应字体
oops.res.load("language/font/" + oops.language.current, next);
//加载精灵配置表
oops.res.load("config/game/heros", next);
});
}
@@ -77,6 +84,10 @@ export class Initialize extends ecs.Entity {
/** 加载完成进入游戏内容加载界面 */
private onComplete(queue: AsyncQueue) {
queue.complete = () => {
this.HeroList = new HeroList();
this.HeroList.init(); // 等待数据加载完成
smc.heros = this.HeroList.list;
var uic: UICallbacks = {
onAdded: (node: Node, params: any) => {
var comp = node.getComponent(LoadingViewComp) as ecs.Comp;

View File

@@ -40,6 +40,10 @@ export class CardControllerComp extends CCComp {
smc.vm_data.gold.min -= smc.vm_data.cards.up_cost;
smc.vm_data.cards.level += 1;
smc.vm_data.cards.up_cost += 2
if(smc.vm_data.cards.level >= smc.vm_data.cards.level_max){
smc.vm_data.cards.level = smc.vm_data.cards.level_max;
smc.vm_data.cards.up_cost = 11
}
console.log("card _level:"+this.card_level+"cost:"+smc.vm_data.cards.up_cost)
}else{
oops.gui.toast("金币不够");

View File

@@ -0,0 +1,28 @@
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
/** 策划 Excel 导出的 Json 静态数据 */
export class HeroList {
static TableName: string = "config/game/heros";
/** 静态表中一条数据 */
private data: any;
init() {
var table = oops.res.get(HeroList.TableName);
this.data = table['json']['list'];
}
/** 数据唯一编号 */
id: number = 0;
/** 数据 */
get list(): number {
let res:any = []
for(let i=0;i<this.data.length;i++)
{
res[this.data[i].uuid] = this.data[i];
}
return res;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "96c600ef-79ab-4952-a5c8-a3bbc7a7d15f",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,4 +1,4 @@
import { v3, Vec3, _decorator ,Prefab,instantiate} from "cc";
import { v3, Vec3, _decorator ,Prefab,instantiate,JsonAsset} 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";
@@ -11,29 +11,27 @@ import { MapViewScene } from "./MapViewScene";
import { Timer } from "../../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
import { oops } from "../../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { CardSet } from "../../common/config/CardSet";
const { ccclass, property } = _decorator;
@ccclass('MapViewComp')
@ecs.register('MapView', false)
export class MapViewComp extends CCComp {
scene: MapViewScene = null!;
/** 是否正在转场 */
/** 当前地图数据 */
current_map: any;
/** 转场碰撞点对象集合 */
private game_timer: Timer = new Timer(1);
private monster_refresh_rtimer: Timer = new Timer(3);
private mapLoaded() {
}
onLoad(){
async onLoad(){
// 监听全局事件
oops.message.on("do_add_monster", this.on_do_add_monster, this);
oops.message.on("do_add_hero", this.on_do_add_hero, this);
}
private on_do_add_monster(event: string, args: any) {
this.addMonster()
@@ -49,9 +47,12 @@ export class MapViewComp extends CCComp {
start() {
this.scene = this.getComponent(MapViewScene);
this.load_data()
}
load_data(){
// let heros = oops.res.get("config/game/heros")
// console.log("heros",heros)
}
protected update(dt: number): void {
if (this.monster_refresh_rtimer.update(dt)) {
this.monster_refresh()

View File

@@ -97,11 +97,11 @@ export class HeroCardViewComp extends CCComp {
}
use_card(){
if(smc.vm_data.gold.min >= CardSet[this.card_uid].level){
if(smc.vm_data.gold.min >= smc.vm_data.cards.ref_cost){
this.in_destroy = true;
oops.message.dispatchEvent("do_add_hero",{uuid:this.card_uid})
this.ent.destroy();
smc.vm_data.gold.min -= CardSet[this.card_uid].level;
smc.vm_data.gold.min -= smc.vm_data.cards.ref_cost;
}else{
oops.gui.toast("金币不够");
this.node.setPosition(this.pos_x,this.pos_y);