Skip to content

Conversation

FreezyLemon
Copy link
Contributor

What the title says.
Also updated the Tests to implement the new class (works on my end).

Some changes will have to be made in the main game repository to work with this (namely renaming all previous wrapper class/constructor uses to "LoadWrapper" instead. Yes, that's it).
This is referring to this issue over at the main repo. I will also post a PR there including this change alongside the other requested changes.

…e old AsyncLoadWrapper and DelayedLoadWrapper classes.

Syntactically mostly the same: Only if you used a DelayedLoadWrapper instance without explicitly setting a TimeBeforeLoad which used to set a default delay of 500 (ms), this will now set it to zero in the new constructor, making it not delayed. This is so that all "AsyncLoadWrapper" constructors will still work.
If you want to delay the loading, you will now HAVE to explicitly change the TimeBeforeLoad. Every DelayedLoadWrapper implementation already explicitly defined it, so nothing really had to be changed (except for obviously the naming).
@peppy
Copy link
Member

peppy commented Nov 22, 2017

Tempted to keep the remaining class called DelayedLoadWrapper, and possible passing in the time before load as a ctor parameter. @Tom94 @smoogipoo thoughts on this?

@peppy peppy added this to the November 2017 milestone Nov 22, 2017
@smoogipoo
Copy link
Contributor

Would keep the AsyncLoadWrapper naming, but keep it as it is otherwise.

@peppy
Copy link
Member

peppy commented Nov 22, 2017

@FreezyLemon let's go with keeping DelayedLoadWrapper.

@FreezyLemon
Copy link
Contributor Author

Should I change default behaviour then? I mean, if it's called DelayedLoadWrapper, shouldn't it delay by default? (Atm it works like the old AsyncLoadWrapper used to if you don't change the TimeBeforeLoad after constructor call)

@peppy
Copy link
Member

peppy commented Nov 22, 2017

i’d put the delay in the ctor

/// <remarks>If <see cref="timeBeforeLoad"/> remains unchanged (at 0), the loading process will not be delayed.</remarks>
/// <param name="content">The <see cref="Drawable"/> to be loaded.</param>
/// <param name="timeBeforeLoad">The delay in milliseconds before loading begins. Zero means immediate loading.</param>
public DelayedLoadWrapper(Drawable content, double timeBeforeLoad = 0)

This comment was marked as off-topic.

}
}),
},
500),

This comment was marked as off-topic.

Size = new Vector2(0.25f)
}),
},
500),

This comment was marked as off-topic.

[BackgroundDependencyLoader]
private void load()
{
if (ShouldLoadContent)

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

peppy
peppy previously approved these changes Nov 23, 2017
/// In order to benefit from delayed load, we must be inside a <see cref="ScrollContainer"/>.
/// </summary>
public class DelayedLoadWrapper : AsyncLoadWrapper
public class DelayedLoadWrapper : Container

This comment was marked as off-topic.

This comment was marked as off-topic.

@peppy peppy merged commit 549126b into ppy:master Nov 23, 2017
@FreezyLemon FreezyLemon deleted the load-optimization branch June 7, 2018 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants