-
Notifications
You must be signed in to change notification settings - Fork 928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force sounds to download even when "preload in cache" is unchecked #5984
Merged
+199
−58
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1261be3
Force sounds to be downloaded.
D8H cadeba6
Keep the background image for intermediate loading screens.
D8H 176baa0
Fix background color.
D8H 8be9763
Ensure that the logo will actually be shown if enabled.
D8H 3ef45e8
Add an icon for the new action.
D8H d1a5cbb
Fix icon ratio.
D8H d3821c7
Fix flow.
D8H 7721889
Download the background image before any other resources.
D8H b6ab855
Don't show the background color if there is a background image to avo…
D8H 1fef2f1
Only override forbidden values.
D8H f96f78d
Simplify a path of the icon.
D8H 6670543
Add a comment.
D8H File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ namespace gdjs { | |
} | ||
|
||
const fadeIn = ( | ||
object: PIXI.DisplayObject | null, | ||
object: { alpha: number } | null, | ||
duration: float, | ||
deltaTimeInMs: float | ||
) => { | ||
|
@@ -54,14 +54,12 @@ namespace gdjs { | |
return; | ||
} | ||
this._pixiRenderer.background.color = this._loadingScreenData.backgroundColor; | ||
this._pixiRenderer.background.alpha = 0; | ||
|
||
const backgroundTexture = imageManager.getOrLoadPIXITexture( | ||
loadingScreenData.backgroundImageResourceName | ||
); | ||
if ( | ||
backgroundTexture !== imageManager.getInvalidPIXITexture() && | ||
isFirstScene | ||
) { | ||
if (backgroundTexture !== imageManager.getInvalidPIXITexture()) { | ||
this._backgroundSprite = PIXI.Sprite.from(backgroundTexture); | ||
this._backgroundSprite.alpha = 0; | ||
this._backgroundSprite.anchor.x = 0.5; | ||
|
@@ -173,6 +171,15 @@ namespace gdjs { | |
} else if (this._state == LoadingScreenState.STARTED) { | ||
const backgroundFadeInDuration = this._loadingScreenData | ||
.backgroundFadeInDuration; | ||
|
||
this._pixiRenderer.clear(); | ||
if (!this._backgroundSprite) { | ||
fadeIn( | ||
this._pixiRenderer.background, | ||
backgroundFadeInDuration, | ||
deltaTimeInMs | ||
); | ||
} | ||
fadeIn(this._backgroundSprite, backgroundFadeInDuration, deltaTimeInMs); | ||
|
||
if (hasFadedIn(this._backgroundSprite)) { | ||
|
@@ -245,6 +252,13 @@ namespace gdjs { | |
); | ||
this._progressBarGraphics.endFill(); | ||
} | ||
} else if (this._state === LoadingScreenState.FINISHED) { | ||
// Display a black screen to avoid a stretched image of the loading | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, great polishing work. |
||
// screen to appear. | ||
this._pixiRenderer.background.color = 'black'; | ||
this._pixiRenderer.background.alpha = 1; | ||
this._pixiRenderer.clear(); | ||
this._loadingScreenContainer.removeChildren(); | ||
} | ||
|
||
this._pixiRenderer.render(this._loadingScreenContainer); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a risk to download large files that have not been tagged as "preload as a music" by the user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, we have the choice between:
I didn't update the UI because we may make it asynchronous if it's a good trade off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok! What do we do about the other TODO "Decide if sounds should be allowed to be downloaded after the scene starts"?