Commit b659e3a4 authored by Tt's avatar Tt

游戏基础调整

parent 79617c0a
......@@ -7199,7 +7199,7 @@
"__id__": 156
}
],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 158
......@@ -7379,13 +7379,13 @@
},
{
"__type__": "cc.Node",
"_name": "Comeon",
"_name": "ani_comeon",
"_objFlags": 0,
"_parent": {
"__id__": 146
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 151
......@@ -7481,13 +7481,13 @@
},
{
"__type__": "cc.Node",
"_name": "Excellent",
"_name": "ani_excellent",
"_objFlags": 0,
"_parent": {
"__id__": 146
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 153
......@@ -7583,13 +7583,13 @@
},
{
"__type__": "cc.Node",
"_name": "Nice",
"_name": "ani_nice",
"_objFlags": 0,
"_parent": {
"__id__": 146
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 155
......@@ -7685,13 +7685,13 @@
},
{
"__type__": "cc.Node",
"_name": "Tryagain",
"_name": "ani_tryagain",
"_objFlags": 0,
"_parent": {
"__id__": 146
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 157
......@@ -7721,7 +7721,7 @@
"ctor": "Float64Array",
"array": [
0,
-254,
-225.221,
0,
0,
0,
......@@ -7759,7 +7759,7 @@
}
],
"_armatureName": "armatureName",
"_animationName": "",
"_animationName": "结算",
"_preCacheMode": 0,
"_cacheMode": 0,
"playTimes": -1,
......@@ -7778,7 +7778,7 @@
"__uuid__": "94fe694d-23eb-4878-911f-699e779e09f8"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 0,
"_N$_animationIndex": 1,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
......@@ -9689,7 +9689,6 @@
"btn_audio_on": {
"__id__": 94
},
"bg_countdown": null,
"layout_card": {
"__id__": 97
},
......
This diff is collapsed.
......@@ -619,6 +619,38 @@ let pg = {
return skl;
},
/**
* 为DragonBones动画添加一次性的动画完成回调事件,回调触发一次后自动移除
* @param {cc.Node|cc.Component} item - 包含DragonBones组件的节点或组件
* @returns {dragonBones.ArmatureDisplay} DragonBones骨骼组件
*/
addDBAnimationCallbackOnce(item, callback) {
if (!item || !cc.isValid(item)) return pg.logger.w("添加一次性动画回调失败,传入了错误的item");
if (!callback) return pg.logger.w("添加一次性动画回调失败,未传入回调函数");
let node = item.node ? item.node : item;
if (!cc.isValid(node)) return pg.logger.w("节点已销毁");
let skl: dragonBones.ArmatureDisplay = node.getComponent(dragonBones.ArmatureDisplay);
if (!skl) return pg.logger.w("节点上没有DragonBones组件");
// 创建一个包装回调,在执行原始回调后自动移除监听器
const onceCallback = (event) => {
// 先移除监听器,防止回调中可能的异常导致监听器未被移除
skl.removeEventListener(dragonBones.EventObject.COMPLETE);
// 执行原始回调
callback(event);
};
// 移除之前可能存在的监听器,避免重复添加
skl.removeEventListener(dragonBones.EventObject.COMPLETE, onceCallback);
// 添加一次性动画完成事件监听
skl.addEventListener(dragonBones.EventObject.COMPLETE, onceCallback);
return skl;
},
/**
* 设置DragonBones动画的播放速度
* @param {cc.Node|cc.Component} item - 包含DragonBones组件的节点或组件
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment