属性弹窗++

This commit is contained in:
2025-06-26 10:49:08 +08:00
parent 862777a9c7
commit d31c495a54
7 changed files with 13616 additions and 3918 deletions

View File

@@ -0,0 +1,102 @@
import { EventHandler, EventTouch, _decorator } from "cc";
import { ButtonTouchLong } from "../../../../extensions/oops-plugin-framework/assets/libs/gui/button/ButtonTouchLong";
const { ccclass, property, menu } = _decorator;
/**
* 增强版长按按钮组件
* 支持长按触发和放开后触发两种事件
*/
@ccclass("EnhancedButtonTouchLong")
@menu('ui/button/EnhancedButtonTouchLong')
export class EnhancedButtonTouchLong extends ButtonTouchLong {
@property({
type: [EventHandler],
tooltip: "放开后触发的事件"
})
releaseEvents: EventHandler[] = [];
@property({
tooltip: "是否在长按后放开时触发事件"
})
triggerOnRelease: boolean = true;
@property({
tooltip: "是否在短按时也触发放开事件"
})
triggerOnShortPress: boolean = false;
private _wasLongPressed: boolean = false;
private _hasTriggeredRelease: boolean = false;
onLoad() {
super.onLoad();
this._wasLongPressed = false;
this._hasTriggeredRelease = false;
}
/** 触摸开始 */
onTouchtStart(event: EventTouch) {
this._wasLongPressed = false;
this._hasTriggeredRelease = false;
super.onTouchtStart(event);
}
/** 触摸结束 */
onTouchEnd(event: EventTouch) {
// 检查是否已经长按过
if (this._passTime > this.time) {
this._wasLongPressed = true;
}
// 触发放开事件
if (this.triggerOnRelease && !this._hasTriggeredRelease) {
if (this._wasLongPressed || this.triggerOnShortPress) {
this._hasTriggeredRelease = true;
this.onReleaseTrigger();
}
}
super.onTouchEnd(event);
}
/** 引擎更新事件 */
update(dt: number) {
super.update(dt);
// 在父类的update中如果触发了长按事件标记为已长按
if (this._passTime >= this.time && !this._isTouchLong) {
this._wasLongPressed = true;
}
}
/**
* 放开触发回调
*/
protected onReleaseTrigger() {
// 发送自定义事件
this.node.emit('releaseTrigger', this);
// 触发配置的事件
this.releaseEvents.forEach(event => {
event.emit([event.customEventData]);
});
console.log('放开触发!');
}
/**
* 获取是否已经长按过
*/
wasLongPressed(): boolean {
return this._wasLongPressed;
}
/**
* 获取当前按住时间
*/
getPassTime(): number {
return this._passTime;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "caba3955-8e72-4e90-8666-0d0ee57797d9",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -55,6 +55,10 @@ export class SingletonModuleComp extends ecs.Comp {
dod:99,
dod_no:false,
crit_no:false,
wind:0,
thorns:0,
lifesteal:0,
},
friend:{
hp:0,
@@ -72,6 +76,9 @@ export class SingletonModuleComp extends ecs.Comp {
dod:99,
dod_no:false,
crit_no:false,
wind:0,
thorns:0,
lifesteal:0,
},
boss:{
hp:0,
@@ -89,6 +96,9 @@ export class SingletonModuleComp extends ecs.Comp {
dod:99,
dod_no:false,
crit_no:false,
wind:0,
thorns:0,
lifesteal:0,
},
};
vmAdd() {

View File

@@ -52,16 +52,16 @@ export const MissionStatus = {
end:4,
}
export enum FightSet {
FRIEND_WAVE_UP=2, //伙伴登场波次
FRIEND_WAVE_UP=3, //伙伴登场波次
BOSS_WAVE_UP_1=3, //boss登场波次
BOSS_WAVE_UP_2=5, //boss登场波次
BOSS_WAVE_UP_3=7, //boss登场波次
EQUIP_WAVE_UP_1=4, //装备登场波次
EQUIP_WAVE_UP_2=6, //装备登场波次
EQUIP_WAVE_UP_3=8, //装备登场波次
SKILL_WAVE_UP_1=1, //技能登场波次
SKILL_WAVE_UP_2=3, //技能登场波次
SKILL_WAVE_UP_3=5, //技能登场波次
SKILL_WAVE_UP_1=2, //技能登场波次
SKILL_WAVE_UP_2=5, //技能登场波次
SKILL_WAVE_UP_3=7, //技能登场波次
MON_WAVE_TIME=10,//怪物波次时间
FRIEND_LIVE_CD=10,//伙伴复活时间
ATK_ADD_FRIEND_COUNT=4,//伙伴攻击力增加