Topic: Need help making TitleScreen that shows after Intro and before Main

Hi! I have been trying to make a title screen that shows after the intro video, but before the main menu.  I have tried modifying the main menu screen prefab and textureintroscreen prefab, but cannot get anything to work properly.  If someone could help point out what to add in globalinfo.cs and explain how to neatly setup a script for the titlescreen that would help a lot! Thank you!

Share

Thumbs up Thumbs down

2 (edited by TheAtomicFist 2016-01-14 20:30:08)

Re: Need help making TitleScreen that shows after Intro and before Main

I made a title screen visible, seeing if it works now.

Edit: Title Screen works! If anyone is interesting in learning what I did, let me know.  I would be happy to help.

Share

Thumbs up Thumbs down

Re: Need help making TitleScreen that shows after Intro and before Main

Please let us know how you did that smile

shubi's Website

Share

Thumbs up +1 Thumbs down

Re: Need help making TitleScreen that shows after Intro and before Main

shubi wrote:

Please let us know how you did that smile

I have started writing a guide and will post here tomorrow.  Need to make sure I do not skip anything.  There is a lot of copying and pasting and searching.

Share

Thumbs up +5 Thumbs down

Re: Need help making TitleScreen that shows after Intro and before Main

I would really REALLY like to know how did you did it!

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

6 (edited by TheAtomicFist 2016-01-15 19:09:05)

Re: Need help making TitleScreen that shows after Intro and before Main

Here is a quick guide on how I made my title screen, aka MainMenuScreen 2. MAKE A BACKUP JUST IN CASE!

Step 1: Making the Title Screen option appear in Global Editor.

Open GlobalEditorWindow.cs and search for SubGroupTitle("Main");.  This is where the GUI for each scene is listed. 

Use this and insert where ever you would like.  I pasted this on top of my main menu section.

EditorGUILayout.BeginHorizontal();{
                                    globalInfo.gameGUI.titleScreen = (TitleScreen)EditorGUILayout.ObjectField("Title:", globalInfo.gameGUI.titleScreen, typeof(TitleScreen), true);
                                    EditorGUI.BeginDisabledGroup(DisableScreenButton(globalInfo.gameGUI.titleScreen));{
                                        // if (GUILayout.Button("Open", GUILayout.Width(45))) OpenGUICanvas(globalInfo.gameGUI.mainMenuScreen);
                                        ScreenButton(globalInfo.gameGUI.titleScreen);
                                    } EditorGUI.EndDisabledGroup();
                                } EditorGUILayout.EndHorizontal();

Close the code and see if a new option is available for Title Screen. If not, check your indentions, spacing, etc. After previewing this post, it looks like the code is spaced incorrectly.  In order to get a title screen option, all you have to do is copy main menu or another, and replace everything with title screen.

Now open GlobalInfo.cs and look for this code:

    public IntroScreen introScreen;
    public MainMenuScreen mainMenuScreen;
    public OptionsScreen optionsScreen;
    public CreditsScreen creditsScreen;
    public PauseScreen pauseScreen;

Place public TitleScreen titleScreen; anywhere. I placed my beneath the pause screen.

Step 2: Creating the Title Screen Script.

Create a new script in SCRIPTS/UI/BASE folder in your project and call it TitleScreen. Then paste this code into the script.

using UnityEngine;
using System.Collections;

public class TitleScreen : UFEScreen {
    public virtual void Quit(){
        UFE.Quit();
    }

    public virtual void GoToStoryModeScreen(){
        UFE.StartStoryMode();
    }

    public virtual void GoToVersusModeScreen(){
        UFE.StartVersusModeScreen();
    }

    public virtual void GoToTrainingModeScreen(){
        UFE.StartTrainingMode();
    }

    public virtual void GoToNetworkPlayScreen(){
        UFE.StartNetworkGameScreen();
    }

    public virtual void GoToOptionsScreen(){
        UFE.StartOptionsScreen();
    }

    public virtual void GoToMainMenuScreen(){
        UFE.StartMainMenuScreen();
    
    }

    public virtual void GoToCreditsScreen(){
        UFE.StartCreditsScreen();
    }
}

This is the Main Menu script, but with a StartMainMenuScreen function added.

Step 3: Create the DefaultTitleScreen script.

Create a script in SCRIPTS/UI/BASE and call it DefaultTitleScreen. Paste this code inside.

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;

public class DefaultTitleScreen : TitleScreen{
    #region public instance fields
    public AudioClip onLoadSound;
    public AudioClip music;
    public AudioClip selectSound;
    public AudioClip cancelSound;
    public AudioClip moveCursorSound;
    public bool stopPreviousSoundEffectsOnLoad = false;
    public float delayBeforePlayingMusic = 0.1f;

    public Button buttonNetwork;
    #endregion

    #region public override methods
    public override void DoFixedUpdate(){
        base.DoFixedUpdate();
        this.DefaultNavigationSystem(this.selectSound, this.moveCursorSound, null, this.cancelSound);
    }

    public override void OnShow (){
        base.OnShow ();
        this.HighlightOption(this.FindFirstSelectable());

        if (this.music != null){
            UFE.DelayLocalAction(delegate(){UFE.PlayMusic(this.music);}, this.delayBeforePlayingMusic);
        }
        
        if (this.stopPreviousSoundEffectsOnLoad){
            UFE.StopSounds();
        }
        
        if (this.onLoadSound != null){
            UFE.DelayLocalAction(delegate(){UFE.PlaySound(this.onLoadSound);}, this.delayBeforePlayingMusic);
        }
    }
    #endregion
}

Step 4: Change VideoIntro to go to TitleScreen instead of Main Menu.

Open your IntroSceen.cs script and change GoToMainMenu to GoToTitleScreen. You must also change this in the VideoIntro.cs and TextureIntro.cs scripts.

Step 5: Create Title Screen Prefab.

Copy and Paste Main Menu prefab, then switch out the DefaultMainMenu script with the DefaultTitleScript and setup buttons. Once done, drag the prefab to the Title Screen section.

Hopefully I covered everything that needed to be changed.  If not, this is very simple and should be understanding when looking in the right places.  If anyone needs help, I will be available. I get emails from this post.  So feel free to ask!

Share

Thumbs up +4 Thumbs down

Re: Need help making TitleScreen that shows after Intro and before Main

well, i've done it all but the title screen doesn't pop up, and i'm not sure what is wrong. we don't need to change anything in UFE.cs?

thanks in advance

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

Re: Need help making TitleScreen that shows after Intro and before Main

StriderSpinel wrote:

well, i've done it all but the title screen doesn't pop up, and i'm not sure what is wrong. we don't need to change anything in UFE.cs?

thanks in advance

I knew I left something out.  Search for this in UFE.cs:

#region public class methods: GUI Related methods
    public static BattleGUI GetBattleGUI(){
        return UFE.config.gameGUI.battleGUI;
    }

Then add this line of code to match with the others:

public static TitleScreen GetTitleScreen(){
        return UFE.config.gameGUI.titleScreen;
    }

See if that works.

Share

Thumbs up +1 Thumbs down

Re: Need help making TitleScreen that shows after Intro and before Main

TheAtomicFist wrote:
StriderSpinel wrote:

well, i've done it all but the title screen doesn't pop up, and i'm not sure what is wrong. we don't need to change anything in UFE.cs?

thanks in advance

I knew I left something out.  Search for this in UFE.cs:

#region public class methods: GUI Related methods
    public static BattleGUI GetBattleGUI(){
        return UFE.config.gameGUI.battleGUI;
    }

Then add this line of code to match with the others:

public static TitleScreen GetTitleScreen(){
        return UFE.config.gameGUI.titleScreen;
    }

See if that works.


it stil doesn't work, in introscreen.cs  i have

using UnityEngine;
using System.Collections;

public class IntroScreen : UFEScreen {
    public virtual void GoToTitleScreen(){
        UFE.StartMainMenuScreen(0f);
    }
}

i don't know if that area "start main menu screen" have something to do with it, i'm really bad at coding

Thanks!

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

Re: Need help making TitleScreen that shows after Intro and before Main

StriderSpinel wrote:
TheAtomicFist wrote:
StriderSpinel wrote:

well, i've done it all but the title screen doesn't pop up, and i'm not sure what is wrong. we don't need to change anything in UFE.cs?

thanks in advance

I knew I left something out.  Search for this in UFE.cs:

#region public class methods: GUI Related methods
    public static BattleGUI GetBattleGUI(){
        return UFE.config.gameGUI.battleGUI;
    }

Then add this line of code to match with the others:

public static TitleScreen GetTitleScreen(){
        return UFE.config.gameGUI.titleScreen;
    }

See if that works.


it stil doesn't work, in introscreen.cs  i have

using UnityEngine;
using System.Collections;

public class IntroScreen : UFEScreen {
    public virtual void GoToTitleScreen(){
        UFE.StartMainMenuScreen(0f);
    }
}

i don't know if that area "start main menu screen" have something to do with it, i'm really bad at coding

Thanks!

Change StartMainMenuScreen to StartTitleScreen.

Share

Thumbs up Thumbs down

Re: Need help making TitleScreen that shows after Intro and before Main

the text turns red and gives me this error:

Assets/UFE/Scripts/UI/Base/IntroScreen.cs(6,21): error CS0117: `UFE' does not contain a definition for `StartTitleScreen'

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

12 (edited by TheAtomicFist 2016-01-16 18:40:36)

Re: Need help making TitleScreen that shows after Intro and before Main

StriderSpinel wrote:

the text turns red and gives me this error:

Assets/UFE/Scripts/UI/Base/IntroScreen.cs(6,21): error CS0117: `UFE' does not contain a definition for `StartTitleScreen'

I have had this problem before.  There is another part I left out.   

Search for this:

private static void _StartMainMenuScreen(float fadeTime){
        if (UFE.isConnected && !UFE.disconnecting) Network.Disconnect();
        CameraFade.StartAlphaFade(Color.black, true, fadeTime);

        UFE.EndGame();
        UFE.HideScreen(UFE.currentScreen);
        if (UFE.config.gameGUI.mainMenuScreen == null){
            Debug.LogError("Main Menu Screen not found! Make sure you have set the prefab correctly in the Global Editor");
        }else{
            UFE.ShowScreen(UFE.config.gameGUI.mainMenuScreen);
        }
    }

Then add this below it:

private static void _StartTitleScreen(float fadeTime){
        if (UFE.isConnected && !UFE.disconnecting) Network.Disconnect();
        CameraFade.StartAlphaFade(Color.black, true, fadeTime);
        
        UFE.EndGame();
        UFE.HideScreen(UFE.currentScreen);
        if (UFE.config.gameGUI.titleScreen == null){
            Debug.LogError("Title Screen not found! Make sure you have set the prefab correctly in the Global Editor");
        }else{
            UFE.ShowScreen(UFE.config.gameGUI.titleScreen);
        }
    }

Share

Thumbs up Thumbs down

Re: Need help making TitleScreen that shows after Intro and before Main

ok... i did that and it told me it dind't have a StartTitleScreen in UFE.cs

so i searched and found this:

public static void StartMainMenuScreen(){
        UFE.StartMainMenuScreen(UFE.config.gameGUI.defaultFadeDuration);
    }

    public static void StartMainMenuScreen(float fadeTime){
        CameraFade.StartAlphaFade(Color.black, false, fadeTime/2f, 0, () => { UFE._StartTitleScreen(fadeTime/2f); });
    }

and added this:

public static void StartTitleScreen(){
        UFE.StartTitleScreen(UFE.config.gameGUI.defaultFadeDuration);
    }
    
    public static void StartTitleScreen(float fadeTime){
        CameraFade.StartAlphaFade(Color.black, false, fadeTime/2f, 0, () => { UFE._StartTitleScreen(fadeTime/2f); });
    }

now the title screen appears! but i ca't get out of it!

it's almost there i think!

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

Re: Need help making TitleScreen that shows after Intro and before Main

StriderSpinel wrote:

ok... i did that and it told me it dind't have a StartTitleScreen in UFE.cs

so i searched and found this:

public static void StartMainMenuScreen(){
        UFE.StartMainMenuScreen(UFE.config.gameGUI.defaultFadeDuration);
    }

    public static void StartMainMenuScreen(float fadeTime){
        CameraFade.StartAlphaFade(Color.black, false, fadeTime/2f, 0, () => { UFE._StartTitleScreen(fadeTime/2f); });
    }

and added this:

public static void StartTitleScreen(){
        UFE.StartTitleScreen(UFE.config.gameGUI.defaultFadeDuration);
    }
    
    public static void StartTitleScreen(float fadeTime){
        CameraFade.StartAlphaFade(Color.black, false, fadeTime/2f, 0, () => { UFE._StartTitleScreen(fadeTime/2f); });
    }

now the title screen appears! but i ca't get out of it!

it's almost there i think!

What do you mean when you say you can't get out of it?

Share

Thumbs up +1 Thumbs down

Re: Need help making TitleScreen that shows after Intro and before Main

the title screen appears, but no button takes me to the main menu, if i press ok or cancel the sounds play, but the screen won't change.

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

Re: Need help making TitleScreen that shows after Intro and before Main

StriderSpinel wrote:

the title screen appears, but no button takes me to the main menu, if i press ok or cancel the sounds play, but the screen won't change.

Easy fix, you just have to go into the TitleScreen Prefab, make a button and you should be able to assign the TitleScreen Object to the button script and set it to GoToMainMenu.

Share

Thumbs up +1 Thumbs down

Re: Need help making TitleScreen that shows after Intro and before Main

well, well, now that i think of it, i don't have any buttons... silly me, nobody can't tell the game i want to go out...

my bad.

:S

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

Re: Need help making TitleScreen that shows after Intro and before Main

TheAtomicFist wrote:
StriderSpinel wrote:

the title screen appears, but no button takes me to the main menu, if i press ok or cancel the sounds play, but the screen won't change.

Easy fix, you just have to go into the TitleScreen Prefab, make a button and you should be able to assign the TitleScreen Object to the button script and set it to GoToMainMenu.

i put the button, but now it's in a loop... i told it to go to Mainmenu, but it returns to the title screen over and over again

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

Re: Need help making TitleScreen that shows after Intro and before Main

StriderSpinel wrote:
TheAtomicFist wrote:
StriderSpinel wrote:

the title screen appears, but no button takes me to the main menu, if i press ok or cancel the sounds play, but the screen won't change.

Easy fix, you just have to go into the TitleScreen Prefab, make a button and you should be able to assign the TitleScreen Object to the button script and set it to GoToMainMenu.

i put the button, but now it's in a loop... i told it to go to Mainmenu, but it returns to the title screen over and over again

That's odd. Not quite sure what the problem is to be honest.  ONly thing I can think of is that the Main Menu is set as the title screen as well now. Other than that, go through GlobalEditor, UFE, the TitleScreen scripts/Main Menu scripts and IntroScreen scripts to make sure the terms are all the same. If you have skype or another instant messaging system, I can help you through there.  Communication will be faster.

Share

Thumbs up +1 Thumbs down

Re: Need help making TitleScreen that shows after Intro and before Main

i've sent you a PM, can't found out what it is

Thanks!

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

Re: Need help making TitleScreen that shows after Intro and before Main

Sounds like either your GoToMainMenu() or _GoToMainMenu() methods are calling the Title Screen, or you have the title screen set as your main menu gui prefab.

Share

Thumbs up Thumbs down