Beispiel #1
0
    void OnGUI()
    {
        // Small GUI code to make the 3 option menu
        GUI.skin = customSkin;

        if (optionsIsOpen)
        {
            GUI.enabled = false;
        }

        if (startingCharacterSelect)
        {
            GUI.color = new Color(1, 1, 1, (Mathf.PingPong(Time.time * 15, 1)) / 2);
        }
        if (GUI.Button(startButtonRect, "", startButtonStyle) && !startingCharacterSelect)
        {
            if (UFE.config.soundfx)
            {
                Camera.main.audio.PlayOneShot(selectSound);
            }
            Invoke("StartCharacterSelect", .5f);
            startingCharacterSelect = true;
        }
        GUI.color = Color.white;

        if (GUI.Button(optionsButtonRect, "", optionsButtonStyle) && !startingCharacterSelect)
        {
            if (UFE.config.soundfx)
            {
                Camera.main.audio.PlayOneShot(selectSound);
            }
            optionsIsOpen = true;
        }

        if (GUI.Button(creditsButtonRect, "", creditsButtonStyle) && !startingCharacterSelect)
        {
            if (UFE.config.soundfx)
            {
                Camera.main.audio.PlayOneShot(selectSound);
            }
            UFE.StartCreditsScreen(2);
        }
        GUI.enabled = true;

        if (optionsIsOpen)
        {
            GUI.BeginGroup(new Rect(Screen.width / 2 - 200, Screen.height / 2 - 130, 400, 220)); {
                GUI.Box(new Rect(0, 0, 400, 220), "Options");
                GUI.BeginGroup(new Rect(15, 0, 380, 220)); {
                    GUILayoutUtility.GetRect(1, 45);

                    GUILayout.BeginHorizontal(); {
                        GUILayout.Label("Music", GUILayout.Width(240));
                        if (UFE.GetMusic())
                        {
                            if (GUILayout.Button("On", GUILayout.Width(120)))
                            {
                                UFE.SetMusic(false);
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("Off", GUILayout.Width(120)))
                            {
                                UFE.SetMusic(true);
                            }
                        }
                    } GUILayout.EndHorizontal();

                    if (UFE.GetMusic())
                    {
                        GUILayout.BeginHorizontal(); {
                            GUILayout.Label("Music Volume", GUILayout.Width(240));
                            UFE.SetVolume(GUILayout.HorizontalSlider(UFE.GetVolume(), 0, 1, GUILayout.Width(120)));
                        } GUILayout.EndHorizontal();
                    }
                    else
                    {
                        GUILayoutUtility.GetRect(1, 34);
                    }

                    GUILayout.BeginHorizontal(); {
                        GUILayout.Label("Sound FX", GUILayout.Width(240));
                        if (UFE.GetSoundFX())
                        {
                            if (GUILayout.Button("On", GUILayout.Width(120)))
                            {
                                UFE.SetSoundFX(false);
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("Off", GUILayout.Width(120)))
                            {
                                UFE.SetSoundFX(true);
                            }
                        }
                    } GUILayout.EndHorizontal();

                    GUILayoutUtility.GetRect(1, 40);
                    GUILayout.BeginHorizontal(); {
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("Close"))
                        {
                            optionsIsOpen = false;
                        }
                        GUILayout.FlexibleSpace();
                    } GUILayout.EndHorizontal();
                } GUI.EndGroup();
            } GUI.EndGroup();
        }
    }
Beispiel #2
0
 public virtual void SetMusic(bool enabled)
 {
     UFE.SetMusic(enabled);
 }
Beispiel #3
0
    void OnGUI()
    {
        GUI.skin = customSkin;

        if (showSpecials)
        {
            GUI.skin.label.fontSize = 14;
        }
        else
        {
            GUI.skin.label.fontSize = 20;
        }

        if (showControls && UFE.isPaused())
        {
            GUI.BeginGroup(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 200, 500, 400)); {
                GUI.Box(new Rect(0, 0, 500, 400), "Options");
                GUI.BeginGroup(new Rect(15, 0, 480, 400)); {
                    GUILayoutUtility.GetRect(1, 25, GUILayout.Width(470));
                    if (showSpecials)
                    {
                        GUILayout.Label("Fireball - Down, Forward, Punch (any)");
                        GUILayout.Label("Dragon Punch - Forward, Down, Forward, Punch (any)");
                        GUILayout.Label("Super Fireball - Down, Forward, Down, Forward, Light Punch");
                        GUILayout.Label("Super Dragon Punch - Down, Forward, Down, Forward, Medium Punch");
                        GUILayout.Label("Custom Combo 1:");
                        GUILayout.Label("Light Punch, Light Kick, Medium Kick, Heavy Kick");
                        GUILayout.Label("Custom Combo 2:");
                        GUILayout.Label("Light Punch, Heavy Dragon Punch");
                        GUILayout.Label("Custom Combo 3:");
                        GUILayout.Label("Crouching Light Punch, Crouching Light Kick, Crouching Medium Punch,");
                        GUILayout.Label("Crouching Medium Kick, Crouching Heavy Kick");
                        GUILayout.Label("Custom Combo 4:");
                        GUILayout.Label("Crouching Medium Kick, Crouching Heavy Punch, Jump, Medium Kick,");
                        GUILayout.Label("Medium Punch, (land) Crouching Heavy Punch, Super Fireball");
                    }
                    else
                    {
                        GUILayout.BeginHorizontal(); {
                            GUILayout.Label("Player 1");
                            GUILayout.FlexibleSpace();
                            GUILayout.Label("Player 2");
                        } GUILayout.EndHorizontal();

                        GUILayout.BeginHorizontal(); {
                            GUILayout.Label("Controls - W A S D");
                            GUILayout.FlexibleSpace();
                            GUILayout.Label("Controls - Arrow Keys");
                        } GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal(); {
                            GUILayout.Label("Light Punch - T");
                            GUILayout.FlexibleSpace();
                            GUILayout.Label("Light Punch - Insert");
                        } GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal(); {
                            GUILayout.Label("Light Kick - G");
                            GUILayout.FlexibleSpace();
                            GUILayout.Label("Light Kick - Delete");
                        } GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal(); {
                            GUILayout.Label("Medium Punch - Y");
                            GUILayout.FlexibleSpace();
                            GUILayout.Label("Medium Punch - Home");
                        } GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal(); {
                            GUILayout.Label("Medium Kick - H");
                            GUILayout.FlexibleSpace();
                            GUILayout.Label("Medium Kick - End");
                        } GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal(); {
                            GUILayout.Label("Heavy Punch - U");
                            GUILayout.FlexibleSpace();
                            GUILayout.Label("Heavy Punch - Page Up");
                        } GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal(); {
                            GUILayout.Label("Heavy Kick - J");
                            GUILayout.FlexibleSpace();
                            GUILayout.Label("Heavy Kick - Page Down");
                        } GUILayout.EndHorizontal();
                    }

                    GUILayoutUtility.GetRect(1, 5);
                    GUILayout.BeginHorizontal(); {
                        if (showSpecials)
                        {
                            if (GUILayout.Button("Controls"))
                            {
                                showSpecials = false;
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("Specials"))
                            {
                                showSpecials = true;
                            }
                        }
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("Back"))
                        {
                            showControls = false;
                        }
                    } GUILayout.EndHorizontal();
                } GUI.EndGroup();
            } GUI.EndGroup();
        }
        else if (!showEndMenu && UFE.isPaused())
        {
            GUI.BeginGroup(new Rect(Screen.width / 2 - 200, Screen.height / 2 - 130, 400, 260)); {
                GUI.Box(new Rect(0, 0, 400, 260), "Options");
                GUI.BeginGroup(new Rect(15, 0, 380, 260)); {
                    GUILayoutUtility.GetRect(1, 45);

                    GUILayout.BeginHorizontal(); {
                        GUILayout.Label("Music", GUILayout.Width(240));
                        if (UFE.GetMusic())
                        {
                            if (GUILayout.Button("On", GUILayout.Width(120)))
                            {
                                UFE.SetMusic(false);
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("Off", GUILayout.Width(120)))
                            {
                                UFE.SetMusic(true);
                            }
                        }
                    } GUILayout.EndHorizontal();

                    if (UFE.GetMusic())
                    {
                        GUILayout.BeginHorizontal(); {
                            GUILayout.Label("Music Volume", GUILayout.Width(240));
                            UFE.SetVolume(GUILayout.HorizontalSlider(UFE.GetVolume(), 0, 1, GUILayout.Width(120)));
                        } GUILayout.EndHorizontal();
                    }
                    else
                    {
                        GUILayoutUtility.GetRect(1, 34);
                    }

                    GUILayout.BeginHorizontal(); {
                        GUILayout.Label("Sound FX", GUILayout.Width(240));
                        if (UFE.GetSoundFX())
                        {
                            if (GUILayout.Button("On", GUILayout.Width(120)))
                            {
                                UFE.SetSoundFX(false);
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("Off", GUILayout.Width(120)))
                            {
                                UFE.SetSoundFX(true);
                            }
                        }
                    } GUILayout.EndHorizontal();

                    GUILayoutUtility.GetRect(1, 30);

                    GUILayout.BeginHorizontal(); {
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("Controls", GUILayout.Width(200)))
                        {
                            showControls = true;
                        }
                        GUILayout.FlexibleSpace();
                    } GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(); {
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("Special Moves", GUILayout.Width(200)))
                        {
                            showSpecials = true;
                            showControls = true;
                        }
                        GUILayout.FlexibleSpace();
                    } GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(); {
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("Main Menu", GUILayout.Width(200)))
                        {
                            UFE.StartIntro(2);
                            showEndMenu = false;
                            Destroy(mainAlertGO);
                        }
                        GUILayout.FlexibleSpace();
                    } GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(); {
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("Close"))
                        {
                            UFE.PauseGame(false);
                        }
                        GUILayout.FlexibleSpace();
                    } GUILayout.EndHorizontal();
                } GUI.EndGroup();
            } GUI.EndGroup();
        }

        if (showEndMenu)
        {
            GUI.BeginGroup(new Rect(Screen.width / 2 - 100, Screen.height / 2 + 20, 200, 130)); {
                GUI.Box(new Rect(0, 0, 200, 100), ""); {
                    GUILayoutUtility.GetRect(1, 2);

                    /*GUILayout.BeginHorizontal();{ // Not functional
                     *      GUILayout.FlexibleSpace();
                     *      if (GUILayout.Button("Rematch", GUILayout.Width(200))) {
                     *              UFE.StartGame(2);
                     *              showMenu = false;
                     *              Destroy(mainAlertGO);
                     *      }
                     *      GUILayout.FlexibleSpace();
                     * }GUILayout.EndHorizontal();*/

                    GUILayoutUtility.GetRect(1, 20);
                    GUILayout.BeginHorizontal(); {
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("Character Select", GUILayout.Width(200)))
                        {
                            UFE.StartCharacterSelect(2);
                            showEndMenu = false;
                            Destroy(mainAlertGO);
                        }
                        GUILayout.FlexibleSpace();
                    } GUILayout.EndHorizontal();

                    GUILayoutUtility.GetRect(1, 20);
                    GUILayout.BeginHorizontal(); {
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("Main Menu", GUILayout.Width(200)))
                        {
                            UFE.StartIntro(2);
                            showEndMenu = false;
                            Destroy(mainAlertGO);
                        }
                        GUILayout.FlexibleSpace();
                    } GUILayout.EndHorizontal();
                }
            } GUI.EndGroup();
        }

        if (!isRunning)
        {
            return;
        }
        // Draw the lifebars and gauge bars using the data stored in UFE.config.guiOptions
        DrawBar(UFE.config.guiOptions.lifeBarOptions1, Side.Left, player1TargetLife, player1TotalLife, true);
        DrawBar(UFE.config.guiOptions.lifeBarOptions2, Side.Right, player2TargetLife, player2TotalLife, true);

        DrawBar(UFE.config.guiOptions.gaugeBarOptions1, Side.Left,
                UFE.config.player1Character.currentGaugePoints, UFE.config.player2Character.maxGaugePoints, false);
        DrawBar(UFE.config.guiOptions.gaugeBarOptions1, Side.Right,
                UFE.config.player2Character.currentGaugePoints, UFE.config.player2Character.maxGaugePoints, false);
    }
Beispiel #4
0
 public virtual void ToggleMusic()
 {
     UFE.SetMusic(!UFE.GetMusic());
 }
    protected virtual IEnumerator LoadMovie()
    {
        // Start loading movie from disk...
        string url =
            this.otherPlatformsPath
            .Replace(VideoIntroScreen.Data, Application.dataPath)
            .Replace(VideoIntroScreen.Persistent, Application.persistentDataPath)
            .Replace(VideoIntroScreen.StreamingAssets, Application.streamingAssetsPath)
            .Replace(VideoIntroScreen.Temp, Application.temporaryCachePath);


        WWW          www   = new WWW(url);
        MovieTexture movie = www.movie;

        // Assign the movie to a GUITexture...
        GUITexture guiTexture = this.GetComponent <GUITexture>();

        if (guiTexture == null)
        {
            guiTexture = this.gameObject.AddComponent <GUITexture>();
        }

        AudioClip audio = movie.audioClip;

        guiTexture.pixelInset = new Rect(0f, 0f, Screen.width, Screen.height);
        guiTexture.texture    = movie;

        // Wait the min delay before starting playing the video
        if (this.delayBeforePlayingVideo > 0)
        {
            guiTexture.color = Color.black;
            yield return(new WaitForSeconds(this.delayBeforePlayingVideo));
        }
        guiTexture.color = Color.white;

        // Wait until we have enough information to start playing the movie...
        while (!movie.isReadyToPlay)
        {
            yield return(null);
        }

        // When we're ready to start playing the image, resize the texture
        guiTexture.pixelInset = new Rect(0.5f * Screen.width, 0.5f * Screen.height, 0f, 0f);

        // Start playing the movie
        movie.Play();

        //-------------------------------------------------------------------------------------------------------------
        // We need to enable the sound during the duration of the movie because it doesn't matter the user settings,
        // we want him to hear the AudioClip. However, we need to play this sound as music because Unity won't allow
        // us to play streamed audio as SoundFX (Unity doesn't throw an error, but the AudioClip isn't played).
        //-------------------------------------------------------------------------------------------------------------
        bool      musicEnabled = UFE.GetMusic();
        bool      musicLooped  = UFE.IsMusicLooped();
        float     musicVolume  = UFE.GetMusicVolume();
        AudioClip clip         = UFE.GetMusicClip();

        UFE.SetMusic(true);
        UFE.LoopMusic(false);
        UFE.SetMusicVolume(1f);

        UFE.PlayMusic(audio);

        //-------------------------------------------------------------------------------------------------------------
        // After the video finish, restore the original audio settings.
        //-------------------------------------------------------------------------------------------------------------
        while (movie.isPlaying && !(skippable && Input.anyKeyDown))
        {
            yield return(null);
        }

        //-------------------------------------------------------------------------------------------------------------
        // Check if the video has been skipped. In that case, wait for the "delay after skipping video" time.
        //-------------------------------------------------------------------------------------------------------------
        if (movie.isPlaying && this.delayAfterSkippingVideo > 0f)
        {
            if (this.stopMusicImmediatelyAfterSkippingVideo)
            {
                UFE.StopMusic();
            }

            if (this.stopVideoImmediatelyAfterSkippingVideo)
            {
                movie.Stop();
                guiTexture.color = Color.black;
            }

            yield return(new WaitForSeconds(this.delayAfterSkippingVideo));
        }

        //-------------------------------------------------------------------------------------------------------------
        // If we haven't done it yet, stop the video, the audio and free the used memory
        //-------------------------------------------------------------------------------------------------------------
        UFE.StopMusic();
        movie.Stop();
        GameObject.DestroyObject(clip);
        GameObject.DestroyObject(movie);

        //-------------------------------------------------------------------------------------------------------------
        // Finally, restore the original audio settings...
        //-------------------------------------------------------------------------------------------------------------
        UFE.SetMusic(musicEnabled);
        UFE.LoopMusic(musicLooped);
        UFE.SetMusicVolume(musicVolume);
        UFE.PlayMusic(clip);

        //-------------------------------------------------------------------------------------------------------------
        // And go to the next screen
        //-------------------------------------------------------------------------------------------------------------
        this.GoToNextScreen();
    }