提速了下
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.1.50",
|
|
||||||
"importer": "prefab",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "eab34733-3779-4103-81f1-b0452ebeca7a",
|
|
||||||
"files": [
|
|
||||||
".json"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"syncNodeName": "heroinfo"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -37,6 +37,7 @@ export class BuffComp extends Component {
|
|||||||
speek_time:number=0;
|
speek_time:number=0;
|
||||||
HeroView:HeroViewComp=null!
|
HeroView:HeroViewComp=null!
|
||||||
FIGHTCON:FightConComp=null!
|
FIGHTCON:FightConComp=null!
|
||||||
|
hp_bar:any=null
|
||||||
protected onLoad(): void {
|
protected onLoad(): void {
|
||||||
oops.message.on(GameEvent.UpdateVMData,this.to_update_vmdata,this)
|
oops.message.on(GameEvent.UpdateVMData,this.to_update_vmdata,this)
|
||||||
}
|
}
|
||||||
@@ -50,6 +51,7 @@ export class BuffComp extends Component {
|
|||||||
this.top_node = this.node.getChildByName("top");
|
this.top_node = this.node.getChildByName("top");
|
||||||
let hp_y=this.node.getComponent(UITransform).height+20
|
let hp_y=this.node.getComponent(UITransform).height+20
|
||||||
this.top_node.setPosition(0,hp_y,0)
|
this.top_node.setPosition(0,hp_y,0)
|
||||||
|
this.hp_bar=this.top_node.getChildByName("hp").getComponent(ProgressBar)
|
||||||
// this.top_node.getChildByName("hp").active=(this.node.getComponent(HeroViewComp).fac == 1 ? true : false)
|
// this.top_node.getChildByName("hp").active=(this.node.getComponent(HeroViewComp).fac == 1 ? true : false)
|
||||||
|
|
||||||
this.vmdata_update()
|
this.vmdata_update()
|
||||||
@@ -70,7 +72,7 @@ export class BuffComp extends Component {
|
|||||||
if(this.buff_cd <= 0 && this.node.getChildByName("buff").active){
|
if(this.buff_cd <= 0 && this.node.getChildByName("buff").active){
|
||||||
this.node.getChildByName("buff").active = false;
|
this.node.getChildByName("buff").active = false;
|
||||||
}
|
}
|
||||||
this.in_speek(deltaTime)
|
// this.in_speek(deltaTime)
|
||||||
// this.vmdata_update()
|
// this.vmdata_update()
|
||||||
}
|
}
|
||||||
hp_show(){
|
hp_show(){
|
||||||
@@ -78,7 +80,7 @@ export class BuffComp extends Component {
|
|||||||
let hp=this.HeroView.hp;
|
let hp=this.HeroView.hp;
|
||||||
let hp_max=this.HeroView.hp_max;
|
let hp_max=this.HeroView.hp_max;
|
||||||
let hp_progress= hp/hp_max;
|
let hp_progress= hp/hp_max;
|
||||||
this.top_node.getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
this.hp_bar.progress = hp_progress;
|
||||||
if(this.HeroView.is_boss) return
|
if(this.HeroView.is_boss) return
|
||||||
this.top_node.getChildByName("hp").active = (hp == hp_max) ? false : true;
|
this.top_node.getChildByName("hp").active = (hp == hp_max) ? false : true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,11 @@ export default class HeroAnmComp extends Component{
|
|||||||
this.anm?.play('move')
|
this.anm?.play('move')
|
||||||
}else{
|
}else{
|
||||||
this.spine?.setToSetupPose();
|
this.spine?.setToSetupPose();
|
||||||
|
if(this.node.parent.getComponent(HeroViewComp).fac==FacSet.HERO){
|
||||||
this.spine?.setAnimation(0, 'Idle', true);
|
this.spine?.setAnimation(0, 'Idle', true);
|
||||||
|
}else{
|
||||||
|
this.spine?.setAnimation(0, 'move', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
import { _decorator, Label, resources, Sprite, SpriteAtlas } 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 { HeroModelComp } from "./HeroModelComp";
|
|
||||||
import { HeroViewComp } from "./HeroViewComp";
|
|
||||||
import { HeroInfo, HeroPos } from "../common/config/heroSet";
|
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
/** 视图层对象 */
|
|
||||||
@ccclass('HeroInfoCompComp')
|
|
||||||
@ecs.register('HeroInfoComp', false)
|
|
||||||
export class HeroInfoCompComp extends CCComp {
|
|
||||||
@property
|
|
||||||
c_id:number=0
|
|
||||||
@property
|
|
||||||
is_Change:boolean=false
|
|
||||||
|
|
||||||
has_hero:boolean=false
|
|
||||||
/** 视图层逻辑代码分离演示 */
|
|
||||||
start() {
|
|
||||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
|
||||||
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
|
||||||
this.init()
|
|
||||||
}
|
|
||||||
init(){
|
|
||||||
this.has_hero=false
|
|
||||||
}
|
|
||||||
update(dt: number): void {
|
|
||||||
if(!smc.mission.play) return
|
|
||||||
this.update_info()
|
|
||||||
}
|
|
||||||
update_info(){
|
|
||||||
let heros=ecs.query(ecs.allOf(HeroModelComp))
|
|
||||||
this.has_hero=false
|
|
||||||
this.node.getChildByName("info").getChildByName("ap").getChildByName("num").getComponent(Label).string=""
|
|
||||||
this.node.getChildByName("info").getChildByName("hp").getChildByName("num").getComponent(Label).string=""
|
|
||||||
this.node.getChildByName("name").getComponent(Label).string="无英雄"
|
|
||||||
const sprite = this.node.getChildByName("mask").getChildByName("icon").getComponent(Sprite);
|
|
||||||
// sprite.spriteFrame = //需要添加默认头像
|
|
||||||
for(let hero of heros){
|
|
||||||
let info=hero.get(HeroViewComp)
|
|
||||||
if(info.node.position.x==HeroPos[this.c_id].pos.x){
|
|
||||||
this.has_hero=true
|
|
||||||
this.node.getChildByName("info").getChildByName("ap").getChildByName("num").getComponent(Label).string=info.ap.toString()
|
|
||||||
this.node.getChildByName("info").getChildByName("hp").getChildByName("num").getComponent(Label).string=info.hp.toString()
|
|
||||||
this.node.getChildByName("name").getComponent(Label).string=HeroInfo[info.hero_uuid].name
|
|
||||||
var icon_path = "game/heros/herois"
|
|
||||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
|
||||||
const sprite = this.node.getChildByName("mask").getChildByName("icon").getComponent(Sprite);
|
|
||||||
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[info.hero_uuid].path);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if(this.is_Change){
|
|
||||||
// this.node.getChildByName("change").active=this.has_hero
|
|
||||||
// this.node.getChildByName("select").active=!this.has_hero
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
/** 全局消息逻辑处理 */
|
|
||||||
// private onHandler(event: string, args: any) {
|
|
||||||
// switch (event) {
|
|
||||||
// case ModuleEvent.Cmd:
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
|
||||||
reset() {
|
|
||||||
this.node.destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "e8cba331-88b0-4b08-9756-374a422d3c28",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
@@ -17,12 +17,18 @@ export class EquipSkillComp extends CCComp {
|
|||||||
skill2:any=null
|
skill2:any=null
|
||||||
skill3:any=null
|
skill3:any=null
|
||||||
boxs:Node=null
|
boxs:Node=null
|
||||||
|
skill1_cd_bar_progress:any=null
|
||||||
|
skill2_cd_bar_progress:any=null
|
||||||
|
skill3_cd_bar_progress:any=null
|
||||||
/** 视图层逻辑代码分离演示 */
|
/** 视图层逻辑代码分离演示 */
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.on(GameEvent.UseSkillCard, this.get_skill, this);
|
this.on(GameEvent.UseSkillCard, this.get_skill, this);
|
||||||
this.on(GameEvent.FightReady,this.fight_ready,this)
|
this.on(GameEvent.FightReady,this.fight_ready,this)
|
||||||
this.on(GameEvent.SKILL_STONE_UP,this.skill_stone_up,this)
|
this.on(GameEvent.SKILL_STONE_UP,this.skill_stone_up,this)
|
||||||
this.boxs=this.node.getChildByName("boxs")
|
this.boxs=this.node.getChildByName("boxs")
|
||||||
|
this.skill1_cd_bar_progress=this.boxs.getChildByName("skill1").getChildByName("icon").getChildByName("cd").getComponent(ProgressBar)
|
||||||
|
this.skill2_cd_bar_progress=this.boxs.getChildByName("skill2").getChildByName("icon").getChildByName("cd").getComponent(ProgressBar)
|
||||||
|
this.skill3_cd_bar_progress=this.boxs.getChildByName("skill3").getChildByName("icon").getChildByName("cd").getComponent(ProgressBar)
|
||||||
}
|
}
|
||||||
start(){
|
start(){
|
||||||
this.fight_ready()
|
this.fight_ready()
|
||||||
@@ -79,7 +85,6 @@ export class EquipSkillComp extends CCComp {
|
|||||||
update(dt: number): void {
|
update(dt: number): void {
|
||||||
if(!smc.mission.play||smc.mission.pause) return
|
if(!smc.mission.play||smc.mission.pause) return
|
||||||
if(this.skill1.uuid!=0){
|
if(this.skill1.uuid!=0){
|
||||||
let cd_bar=this.boxs.getChildByName("skill1").getChildByName("icon").getChildByName("cd")
|
|
||||||
let cd=this.skill1.cd*(100-smc.vmdata.hero.skill_cd_buff)/100
|
let cd=this.skill1.cd*(100-smc.vmdata.hero.skill_cd_buff)/100
|
||||||
if(this.skill1.cd_time < cd){
|
if(this.skill1.cd_time < cd){
|
||||||
this.skill1.cd_time+=dt
|
this.skill1.cd_time+=dt
|
||||||
@@ -88,10 +93,9 @@ export class EquipSkillComp extends CCComp {
|
|||||||
this.do_skill1()
|
this.do_skill1()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cd_bar.getComponent(ProgressBar).progress=(1-this.skill1.cd_time/cd)
|
this.skill1_cd_bar_progress.progress=(1-this.skill1.cd_time/cd)
|
||||||
}
|
}
|
||||||
if(this.skill2.uuid!=0){
|
if(this.skill2.uuid!=0){
|
||||||
let cd_bar=this.boxs.getChildByName("skill2").getChildByName("icon").getChildByName("cd")
|
|
||||||
let cd=this.skill2.cd*(100-smc.vmdata.hero.skill_cd_buff)/100
|
let cd=this.skill2.cd*(100-smc.vmdata.hero.skill_cd_buff)/100
|
||||||
if(this.skill2.cd_time < cd){
|
if(this.skill2.cd_time < cd){
|
||||||
this.skill2.cd_time+=dt
|
this.skill2.cd_time+=dt
|
||||||
@@ -100,10 +104,9 @@ export class EquipSkillComp extends CCComp {
|
|||||||
this.do_skill2()
|
this.do_skill2()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cd_bar.getComponent(ProgressBar).progress=(1-this.skill2.cd_time/cd)
|
this.skill2_cd_bar_progress.progress=(1-this.skill2.cd_time/cd)
|
||||||
}
|
}
|
||||||
if(this.skill3.uuid!=0){
|
if(this.skill3.uuid!=0){
|
||||||
let cd_bar=this.boxs.getChildByName("skill3").getChildByName("icon").getChildByName("cd")
|
|
||||||
let cd=this.skill3.cd*(100-smc.vmdata.hero.skill_cd_buff)/100
|
let cd=this.skill3.cd*(100-smc.vmdata.hero.skill_cd_buff)/100
|
||||||
if(this.skill3.cd_time < cd){
|
if(this.skill3.cd_time < cd){
|
||||||
this.skill3.cd_time+=dt
|
this.skill3.cd_time+=dt
|
||||||
@@ -112,7 +115,7 @@ export class EquipSkillComp extends CCComp {
|
|||||||
// this.do_skill3()
|
// this.do_skill3()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cd_bar.getComponent(ProgressBar).progress=(1-this.skill3.cd_time/cd)
|
this.skill3_cd_bar_progress.progress=(1-this.skill3.cd_time/cd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
do_skill1(){
|
do_skill1(){
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export class SkillCom extends CCComp {
|
|||||||
}
|
}
|
||||||
oops.message.on(GameEvent.MissionEnd, this.doDestroy, this);
|
oops.message.on(GameEvent.MissionEnd, this.doDestroy, this);
|
||||||
this.node.active = true;
|
this.node.active = true;
|
||||||
// //console.log("[SkillCom]:caster",this.caster)
|
//console.log("[SkillCom]:caster",this.caster)
|
||||||
|
|
||||||
|
|
||||||
let collider = this.getComponent(Collider2D);
|
let collider = this.getComponent(Collider2D);
|
||||||
@@ -124,15 +124,15 @@ export class SkillCom extends CCComp {
|
|||||||
this.node.setPosition(this.targetPos.x,this.targetPos.y,0)
|
this.node.setPosition(this.targetPos.x,this.targetPos.y,0)
|
||||||
if(this.node.getComponent(Animation)){
|
if(this.node.getComponent(Animation)){
|
||||||
let anim = this.node.getComponent(Animation);
|
let anim = this.node.getComponent(Animation);
|
||||||
// //console.log("[SkillCom]:has anim",anim)
|
//console.log("[SkillCom]:has anim",anim)
|
||||||
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
||||||
}
|
}
|
||||||
if(this.node.getChildByName('anm')){
|
if(this.node.getChildByName('anm')){
|
||||||
if(this.node.getChildByName('anm').getComponent('sp.Skeleton')){
|
if(this.node.getChildByName('anm').getComponent('sp.Skeleton')){
|
||||||
// //console.log("[SkillCom]:has spine",this.spine)
|
//console.log("[SkillCom]:has spine",this.spine)
|
||||||
this.spine.setCompleteListener((trackEntry) => {
|
this.spine.setCompleteListener((trackEntry) => {
|
||||||
this.onAnimationFinished()
|
this.onAnimationFinished()
|
||||||
// //console.log("[SkillCom]:[track %s][animation %s] complete: %s", trackEntry.trackIndex);
|
//console.log("[SkillCom]:[track %s][animation %s] complete: %s", trackEntry.trackIndex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ export class SkillCom extends CCComp {
|
|||||||
}
|
}
|
||||||
//范围伤害
|
//范围伤害
|
||||||
range_damage(){
|
range_damage(){
|
||||||
console.log("[SkillCom]:range_damage",this.s_uuid)
|
// console.log("[SkillCom]:range_damage",this.s_uuid)
|
||||||
let enemys=ecs.query(ecs.allOf(MonModelComp))
|
let enemys=ecs.query(ecs.allOf(MonModelComp))
|
||||||
if(this.fac==FacSet.MON) enemys=ecs.query(ecs.allOf(HeroModelComp))
|
if(this.fac==FacSet.MON) enemys=ecs.query(ecs.allOf(HeroModelComp))
|
||||||
enemys.forEach(entity => {
|
enemys.forEach(entity => {
|
||||||
|
|||||||
Reference in New Issue
Block a user