您的位置:首页 > 移动开发 > Unity3D

Unity3D学习 愤怒的小鸟之关卡选择界面(六)

2012-07-10 22:26 639 查看
目标:实现关卡选择界面



这一篇里没有新的内容,全是前面5讲知识点的综合,如何用GUITexture做背景,如何用GUISkin做个性化的按钮,如何添加游戏背景音乐,如何修改鼠标样式,这些都是前面提到的知识点,在这里大家用这个界面把之前的都巩固下吧。

#pragma strict

var customSkin : GUISkin;

function Start () {

}

function Update () {

}

function OnGUI () {
GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity,
Vector3(Screen.width / 800.0, Screen.height / 600.0, 1));

GUI.skin = customSkin;

if (GUI.Button(Rect(125, 100, 150, 150), "", "Level1")) {
Application.LoadLevel(3);
}

if (GUI.Button(Rect(325, 100, 150, 150), "", "Level2")) {
}

if (GUI.Button(Rect(525, 100, 150, 150), "", "Level3")) {
}

if (GUI.Button(Rect(125, 300, 150, 150), "", "Level4")) {
}

if (GUI.Button(Rect(325, 300, 150, 150), "", "Level5")) {
}

if (GUI.Button(Rect(525, 300, 150, 150), "", "Level6")) {
}

if (GUI.Button(Rect(70, 500, 100, 80), "", "Back")) {
Application.LoadLevel(1);
}
}


OK,运行下试试吧!

源码下载地址: http://download.csdn.net/detail/ariel7321/4421702
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: