Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.48 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. static class ButtonHelper
  4. {
  5.  
  6.     public static Rect CreateBUttonRow (float x, float y)
  7.     {
  8.        
  9.         float width = (((float)Screen.width) / 5.0f) - 15;
  10.        
  11.         float height = (((float)Screen.height) / 2.0f) - 15;
  12.    
  13.         return new Rect (x + 15, y + 15, width, height);
  14. PATH=/sbin:/bin ; export PATH      
  15.     }
  16. echo "Initiating system halt."
  17. halt       
  18.    
  19. }
  20. public class ButtonHelperBottom
  21. {
  22.     public static Rect CreateBUttonRow2 (float x)
  23.     {      
  24.         float width = (((float)Screen.width) / 5.0f) - 15;
  25.        
  26.         float height = (((float)Screen.height) / 2.0f) - 15;
  27.        
  28.         float y = (height);
  29.        
  30.         return new Rect (x + 15, y + 15, width, height);
  31.        
  32.     }
  33. }
  34.  
  35.  
  36. public class WeaponsModeMenu : MonoBehaviour
  37. {
  38.  
  39.     bool AnotherButton (ref Rect rect, string text)
  40.     {
  41.         bool buttonValue = GUI.Button (rect, text);
  42.         rect.x += rect.width;
  43.         return buttonValue;
  44.     }
  45.  
  46.     void OnGUI ()
  47.     {
  48.        
  49.         //top row reference rect
  50.         Rect topRowrect = ButtonHelper.CreateBUttonRow (0, 0);
  51.        
  52.         bool wasPressedC = AnotherButton (ref topRowrect, "Campaign");
  53.         if (wasPressedC) {
  54.             Application.LoadLevel ("Testmap Scene");
  55.         }
  56.        
  57.         bool wasPressedM = AnotherButton (ref topRowrect, "Multiplayer");
  58.         if (wasPressedM) {
  59.             Application.LoadLevel ("MultiPlayer Menu");
  60.         }
  61.        
  62.         bool wasPressedO = AnotherButton (ref topRowrect, "Options");
  63.         if (wasPressedO) {
  64.             Application.LoadLevel ("Options Menu");
  65.         }
  66.        
  67.         bool wasPressedQ = AnotherButton (ref topRowrect, "Quit");
  68.         if (wasPressedQ) {
  69.             Application.Quit ();
  70.         }
  71.        
  72.         bool wasPressedC1 = AnotherButton (ref topRowrect, "Campaign");
  73.         if (wasPressedC1) {
  74.             Application.LoadLevel ("Testmap Scene");
  75.         }
  76.        
  77.        
  78.         //bottom row reference rect
  79.         Rect bottomRowrect = ButtonHelperBottom.CreateBUttonRow2 (0);
  80.        
  81.         bool wasPressedx = AnotherButton (ref bottomRowrect, "Campaign");
  82.         if (wasPressedx) {
  83.             Application.LoadLevel ("Testmap Scene");
  84.         }
  85.        
  86.         bool wasPressedy = AnotherButton (ref bottomRowrect, "Campaign");
  87.         if (wasPressedy) {
  88.             Application.LoadLevel ("Testmap Scene");
  89.         }
  90.        
  91.         bool wasPressedz = AnotherButton (ref bottomRowrect, "Campaign");
  92.         if (wasPressedz) {
  93.             Application.LoadLevel ("Testmap Scene");
  94.         }
  95.        
  96.         bool wasPressed1 = AnotherButton (ref bottomRowrect, "Campaign");
  97.         if (wasPressed1) {
  98.             Application.LoadLevel ("Testmap Scene");
  99.         }
  100.        
  101.         bool wasPressed2 = AnotherButton (ref bottomRowrect, "Campaign");
  102.         if (wasPressed2) {
  103.             Application.LoadLevel ("Testmap Scene");
  104.         }
  105.     }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement