Advertisement
WilsonKoder111

Advanced Menu

Jun 25th, 2014
8,330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.54 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class MainMenu : MonoBehaviour {
  5.  
  6.     private bool showOptions = false;
  7.     public float shadowDrawDistance;
  8.     public int ResX;
  9.     public int ResY;
  10.     public bool Fullscreen;
  11.     // Use this for initialization
  12.     void Start () {
  13.         showOptions = false;
  14.     }
  15.    
  16.     // Update is called once per frame
  17.     void Update () {
  18.    
  19.     }
  20.  
  21.     void OnGUI() {
  22.         if(GUI.Button(new Rect(500, 100, 300, 100), "Start Game")) {
  23.             Application.LoadLevel(1);
  24.         }
  25.         if(GUI.Button(new Rect(500, 210, 300, 100), "Quit Game")) {
  26.             Application.Quit();
  27.         }
  28.         if(GUI.Button(new Rect(500, 320, 300, 100), "Options Menu")) {
  29.             showOptions = true;
  30.         }
  31.         if(showOptions == true) {
  32.             //INCREASE QUALITY PRESET
  33.             if(GUI.Button(new Rect(810, 100, 300, 100), "Increase Quality")) {
  34.                 QualitySettings.IncreaseLevel();
  35.                 Debug.Log ("Increased quality");
  36.             }
  37.             //DECREASE QUALITY PRESET
  38.             if(GUI.Button(new Rect(810, 210, 300, 100), "Decrease Quality")) {
  39.                 QualitySettings.DecreaseLevel();
  40.                 Debug.Log ("Decreased quality");
  41.             }
  42.             //0 X AA SETTINGS
  43.             if(GUI.Button(new Rect(810, 320, 65, 100), "No AA")) {
  44.                 QualitySettings.antiAliasing = 0;
  45.                 Debug.Log ("0 AA");
  46.             }
  47.             //2 X AA SETTINGS
  48.             if(GUI.Button(new Rect(879, 320, 65, 100), "2x AA")) {
  49.                 QualitySettings.antiAliasing = 2;
  50.                 Debug.Log ("2 x AA");
  51.             }
  52.             //4 X AA SETTINGS
  53.             if(GUI.Button(new Rect(954, 320, 65, 100), "4x AA")) {
  54.                 QualitySettings.antiAliasing = 4;
  55.                 Debug.Log ("4 x AA");
  56.             }
  57.             //8 x AA SETTINGS
  58.             if(GUI.Button(new Rect(1028, 320, 65, 100), "8x AA")) {
  59.                 QualitySettings.antiAliasing = 8;
  60.                 Debug.Log ("8 x AA");
  61.             }
  62.             //TRIPLE BUFFERING SETTINGS
  63.             if(GUI.Button(new Rect(810, 430, 140, 100), "Triple Buffering On")) {
  64.                 QualitySettings.maxQueuedFrames = 3;
  65.                 Debug.Log ("Triple buffering on");
  66.             }
  67.             if(GUI.Button(new Rect(955, 430, 140, 100), "Triple Buffering Off")) {
  68.                 QualitySettings.maxQueuedFrames = 0;
  69.                 Debug.Log ("Triple buffering off");
  70.             }
  71.             //ANISOTROPIC FILTERING SETTINGS
  72.             if(GUI.Button(new Rect(190, 100, 300, 100), "Anisotropic Filtering On")) {
  73.                 QualitySettings.anisotropicFiltering = AnisotropicFiltering.ForceEnable;
  74.                 Debug.Log ("Force enable anisotropic filtering!");
  75.             }
  76.             if(GUI.Button(new Rect(190, 210, 300, 100), "Anisotropic Filtering Off")) {
  77.                 QualitySettings.anisotropicFiltering = AnisotropicFiltering.Disable;
  78.                 Debug.Log ("Disable anisotropic filtering!");
  79.             }
  80.             //RESOLUTION SETTINGS
  81.             //60Hz
  82.             if(GUI.Button(new Rect(190, 320, 300, 100), "60Hz")) {
  83.                 Screen.SetResolution(ResX, ResY, Fullscreen, 60);
  84.                 Debug.Log ("60Hz");
  85.             }
  86.             //120Hz
  87.             if(GUI.Button(new Rect(190, 430, 300, 100), "120Hz")) {
  88.                 Screen.SetResolution(ResX, ResY, Fullscreen, 120);
  89.                 Debug.Log ("120Hz");
  90.             }
  91.             //1080p
  92.             if(GUI.Button(new Rect(500, 430, 93, 100), "1080p")) {
  93.                 Screen.SetResolution(1920, 1080, Fullscreen);
  94.                 ResX = 1920;
  95.                 ResY = 1080;
  96.                 Debug.Log ("1080p");
  97.             }
  98.             //720p
  99.             if(GUI.Button(new Rect(596, 430, 93, 100), "720p")) {
  100.                 Screen.SetResolution(1280, 720, Fullscreen);
  101.                 ResX = 1280;
  102.                 ResY = 720;
  103.                 Debug.Log ("720p");
  104.             }
  105.             //480p
  106.             if(GUI.Button(new Rect(692, 430, 93, 100), "480p")) {
  107.                 Screen.SetResolution(640, 480, Fullscreen);
  108.                 ResX = 640;
  109.                 ResY = 480;
  110.                 Debug.Log ("480p");
  111.             }
  112.             if(GUI.Button(new Rect(500, 0, 140, 100), "Vsync On")) {
  113.                 QualitySettings.vSyncCount = 1;
  114.             }
  115.             if(GUI.Button(new Rect(645, 0, 140, 100), "Vsync Off")) {
  116.                 QualitySettings.vSyncCount = 0;
  117.             }
  118.         }
  119.     }
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement