mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-06-07 18:52:23 +08:00
Merge branch 'master' of https://gitee.com/dgflash/oops-plugin-framework
This commit is contained in:
@@ -103,7 +103,7 @@ export class LayerManager {
|
||||
|
||||
let finalW: number = 0;
|
||||
let finalH: number = 0;
|
||||
|
||||
|
||||
if (windowAspectRatio > designAspectRatio) {
|
||||
finalH = drs.height;
|
||||
finalW = finalH * ws.width / ws.height;
|
||||
@@ -256,8 +256,13 @@ export class LayerManager {
|
||||
* @param uiArgs 新打开场景参数
|
||||
*/
|
||||
replace(removeUiId: number, openUiId: number, uiArgs: any = null) {
|
||||
this.open(openUiId, uiArgs);
|
||||
this.remove(removeUiId);
|
||||
const callbacks: UICallbacks = {
|
||||
onAdded: (node: Node, params: any) => {
|
||||
this.remove(removeUiId);
|
||||
}
|
||||
};
|
||||
this.open(openUiId, uiArgs, callbacks);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@ export default class ButtonSimple extends Component {
|
||||
type: AudioClip
|
||||
})
|
||||
private effect: AudioClip = null!;
|
||||
private effectIds: number[] = [];
|
||||
// private effectIds: number[] = [];
|
||||
private touchCount = 0;
|
||||
private touchtEndTime = 0;
|
||||
|
||||
@@ -57,10 +57,11 @@ export default class ButtonSimple extends Component {
|
||||
/** 短按触摸音效 */
|
||||
protected async playEffect() {
|
||||
if (this.effect) {
|
||||
const effectId = await oops.audio.playEffect(this.effect, resLoader.defaultBundleName, () => {
|
||||
this.effectIds.remove(effectId);
|
||||
});
|
||||
if (effectId > 0) this.effectIds.push(effectId);
|
||||
oops.audio.playEffect(this.effect);
|
||||
// const effectId = await oops.audio.playEffect(this.effect, resLoader.defaultBundleName, () => {
|
||||
// this.effectIds.remove(effectId);
|
||||
// });
|
||||
// if (effectId > 0) this.effectIds.push(effectId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,11 +69,10 @@ export default class ButtonSimple extends Component {
|
||||
this.node.off(Node.EventType.TOUCH_END, this.onTouchEnd, this);
|
||||
this.node.off(Node.EventType.TOUCH_CANCEL, this.onTouchEnd, this);
|
||||
|
||||
if (this.effect) {
|
||||
this.effectIds.forEach(effectId => {
|
||||
console.log(effectId);
|
||||
oops.audio.putEffect(effectId, this.effect);
|
||||
});
|
||||
}
|
||||
// if (this.effect) {
|
||||
// this.effectIds.forEach(effectId => {
|
||||
// oops.audio.putEffect(effectId, this.effect);
|
||||
// });
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export default class UIButton extends Button {
|
||||
type: AudioClip
|
||||
})
|
||||
private effect: AudioClip = null!;
|
||||
private effectIds: number[] = [];
|
||||
// private effectIds: number[] = [];
|
||||
|
||||
/** 触摸次数 */
|
||||
private _touchCount = 0;
|
||||
@@ -61,19 +61,20 @@ export default class UIButton extends Button {
|
||||
/** 短按触摸音效 */
|
||||
protected async playEffect() {
|
||||
if (this.effect) {
|
||||
const effectId = await oops.audio.playEffect(this.effect, resLoader.defaultBundleName, () => {
|
||||
this.effectIds.remove(effectId);
|
||||
});
|
||||
if (effectId > 0) this.effectIds.push(effectId);
|
||||
oops.audio.playEffect(this.effect);
|
||||
// const effectId = await oops.audio.playEffect(this.effect, resLoader.defaultBundleName, () => {
|
||||
// this.effectIds.remove(effectId);
|
||||
// });
|
||||
// if (effectId > 0) this.effectIds.push(effectId);
|
||||
}
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
if (this.effect) {
|
||||
this.effectIds.forEach(effectId => {
|
||||
console.log(effectId);
|
||||
oops.audio.putEffect(effectId, this.effect);
|
||||
});
|
||||
}
|
||||
}
|
||||
// onDestroy() {
|
||||
// if (this.effect) {
|
||||
// this.effectIds.forEach(effectId => {
|
||||
// console.log(effectId);
|
||||
// oops.audio.putEffect(effectId, this.effect);
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user