Unity3D 菜单界面的代码例子
2013-07-09 21:10
246 查看
private var bg:Texture2D; private var title:Texture2D; private var tex:Object[]; private var x:int; private var y:int; private var nowFram:int; private var mFrameCount:int; private var fps:float = 5; private var time:float = 0; function Start () { bg = Resources.Load("bg"); title = Resources.Load("title"); tex = Resources.LoadAll("anim"); x = Screen.width; y = 200; } function OnGUI() { GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height),bg,ScaleMode.StretchToFill,true,0); GUI.DrawTexture(Rect((Screen.width - title.width)>>1,30,title.width,title.height),title,ScaleMode.StretchToFill,true,0); DrawAnimation(tex,Rect(x,y,40,60)); x--; if(x < -42) { x = 480; } } function DrawAnimation(tex:Object[],rect:Rect) { GUI.DrawTexture(rect,tex[nowFram],ScaleMode.StretchToFill,true,0); time += Time.deltaTime; if(time > 1.0/ fps) { nowFram++; time = 0; if(nowFram >= tex.Length) { nowFram = 0; } } }
相关文章推荐
- iPhone 应用中界面选择或功能开关代码例子
- Android 上层界面到内核代码的完整的流程分析,以alarm为例子
- Android 上层界面到内核代码的完整的流程分析,以alarm为例子
- Unity3D - 窗口、菜单界面介绍,资源管理,脚本
- 使用ionic(选项卡栏tab) icon(图标) ionic上拉菜单(ActionSheet) 实现通讯录界面切换实例代码
- Android 上层界面到内核代码的完整的流程分析,以alarm为例子
- 【unity3d】Loading界面代码
- AttachXMLForSelect:XML自动关联多级SELECT菜单代码和例子
- UNITY3D shader代码例子<一> 法线颜色
- unity3d编辑器界面扩展,编辑状态下显示选择对象的所有脚本组件代码内容
- 在拍照界面里调出相册的代码例子
- 11 PopupMenu菜单和代码例子
- javascript仿qq界面的折叠菜单实现代码
- java代码实现弹出系统关机界面,关机菜单
- AttachXMLForSelect:XML自动关联多级SELECT菜单代码和例子
- DIV+CSS实现仿DreamWeaver界面图形菜单效果代码
- iPhone App 表格菜单代码例子
- 滑动弹出菜单的代码例子
- 11 PopupMenu菜单和代码例子