Example #1
0
 void OnGUI()
 {
     if (GUI.Button(backButtonRect, "", backButtonStyle))
     {
         UFE.StartIntro(2);
     }
 }
    void OnGUI()
    {
        GUI.skin       = customSkin;
        p1JoystickName = "";
        p2JoystickName = "";
        string[] joysticks = Input.GetJoystickNames();
        foreach (string joystickName in joysticks)
        {
            if (joystickName != p2JoystickName)
            {
                p1JoystickName = joystickName;
            }
            if (joystickName != p1JoystickName)
            {
                p2JoystickName = joystickName;
            }
        }

        p1KeyboardSelected = GUI.Toggle(SetResolution(new Rect(412, 176, 202, 59)), p1KeyboardSelected, "", p1KeyboardStyle);
        if (p1KeyboardSelected)
        {
            p1ControllerSelected = false;
            foreach (InputReferences inputRef in UFE.config.player1_Inputs)
            {
                if (inputRef.inputType == InputType.HorizontalAxis)
                {
                    inputRef.inputButtonName = "P1KeyboardHorizontal";
                    p1HorizontalAxis         = inputRef.inputButtonName;
                }
                else if (inputRef.inputType == InputType.VerticalAxis)
                {
                    inputRef.inputButtonName = "P1KeyboardVertical";
                    p1VerticalAxis           = inputRef.inputButtonName;
                }
            }
        }
        if (!p1KeyboardSelected && !p1ControllerSelected)
        {
            p1KeyboardSelected = true;
        }

        if (p1JoystickName == "")
        {
            GUI.enabled = false;
        }
        p1ControllerSelected = GUI.Toggle(SetResolution(new Rect(421, 324, 177, 116)), p1ControllerSelected, "", controllerStyle);
        if (p1ControllerSelected && p1KeyboardSelected)
        {
            p1KeyboardSelected = false;
            foreach (InputReferences inputRef in UFE.config.player1_Inputs)
            {
                if (inputRef.inputType == InputType.HorizontalAxis)
                {
                    inputRef.inputButtonName = "P1JoystickHorizontal";
                    p1HorizontalAxis         = inputRef.inputButtonName;
                }
                else if (inputRef.inputType == InputType.VerticalAxis)
                {
                    inputRef.inputButtonName = "P1JoystickVertical";
                    p1VerticalAxis           = inputRef.inputButtonName;
                }
            }
        }
        GUI.enabled = true;

        p2KeyboardSelected = GUI.Toggle(SetResolution(new Rect(677, 176, 202, 59)), p2KeyboardSelected, "", p2KeyboardStyle);
        if (p2KeyboardSelected && p2ControllerSelected)
        {
            p2ControllerSelected = false;
            foreach (InputReferences inputRef in UFE.config.player2_Inputs)
            {
                if (inputRef.inputType == InputType.HorizontalAxis)
                {
                    inputRef.inputButtonName = "P2KeyboardHorizontal";
                    p2HorizontalAxis         = inputRef.inputButtonName;
                }
                else if (inputRef.inputType == InputType.VerticalAxis)
                {
                    inputRef.inputButtonName = "P2KeyboardVertical";
                    p2VerticalAxis           = inputRef.inputButtonName;
                }
            }
        }
        if (!p2KeyboardSelected && !p2ControllerSelected)
        {
            p2KeyboardSelected = true;
        }

        if (p2JoystickName == "")
        {
            GUI.enabled = false;
        }
        p2ControllerSelected = GUI.Toggle(SetResolution(new Rect(691, 324, 177, 116)), p2ControllerSelected, "", controllerStyle);
        if (p2ControllerSelected && p2KeyboardSelected)
        {
            p2KeyboardSelected = false;
            foreach (InputReferences inputRef in UFE.config.player1_Inputs)
            {
                if (inputRef.inputType == InputType.HorizontalAxis)
                {
                    inputRef.inputButtonName = "P2JoystickHorizontal";
                    p2HorizontalAxis         = inputRef.inputButtonName;
                }
                else if (inputRef.inputType == InputType.VerticalAxis)
                {
                    inputRef.inputButtonName = "P2JoystickVertical";
                    p2VerticalAxis           = inputRef.inputButtonName;
                }
            }
        }
        GUI.enabled = true;


        Texture2D p1SelectedBig = null;
        Texture2D p2SelectedBig = null;

        //GUI.BeginGroup(SetResolution(new Rect(457, 465, 378, 220)));{
        GUI.BeginGroup(SetResolution(charactersGrid)); {
            int xCount       = 0;
            int yCount       = 0;
            int currentIndex = 0;
            foreach (CharacterInfo character in UFE.config.characters)
            {
                float xPos = 96 * xCount;
                float yPos = 114 * yCount;

                xCount++;
                if (xCount == gridColumns)
                {
                    yCount++;
                    xCount = 0;
                }
                GUI.DrawTexture(SetResolution(new Rect(xPos, yPos, 86, 105)), character.profilePictureSmall);
                //GUI.DrawTextureWithTexCoords(SetResolution(new Rect(xPos, yPos, 86, 105)), character.profilePictureSmall, new Rect(0, 0, 1, 1));
                //if (GUI.Button(SetResolution(new Rect(xPos, yPos, 86, 105)), character.profilePictureSmall)) {
                // .
                //}

                //if (UFE.config.player1Character != null)

                //GUI.color = new Color(1,1,1,(Mathf.Sin(Time.time * 20) + 1)/ 2);

                if (p1HoverIndex == currentIndex && p1HoverIndex == p2HoverIndex)
                {
                    bool selTemp = (UFE.config.player1Character != null && UFE.config.player1Character != null)? true : false;
                    DrawHud(new Rect(xPos, yPos, 86, 105), p1P2Hud, selTemp);
                    //GUI.DrawTexture(SetResolution(new Rect(xPos, yPos, 86, 105)), p1P2Hud);
                    p1SelectedBig = character.profilePictureBig;
                    p2SelectedBig = character.profilePictureBig;
                }
                else
                {
                    if (p1HoverIndex == currentIndex)
                    {
                        DrawHud(new Rect(xPos, yPos, 86, 105), p1Hud, (UFE.config.player1Character != null));
                        //GUI.DrawTexture(SetResolution(new Rect(xPos, yPos, 86, 105)), p1Hud);
                        p1SelectedBig = character.profilePictureBig;
                    }

                    if (p2HoverIndex == currentIndex)
                    {
                        DrawHud(new Rect(xPos, yPos, 86, 105), p2Hud, (UFE.config.player2Character != null));
                        //GUI.DrawTexture(SetResolution(new Rect(xPos, yPos, 86, 105)), p2Hud);
                        p2SelectedBig = character.profilePictureBig;
                    }
                }

                //GUI.color = Color.white;

                currentIndex++;
            }
        } GUI.EndGroup();


        if (p1SelectedBig != null)
        {
            GUI.DrawTexture(SetResolution(new Rect(79, 112, 311, 496)), p1SelectedBig);
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUI.skin.label.fontSize  = 30 * (Screen.height / 720);
            GUI.Label(SetResolution(new Rect(178, 597, 250, 50)), UFE.config.characters[p1HoverIndex].characterName);
        }
        if (p2SelectedBig != null)
        {
            GUI.DrawTextureWithTexCoords(SetResolution(new Rect(902, 113, 311, 496)), p2SelectedBig, new Rect(0, 0, -1, 1));
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUI.skin.label.fontSize  = 30 * (Screen.height / 720);
            GUI.Label(SetResolution(new Rect(860, 597, 250, 50)), UFE.config.characters[p2HoverIndex].characterName);
        }
        GUI.skin.label.alignment = TextAnchor.UpperLeft;

        GUI.DrawTexture(SetResolution(new Rect(61, 554, p1Overlay.width, p1Overlay.height)), p1Overlay);
        GUI.DrawTexture(SetResolution(new Rect(1130, 554, p2Overlay.width, p2Overlay.height)), p2Overlay);

        if (GUI.Button(returnButtonRect, "", returnButtonStyle))
        {
            UFE.StartIntro(2);
        }
    }
Example #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);
    }