This commit is contained in:
2024-08-13 17:06:10 +08:00
parent 825457fd0e
commit 876a56c8c1
17 changed files with 2156 additions and 610 deletions

View File

@@ -25,12 +25,12 @@ export class Main extends Root {
protected async run() {
smc.initialize = ecs.getEntity<Initialize>(Initialize);
smc.monsters = [
{uuid:1102},
{uuid:1102},
{uuid:1102},
{uuid:1201},
{uuid:1201},
{uuid:1201},
{uuid:1011},
{uuid:1021},
{uuid:1031},
{uuid:1041},
{uuid:1041},
{uuid:1041},
]
console.log("Game start");

View File

@@ -31,6 +31,8 @@ export class SingletonModuleComp extends ecs.Comp {
heros_dead = []
vm_data: any = {
name : "数据测试",
/**宝石数量 */
gems: 10,
/** 当前等级 */
cards:{
level:1,
@@ -42,7 +44,7 @@ export class SingletonModuleComp extends ecs.Comp {
max:30
},
power: {
min: 0,
min: 10,
max: 30
},
gold: {
@@ -50,11 +52,11 @@ export class SingletonModuleComp extends ecs.Comp {
max: 3,
max_limit:10,
time:0,
cd:15,
cd:10,
},
shuaxin: {
min: 0,
max: 15,
max: 5,
speed:1,
},

View File

@@ -9,40 +9,49 @@ export const CardType = {
2: "后排",
}
export const CardList={
1:[1001,1002,1003,1102],
2:[1001,1002,1003,1004,1102,1201],
3:[1001,1002,1003,1004,1102,1201],
4:[1001,1002,1003,1004,1102,1201],
5:[1001,1002,1003,1004,1102,1201],
6:[1001,1002,1003,1004,1102,1201],
1:[1011,1021,1031,1041],
2:[1011,1021,1031,1041,2021,2022,2031,2032],
3:[1011,1021,1031,1041,2021,2022,2031,2032],
4:[1011,1021,1031,1041,2021,2022,2031,2032],
5:[1011,1021,1031,1041,2021,2022,2031,2032],
6:[1011,1021,1031,1041,2021,2022,2031,2032],
}
export const CardSet = {
1001:{
uuid:1001, name:'护盾战士', type:1, level:1,prefab_path:1001,atk:1,atk_cd:1.5, hp:20, power:50, speed:50,
1011:{
uuid:1011, name:'叽叽', type:1, level:1,prefab_path:1011,atk:1,atk_cd:0.5, hp:15, power:45, speed:80,
skill:{ }
},
1002:{
uuid:1002, name:'无名法师', type:2, level:1,prefab_path:1002,atk:3,atk_cd:1.5, hp:10, power:50, speed:50,
1021:{
uuid:1021, name:'汪汪', type:1, level:1,prefab_path:1021,atk:2,atk_cd:1, hp:15, power:50, speed:50,
skill:{ }
},
1003:{
uuid:1003, name:'无名战士', type:1, level:1,prefab_path:1003,atk:2, atk_cd:1.5, hp:15, power:50, speed:50,
1031:{
uuid:1031, name:'喵喵', type:1, level:1,prefab_path:1031,atk:1, atk_cd:0.5, hp:20, power:50, speed:50,
skill:{ }
},
1102:{
uuid:1102, name:'骷髅士兵', type:1, level:1,prefab_path:1102,atk:2,atk_cd:1.5, hp:10, power:50, speed:50,
1041:{
uuid:1041, name:'胖大', type:2, level:1,prefab_path:1041,atk:4,atk_cd:1.5, hp:15, power:50, speed:50,
skill:{ }
},
1004:{
uuid:1004, name:'火焰法师', type:2, level:2,prefab_path:1004,atk:4,atk_cd:1.5, hp:15, power:50, speed:50,
2021:{
uuid:2021, name:'汪汪[强]', type:1, level:2,prefab_path:2021,atk:6,atk_cd:1, hp:25, power:50, speed:50,
skill:{ }
},
1201:{
uuid:1201, name:'猎寻狼', type:1, level:2,prefab_path:1201,atk:5,atk_cd:1.5, hp:20, power:100, speed:100,
2022:{
uuid:2022, name:'沃夫', type:1, level:2,prefab_path:2022,atk:6,atk_cd:1, hp:30, power:50, speed:50,
skill:{ }
},
2031:{
uuid:2031, name:'泰哥', type:1, level:2,prefab_path:2031,atk:4,atk_cd:0.5, hp:25, power:50, speed:50,
skill:{ }
},
2032:{
uuid:2032, name:'喵喵[厚]', type:1, level:2,prefab_path:2032,atk:2.5,atk_cd:0.5, hp:40, power:50, speed:50,
skill:{ }
},
}

View File

@@ -10,9 +10,9 @@ import { CardList } from "../common/config/CardSet";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('ControllerComp')
@ecs.register('Controller', false)
export class ControllerComp extends CCComp {
@ccclass('CardControllerComp')
@ecs.register('CardController', false)
export class CardControllerComp extends CCComp {
card_level = 1;
start() {
this.load_cards()

View File

@@ -1,29 +0,0 @@
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";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('CardControllerComp')
@ecs.register('CardController', false)
export class CardControllerComp extends CCComp {
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -0,0 +1,73 @@
import { _decorator,NodeEventType,EventTouch } 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 { smc } from "../common/SingletonModuleComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('CsuoComp')
@ecs.register('Csuo', false)
export class CsuoComp extends CCComp {
protected onLoad() {
// this.node.on(NodeEventType.TOUCH_START, this.onTouch, this);
}
onTouch() {
oops.gui.open(
UIID.Window,
{
'title':'解锁',
'content':'解锁解锁解锁解锁解锁解锁解锁解锁解锁解锁解锁解锁',
'okWord':'ok',
'okFunc':this.onOk(),
'cancelWord':'解锁',
'cancelFunc':this.oncancel(),
'needCancel':true
}
)
}
onOk(){
}
oncancel(){
smc.vm_data.power.min=smc.vm_data.power.min+1;
this.node.active=false;
}
/**
*
*
* @param params 参数
* {
* title: 标题
* content: 内容
* okWord: ok按钮上的文字
* okFunc: 确认时执行的方法
* cancelWord: 取消按钮的文字
* cancelFunc: 取消时执行的方法
* needCancel: 是否需要取消按钮
* }
*/
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -2,7 +2,7 @@
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "7c495718-13bc-4f64-8ecc-27c210626d0a",
"uuid": "bcd8a069-5208-4be1-8c8e-2cedddb3860a",
"files": [],
"subMetas": {},
"userData": {}

View File

@@ -20,11 +20,9 @@ export class HeroCard extends ecs.Entity {
// 视图层
protected init() {
// this.addComponents<ecs.Comp>(
// MonsterModelComp);
}
destroy(): void {
@@ -34,7 +32,7 @@ export class HeroCard extends ecs.Entity {
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,uuid:number=1001,parent:Node) {
console.log("load hero",uuid);
// console.log("load hero",uuid);
// var path = "game/monster/"+prefab_path;
var path = "game/heros/cards/hero_card";
var prefab: Prefab = oops.res.get(path, Prefab)!;

View File

@@ -70,6 +70,7 @@ export class HeroCardViewComp extends CCComp {
this.ent.destroy();
smc.vm_data.gold.min -= CardSet[this.card_uid].level;
}else{
oops.gui.toast("金币不够");
this.node.setPosition(this.pos_x,this.pos_y);
}
}