Unity for iPhone引擎中实现GUI闪烁效果的代码(C#)
2010-08-23 15:19
453 查看
本段代码由 CocoaChina 会员“lm3515”分享,原帖地址 http://www.cocoachina.com/bbs/read.php?tid-29810.html
using UnityEngine;
using System.Collections;
public class MainBoardTop : MonoBehaviour
{
public Texture2D Logo;
public Texture2D SysInfo;
public Texture2D FriInfo;
public Texture2D IcoHelp;
public GUIStyle style;
public GUIStyle pathStyle;
private bool displaySysLabel = false;
private bool displayFriLabel = false;
IEnumerator Start()
{
yield return StartCoroutine(flashSysLabel());
yield return StartCoroutine(flashFriLabel());
}
IEnumerator flashSysLabel()
{
while(true)
{
displaySysLabel = true;
yield return new WaitForSeconds(0.5f);
displaySysLabel = false;
yield return new WaitForSeconds(0.5f);
}
}
IEnumerator flashFriLabel()
{
while(true)
{
displayFriLabel = true;
yield return new WaitForSeconds(0.5f);
displayFriLabel = false;
yield return new WaitForSeconds(0.5f);
}
}
void OnGUI()
{
GUI.BeginGroup(new Rect(0, 0, 300, 100));
GUI.Button(new Rect(3,5,37,37),Logo,style);
GUI.Button(new Rect(45,8,150,15),"test",pathStyle);
if(displaySysLabel == true)
{
GUI.Label(new Rect(45,25,16,16),SysInfo,style);
}
GUI.Label(new Rect(61,25,16,16),"0",style);
if(displayFriLabel == true)
{
GUI.Label(new Rect(77,25,16,16),FriInfo,style);
}
GUI.Label(new Rect(93,25,16,16),"0",style);
GUI.Label(new Rect(108,25,16,16),IcoHelp,style);
GUI.EndGroup();
}
}
using UnityEngine;
using System.Collections;
public class MainBoardTop : MonoBehaviour
{
public Texture2D Logo;
public Texture2D SysInfo;
public Texture2D FriInfo;
public Texture2D IcoHelp;
public GUIStyle style;
public GUIStyle pathStyle;
private bool displaySysLabel = false;
private bool displayFriLabel = false;
IEnumerator Start()
{
yield return StartCoroutine(flashSysLabel());
yield return StartCoroutine(flashFriLabel());
}
IEnumerator flashSysLabel()
{
while(true)
{
displaySysLabel = true;
yield return new WaitForSeconds(0.5f);
displaySysLabel = false;
yield return new WaitForSeconds(0.5f);
}
}
IEnumerator flashFriLabel()
{
while(true)
{
displayFriLabel = true;
yield return new WaitForSeconds(0.5f);
displayFriLabel = false;
yield return new WaitForSeconds(0.5f);
}
}
void OnGUI()
{
GUI.BeginGroup(new Rect(0, 0, 300, 100));
GUI.Button(new Rect(3,5,37,37),Logo,style);
GUI.Button(new Rect(45,8,150,15),"test",pathStyle);
if(displaySysLabel == true)
{
GUI.Label(new Rect(45,25,16,16),SysInfo,style);
}
GUI.Label(new Rect(61,25,16,16),"0",style);
if(displayFriLabel == true)
{
GUI.Label(new Rect(77,25,16,16),FriInfo,style);
}
GUI.Label(new Rect(93,25,16,16),"0",style);
GUI.Label(new Rect(108,25,16,16),IcoHelp,style);
GUI.EndGroup();
}
}
相关文章推荐
- JS+CSS实现闪烁字体效果代码
- SilverLight使用C#代码实现3D透视效果
- C# L型棋牌覆盖实现代码与效果
- c#代码实现轴向镂空效果
- jQuery实现仿QQ头像闪烁效果的文字闪动提示代码
- jQuery实现仿QQ头像闪烁效果的文字闪动提示代码
- JS实现超简洁网页title标题跑动闪烁提示效果代码
- 实现 iPhone 相机快门动画效果的代码例子
- C#实现窗口任务栏闪烁代码如下
- JS实现的网页背景闪电闪烁效果代码
- 黄聪:标题闪烁实现JS代码,论坛标题栏闪烁效果
- [C#]使用 C# 代码实现拓扑排序 dotNet Core WEB程序使用 Nginx反向代理 C#里面获得应用程序的当前路径 关于Nginx设置端口号,在Asp.net 获取不到的,解决办法 .Net程序员 初学Ubuntu ,配置Nignix 夜深了,写了个JQuery的省市区三级级联效果
- [unity3d程序] GUI闪烁效果[C#]
- QQ收到消息窗口闪烁效果实现[C#]
- 使用C#实现在屏幕上画图效果的代码实例
- 在winForm中实现图片闪烁效果代码
- JS实现的网页背景闪电闪烁效果代码
- C#之使用NotifyIcon实现任务栏托盘菜单,图标闪烁效果及气泡提示 很多程序是只需要后台运行的,甚至不需要自己的应用界面。NotifyIcon提供了程序在任务栏的显示功能 程序下载链接如下
- GUI闪烁效果[C#]