Skip to content
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

[Question] How do you properly make an implementation based on IGameUI::OnLevelLoadingFinished? #411

Open
colistro123 opened this issue Mar 12, 2017 · 2 comments
Labels

Comments

@colistro123
Copy link

colistro123 commented Mar 12, 2017

Long story short, I replaced the game ui and loading screens with HTML but once the levels are done loading I want to hide the loading screen. OnLevelLoadingFinished gets invoked once the loading screens are done but not sure on how to make a proper implementation for it.

I haven't been able to find anything to make a class that inherits from IGameUI to be able to receive the OnLevelLoadingFinished call and do something from there depending on the bError / failureReason result. As a last resort I decided to do some hideous thing like getting the IGameUI vtable, replacing the OnLevelLoadingFinished member for one of mine and calling back the original function but that's not how you should do things.

Thanks in advance.

@colistro123 colistro123 changed the title [Question] How do you properly 'hook' IGameUI::OnLevelLoadingFinished? [Question] How do you properly make an implementation based on IGameUI::OnLevelLoadingFinished? Mar 12, 2017
@BerntA
Copy link

BerntA commented Mar 12, 2017

Can't you just use SetLoadingBackgroundDialog?

Example:

static CDllDemandLoader g_GameUIDLL("GameUI");
CreateInterfaceFn gameUIFactory = g_GameUIDLL.GetFactory();
if (gameUIFactory)
{
	GameUI = (IGameUI *)gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL);
	if (GameUI)
		GameUI->SetLoadingBackgroundDialog(MyPanel->GetVPanel());
}

@colistro123
Copy link
Author

@BerntA Thanks, yeah I'm doing this to set the html panels as the backgrounds, problem is that I have another panel that needs triggering once the game is either:

A: Done loading a level.
B: Fails to load a level.

As I said before there's OnLevelLoadingFinished in the IGameUI class but I couldn't find anything to make a class that inherits from that one so I know when OnLevelLoadingFinished is called.

I temporarily solved it by getting the loading state bool from GameUI (which is set to true once a level is loading and then set to false when the loading finishes or fails) and checking it in an UpdateFrame function but that's a really 'hacky' workaround I shouldn't be doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants