feat: update gacha sfx

feature/ads-smart-display
tiendat3699 2024-06-19 11:35:41 +07:00
parent 037c5b8d7b
commit 0c5c905ead
52 changed files with 4432 additions and 3887 deletions

View File

@ -932,6 +932,8 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "42MH7u9olEzbD3eARpEEGO", "fileId": "42MH7u9olEzbD3eARpEEGO",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@ -1011,6 +1013,18 @@
"__id__": 28 "__id__": 28
} }
], ],
"showSfx": {
"__uuid__": "239a95de-d63b-48eb-be24-28ebec455f99",
"__expectedType__": "cc.AudioClip"
},
"selectCardSfx": {
"__uuid__": "2b5160a6-db5c-4925-9cb9-620c46695762",
"__expectedType__": "cc.AudioClip"
},
"openCardSfx": {
"__uuid__": "23a142a8-835d-4f43-8c3a-acbfadc56c23",
"__expectedType__": "cc.AudioClip"
},
"_id": "" "_id": ""
}, },
{ {
@ -1026,7 +1040,6 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "244TXoUqdKA4qqvhPODAbd", "fileId": "244TXoUqdKA4qqvhPODAbd",
"instance": null, "targetOverrides": []
"targetOverrides": null
} }
] ]

View File

@ -1025,6 +1025,10 @@
"rewardLabel": { "rewardLabel": {
"__id__": 23 "__id__": 23
}, },
"openSound": {
"__uuid__": "37e56b7e-d9f1-46d7-8df3-21766bd1c253",
"__expectedType__": "cc.AudioClip"
},
"_id": "" "_id": ""
}, },
{ {

View File

@ -3159,6 +3159,22 @@
}, },
"wheelBoneName": "wheel", "wheelBoneName": "wheel",
"speed": 3, "speed": 3,
"showSfx": {
"__uuid__": "d03f0c89-dd68-4d13-af73-918b39cf7953",
"__expectedType__": "cc.AudioClip"
},
"btnSfx": {
"__uuid__": "4d36d11c-3612-4f53-a3fd-d3b55b73422c",
"__expectedType__": "cc.AudioClip"
},
"spinSfx": {
"__uuid__": "d0d5f5b7-dd0a-46cc-8957-9270fece9d32",
"__expectedType__": "cc.AudioClip"
},
"stopSfx": {
"__uuid__": "f0506909-3673-4420-99d8-c2e45c9b72a7",
"__expectedType__": "cc.AudioClip"
},
"spinCurve": { "spinCurve": {
"__id__": 144 "__id__": 144
}, },
@ -3324,7 +3340,6 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "b0CgrEZDdPP6qjRGc5LHCx", "fileId": "b0CgrEZDdPP6qjRGc5LHCx",
"instance": null, "targetOverrides": []
"targetOverrides": null
} }
] ]

View File

@ -1025,6 +1025,10 @@
"rewardLabel": { "rewardLabel": {
"__id__": 23 "__id__": 23
}, },
"openSound": {
"__uuid__": "37e56b7e-d9f1-46d7-8df3-21766bd1c253",
"__expectedType__": "cc.AudioClip"
},
"_id": "" "_id": ""
}, },
{ {

View File

@ -1013,6 +1013,18 @@
"__id__": 28 "__id__": 28
} }
], ],
"showSfx": {
"__uuid__": "239a95de-d63b-48eb-be24-28ebec455f99",
"__expectedType__": "cc.AudioClip"
},
"selectCardSfx": {
"__uuid__": "2b5160a6-db5c-4925-9cb9-620c46695762",
"__expectedType__": "cc.AudioClip"
},
"openCardSfx": {
"__uuid__": "23a142a8-835d-4f43-8c3a-acbfadc56c23",
"__expectedType__": "cc.AudioClip"
},
"_id": "" "_id": ""
}, },
{ {
@ -1028,7 +1040,6 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "244TXoUqdKA4qqvhPODAbd", "fileId": "244TXoUqdKA4qqvhPODAbd",
"instance": null, "targetOverrides": []
"targetOverrides": null
} }
] ]

View File

@ -3525,6 +3525,7 @@
"__id__": 129 "__id__": 129
} }
], ],
"sprites": [],
"cardSlotPath": [ "cardSlotPath": [
4, 4,
5, 5,
@ -3561,7 +3562,6 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "ec0xxH/etG0KDLbW0fRRht", "fileId": "ec0xxH/etG0KDLbW0fRRht",
"instance": null,
"targetOverrides": null "targetOverrides": null
} }
] ]

View File

@ -545,6 +545,8 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "01q2I1EmNPXr4APxBvWUXg", "fileId": "01q2I1EmNPXr4APxBvWUXg",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@ -1023,6 +1025,10 @@
"rewardLabel": { "rewardLabel": {
"__id__": 23 "__id__": 23
}, },
"openSound": {
"__uuid__": "37e56b7e-d9f1-46d7-8df3-21766bd1c253",
"__expectedType__": "cc.AudioClip"
},
"_id": "" "_id": ""
}, },
{ {
@ -1038,7 +1044,6 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "d8nEtFnupHxp1DyuqkemXx", "fileId": "d8nEtFnupHxp1DyuqkemXx",
"instance": null, "targetOverrides": []
"targetOverrides": null
} }
] ]

View File

@ -3159,6 +3159,22 @@
}, },
"wheelBoneName": "wheel", "wheelBoneName": "wheel",
"speed": 3, "speed": 3,
"showSfx": {
"__uuid__": "d03f0c89-dd68-4d13-af73-918b39cf7953",
"__expectedType__": "cc.AudioClip"
},
"btnSfx": {
"__uuid__": "4d36d11c-3612-4f53-a3fd-d3b55b73422c",
"__expectedType__": "cc.AudioClip"
},
"spinSfx": {
"__uuid__": "d0d5f5b7-dd0a-46cc-8957-9270fece9d32",
"__expectedType__": "cc.AudioClip"
},
"stopSfx": {
"__uuid__": "f0506909-3673-4420-99d8-c2e45c9b72a7",
"__expectedType__": "cc.AudioClip"
},
"spinCurve": { "spinCurve": {
"__id__": 144 "__id__": 144
}, },
@ -3324,7 +3340,6 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "b0CgrEZDdPP6qjRGc5LHCx", "fileId": "b0CgrEZDdPP6qjRGc5LHCx",
"instance": null, "targetOverrides": []
"targetOverrides": null
} }
] ]

View File

@ -10994,6 +10994,18 @@
"countDownLabel": { "countDownLabel": {
"__id__": 425 "__id__": 425
}, },
"collectSfx": {
"__uuid__": "65a4db41-8617-4b1e-a465-e9aea50f5029",
"__expectedType__": "cc.AudioClip"
},
"countDownSfx": {
"__uuid__": "b03a6bbd-031f-451c-8a2c-cb6e6ec15464",
"__expectedType__": "cc.AudioClip"
},
"readySfx": {
"__uuid__": "2e5f5592-b662-4477-b4f0-e4d22682d0d8",
"__expectedType__": "cc.AudioClip"
},
"gachas": [ "gachas": [
{ {
"__id__": 430 "__id__": 430
@ -18020,6 +18032,20 @@
"_timeIcon": { "_timeIcon": {
"__id__": 621 "__id__": 621
}, },
"normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"warnColor": {
"__type__": "cc.Color",
"r": 255,
"g": 0,
"b": 0,
"a": 255
},
"_countDownSound": { "_countDownSound": {
"__uuid__": "c96f7bd8-69d7-4810-a6d4-3cfa61766b2c", "__uuid__": "c96f7bd8-69d7-4810-a6d4-3cfa61766b2c",
"__expectedType__": "cc.AudioClip" "__expectedType__": "cc.AudioClip"

View File

@ -9858,7 +9858,7 @@
"instance": { "instance": {
"__id__": 381 "__id__": 381
}, },
"targetOverrides": null, "targetOverrides": [],
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@ -10191,7 +10191,7 @@
"instance": { "instance": {
"__id__": 405 "__id__": 405
}, },
"targetOverrides": null, "targetOverrides": [],
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@ -10490,6 +10490,18 @@
"countDownLabel": { "countDownLabel": {
"__id__": 413 "__id__": 413
}, },
"collectSfx": {
"__uuid__": "65a4db41-8617-4b1e-a465-e9aea50f5029",
"__expectedType__": "cc.AudioClip"
},
"countDownSfx": {
"__uuid__": "b03a6bbd-031f-451c-8a2c-cb6e6ec15464",
"__expectedType__": "cc.AudioClip"
},
"readySfx": {
"__uuid__": "2e5f5592-b662-4477-b4f0-e4d22682d0d8",
"__expectedType__": "cc.AudioClip"
},
"gachas": [ "gachas": [
{ {
"__id__": 418 "__id__": 418
@ -16447,6 +16459,20 @@
"_timeIcon": { "_timeIcon": {
"__id__": 578 "__id__": 578
}, },
"normalColor": {
"__type__": "cc.Color",
"r": 0,
"g": 255,
"b": 0,
"a": 255
},
"warnColor": {
"__type__": "cc.Color",
"r": 255,
"g": 0,
"b": 0,
"a": 255
},
"_countDownSound": { "_countDownSound": {
"__uuid__": "c96f7bd8-69d7-4810-a6d4-3cfa61766b2c", "__uuid__": "c96f7bd8-69d7-4810-a6d4-3cfa61766b2c",
"__expectedType__": "cc.AudioClip" "__expectedType__": "cc.AudioClip"

View File

@ -12346,7 +12346,7 @@
"instance": { "instance": {
"__id__": 469 "__id__": 469
}, },
"targetOverrides": null, "targetOverrides": [],
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@ -12679,7 +12679,7 @@
"instance": { "instance": {
"__id__": 493 "__id__": 493
}, },
"targetOverrides": null, "targetOverrides": [],
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@ -12978,6 +12978,18 @@
"countDownLabel": { "countDownLabel": {
"__id__": 501 "__id__": 501
}, },
"collectSfx": {
"__uuid__": "65a4db41-8617-4b1e-a465-e9aea50f5029",
"__expectedType__": "cc.AudioClip"
},
"countDownSfx": {
"__uuid__": "b03a6bbd-031f-451c-8a2c-cb6e6ec15464",
"__expectedType__": "cc.AudioClip"
},
"readySfx": {
"__uuid__": "2e5f5592-b662-4477-b4f0-e4d22682d0d8",
"__expectedType__": "cc.AudioClip"
},
"gachas": [ "gachas": [
{ {
"__id__": 506 "__id__": 506
@ -18953,6 +18965,20 @@
"_timeIcon": { "_timeIcon": {
"__id__": 667 "__id__": 667
}, },
"normalColor": {
"__type__": "cc.Color",
"r": 0,
"g": 255,
"b": 0,
"a": 255
},
"warnColor": {
"__type__": "cc.Color",
"r": 255,
"g": 0,
"b": 0,
"a": 255
},
"_countDownSound": { "_countDownSound": {
"__uuid__": "c96f7bd8-69d7-4810-a6d4-3cfa61766b2c", "__uuid__": "c96f7bd8-69d7-4810-a6d4-3cfa61766b2c",
"__expectedType__": "cc.AudioClip" "__expectedType__": "cc.AudioClip"

File diff suppressed because it is too large Load Diff

View File

@ -9997,7 +9997,7 @@
"instance": { "instance": {
"__id__": 385 "__id__": 385
}, },
"targetOverrides": null, "targetOverrides": [],
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@ -10330,7 +10330,7 @@
"instance": { "instance": {
"__id__": 409 "__id__": 409
}, },
"targetOverrides": null, "targetOverrides": [],
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@ -10629,6 +10629,18 @@
"countDownLabel": { "countDownLabel": {
"__id__": 417 "__id__": 417
}, },
"collectSfx": {
"__uuid__": "65a4db41-8617-4b1e-a465-e9aea50f5029",
"__expectedType__": "cc.AudioClip"
},
"countDownSfx": {
"__uuid__": "b03a6bbd-031f-451c-8a2c-cb6e6ec15464",
"__expectedType__": "cc.AudioClip"
},
"readySfx": {
"__uuid__": "2e5f5592-b662-4477-b4f0-e4d22682d0d8",
"__expectedType__": "cc.AudioClip"
},
"gachas": [ "gachas": [
{ {
"__id__": 422 "__id__": 422
@ -16586,6 +16598,20 @@
"_timeIcon": { "_timeIcon": {
"__id__": 582 "__id__": 582
}, },
"normalColor": {
"__type__": "cc.Color",
"r": 0,
"g": 255,
"b": 0,
"a": 255
},
"warnColor": {
"__type__": "cc.Color",
"r": 255,
"g": 0,
"b": 0,
"a": 255
},
"_countDownSound": { "_countDownSound": {
"__uuid__": "c96f7bd8-69d7-4810-a6d4-3cfa61766b2c", "__uuid__": "c96f7bd8-69d7-4810-a6d4-3cfa61766b2c",
"__expectedType__": "cc.AudioClip" "__expectedType__": "cc.AudioClip"

File diff suppressed because it is too large Load Diff

View File

@ -52,7 +52,7 @@ export class FloatingText extends Component {
) )
.call(() => { .call(() => {
this._sprite.spriteFrame = null; this._sprite.spriteFrame = null;
ObjectPool.release(this.node); this.node.releaseToPool();
}) })
.start(); .start();
await Utils.delay(0.05); await Utils.delay(0.05);

View File

@ -1,6 +1,7 @@
import { _decorator, Component, Node, Sprite } from 'cc'; import { _decorator, AudioClip, Component, Node, Sprite } from 'cc';
import GachaBase from '../Base/GachaBase'; import GachaBase from '../Base/GachaBase';
import SpineAnimationHandler from '../Base/SpineAnimationHandler'; import SpineAnimationHandler from '../Base/SpineAnimationHandler';
import AudioManager from '../Manager/AudioManager';
import GachaManager from '../Manager/GachaManager'; import GachaManager from '../Manager/GachaManager';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ -13,6 +14,12 @@ export default class FlipCard extends GachaBase {
private spineRoot: Node; private spineRoot: Node;
@property(Sprite) @property(Sprite)
private cards: Sprite[] = []; private cards: Sprite[] = [];
@property(AudioClip)
private showSfx: AudioClip;
@property(AudioClip)
private selectCardSfx: AudioClip;
@property(AudioClip)
private openCardSfx: AudioClip;
private _opened: boolean = false; private _opened: boolean = false;
@ -21,15 +28,19 @@ export default class FlipCard extends GachaBase {
switch (e.data.name) { switch (e.data.name) {
case 'card1-active': case 'card1-active':
this.cards[0].setNodeActive(true); this.cards[0].setNodeActive(true);
AudioManager.playSfx(this.openCardSfx);
break; break;
case 'card2-active': case 'card2-active':
this.cards[1].setNodeActive(true); this.cards[1].setNodeActive(true);
AudioManager.playSfx(this.openCardSfx);
break; break;
case 'card3-active': case 'card3-active':
this.cards[2].setNodeActive(true); this.cards[2].setNodeActive(true);
AudioManager.playSfx(this.openCardSfx);
break; break;
case 'card4-active': case 'card4-active':
this.cards[3].setNodeActive(true); this.cards[3].setNodeActive(true);
AudioManager.playSfx(this.openCardSfx);
break; break;
} }
}); });
@ -44,6 +55,7 @@ export default class FlipCard extends GachaBase {
public async show(): Promise<void> { public async show(): Promise<void> {
this.spineRoot.setActive(true); this.spineRoot.setActive(true);
this.animationHandler.clearTracks(); this.animationHandler.clearTracks();
AudioManager.playSfx(this.showSfx);
await this.animationHandler.setAnimationAsync('appear'); await this.animationHandler.setAnimationAsync('appear');
this.animationHandler.addAnimation('idle', { loop: true }); this.animationHandler.addAnimation('idle', { loop: true });
} }
@ -54,6 +66,7 @@ export default class FlipCard extends GachaBase {
if (this.cards[+value - 1].node.active) return; if (this.cards[+value - 1].node.active) return;
const reward = await GachaManager.instance.getReward(); const reward = await GachaManager.instance.getReward();
if (reward) { if (reward) {
AudioManager.playSfx(this.selectCardSfx);
this.cards[+value - 1].spriteFrame = reward.icon; this.cards[+value - 1].spriteFrame = reward.icon;
await this.animationHandler.setAnimationAsync(`card${value}-active`, { trackIndex: +value }); await this.animationHandler.setAnimationAsync(`card${value}-active`, { trackIndex: +value });
const pos = this.cards[+value - 1].node.worldPosition.clone(); const pos = this.cards[+value - 1].node.worldPosition.clone();

View File

@ -1,6 +1,7 @@
import { _decorator, clamp01, Component, easing, game, Label, Node, Sprite, Vec3 } from 'cc'; import { _decorator, AudioClip, clamp01, Component, easing, game, Label, Node, Sprite, Vec3 } from 'cc';
import GachaBase from '../Base/GachaBase'; import GachaBase from '../Base/GachaBase';
import SpineAnimationHandler from '../Base/SpineAnimationHandler'; import SpineAnimationHandler from '../Base/SpineAnimationHandler';
import AudioManager from '../Manager/AudioManager';
import GachaManager, { RewardConfig } from '../Manager/GachaManager'; import GachaManager, { RewardConfig } from '../Manager/GachaManager';
import Utils from '../Utilities'; import Utils from '../Utilities';
@ -18,6 +19,8 @@ export default class FreeReward extends GachaBase {
private rewardSprite: Sprite; private rewardSprite: Sprite;
@property(Label) @property(Label)
private rewardLabel: Label; private rewardLabel: Label;
@property(AudioClip)
private openSound: AudioClip;
private _opened: boolean = false; private _opened: boolean = false;
private _reward: RewardConfig; private _reward: RewardConfig;
@ -49,10 +52,16 @@ export default class FreeReward extends GachaBase {
this._opened = true; this._opened = true;
this._reward = await GachaManager.instance.getReward(); this._reward = await GachaManager.instance.getReward();
if (this._reward) { if (this._reward) {
AudioManager.playSfx(this.openSound);
this.rewardSprite.spriteFrame = this._reward.icon; this.rewardSprite.spriteFrame = this._reward.icon;
this.rewardLabel.string = 'x' + this._reward.quantity; this.rewardLabel.string = 'x' + this._reward.quantity;
await this.animationHandler.setAnimationAsync('open'); await this.animationHandler.setAnimationAsync('open');
this.rewardRoot.setActive(true); this.rewardRoot.setActive(true);
GachaManager.instance.showFloatingText(
this._reward.quantity.toString(),
this.node.worldPosition,
this._reward.icon,
);
GachaManager.instance.gachaDone(); GachaManager.instance.gachaDone();
return; return;
} }

View File

@ -1,5 +1,6 @@
import { import {
_decorator, _decorator,
AudioClip,
CCFloat, CCFloat,
CCInteger, CCInteger,
CCString, CCString,
@ -14,6 +15,7 @@ import {
} from 'cc'; } from 'cc';
import GachaBase from '../Base/GachaBase'; import GachaBase from '../Base/GachaBase';
import SpineAnimationHandler from '../Base/SpineAnimationHandler'; import SpineAnimationHandler from '../Base/SpineAnimationHandler';
import AudioManager from '../Manager/AudioManager';
import GachaManager, { RewardConfig } from '../Manager/GachaManager'; import GachaManager, { RewardConfig } from '../Manager/GachaManager';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ -49,6 +51,14 @@ export default class LuckyWheel extends GachaBase {
private wheelBoneName: string = ''; private wheelBoneName: string = '';
@property(CCInteger) @property(CCInteger)
private speed: number = 1; private speed: number = 1;
@property(AudioClip)
private showSfx: AudioClip;
@property(AudioClip)
private btnSfx: AudioClip;
@property(AudioClip)
private spinSfx: AudioClip;
@property(AudioClip)
private stopSfx: AudioClip;
@property(RealCurve) @property(RealCurve)
private spinCurve: RealCurve = new RealCurve(); private spinCurve: RealCurve = new RealCurve();
@property(RewardDisplay) @property(RewardDisplay)
@ -62,6 +72,7 @@ export default class LuckyWheel extends GachaBase {
private _timer: number = 0; private _timer: number = 0;
private _timeSpin: number = 0; private _timeSpin: number = 0;
private _maxAngle: number = 0; private _maxAngle: number = 0;
private _preAngle: number = 0;
private _allCards: RewardCard[]; private _allCards: RewardCard[];
private _random: number; private _random: number;
@ -83,8 +94,13 @@ export default class LuckyWheel extends GachaBase {
const angle = this._maxAngle * this.spinCurve.evaluate(this._timer / this._timeSpin); const angle = this._maxAngle * this.spinCurve.evaluate(this._timer / this._timeSpin);
this._wheel.rotation = this._targetAngle + angle; this._wheel.rotation = this._targetAngle + angle;
this._wheel.update(); this._wheel.update();
if (Math.abs(this._preAngle - angle) >= 36) {
this._preAngle = angle;
AudioManager.playSfx(this.spinSfx);
}
if (this._timer >= this._timeSpin) { if (this._timer >= this._timeSpin) {
this._spinning = false; this._spinning = false;
AudioManager.playSfx(this.stopSfx);
GachaManager.instance.showFloatingText( GachaManager.instance.showFloatingText(
this._allCards[this._random].reward.quantity.toString(), this._allCards[this._random].reward.quantity.toString(),
this.node.worldPosition, this.node.worldPosition,
@ -106,19 +122,21 @@ export default class LuckyWheel extends GachaBase {
public async show(): Promise<void> { public async show(): Promise<void> {
this.setReward(); this.setReward();
this.spineRoot.setActive(true); this.spineRoot.setActive(true);
AudioManager.playSfx(this.showSfx);
await this.animationHandler.setAnimationAsync('appear'); await this.animationHandler.setAnimationAsync('appear');
this.animationHandler.addAnimation('idle', { loop: true }); this.animationHandler.addAnimation('idle', { loop: true });
} }
public async spin() { public async spin() {
if (this._spinning) return; if (this._spinning) return;
this._spinning = true; this._spinning = true;
AudioManager.playSfx(this.btnSfx);
this._random = this._allCards.getRandomIndex(); this._random = this._allCards.getRandomIndex();
this.animationHandler.clearTrack(0); this.animationHandler.clearTrack(0);
this._targetAngle = -(360 / this.rewardDisplay.length) * this._random + this.offsetAngle; this._targetAngle = -(360 / this.rewardDisplay.length) * this._random + this.offsetAngle;
this._timer = 0; this._timer = 0;
this._timeSpin = randomRangeInt(10, 15); this._timeSpin = randomRangeInt(10, 15);
this._maxAngle = 360 * this._timeSpin; this._maxAngle = 360 * this._timeSpin;
this._preAngle = this._maxAngle;
} }
} }

View File

@ -408,7 +408,7 @@ export default class Gizmos3D {
public static drawDashLineList(node: Node, points: Vec3[], close: boolean = false) { public static drawDashLineList(node: Node, points: Vec3[], close: boolean = false) {
const debugNode = this.getDebugNode(node); const debugNode = this.getDebugNode(node);
debugNode?.drawLineList(points, close); debugNode?.drawDashLineList(points, close);
} }
public static drawCircle(node: Node, center: Vec3, radius: number, rot: Vec3 = Vec3.ZERO, segments: number = 32) { public static drawCircle(node: Node, center: Vec3, radius: number, rot: Vec3 = Vec3.ZERO, segments: number = 32) {

View File

@ -1,5 +1,6 @@
import { import {
_decorator, _decorator,
AudioClip,
CCInteger, CCInteger,
CCString, CCString,
clamp01, clamp01,
@ -24,6 +25,7 @@ import FloatingTextFactory from '../Factory/FloatingTextFactory';
import P4PSDK from '../P4PSDK'; import P4PSDK from '../P4PSDK';
import Singleton from '../Singleton'; import Singleton from '../Singleton';
import Utils from '../Utilities'; import Utils from '../Utilities';
import AudioManager from './AudioManager';
import { EventManger } from './EventManger'; import { EventManger } from './EventManger';
import { GameManager } from './GameManager'; import { GameManager } from './GameManager';
import { SpawnObjectManager } from './SpawnObjectManager'; import { SpawnObjectManager } from './SpawnObjectManager';
@ -78,6 +80,14 @@ export default class GachaManager extends Singleton<GachaManager>() {
private floatingScoreFactory: FloatingTextFactory; private floatingScoreFactory: FloatingTextFactory;
@property(Label) @property(Label)
private countDownLabel: Label; private countDownLabel: Label;
@property(AudioClip)
private collectSfx: AudioClip;
@property(AudioClip)
private countDownSfx: AudioClip;
@property(AudioClip)
private readySfx: AudioClip;
@property(Gacha) @property(Gacha)
private gachas: Gacha[] = []; private gachas: Gacha[] = [];
@property(RewardConfig) @property(RewardConfig)
@ -123,6 +133,7 @@ export default class GachaManager extends Singleton<GachaManager>() {
public showFloatingText(text: string, position: Vec3, icon: SpriteFrame) { public showFloatingText(text: string, position: Vec3, icon: SpriteFrame) {
const floatingText = this.floatingScoreFactory.create(this.node); const floatingText = this.floatingScoreFactory.create(this.node);
AudioManager.playSfx(this.collectSfx);
floatingText.show(`+${text}`, position, 3, 1, icon); floatingText.show(`+${text}`, position, 3, 1, icon);
} }
@ -159,6 +170,7 @@ export default class GachaManager extends Singleton<GachaManager>() {
let count = 3; let count = 3;
while (count >= 0) { while (count >= 0) {
this.countDownLabel.setString(count == 0 ? 'Ready' : count); this.countDownLabel.setString(count == 0 ? 'Ready' : count);
AudioManager.playSfx(count == 0 ? this.readySfx : this.countDownSfx);
count--; count--;
await Utils.delay(0.5); await Utils.delay(0.5);
} }

View File

@ -14,6 +14,10 @@ export class TimeUI extends Component {
private _fill: Sprite; private _fill: Sprite;
@property({ type: Node, visible: true }) @property({ type: Node, visible: true })
private _timeIcon: Node; private _timeIcon: Node;
@property(Color)
private normalColor: Color = new Color();
@property(Color)
private warnColor: Color = new Color();
@property({ type: AudioClip, visible: true }) @property({ type: AudioClip, visible: true })
private _countDownSound: AudioClip; private _countDownSound: AudioClip;
@ -41,7 +45,7 @@ export class TimeUI extends Component {
case GameState.Playing: case GameState.Playing:
AudioManager.stopSfx(this._countDownSound); AudioManager.stopSfx(this._countDownSound);
Tween.stopAllByTarget(this._timeIcon); Tween.stopAllByTarget(this._timeIcon);
this._fill.color = Color.GREEN; this._fill.color = this.normalColor;
this._timeLabel.color = Color.WHITE; this._timeLabel.color = Color.WHITE;
break; break;
case GameState.GameOver: case GameState.GameOver:
@ -62,7 +66,7 @@ export class TimeUI extends Component {
private onWarningTime(warning: boolean) { private onWarningTime(warning: boolean) {
if (warning) { if (warning) {
AudioManager.playSfx(this._countDownSound, { loop: true }); AudioManager.playSfx(this._countDownSound, { loop: true });
this._fill.color = Color.RED; this._fill.color = this.warnColor;
tween(this._timeIcon) tween(this._timeIcon)
.to(0.05, { position: new Vec3(3.117, 3.177) }) .to(0.05, { position: new Vec3(3.117, 3.177) })
.to(0.08, { scale: new Vec3(0.9, 1.1) }) .to(0.08, { scale: new Vec3(0.9, 1.1) })
@ -78,7 +82,7 @@ export class TimeUI extends Component {
} else { } else {
AudioManager.stopSfx(this._countDownSound); AudioManager.stopSfx(this._countDownSound);
Tween.stopAllByTarget(this._timeIcon); Tween.stopAllByTarget(this._timeIcon);
this._fill.color = Color.GREEN; this._fill.color = this.normalColor;
this._timeLabel.color = Color.WHITE; this._timeLabel.color = Color.WHITE;
} }
} }

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "399eabc2-4bee-43d8-ae89-fb8e93e61de5",
"files": [],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "239a95de-d63b-48eb-be24-28ebec455f99",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "23a142a8-835d-4f43-8c3a-acbfadc56c23",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "2b5160a6-db5c-4925-9cb9-620c46695762",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "4d36d11c-3612-4f53-a3fd-d3b55b73422c",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "65a4db41-8617-4b1e-a465-e9aea50f5029",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "b03a6bbd-031f-451c-8a2c-cb6e6ec15464",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "2e5f5592-b662-4477-b4f0-e4d22682d0d8",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "d03f0c89-dd68-4d13-af73-918b39cf7953",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "d0d5f5b7-dd0a-46cc-8957-9270fece9d32",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "f0506909-3673-4420-99d8-c2e45c9b72a7",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "37e56b7e-d9f1-46d7-8df3-21766bd1c253",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}