fix: booster not show after collect once

feature/ads-smart-display
tiendat3699 2024-06-12 23:10:46 +07:00
parent 2017a46914
commit f890a29fb1
7 changed files with 278 additions and 274 deletions

View File

@ -22,7 +22,7 @@
"__id__": 2
},
{
"__id__": 10
"__id__": 78
}
],
"_active": true,
@ -86,21 +86,25 @@
"_parent": {
"__id__": 1
},
"_children": [],
"_children": [
{
"__id__": 3
}
],
"_active": true,
"_components": [
{
"__id__": 3
"__id__": 71
},
{
"__id__": 5
"__id__": 73
},
{
"__id__": 7
"__id__": 75
}
],
"_prefab": {
"__id__": 9
"__id__": 77
},
"_lpos": {
"__type__": "cc.Vec3",
@ -131,197 +135,34 @@
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 4
},
"_contentSize": {
"__type__": "cc.Size",
"width": 166.52999877929688,
"height": 160.13999938964844
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5016513632852623,
"y": 0.5191707237824722
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8cgS7HLu5PoZB6mL8KbJv8"
},
{
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 6
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_skeletonData": {
"__uuid__": "a2e8df4b-a028-47ea-940e-a59e1aa826f0",
"__expectedType__": "sp.SkeletonData"
},
"defaultSkin": "default",
"defaultAnimation": "idle",
"_premultipliedAlpha": true,
"_timeScale": 1,
"_preCacheMode": 0,
"_cacheMode": 0,
"_sockets": [],
"_useTint": false,
"_debugMesh": false,
"_debugBones": false,
"_debugSlots": false,
"_enableBatch": false,
"loop": true,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c1tC0lYOlLFKA9oivphpal"
},
{
"__type__": "b2937Y+5yVLE4z8uGa84ZqS",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 8
},
"skeleton": {
"__id__": 5
},
"_flipX": false,
"_flipY": false,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a6iULR29ROkqlLhKZ24pRU"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "eb772pMDdMO7KDMpjPbAfI",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "Sprite",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 11
}
],
"_active": true,
"_components": [
{
"__id__": 79
},
{
"__id__": 81
}
],
"_prefab": {
"__id__": 83
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "Particle",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 10
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 12
"__id__": 4
},
{
"__id__": 14
"__id__": 6
},
{
"__id__": 76
"__id__": 68
}
],
"_prefab": {
"__id__": 78
"__id__": 70
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 40,
"x": 2.2737367544323206e-13,
"y": -15.384615384615245,
"z": 10
},
"_lrot": {
@ -333,8 +174,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 10,
"y": 10,
"x": 15.384615384615383,
"y": 15.384615384615383,
"z": 1
},
"_mobility": 0,
@ -353,11 +194,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 11
"__id__": 3
},
"_enabled": true,
"__prefab": {
"__id__": 13
"__id__": 5
},
"_contentSize": {
"__type__": "cc.Size",
@ -381,11 +222,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 11
"__id__": 3
},
"_enabled": true,
"__prefab": {
"__id__": 15
"__id__": 7
},
"_materials": [
{
@ -396,56 +237,56 @@
],
"_visFlags": 0,
"startColor": {
"__id__": 16
"__id__": 8
},
"scaleSpace": 1,
"startSize3D": false,
"startSizeX": {
"__id__": 17
"__id__": 9
},
"startSize": {
"__id__": 17
"__id__": 9
},
"startSizeY": {
"__id__": 18
"__id__": 10
},
"startSizeZ": {
"__id__": 19
"__id__": 11
},
"startSpeed": {
"__id__": 20
"__id__": 12
},
"startRotation3D": false,
"startRotationX": {
"__id__": 21
"__id__": 13
},
"startRotationY": {
"__id__": 22
"__id__": 14
},
"startRotationZ": {
"__id__": 23
"__id__": 15
},
"startRotation": {
"__id__": 23
"__id__": 15
},
"startDelay": {
"__id__": 24
"__id__": 16
},
"startLifetime": {
"__id__": 25
"__id__": 17
},
"duration": 5,
"loop": true,
"simulationSpeed": 1,
"playOnAwake": true,
"gravityModifier": {
"__id__": 26
"__id__": 18
},
"rateOverTime": {
"__id__": 27
"__id__": 19
},
"rateOverDistance": {
"__id__": 28
"__id__": 20
},
"bursts": [],
"_renderCulling": false,
@ -456,37 +297,37 @@
"_dataCulling": false,
"enableCulling": false,
"_colorOverLifetimeModule": {
"__id__": 29
"__id__": 21
},
"_shapeModule": {
"__id__": 39
"__id__": 31
},
"_sizeOvertimeModule": {
"__id__": 41
"__id__": 33
},
"_velocityOvertimeModule": {
"__id__": 47
"__id__": 39
},
"_forceOvertimeModule": {
"__id__": 52
"__id__": 44
},
"_limitVelocityOvertimeModule": {
"__id__": 56
"__id__": 48
},
"_rotationOvertimeModule": {
"__id__": 61
"__id__": 53
},
"_textureAnimationModule": {
"__id__": 65
"__id__": 57
},
"_noiseModule": {
"__id__": 69
"__id__": 61
},
"_trailModule": {
"__id__": 70
"__id__": 62
},
"renderer": {
"__id__": 75
"__id__": 67
},
"_prewarm": false,
"_capacity": 100,
@ -587,41 +428,41 @@
"__type__": "cc.ColorOvertimeModule",
"_enable": true,
"color": {
"__id__": 30
"__id__": 22
}
},
{
"__type__": "cc.GradientRange",
"_mode": 1,
"gradient": {
"__id__": 31
"__id__": 23
}
},
{
"__type__": "cc.Gradient",
"colorKeys": [
{
"__id__": 32
"__id__": 24
},
{
"__id__": 33
"__id__": 25
},
{
"__id__": 34
"__id__": 26
}
],
"alphaKeys": [
{
"__id__": 35
"__id__": 27
},
{
"__id__": 36
"__id__": 28
},
{
"__id__": 37
"__id__": 29
},
{
"__id__": 38
"__id__": 30
}
],
"mode": 0
@ -694,7 +535,7 @@
"arcMode": 0,
"arcSpread": 0,
"arcSpeed": {
"__id__": 40
"__id__": 32
},
"length": 5,
"boxThickness": {
@ -735,23 +576,23 @@
"_enable": true,
"separateAxes": false,
"size": {
"__id__": 42
"__id__": 34
},
"x": {
"__id__": 44
"__id__": 36
},
"y": {
"__id__": 45
"__id__": 37
},
"z": {
"__id__": 46
"__id__": 38
}
},
{
"__type__": "cc.CurveRange",
"mode": 1,
"spline": {
"__id__": 43
"__id__": 35
},
"multiplier": 1
},
@ -825,16 +666,16 @@
"__type__": "cc.VelocityOvertimeModule",
"_enable": false,
"x": {
"__id__": 48
"__id__": 40
},
"y": {
"__id__": 49
"__id__": 41
},
"z": {
"__id__": 50
"__id__": 42
},
"speedModifier": {
"__id__": 51
"__id__": 43
},
"space": 1
},
@ -866,13 +707,13 @@
"__type__": "cc.ForceOvertimeModule",
"_enable": false,
"x": {
"__id__": 53
"__id__": 45
},
"y": {
"__id__": 54
"__id__": 46
},
"z": {
"__id__": 55
"__id__": 47
},
"space": 1
},
@ -898,16 +739,16 @@
"__type__": "cc.LimitVelocityOvertimeModule",
"_enable": false,
"limitX": {
"__id__": 57
"__id__": 49
},
"limitY": {
"__id__": 58
"__id__": 50
},
"limitZ": {
"__id__": 59
"__id__": 51
},
"limit": {
"__id__": 60
"__id__": 52
},
"dampen": 3,
"separateAxes": false,
@ -942,13 +783,13 @@
"_enable": true,
"_separateAxes": false,
"x": {
"__id__": 62
"__id__": 54
},
"y": {
"__id__": 63
"__id__": 55
},
"z": {
"__id__": 64
"__id__": 56
}
},
{
@ -980,10 +821,10 @@
"_mode": 0,
"animation": 0,
"frameOverTime": {
"__id__": 66
"__id__": 58
},
"startFrame": {
"__id__": 68
"__id__": 60
},
"cycleCount": 0,
"_flipU": 0,
@ -996,7 +837,7 @@
"__type__": "cc.CurveRange",
"mode": 1,
"spline": {
"__id__": 67
"__id__": 59
},
"multiplier": 1
},
@ -1063,21 +904,21 @@
"_enable": false,
"mode": 0,
"lifeTime": {
"__id__": 71
"__id__": 63
},
"_minParticleDistance": 0.1,
"existWithParticles": true,
"textureMode": 0,
"widthFromParticle": true,
"widthRatio": {
"__id__": 72
"__id__": 64
},
"colorFromParticle": false,
"colorOverTrail": {
"__id__": 73
"__id__": 65
},
"colorOvertime": {
"__id__": 74
"__id__": 66
},
"_space": 0,
"_particleSystem": null
@ -1140,11 +981,11 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 11
"__id__": 3
},
"_enabled": true,
"__prefab": {
"__id__": 77
"__id__": 69
},
"_id": ""
},
@ -1161,8 +1002,6 @@
"__id__": 0
},
"fileId": "84py8yOJVJWZOHcC5itxPh",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
@ -1171,7 +1010,166 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 72
},
"_contentSize": {
"__type__": "cc.Size",
"width": 166.52999877929688,
"height": 160.13999938964844
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5016513632852623,
"y": 0.5191707237824722
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8cgS7HLu5PoZB6mL8KbJv8"
},
{
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 74
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_skeletonData": {
"__uuid__": "a2e8df4b-a028-47ea-940e-a59e1aa826f0",
"__expectedType__": "sp.SkeletonData"
},
"defaultSkin": "default",
"defaultAnimation": "idle",
"_premultipliedAlpha": true,
"_timeScale": 1,
"_preCacheMode": 1,
"_cacheMode": 1,
"_sockets": [],
"_useTint": false,
"_debugMesh": false,
"_debugBones": false,
"_debugSlots": false,
"_enableBatch": false,
"loop": true,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c1tC0lYOlLFKA9oivphpal"
},
{
"__type__": "b2937Y+5yVLE4z8uGa84ZqS",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 76
},
"skeleton": {
"__id__": 73
},
"_flipX": false,
"_flipY": false,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a6iULR29ROkqlLhKZ24pRU"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "eb772pMDdMO7KDMpjPbAfI",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "Sprite",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 79
},
{
"__id__": 81
}
],
"_prefab": {
"__id__": 83
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 78
},
"_enabled": true,
"__prefab": {
@ -1199,7 +1197,7 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
"__id__": 78
},
"_enabled": true,
"__prefab": {
@ -1310,7 +1308,7 @@
"displayName": "COLLAGEN JELLY",
"duration": 10,
"animationHandler": {
"__id__": 7
"__id__": 75
},
"_id": ""
},

View File

@ -336,7 +336,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 540,
"y": 1169.9999999999998,
"y": 1169.9999999999995,
"z": 0
},
"_lrot": {
@ -387,7 +387,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"y": 2.2737367544323206e-13,
"z": 1000
},
"_lrot": {
@ -427,7 +427,7 @@
"_priority": 0,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 1170,
"_orthoHeight": 1169.9999999999998,
"_near": 0,
"_far": 2000,
"_color": {
@ -29721,9 +29721,9 @@
"__uuid__": "cc731501-912a-465f-9070-dbe0d8ad3598",
"__expectedType__": "cc.Prefab"
},
"weight": 60,
"weight": 10000,
"weightStepOnGoal": 0,
"maxWeight": 60,
"maxWeight": 10000,
"maxObjects": 1
},
{
@ -34995,7 +34995,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 1080,
"height": 2340
"height": 2339.9999999999995
},
"_anchorPoint": {
"__type__": "cc.Vec2",

View File

@ -14,14 +14,14 @@ export class CumulativeBooster extends BoosterBase {
protected onLoad(): void {
super.onLoad();
this.sprite.setNodeActive(true);
this.animationHandler?.setNodeActive(false);
}
public collect(collector: Node): void {
public async collect(collector: Node): Promise<void> {
super.collect(collector);
AudioManager.setPlayRateBGM(1.5);
this.animationHandler?.setAnimation('active');
await this.animationHandler?.setAnimationAsync('active');
this.animationHandler?.setNodeActive(false);
}
public end(): void {
@ -33,7 +33,13 @@ export class CumulativeBooster extends BoosterBase {
await super.onGet();
if (this.animationHandler) {
this.animationHandler.setNodeActive(true);
this.animationHandler.setAnimation('idle', { loop: true });
this.sprite.setNodeActive(false);
}
}
onRelease(): void {
super.onRelease();
this.animationHandler?.setNodeActive(false);
}
}

View File

@ -40,12 +40,12 @@ export class ScoreObject extends Component implements IPoolable {
private _originColor: Color;
private _isHit = false;
private _enabled: boolean = true;
private _colliderEnabled: boolean = true;
protected onLoad(): void {
this._collider.on(Contact2DType.BEGIN_CONTACT, this.onContactBegin, this);
this._originColor = this._sprite.color.clone();
this._enabled = false;
this._colliderEnabled = false;
}
protected update(dt: number): void {
@ -68,10 +68,10 @@ export class ScoreObject extends Component implements IPoolable {
}
private async onContactBegin(selfCollider: Collider2D, otherCollider: Collider2D) {
if (!this._enabled) return;
if (!this._colliderEnabled) return;
if (this._isHit) return;
if (this._hitSound) AudioManager.playSfx(this._hitSound);
this._enabled = false;
this._colliderEnabled = false;
// let center = this.node.getWorldPosition();
// let other = otherCollider.node.getWorldPosition();
// this._flyDirection = center.subtract(other);
@ -91,12 +91,12 @@ export class ScoreObject extends Component implements IPoolable {
public async onGet() {
this._animation.play(this._animation.clips[0].name);
await Utils.delay(this._animation.clips[0].duration);
this._enabled = true;
this._colliderEnabled = true;
}
public onRelease() {
this._isHit = false;
this._enabled = false;
this._colliderEnabled = false;
this.node.angle = 0;
this.node.setScale(Vec3.ONE);
this._sprite.color = this._originColor;

View File

@ -22,7 +22,7 @@ export default class SlingShot extends Component {
const velocity = other.getComponent(RigidBody2D).linearVelocity.length();
AudioManager.playSfx(this._soundFx);
if (velocity >= 40) {
CameraController.instance.shake(0.08);
CameraController.instance.shake(0.1);
}
}
}

View File

@ -35,7 +35,7 @@ export class Cannon extends Component {
@property({ type: EventHandler, visible: true })
private onDone: EventHandler[] = [];
private _enabled: boolean = true;
private _colliderEnabled: boolean = true;
protected onLoad(): void {
this._collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
@ -43,14 +43,14 @@ export class Cannon extends Component {
}
private async onBeginContact(self: Collider2D, other: Collider2D) {
if (!this._enabled) return;
if (!this._colliderEnabled) return;
const ball = other.getComponent(Ball);
this._enabled = false;
this._colliderEnabled = false;
if (ball) {
ball.clearRigiState(false);
tween(ball.node).to(0.1, { worldPosition: this.node.worldPosition }).start();
await Utils.delay(TimeConfig.DelayCannonFire);
CameraController.instance.shake(0.2);
CameraController.instance.shake(0.3);
this._animation.play();
ball.clearRigiState(true);
ball.throwBall(new Vec2(0, this._force));
@ -63,7 +63,7 @@ export class Cannon extends Component {
private onBallOut() {
tween(this._collider.node)
.to(0.5, { scale: Vec3.ONE }, { easing: 'backOut', onComplete: () => (this._enabled = true) })
.to(0.5, { scale: Vec3.ONE }, { easing: 'backOut', onComplete: () => (this._colliderEnabled = true) })
.start();
}
}

View File

@ -64,7 +64,7 @@ export class MultiBall extends Component {
protected lateUpdate(dt: number): void {
if (this._trigged) {
CameraController.instance.shake(0.2);
CameraController.instance.shake(0.3);
const ball1 = this._originBall;
ball1.clearRigiState(false);
const ball2 = GameManager.instance.spawnBall(false, false);
@ -83,7 +83,7 @@ export class MultiBall extends Component {
}
public async spawnBall(quantity: number) {
CameraController.instance.shake(0.2);
CameraController.instance.shake(0.3);
this._colliderEnabled = false;
for (let i = 0; i < quantity; i++) {
const ball = GameManager.instance.spawnBall(false, false);