Advertisement
Bruno2Silva2

SaveGUI

May 28th, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Header("Alterações Minhas Para facilitar")
  2. var CaminhoAux : String;
  3. var LocalSave  : String = "/LastSurvivor";
  4.  
  5. function LerPastas() {
  6.     LinhasInf = Directory.GetDirectories(CaminhoAux+"/");
  7.     Linhas = new String[LinhasInf.Length];
  8.  
  9.     for (i = 0; i < LinhasInf.Length; i++){
  10.         Linhas[i] = Path.GetFileName(LinhasInf[i]);
  11.     }
  12.    
  13. }
  14.  
  15. function Awake () {
  16.     CaminhoAux = Application.dataPath+LocalSave;
  17. }
  18.  
  19. function onGUI() {
  20.     if(Salvos){
  21.         if (GUI.Button(Rect(Screen.height/2-Screen.height/2,Screen.width/5,90,100),Imagens[2])){
  22.             Salvos = false;
  23.             Menu = true;
  24.         }
  25.  
  26.         if (GUI.Button(Rect(Screen.height/2-Screen.height/2,Screen.width/30,90,100),Imagens[5])){
  27.             DeletarPasta =!DeletarPasta;
  28.         }
  29.  
  30.         if (GUI.Button(Rect(Screen.height/2-Screen.height/2,Screen.width/2-Screen.width/7.5,90,100),Imagens[6])){
  31.             GetComponent.<AudioSource>().clip = soundClick;
  32.             GetComponent.<AudioSource>().Play();
  33.             isLoading = true;
  34.             CriarMundo = true;
  35.             Salvos = false;
  36.  
  37.         }
  38.  
  39.         try
  40.         {
  41.             GUI.Button(Rect (Screen.width/2 -Screen.width /30 , Screen.height/2+Screen.height/150, Screen.width/2,Screen.height/20),""+CaminhoAux);
  42.             Scroll = GUI.BeginScrollView( Rect(Screen.width/2-Screen.width/2, Screen.height/2-Screen.height/3, Screen.width/0.5, Screen.height/1.5), Scroll, Rect(0, 0, 0, Linhas.Length*100));
  43.             for (var i = 0; i < Linhas.Length; i++){
  44.                 if (GUI.Button(Rect(Screen.width/2-Screen.width/2.5 , Screen.height / 5-Screen.height / 20 + i * Screen.height/9.5, Screen.width / 1.5+Screen.width/3, Screen.height / 10), Linhas[i])){
  45.                     GetComponent.<AudioSource>().clip = soundClick;
  46.                     GetComponent.<AudioSource>().Play();
  47.                     if(!DeletarPasta){
  48.                         Salvos = false;
  49.                         MapaSelec = ""+Linhas[i];
  50.                         Carregar(true,false);
  51.                     }else{
  52.                         Directory.Delete(CaminhoAux+"/"+Linhas[i],true);
  53.                         DeletarPasta = false;
  54.                     }
  55.                
  56.                
  57.                 }
  58.             }
  59.             GUI.EndScrollView();
  60.    
  61.        
  62.         }catch(err){
  63.  
  64.         }
  65.  
  66.         GUI.Box(Rect (Screen.width/2-Screen.width/2.5, Screen.height/5-Screen.height/5, Screen.width / 1.1, Screen.height/2+Screen.height/1),"Mundos Salvos");
  67.  
  68.         // if(GUI.Button(Rect(Screen.width/2)))
  69.  
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement