using UnityEngine;

using System.Collections;



[ExecuteInEditMode()]

public class PopUpButton : MonoBehaviour {

private Rect windowRect = new Rect(5, 5, 250, 100);

private bool visibleWindow = false;

// Use this for initialization

void OnGUI()

{

if(GUI.Button (new Rect(30,30,120,30), "<<")){

visibleWindow = true;

}

if(visibleWindow){

windowRect = GUI.Window(0, new Rect(Screen.width/2 - 150,Screen.height/2-100,300,180), DoMyWindow, "Painting Cube");

}

}

void DoMyWindow(int windowID){

//LabelText

//GUI.Label (new Rect(windowRect.width/2-120,25,240,30), "This is PopUp Window");

//Button

if(GUI.Button (new Rect(windowRect.width/2-100,windowRect.height*0.2f,200,30), "Restart"))

{

visibleWindow = false;

}

if(GUI.Button (new Rect(windowRect.width/2-100,windowRect.height*0.4f,200,30), "Quit"))

{

visibleWindow = false;

}

if(GUI.Button (new Rect(windowRect.width/2-100,windowRect.height*0.6f,200,30), "About Painting Cube"))

{

visibleWindow = false;

}

GUI.DragWindow(new Rect(0,0,10000,20));

}

}







'유니티3D > 예제' 카테고리의 다른 글

NGUI_강의  (0) 2013.12.05
페인팅큐브_프로토타입  (0) 2013.09.14
2DGameScripts  (0) 2013.09.10
Shoot  (0) 2013.09.03
UpDownRotate  (0) 2013.09.03

+ Recent posts