Files
fc/dev/project/library/imports/d4/d438fda5-1103-45ab-915a-d3be1a599e6d.js
T
2026-05-24 10:21:26 +08:00

254 lines
8.3 KiB
JavaScript

"use strict";
cc._RF.push(module, 'd438f2lEQNFq5Fa074aWZ5t', 'battle_effect');
// Scripts/mod/battle/act/battle_effect.js
// // --------------------------------------------------------------------
// // @author: shiraho@syg.com(必填, 创建模块的人员)
// // @description:
// // 战斗特效单位
// // <br/>Create: new Date().toISOString()
// // --------------------------------------------------------------------
// const BridgeClass = require( "bridge.class" );
// var BattleRolePool = require("battle_role_pool");
// var PathTool = require("pathtool")
// var BattleEffect = cc.Class({
// extends: BridgeClass,
// properties: {
// },
// ctor: function () {
// this.initConfig()
// },
// initConfig:function(){
// this.effect = null; // 特效单位
// // this.skelon_cache = {}; // 动画缓存
// this.effect_active = true;
// this.action_call_list = {}; // 制动动作回调
// this.model = require("battle_controller").getInstance().getModel();
// },
// /**
// * 创建特效
// * @param {*} parent 特效父节点
// * @param {*} scene_pos 场景位置,像素坐标不是格子
// * @param {*} reverse 是否反转
// * @param {*} res_id 特效id
// */
// createEffect:function(parent, scene_pos, reverse, res_id, eftScale){
// this.parent = parent;
// this.scene_pos = scene_pos;
// this.reverse = reverse || 1;
// this.res_id = res_id;
// if(eftScale){
// this.skeleton_time_scale = eftScale;
// }
// this.createEffectWnd()
// },
// // 创建特效具体
// createEffectWnd:function(effect){
// if (effect == null){
// effect = new cc.Node();
// effect.setAnchorPoint(0.5, 0.5);
// effect.addComponent(sp.Skeleton);
// }
// this.effect = effect;
// this.effect.scaleX = this.reverse;
// this.effect.angle = 0;
// this.effect.opacity = 255;
// if (this.parent){
// this.parent.addChild(this.effect);
// }
// this.skeleton = this.effect.getComponent(sp.Skeleton);
// this.skeleton.skeletonData = null;
// // 设置位置
// this.effect.setPosition(this.scene_pos.x, this.scene_pos.y);
// // 设置当前的模型速率
// if (this.skeleton_time_scale) {
// this.skeleton.timeScale = this.skeleton_time_scale;
// this.skeleton_time_scale = null;
// } else {
// var timeScale = this.model.getTimeScale();
// this.skeleton.timeScale = timeScale;
// }
// this.resetInitStatus();
// this.registerEvent();
// },
// // 设置特效位置
// resetScenePos:function(scene_pos){
// this.scene_pos = scene_pos;
// if(this.effect){
// this.effect.setPosition(this.scene_pos.x, this.scene_pos.y);
// }
// },
// // 特效反转
// resetReverse:function(reverse){
// this.reverse = reverse;
// if(this.effect){
// this.effect.scaleX = this.reverse;
// }
// },
// // 添加对象
// registerEvent:function(){
// this.skeleton.setCompleteListener((function (trackEntry, loopCount) {
// var animationName = trackEntry.animation ? trackEntry.animation.name : "";
// if (this.over_func) {
// this.over_func(animationName);
// // 清掉动作事件
// this.over_func = null;
// this.event_func = null;
// // 单循环特效,可以直接清掉,这里可能会有问题,暂时这样处理
// this.play_action_name = ""
// }
// }).bind(this))
// this.skeleton.setEventListener((function (trackEntry, event) {
// if (this.event_func){
// this.event_func(event.data.name)
// }
// }).bind(this))
// },
// // 设置动作伴随事件和动作结束事件回调
// setAnimationActionFunc: function (event_func, over_func) {
// this.event_func = event_func;
// this.over_func = over_func;
// },
// // 播放动作
// playActionOnce:function(action_name, res_name, is_loop){
// res_name = res_name ||"action";
// if(is_loop == null){
// is_loop = true;
// }
// this.effect_play_key = Utils.getNorKey(this.res_id, action_name); //储存一下当前特效资源和动作
// this.effect.name = this.effect_play_key;
// var target_key = Utils.getNorKey(this.res_id, res_name);
// var skeleton_path = PathTool.getSpinePath(this.res_id, res_name,false);
// this.skeleton.skeletonData = null;
// if (this.play_action_res == this.res_id) {
// nx.res.loadRes(skeleton_path,sp.SkeletonData,(_e,res)=>{
// if(res && this.effect && this.skeleton){
// this.skeleton.setToSetupPose();
// this.skeleton.skeletonData = res;
// this.skeleton.setAnimation(0, action_name, is_loop);
// }
// });
// return;
// }
// nx.res.loadRes(skeleton_path,sp.SkeletonData,(_e,_p)=>{
// if( _e ) {
// return;
// }
// // 资源绑定
// // nx.assets.cacheAsset( _p, skeleton_path );
// if(this.effect && this.skeleton){
// this.skeleton.setToSetupPose();
// this.skeleton.skeletonData = _p;
// this.skeleton.setAnimation(0, action_name, is_loop);
// }
// // nx.assets.uncacheAsset( this.spSkeleton );
// this.spSkeleton = _p;
// this.play_action_res = this.res_id;
// });
// },
// getEffectKey:function(){
// return this.effect_play_key || "";
// },
// // 当前深度值
// setLocalZOrder: function (zIndex) {
// if (this.effect) {
// this.effect.zIndex = zIndex;
// }
// },
// // 战斗动作播报
// runAction: function (action) {
// if (this.effect) {
// this.effect.stopAllActions();
// this.effect.runAction(action);
// }
// },
// // 挂接到战斗单位身上的特效,当引用次数为0的时候,不需要移除掉,只要不可见,退出单位统一移除
// setActiveEffect:function(status){
// // if (this.effect_active == status){
// // return;
// // }
// this.effect_active = status;
// if(this.effect){
// this.effect.active = status;
// this.effect.opacity = status?255:0;
// if(!status){
// this.resetInitStatus();
// }
// }
// // if(status){
// // this.parent.addChild(this.effect);
// // }else{
// // this.effect.removeFromParent();
// // }
// },
// // 初始化众泰
// resetInitStatus:function(){
// if (this.skeleton) {
// this.skeleton.setToSetupPose();
// this.skeleton.clearTracks();
// }
// },
// // 子弹需要旋转角度
// setRotation:function(degree){
// if(this.effect){
// this.effect.angle = degree
// }
// },
// // 设置特效的播放速率
// setTimeScale:function(speed){
// if (this.skeleton == null || this.skeleton.skeletonData == null) {
// this.skeleton_time_scale = speed;
// } else {
// if (this.skeleton_timeScale == speed) return;
// this.skeleton_timeScale = speed;
// this.skeleton.timeScale = speed;
// }
// },
// deleEffect:function(){
// this.effect.opacity = 0;
// this.effect.stopAllActions();
// if(this.skeleton.skeletonData){
// this.skeleton.skeletonData = null;
// }
// // 资源释放
// this.spSkeleton = null;
// // if( this.spSkeleton ) {
// // nx.assets.uncacheAsset( this.spSkeleton );
// // this.spSkeleton = null;
// // }
// this.effect.removeFromParent();
// this.effect.destroy();
// }
// });
"use strict";
cc._RF.pop();