This commit is contained in:
2024-08-11 23:56:18 +08:00
parent 6355d80a2c
commit 21b559abcf
13 changed files with 1561 additions and 1284 deletions

View File

@@ -23,19 +23,22 @@
},
{
"__id__": 8
},
{
"__id__": 14
}
],
"_active": true,
"_components": [
{
"__id__": 14
"__id__": 20
},
{
"__id__": 16
"__id__": 22
}
],
"_prefab": {
"__id__": 18
"__id__": 24
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -75,7 +78,7 @@
"__id__": 1
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 3
@@ -338,6 +341,142 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "active",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 15
},
{
"__id__": 17
}
],
"_prefab": {
"__id__": 19
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 14
},
"_enabled": true,
"__prefab": {
"__id__": 16
},
"_contentSize": {
"__type__": "cc.Size",
"width": 110,
"height": 110
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "13sh5Lj+5FIbltkc68Xf4S"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 14
},
"_enabled": true,
"__prefab": {
"__id__": 18
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "fdf9c650-fb92-49bb-82ce-3007df7745b6@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "6azJ507G9Lq60zCRcRIvnI"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "8eCsq/oFNMYb1bIWCaEPbY",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
@@ -348,7 +487,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 15
"__id__": 21
},
"_contentSize": {
"__type__": "cc.Size",
@@ -376,7 +515,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 17
"__id__": 23
},
"_id": ""
},

View File

@@ -1,9 +0,0 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "d5604362-ce57-4bc2-9a05-cb1ba2e170a2",
"files": [],
"subMetas": {},
"userData": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.26",
"importer": "image",
"imported": true,
"uuid": "6f0c2175-1556-4c71-a736-a1c8b1f96c84",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "6f0c2175-1556-4c71-a736-a1c8b1f96c84@6c48a",
"displayName": "blue",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "6f0c2175-1556-4c71-a736-a1c8b1f96c84",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "6f0c2175-1556-4c71-a736-a1c8b1f96c84@f9941",
"displayName": "blue",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 177,
"height": 183,
"rawWidth": 177,
"rawHeight": 183,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-88.5,
-91.5,
0,
88.5,
-91.5,
0,
-88.5,
91.5,
0,
88.5,
91.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
183,
177,
183,
0,
0,
177,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-88.5,
-91.5,
0
],
"maxPos": [
88.5,
91.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "6f0c2175-1556-4c71-a736-a1c8b1f96c84@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": false,
"redirect": "6f0c2175-1556-4c71-a736-a1c8b1f96c84@f9941"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.26",
"importer": "image",
"imported": true,
"uuid": "fdf9c650-fb92-49bb-82ce-3007df7745b6",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "fdf9c650-fb92-49bb-82ce-3007df7745b6@6c48a",
"displayName": "focus",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "fdf9c650-fb92-49bb-82ce-3007df7745b6",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "fdf9c650-fb92-49bb-82ce-3007df7745b6@f9941",
"displayName": "focus",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 189,
"height": 189,
"rawWidth": 189,
"rawHeight": 189,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-94.5,
-94.5,
0,
94.5,
-94.5,
0,
-94.5,
94.5,
0,
94.5,
94.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
189,
189,
189,
0,
0,
189,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-94.5,
-94.5,
0
],
"maxPos": [
94.5,
94.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "fdf9c650-fb92-49bb-82ce-3007df7745b6@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": false,
"redirect": "fdf9c650-fb92-49bb-82ce-3007df7745b6@f9941"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -32,11 +32,11 @@ export class SingletonModuleComp extends ecs.Comp {
vm_data: any = {
name : "数据测试",
/** 当前等级 */
porwer: 0,
/** 当前经验 */
def : 0,
/** 下级经验 */
speed : 0,
cards:{
level:1,
level_max:10,
eid:0,
},
hp: {
min:20,
max:30
@@ -46,18 +46,15 @@ export class SingletonModuleComp extends ecs.Comp {
max: 30
},
gold: {
min: 0,
max: 10
min: 3,
max: 3,
time:0,
cd:30,
},
shuaxin: {
min: 0,
max: 2,
speed:1,
},
gold_add: {
min: 0,
max: 10,
speed:2,
speed:1,
},
};

View File

@@ -8,12 +8,13 @@
export const CardSet = {
1001:{
uuid:1001,
name:'嬴政',
name:'护盾战士',
level:1,
prefab_path:'yinzheng',
hp:100,
power:100,
speed:100,
atk:2,
hp:10,
power:50, //每0.1秒增加1能量
speed:50,
skill:{ }
},

View File

@@ -50,6 +50,7 @@ export class ControllerComp extends CCComp {
card.load(pos,1001,cards_node);
x=x+120
}
this.node.getChildByName("cards").getChildByName("active").active = false
}
/** 转场 */
protected update(dt: number): void {

View File

@@ -60,13 +60,10 @@ export class MapViewComp extends CCComp {
}
gold_add(dt: number) {
smc.vm_data.gold_add.min += smc.vm_data.gold_add.speed*dt;
if (smc.vm_data.gold_add.min >= smc.vm_data.gold_add.max) {
smc.vm_data.gold_add.min = 0;
if (smc.vm_data.gold.min < smc.vm_data.gold.max) {
smc.vm_data.gold.min = smc.vm_data.gold.min + 1
}
smc.vm_data.gold.time += dt;
if (smc.vm_data.gold.time >= smc.vm_data.gold.cd) {
smc.vm_data.gold.min = smc.vm_data.gold.max;
smc.vm_data.gold.time = 0;
}
}
shuaxin(dt: number) {

View File

@@ -3,7 +3,8 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { data } from "../data/data";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { smc } from "../common/SingletonModuleComp";
import { CardSet } from "../common/config/CardSet";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -39,22 +40,40 @@ export class HeroCardViewComp extends CCComp {
}
onTouchMove(event: EventTouch) {
smc.vm_data.cards.eid = this.ent.eid;
let parent = this.node.parent;
let active = parent.getChildByName("active");
active.setPosition(this.node.position.x,this.node.position.y)
active.active = true;
console.log(parent);
// if(this.ent.eid == smc.vm_data.cards.eid){
// this.node.getChildByName("active").active = true;
// }else{
// this.node.getChildByName("active").active = false;
// }
console.log("onTouchMove");
let delta = event.getDelta();
this.node.setPosition(this.node.position.x+delta.x,this.node.position.y+delta.y);
}
onTouchEnd(){
if(this.node.position.y-this.pos_y > 50){
let parent = this.node.parent;
let active = parent.getChildByName("active");
active.setPosition(this.pos_x,this.pos_y)
if(this.node.position.y-this.pos_y > 110){
active.active = false;
this.use_card()
}else{
this.node.setPosition(this.pos_x,this.pos_y);
}
console.log(ecs.query(ecs.allOf(HeroCardViewComp)))
}
use_card(){
if(smc.vm_data.gold.min >= CardSet[this.card_uid].level){
oops.message.dispatchEvent("do_add_hero",this.ent)
this.ent.destroy();
smc.vm_data.gold.min -= CardSet[this.card_uid].level;
}else{
this.node.setPosition(this.pos_x,this.pos_y);
}
}
/** 视图层逻辑代码分离演示 */
start() {

View File

@@ -27,36 +27,41 @@ export class MonsterViewComp extends CCComp {
/** 角色动画 */
as: MonsterSpine = null!;
hero_name : string = "hero";
/** 角色阵营 1hero -1 :monster */
camp: number = 1;
/**角色类型 1近战 2 远程 */
type: number = 1;
/** 状态 1move ,2: act 3: stop */
state: number = 1;
/** 血量 */
hp: number = 100;
hp_max: number = 100;
camp: number = 1; /** 角色阵营 1hero -1 :monster */
type: number = 1; /**角色类型 1前排 2 后排 */
state: number = 1; /** 状态 1move ,2: act 3: stop */
hp: number = 100; /** 血量 */
hp_max: number = 100; /** 最大血量 */
hp_speed: number = 0; //回复速度
/**能量**/
power: number = 0;
power_max: number = 100;
power_speed: number = 1; //回复速度
skill_name: string = "base";
max_skill_name: string = "base";
/**攻击力 */
atk: number = 10;
/**攻击速度 */
power: number = 0; /**能量**/
power_max: number = 100; /** 能量最大值 */
power_speed: number = 1; //能量回复速度每0.1秒回复量
skill_name: string = "base"; //技能名称
max_skill_name: string = "base"; //大技能名称
atk: number = 10; /**攻击 */
// atk_speed: number = 1;
atk_cd: number = 1.3;
atk_time: number = 0;
/** 角色移动速度 */
speed: number = 100;
/** 角色初始速度 */
ospeed: number = 100;
atk_cd: number = 1.3; /**攻击速度 攻击间隔 */
atk_time: number = 0; /** 冷却时间 */
speed: number = 100; /** 角色移动速度 */
ospeed: number = 100; /** 角色初始速度 */
Tpos: Vec3 = v3(0,-60,0);
stop_cd: number = 0;
private timer:Timer = new Timer(0.1);
is_dead:boolean = false;
stop_cd: number = 0; /*停止倒计时*/
private timer:Timer = new Timer(0.1); //计时器
is_dead:boolean = false; //是否摧毁
/*暴击*/
crit_rate:number = 0; //暴击率
crit_damage:number = 2; //暴击伤害倍率
/*闪避*/
dodge_rate:number = 0; //闪避率
shield:number = 0; //护盾量
shield_time:number = 0; //护盾持续时间
/** 视图层逻辑代码分离演示 */
start () {