Button() public static method

public static Button ( string text ) : bool
text string
return bool
Beispiel #1
0
    private void DrawServerOptionsWindow(int id)
    {
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.BeginVertical();
        GUILayout.FlexibleSpace();


        if (DisplayRoundOptionsDelegate != null)
        {
            DisplayRoundOptionsDelegate();
        }

        GUILayout.Space(1);

        GUILayout.BeginHorizontal(Skin.box);
        GUILayout.Label("CHANGE MAP", LabelStyle);
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        foreach (var map in ListOfMaps)
        {
            GUI.enabled = map != Application.loadedLevelName;
            if (GUIExts.Button(map, new GUIStyle(Skin.button)
            {
                fixedWidth = 95
            }))
            {
                OnMapSelection(map);
            }
            GUILayout.Space(1);
        }
        GUI.enabled = true;
        GUILayout.Space(-3);
        GUILayout.EndHorizontal();


        GUILayout.EndVertical();
        GUILayout.EndHorizontal();
    }
Beispiel #2
0
    private void DrawWindow(int id)
    {
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.BeginVertical();

        GUILayout.BeginHorizontal(Skin.box);
        GUILayout.Label("FOV: " + String.Format("{0:0}", FOVOptionValue), LabelStyle);
        FOVOptionValue = GUILayout.HorizontalSlider(FOVOptionValue, CameraScript.MinimumFieldOfView,
                                                    CameraScript.MaximumFieldOfView, Skin.customStyles[0], Skin.customStyles[1]);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal(Skin.box);
        GUILayout.Label("SENSITIVITY", LabelStyle);
        SensitivityOptionValue = GUILayout.HorizontalSlider(SensitivityOptionValue, 0.01f,
                                                            1f, Skin.customStyles[0], Skin.customStyles[1]);
        GUILayout.EndHorizontal();

        if (Debug.isDebugBuild)
        {
            float currentTarget = Application.targetFrameRate;
            if (currentTarget < 0)
            {
                currentTarget = 175f;
            }
            GUILayout.BeginHorizontal(Skin.box);
            GUILayout.Label("FPS LIMIT", LabelStyle);
            float newTarget = GUILayout.HorizontalSlider(currentTarget, 5f,
                                                         175f, Skin.customStyles[0], Skin.customStyles[1]);
            GUILayout.EndHorizontal();
            if (newTarget >= 150f)
            {
                Application.targetFrameRate = -1;
            }
            else
            {
                Application.targetFrameRate = Mathf.RoundToInt(newTarget);
            }


            GUILayout.BeginHorizontal(Skin.box);
            GUILayout.Label("TIME SCALE", LabelStyle);
            Time.timeScale = GUILayout.HorizontalSlider(Time.timeScale, 0.1f,
                                                        1f, Skin.customStyles[0], Skin.customStyles[1]);
            GUILayout.EndHorizontal();
        }



        GUILayout.BeginHorizontal();
        GUILayout.BeginVertical();

        GUILayout.BeginHorizontal(Skin.box);
        GUILayout.Label("THIRD PERSON", LabelStyle);
        IsExteriorView = GUILayout.Toggle(IsExteriorView, "");
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal(Skin.box);
        GUILayout.Label("INVERT AIM", LabelStyle);
        IsAimInverted = GUILayout.Toggle(IsAimInverted, "");
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal(Skin.box);
        GUILayout.Label(" ", LabelStyle);
        GUILayout.EndHorizontal();

        GUILayout.EndVertical();

        GUILayout.Space(1);

        GUILayout.BeginVertical();

        GUILayout.BeginHorizontal(Skin.box);
        GUILayout.Label("MUSIC", LabelStyle);
        ShouldPlayMusic = GUILayout.Toggle(ShouldPlayMusic, "");
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal(Skin.box);
        GUILayout.Label("SOUND EFFECTS", LabelStyle);
        ShouldPlaySoundEffects = GUILayout.Toggle(ShouldPlaySoundEffects, "");
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal(Skin.box);
        GUILayout.Label("LOW LAG AUDIO", LabelStyle);
        UseLowLatencyAudio = GUILayout.Toggle(UseLowLatencyAudio, "");
        GUILayout.EndHorizontal();

        GUILayout.EndVertical();

        GUILayout.EndHorizontal();


        //GUILayout.BeginHorizontal();
        //    GUILayout.BeginVertical();
        //    GUILayout.EndVertical();
        //GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUIExts.Button("ACCEPT", Skin.button))
        {
            OnOptionsMenuWantsClosed();
        }
        GUILayout.Space(1);
        if (Relay.Instance.CurrentServer != null)
        {
            if (GUIExts.Button("LEAVE SERVER", new GUIStyle(Skin.button)
            {
                fixedWidth = 95
            }))
            {
                OnOptionsMenuWantsGoToTitle();
            }
        }
        else
        {
            if (GUIExts.Button("QUIT GAME", new GUIStyle(Skin.button)
            {
                fixedWidth = 95
            }))
            {
                OnOptionsMenuWantsQuitGame();
            }
        }
        if (ShouldDisplaySpectateButton)
        {
            GUILayout.Space(1);
            if (GUIExts.Button("SPECTATE", new GUIStyle(Skin.button)
            {
                fixedWidth = 95
            }))
            {
                OnOptionsMenuWantsSpectate();
                OnOptionsMenuWantsClosed();
            }
        }

        GUILayout.EndHorizontal();
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();
    }
    private void DisplayRoundOptions()
    {
        GUILayout.BeginHorizontal();

        GUILayout.BeginVertical();
        {
            GUILayout.BeginHorizontal(Relay.Instance.BaseSkin.box);
            GUILayout.Label("DEATHMATCH", Relay.Instance.OptionsMenu.LabelStyle);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (IsRoundInProgress)
            {
                if (GUIExts.Button("END ROUND", new GUIStyle(Relay.Instance.BaseSkin.button)
                {
                    fixedWidth = 95 * 3 + 1
                }))
                {
                    EndRoundNow();
                    StartRoundAfterMapChange = false;
                }
            }
            else
            {
                if (GUIExts.Button("START ROUND", new GUIStyle(Relay.Instance.BaseSkin.button)
                {
                    fixedWidth = 95 * 3 + 1
                }))
                {
                    StartRound();
                    StartRoundAfterMapChange   = true;
                    Relay.Instance.ShowOptions = false;
                }
            }
            GUILayout.Space(-3);
            GUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();

        GUILayout.Space(1);

        GUILayout.BeginVertical(new GUIStyle()
        {
            fixedWidth = 95
        });
        {
            GUILayout.BeginHorizontal(Relay.Instance.BaseSkin.box);
            GUILayout.Label("SCORE LIMIT", Relay.Instance.OptionsMenu.LabelStyle);
            GUILayout.EndHorizontal();

            GUI.enabled = !IsRoundInProgress;
            var numText = GUILayout.TextField(ScoreLimit.ToString(), new GUIStyle(Relay.Instance.BaseSkin.textField)
            {
                fixedWidth = 95
            });
            if (numText.Length < 1)
            {
                ScoreLimit = 0;
            }
            else
            {
                int num;
                if (int.TryParse(numText, out num) && num > 0)
                {
                    ScoreLimit = num;
                }
            }
            GUI.enabled = true;
        }
        GUILayout.EndVertical();

        GUILayout.EndHorizontal();
    }