清理 skills下的无效文件,有用的迁移到skill目录
This commit is contained in:
@@ -2,7 +2,7 @@ import { _decorator, CCBoolean, CCFloat, CCInteger, instantiate, Node, Prefab, v
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { getAttrs, RType, SkillSet } from "../common/config/SkillSet";
|
||||
import { RType, SkillSet } from "../common/config/SkillSet";
|
||||
import { AtkConCom } from "./AtkConCom";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
|
||||
|
||||
50
assets/script/game/skill/Tooltip.ts
Normal file
50
assets/script/game/skill/Tooltip.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { TooltipCom } from "./TooltipCom";
|
||||
import { instantiate, Node, Prefab, Vec3 ,tween, v3,animation,Label,resources,SpriteFrame,Sprite} from "cc";
|
||||
|
||||
/** Skill 模块 */
|
||||
@ecs.register(`Tooltip`)
|
||||
export class Tooltip extends ecs.Entity {
|
||||
/** ---------- 数据层 ---------- */
|
||||
// SkillModel!: SkillModelComp;
|
||||
|
||||
/** ---------- 业务层 ---------- */
|
||||
// SkillBll!: SkillBllComp;
|
||||
|
||||
/** ---------- 视图层 ---------- */
|
||||
TooltipView!: TooltipCom;
|
||||
|
||||
/** 实始添加的数据层组件 */
|
||||
protected init() {
|
||||
|
||||
}
|
||||
|
||||
/** 模块资源释放 */
|
||||
destroy() {
|
||||
// 注: 自定义释放逻辑,视图层实现 ecs.IComp 接口的 ecs 组件需要手动释放
|
||||
this.remove(TooltipCom);
|
||||
super.destroy();
|
||||
}
|
||||
load(pos: Vec3 = Vec3.ZERO,type:number=1,vaule:string="",s_uuid:number=1001,parent:any=null,cd:number=1) {
|
||||
|
||||
var path = "game/skill/buff/tooltip";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
node.parent = parent;
|
||||
if(parent.scale.x < 0){
|
||||
node.setScale(-node.scale.x, node.scale.y, 0);
|
||||
}
|
||||
node.setPosition(pos)
|
||||
var sv = node.getComponent(TooltipCom)!;
|
||||
// console.log("load tooltip type",type,vaule,s_uuid);
|
||||
sv.stype = type;
|
||||
sv.value = vaule;
|
||||
sv.s_uuid = s_uuid;
|
||||
sv.alive_time = 0.5;
|
||||
this.add(sv)
|
||||
}
|
||||
}
|
||||
9
assets/script/game/skill/Tooltip.ts.meta
Normal file
9
assets/script/game/skill/Tooltip.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "a5e3c618-6636-439e-aa36-d4ee97793b18",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
117
assets/script/game/skill/TooltipCom.ts
Normal file
117
assets/script/game/skill/TooltipCom.ts
Normal file
@@ -0,0 +1,117 @@
|
||||
import { _decorator,Collider2D ,Contact2DType,v3,IPhysics2DContact,Vec3, tween, Label,resources,SpriteFrame,Sprite} 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 { SkillSet } from "../common/config/SkillSet";
|
||||
import { TooltipTypes } from "../common/config/Mission";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('TooltipCom')
|
||||
@ecs.register('TooltipView', false)
|
||||
export class TooltipCom extends CCComp {
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
// start() {
|
||||
// // var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
// // this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||
// }
|
||||
stype:number = 1; // 1:减少生命值,2:增加生命值,3:技能图标
|
||||
value:string = "";
|
||||
s_uuid:number = 1001;
|
||||
alive_time:number = 0.3;
|
||||
skill_name_time=0.5;
|
||||
scale:number = 1;
|
||||
|
||||
start() {
|
||||
switch(this.stype){
|
||||
case TooltipTypes.life:
|
||||
this.node.setPosition(v3(this.node.position.x,this.node.position.y))
|
||||
this.node.setSiblingIndex(100);
|
||||
this.node.getChildByName("loss_life").getChildByName("hp").getComponent(Label).string = this.value;
|
||||
this.node.getChildByName("loss_life").active=true;
|
||||
this.scheduleOnce(()=>{
|
||||
this.ent.destroy()
|
||||
},0.5)
|
||||
break
|
||||
case TooltipTypes.health:
|
||||
this.node.setSiblingIndex(110);
|
||||
this.node.getChildByName("add_life").getChildByName("hp").getComponent(Label).string = this.value;
|
||||
this.node.getChildByName("add_life").active=true;
|
||||
this.scheduleOnce(()=>{
|
||||
this.ent.destroy()
|
||||
},0.5)
|
||||
break
|
||||
case TooltipTypes.crit:
|
||||
this.node.setPosition(v3(this.node.position.x,this.node.position.y))
|
||||
this.node.setSiblingIndex(200);
|
||||
this.node.getChildByName("bloss").getChildByName("hp").getComponent(Label).string = this.value;
|
||||
this.node.getChildByName("bloss").active=true;
|
||||
this.scheduleOnce(()=>{
|
||||
this.ent.destroy()
|
||||
},0.5)
|
||||
break
|
||||
case TooltipTypes.skill:
|
||||
this.node.getChildByName("skill").getChildByName("name").getComponent(Label).string = "<"+SkillSet[this.s_uuid].name+">";
|
||||
this.node.getChildByName("skill").active=true;
|
||||
this.node.setPosition(v3(this.node.position.x,this.node.position.y+30))
|
||||
this.scheduleOnce(()=>{
|
||||
this.ent.destroy()
|
||||
},0.5)
|
||||
break
|
||||
case TooltipTypes.uskill:
|
||||
this.node.getChildByName("uskill").getChildByName("name").getComponent(Label).string = this.value;
|
||||
this.node.getChildByName("uskill").active=true;
|
||||
this.node.setPosition(v3(this.node.position.x,this.node.position.y+30))
|
||||
this.scheduleOnce(()=>{
|
||||
this.ent.destroy()
|
||||
},0.5)
|
||||
break
|
||||
case TooltipTypes.lvup:
|
||||
// this.node.getChildByName("lvup").getChildByName("name").getComponent(Label).string = this.value;
|
||||
this.node.getChildByName("lvup").active=true;
|
||||
this.node.setPosition(v3(this.node.position.x,this.node.position.y-30))
|
||||
this.scheduleOnce(()=>{
|
||||
this.ent.destroy()
|
||||
},0.5)
|
||||
break
|
||||
case TooltipTypes.apup:
|
||||
this.node.getChildByName("apup").getChildByName("num").getComponent(Label).string = "+"+this.value;
|
||||
this.node.getChildByName("apup").active=true;
|
||||
this.node.setPosition(v3(this.node.position.x,this.node.position.y-60))
|
||||
this.scheduleOnce(()=>{
|
||||
this.ent.destroy()
|
||||
},0.5)
|
||||
break
|
||||
case TooltipTypes.hpup:
|
||||
this.node.getChildByName("hpup").getChildByName("num").getComponent(Label).string = "+"+this.value;
|
||||
this.node.getChildByName("hpup").active=true;
|
||||
this.node.setPosition(v3(this.node.position.x,this.node.position.y-60))
|
||||
this.scheduleOnce(()=>{
|
||||
this.ent.destroy()
|
||||
},0.5)
|
||||
}
|
||||
// console.log("TooltipView start:",this.node.getSiblingIndex());
|
||||
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
do_up(){
|
||||
tween(this.node).to(
|
||||
this.alive_time,
|
||||
{position:v3(this.node.position.x,this.node.position.y+60), },
|
||||
{
|
||||
onComplete:()=>{ this.ent.destroy()},
|
||||
easing:"linear"
|
||||
}
|
||||
).start()
|
||||
}
|
||||
to_destroy() {
|
||||
this.ent.destroy()
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
9
assets/script/game/skill/TooltipCom.ts.meta
Normal file
9
assets/script/game/skill/TooltipCom.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "49ffd76d-7069-4947-b170-62cd72619ede",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
18
assets/script/game/skill/oncend.ts
Normal file
18
assets/script/game/skill/oncend.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { _decorator, Component, Node ,Animation} from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('dead')
|
||||
export class dead extends Component {
|
||||
start() {
|
||||
let anim = this.node.getComponent(Animation);
|
||||
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
||||
}
|
||||
onAnimationFinished(){
|
||||
this.node.destroy();
|
||||
}
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
assets/script/game/skill/oncend.ts.meta
Normal file
9
assets/script/game/skill/oncend.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "0f3c4261-15b1-4eda-b105-a81249ee116f",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
25
assets/script/game/skill/timedCom.ts
Normal file
25
assets/script/game/skill/timedCom.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { SkillSet } from '../common/config/SkillSet';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('timedCom')
|
||||
export class timedCom extends Component {
|
||||
time = 0.3;
|
||||
cd: number = 0;
|
||||
ap: number = 0;
|
||||
|
||||
start() {
|
||||
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
this.time -= deltaTime;
|
||||
if(this.time <= 0)
|
||||
{
|
||||
this.node.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
assets/script/game/skill/timedCom.ts.meta
Normal file
9
assets/script/game/skill/timedCom.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "f140b15c-7345-4364-818e-787001fb1c19",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user