hi again andeeee…
still the dragging of a window… here’s the code I’ve got and with it I can’t get any window to drag, less to say any buttons inside
guess I found the reason why… it has to do with where I define the rectangles for both windows.
if I do it outside the OnGUI function, the window’s are draggable… however, if I do it inside the function, they’re not… at first I thought only the GUI.Window() function mattered…
here’s the code
// Variáveis que armazenam os parâmetros introduzidos nos respectivos campos de texto
var textoAltura = "";
var textoLargura = "";
var textoEspessura = "";
var textoComprimentoA = "";
var textoComprimentoB = "";
var doWindow0 = false;
var doWindow1 = false;
var janelaParedes: Rect = Rect (400, 400, 400, 300);
var janelaParedes1: Rect = Rect (400, 400, 400, 300);
function OnGUI()
{
// Menu Lateral - Paineis
GUI.Box (Rect (10,40,150,Screen.height - 40), "Propriedades");
// Menu Principal
GUI.Box (Rect (10,10,Screen.width - 20, 30), "");
/*##### if done here, the windows don't drag #####
var janelaParedes: Rect = Rect (Screen.width / 2 - 200 ,Screen.height / 2 - 150, 400, 300);
var janelaParedes1: Rect = Rect (Screen.width / 2 - 200 ,Screen.height / 2 - 150, 400, 300);
############################### */
if (doWindow0)
janelaParedes = GUI.Window (0, janelaParedes, DoWindow0, "Criar Paredes - Escolher Opcao");
if (doWindow1) {
janelaParedes1 = GUI.Window (1, janelaParedes1, DoWindow1, "Wizzard para layout de paredes");
}
if (GUI.Button(Rect (15, 15, 100,20), "Criar Paredes")){
if (doWindow0 == true) {
doWindow0 = false;
} else {
doWindow0 = true;
}
}
}
function DoWindow0 (windowID : int) {
if (GUI.Button (Rect (20, 20, 75, 75), "4 Paredes")) {
doWindow0 = false;
doWindow1 = true;
}
GUI.DragWindow (Rect (0,0, 10000, 20));
}
function DoWindow1 (windowID : int) {
// Criação do icon do tipo de parede, com legenda
GUI.Box (Rect ((Screen.width / 2 - 200 ) + 20, (Screen.height / 2 - 150) + 40, 100, 100), "4 paredes");
// Criação das labels para identificação dos diferentes campos de parâmetros.
GUI.Label(Rect ((Screen.width / 2 - 200 ) + 250, (Screen.height / 2 - 150) + 40, 90, 30), "a");
GUI.Label(Rect ((Screen.width / 2 - 200 ) + 340, (Screen.height / 2 - 150) + 40, 90, 30), "b");
GUI.Label(Rect ((Screen.width / 2 - 200 ) + 130, (Screen.height / 2 - 150) + 60, 90, 30), "Comprimento");
// Criação dos campos de texto para introdução dos parâmetros de configuração do compartimento
// Estes parâmetros definem as dimensões das paredes do compartimento (altura, comprimento e espessura)
textoComprimentoA = GUI.TextArea(new Rect ((Screen.width / 2 - 200 ) + 220, (Screen.height / 2 - 150) + 60, 75, 20), textoComprimentoA);
textoComprimentoB = GUI.TextArea(new Rect ((Screen.width / 2 - 200 ) + 305, (Screen.height / 2 - 150) + 60, 75, 20), textoComprimentoB);
}