- Home /
How to add a popup GUI on a specific level before the Win popup?
Hi there. I am having a little bit of trouble getting a GUI popup to show up just before the Win popup in my game.
I have the code set to make a restaurant card popup before the Win popup, but with no errors, the game wants to default to the Win popup only.
I have declared Current Level in the public int status, added Current Level to equal 1 on the awake function, and added a void function to call the Restaurant Card popup.
Can anyone help me out.
Here is the code that I am using:
// Showing lose popup void ShowLosePopup () { AudioAssistant.Shot ("YouLose"); isPlaying = false; GameCamera.main.HideField(); UIAssistant.main.ShowPage("YouLose"); }
// Showing Restaurant Card popup
//================================================================================================
void RestaurantCard ()
{
AudioAssistant.Shot ("Card");
isPlaying = false;
GameCamera.main.HideField();
UIAssistant.main.ShowPage("RestaurantCard");
}
//================================================================================================
// Showing win popup
IEnumerator YouWin ()
{
AudioAssistant.Shot ("YouWin");
PlayerPrefs.SetInt("FirstPass", 1);
isPlaying = false;
ProfileAssistant.main.local_profile["life"]++;
if (ProfileAssistant.main.local_profile.current_level == LevelProfile.main.level)
if (Level.all.ContainsKey(ProfileAssistant.main.local_profile.current_level + 1))
ProfileAssistant.main.local_profile.current_level++;
ProfileAssistant.main.local_profile.SetScore(LevelProfile.main.level, score);
GameCamera.main.HideField();
yield return 0;
while (CPanel.uiAnimation > 0)
yield return 0;
yield return 0;
UIAssistant.main.ShowPage("YouWin");
UserProfileUtils.WriteProfileOnDevice(ProfileAssistant.main.local_profile);
}
public void ShowYouWinPopup() {
bool bestScore = false;
if (ProfileAssistant.main.local_profile.GetScore(LevelProfile.main.level) < score) {
ProfileAssistant.main.local_profile.SetScore(LevelProfile.main.level, score);
bestScore = true;
}
UIAssistant.main.ShowPage(bestScore ? "YouWinBestScore" : "YouWin");
}
Answer by tormentoarmagedoom · Apr 04, 2018 at 09:11 AM
Can you simplify/generalize your problem? What you need?
If you know how to make a popup, i dont understand why dont know how to do 2 of them. Call the restaurantCard instead of Youwin. And inside restaurant call the youwin