Example #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();
        }
    }
Example #2
0
 public virtual void ToggleSoundFX()
 {
     UFE.SetSoundFX(!UFE.GetSoundFX());
 }
Example #3
0
 public virtual void SetSoundFX(bool enabled)
 {
     UFE.SetSoundFX(enabled);
 }
Example #4
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);
    }