Compare commits
2 Commits
2a309a14d0
...
new428
| Author | SHA1 | Date | |
|---|---|---|---|
| c615b93c5b | |||
| ead616a88b |
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"ver": "1.1.50",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "407f71e4-91fa-4800-be94-bcb155cde502",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "MSCard"
|
||||
}
|
||||
}
|
||||
@@ -279,8 +279,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 130,
|
||||
"height": 180
|
||||
"width": 160,
|
||||
"height": 200
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -541,8 +541,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 260,
|
||||
"height": 360
|
||||
"width": 320,
|
||||
"height": 400
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -716,8 +716,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 240,
|
||||
"height": 180
|
||||
"width": 300,
|
||||
"height": 220
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -891,8 +891,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 260,
|
||||
"height": 360
|
||||
"width": 320,
|
||||
"height": 400
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -1209,8 +1209,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 240,
|
||||
"height": 180
|
||||
"width": 300,
|
||||
"height": 220
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -1335,6 +1335,8 @@
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "85cImEieZAY6lnLDMbLF+3",
|
||||
"instance": null,
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
@@ -1500,7 +1502,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -4.650000000000006,
|
||||
"y": 5.349999999999994,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -2173,7 +2175,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -30.325000000000003,
|
||||
"y": -40.325,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -2266,7 +2268,7 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 248,
|
||||
"width": 308,
|
||||
"height": 60
|
||||
},
|
||||
"_anchorPoint": {
|
||||
@@ -2706,7 +2708,7 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 124,
|
||||
"width": 154,
|
||||
"height": 20
|
||||
},
|
||||
"_anchorPoint": {
|
||||
@@ -2803,7 +2805,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -30.236000000000004,
|
||||
"y": -40.236000000000004,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -2896,7 +2898,7 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 248,
|
||||
"width": 308,
|
||||
"height": 60
|
||||
},
|
||||
"_anchorPoint": {
|
||||
@@ -3336,7 +3338,7 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 124,
|
||||
"width": 154,
|
||||
"height": 20
|
||||
},
|
||||
"_anchorPoint": {
|
||||
@@ -4397,8 +4399,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 130,
|
||||
"height": 180
|
||||
"width": 160,
|
||||
"height": 200
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -4702,8 +4704,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 130,
|
||||
"height": 180
|
||||
"width": 160,
|
||||
"height": 200
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -5025,6 +5027,8 @@
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "19a3I/bqxJgaV8Y6giHQjy",
|
||||
"instance": null,
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
@@ -5355,8 +5359,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 130,
|
||||
"height": 180
|
||||
"width": 160,
|
||||
"height": 200
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,45 +0,0 @@
|
||||
import { instantiate, Label, Prefab, resources, Sprite, SpriteAtlas } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { MSCardComp } from "./MSCardComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
|
||||
/** MSCard 模块 */
|
||||
@ecs.register(`MSCard`)
|
||||
export class MSCard extends ecs.Entity {
|
||||
|
||||
|
||||
/** 实始添加的数据层组件 */
|
||||
protected init() {
|
||||
// this.addComponents<ecs.Comp>();
|
||||
}
|
||||
load(uuid:number=1001,parent:any,zone:number=0) {
|
||||
var path = "game/gui/MSCard";
|
||||
var icon_path = "game/skills/skill_icon"
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
console.log("load_hcard",prefab)
|
||||
var node = instantiate(prefab);
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = node.getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[uuid].path);
|
||||
});
|
||||
|
||||
node.getChildByName("name").getComponent(Label).string = SkillSet[uuid].name
|
||||
|
||||
node.parent = parent
|
||||
var msc = node.getComponent(MSCardComp)!;
|
||||
msc.s_uuid= uuid
|
||||
msc.update_data()
|
||||
if(zone==1) {msc.is_update=true }else{msc.is_update=false}
|
||||
if(zone==2) {msc.is_select=true}else{msc.is_select=false}
|
||||
this.add(msc)
|
||||
}
|
||||
/** 模块资源释放 */
|
||||
destroy() {
|
||||
// 注: 自定义释放逻辑,视图层实现 ecs.IComp 接口的 ecs 组件需要手动释放
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b808913f-7dc0-4dbf-9e74-12b5338a39ee",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
import { _decorator, Label } 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";
|
||||
import { MissionHomeComp } from "./MissionHomeComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { SChipComp } from "../hero/SChipComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('MSCardComp')
|
||||
@ecs.register('MSCardComp', false)
|
||||
export class MSCardComp extends CCComp {
|
||||
mhc:MissionHomeComp
|
||||
s_uuid: number = 0;
|
||||
is_update: boolean = false;
|
||||
is_select: boolean = false;
|
||||
is_selected: boolean = false;
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
oops.message.on(GameEvent.MSSelected, this.update_select, this);
|
||||
this.mhc=this.node.parent.parent.parent.parent.getComponent(MissionHomeComp)
|
||||
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(){
|
||||
|
||||
}
|
||||
select(){
|
||||
smc.mission.mskill=this.s_uuid
|
||||
|
||||
oops.message.dispatchEvent(GameEvent.MSSelected,{uuid:this.s_uuid})
|
||||
}
|
||||
update_select(){
|
||||
console.log("update_select",smc.mission.mskill,this.s_uuid)
|
||||
if(smc.mission.mskill ==this.s_uuid){
|
||||
this.node.getChildByName("set").getChildByName("btn").active=false
|
||||
}else{
|
||||
this.node.getChildByName("set").getChildByName("btn").active=true
|
||||
}
|
||||
}
|
||||
update_lv(){
|
||||
|
||||
let mscards:any= ecs.query(ecs.allOf(MSCardComp));
|
||||
for(let i=0;i<mscards.length;i++){
|
||||
mscards[i].MSCardComp.update_data()
|
||||
}
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "f7a30834-31c8-405a-9f9d-70555981d611",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
import { _decorator, Label, ProgressBar, resources, Sprite, SpriteAtlas, v3, Vec3 } 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 { CdType, SkillSet } from "../common/config/SkillSet";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { Skill } from "../skills/Skill";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('MSkillComp')
|
||||
@ecs.register('MSkillComp', false)
|
||||
export class MSkillComp extends CCComp {
|
||||
/** 技能队列 */
|
||||
private skillQueue: Array<{
|
||||
uuid: number,
|
||||
startPos: Vec3,
|
||||
targetPos: Vec3,
|
||||
group: number,
|
||||
count: number,
|
||||
cd: number,
|
||||
cdTimer: number // 改用累计时间计时器
|
||||
}> = [];
|
||||
/** 常驻技能 */
|
||||
MSkill:any={
|
||||
uuid:0,
|
||||
CdType:0,
|
||||
cd:0,
|
||||
count:0,
|
||||
cdTimer:0
|
||||
}
|
||||
/** 技能队列 */
|
||||
protected onLoad(): void {
|
||||
this.on(GameEvent.MissionSkill, this.skill_event, this);
|
||||
}
|
||||
start() {
|
||||
|
||||
}
|
||||
init(){
|
||||
|
||||
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
if (!smc.mission.play || smc.mission.pause) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理技能队列
|
||||
this.processSkillQueue(dt);
|
||||
}
|
||||
skill_event(e: any) {
|
||||
// 技能加入队列
|
||||
const { uuid, startPos, targetPos, group, count = 1, cd = 0 } = e;
|
||||
this.skillQueue.push({
|
||||
uuid,
|
||||
startPos,
|
||||
targetPos,
|
||||
group,
|
||||
count,
|
||||
cd,
|
||||
cdTimer: 0 // 初始化计时器为0
|
||||
});
|
||||
}
|
||||
private processSkillQueue(dt: number) {
|
||||
// 遍历技能队列
|
||||
for (let i = this.skillQueue.length - 1; i >= 0; i--) {
|
||||
const skill = this.skillQueue[i];
|
||||
|
||||
// 累加计时器
|
||||
skill.cdTimer += dt;
|
||||
|
||||
// 检查CD (将cd从毫秒转换为秒进行比较)
|
||||
if (skill.cdTimer < skill.cd * 0.001) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 释放技能
|
||||
this.doSkill(
|
||||
skill.uuid,
|
||||
skill.startPos,
|
||||
skill.targetPos,
|
||||
skill.group
|
||||
);
|
||||
|
||||
// 重置CD计时器
|
||||
skill.cdTimer = 0;
|
||||
|
||||
// 减少技能次数
|
||||
skill.count--;
|
||||
|
||||
// 如果技能次数用完,从队列中移除
|
||||
if (skill.count <= 0) {
|
||||
this.skillQueue.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
private doSkill(uuid: number, start_pos: Vec3, target_pos: Vec3, group: number) {
|
||||
const skillEntity = ecs.getEntity<Skill>(Skill);
|
||||
skillEntity.load(
|
||||
start_pos, // 起始位置
|
||||
group, // 阵营
|
||||
this.node.parent, // 父节点
|
||||
uuid, // 技能ID
|
||||
target_pos, // 目标位置
|
||||
);
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
// 清空技能队列
|
||||
this.skillQueue = [];
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "bce99fa9-0a06-4f7b-b378-77a6aa2524b0",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import { MonModelComp } from "../hero/MonModelComp";
|
||||
import { Missions,} from "../common/config/MissionSet";
|
||||
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
import { VictoryComp } from "./VictoryComp";
|
||||
import { MSkillComp } from "./MSkillComp";
|
||||
import { CardControllerComp } from "./CardController";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
||||
@@ -31,8 +30,7 @@ export class MissionComp extends CCComp {
|
||||
mission_buff_type:number = 1 // 1 攻击 2 防御 3 HP
|
||||
m_mission_buff_type:number = 1 // 1 攻击 2 防御 3 HP
|
||||
mission_buff_up_exp:number = 99999999
|
||||
MSComp:MSkillComp=null
|
||||
MMSComp:MSkillComp=null
|
||||
|
||||
heros_node:any=null
|
||||
heros_node_pos:any=v3(0,0,0)
|
||||
herosc_node:any=null
|
||||
|
||||
Reference in New Issue
Block a user