技能cd完成
This commit is contained in:
@@ -1,63 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"__type__": "cc.Prefab",
|
|
||||||
"_name": "mskill",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_native": "",
|
|
||||||
"data": {
|
|
||||||
"__id__": 1
|
|
||||||
},
|
|
||||||
"optimizationPolicy": 0,
|
|
||||||
"asyncLoadAssets": false,
|
|
||||||
"persistent": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Node",
|
|
||||||
"_name": "mskill",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_parent": null,
|
|
||||||
"_children": [],
|
|
||||||
"_active": true,
|
|
||||||
"_components": [],
|
|
||||||
"_prefab": {
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
"_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
|
|
||||||
},
|
|
||||||
"_layer": 1073741824,
|
|
||||||
"_euler": {
|
|
||||||
"__type__": "cc.Vec3",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0
|
|
||||||
},
|
|
||||||
"_id": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.PrefabInfo",
|
|
||||||
"root": {
|
|
||||||
"__id__": 1
|
|
||||||
},
|
|
||||||
"asset": {
|
|
||||||
"__id__": 0
|
|
||||||
},
|
|
||||||
"fileId": "c46/YsCPVOJYA4mWEpNYRx"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.1.50",
|
|
||||||
"importer": "prefab",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "620e1d42-ec6f-43e1-8c65-5c7711e763f6",
|
|
||||||
"files": [
|
|
||||||
".json"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"syncNodeName": "mskill"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
import { _decorator, resources, Sprite, SpriteAtlas } from "cc";
|
import { _decorator, Label, ProgressBar, resources, Sprite, SpriteAtlas } from "cc";
|
||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||||
import { SkillSet } from "../common/config/SkillSet";
|
import { SkillSet } from "../common/config/SkillSet";
|
||||||
@@ -15,14 +15,17 @@ export class MSkillComp extends CCComp {
|
|||||||
group: number = 0;
|
group: number = 0;
|
||||||
lv:number = 0;
|
lv:number = 0;
|
||||||
skill_on:boolean = false;
|
skill_on:boolean = false;
|
||||||
|
cd:number = 0;
|
||||||
/** 视图层逻辑代码分离演示 */
|
/** 视图层逻辑代码分离演示 */
|
||||||
start() {
|
start() {
|
||||||
console.log("MSkillComp start s_uuid:",this.s_uuid,this.group);
|
console.log("MSkillComp start s_uuid:",this.s_uuid,this.group);
|
||||||
}
|
}
|
||||||
init(){
|
init(){
|
||||||
|
this.lv=0
|
||||||
console.log("MSkillComp init s_uuid:",this.s_uuid,this.group);
|
console.log("MSkillComp init s_uuid:",this.s_uuid,this.group);
|
||||||
|
this.node.getChildByName("lv").getComponent(Label).string=this.lv.toString()
|
||||||
if(SkillSet[this.s_uuid]==undefined){this.skill_on=false; return}
|
if(SkillSet[this.s_uuid]==undefined){this.skill_on=false; return}
|
||||||
|
this.cd=SkillSet[this.s_uuid].cd;
|
||||||
this.s_uuid=smc.mission.mskill
|
this.s_uuid=smc.mission.mskill
|
||||||
smc.vmdata.mission.exp_max=SkillSet[this.s_uuid].exp
|
smc.vmdata.mission.exp_max=SkillSet[this.s_uuid].exp
|
||||||
|
|
||||||
@@ -42,7 +45,17 @@ export class MSkillComp extends CCComp {
|
|||||||
protected update(dt: number): void {
|
protected update(dt: number): void {
|
||||||
if(!this.skill_on) return
|
if(!this.skill_on) return
|
||||||
this.check_exp()
|
this.check_exp()
|
||||||
|
this.doing_cd(dt)
|
||||||
}
|
}
|
||||||
|
doing_cd(dt: number){
|
||||||
|
this.cd-=dt
|
||||||
|
this.node.getChildByName("cd").getComponent(ProgressBar).progress=this.cd/SkillSet[this.s_uuid].cd
|
||||||
|
if(this.cd<=0){
|
||||||
|
console.log("cd<=0")
|
||||||
|
this.cd=SkillSet[this.s_uuid].cd
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
check_exp(){
|
check_exp(){
|
||||||
switch(this.group){
|
switch(this.group){
|
||||||
case BoxSet.HERO:
|
case BoxSet.HERO:
|
||||||
@@ -61,7 +74,8 @@ export class MSkillComp extends CCComp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
lvup(){
|
lvup(){
|
||||||
console.log("MSkillComp lvup s_uuid:",this.s_uuid,this.group);
|
this.lv++
|
||||||
|
this.node.getChildByName("lv").getComponent(Label).string=this.lv.toString()
|
||||||
}
|
}
|
||||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||||
reset() {
|
reset() {
|
||||||
|
|||||||
Reference in New Issue
Block a user