using System.Collections;
using System.Collections.Generic;
using UnityEngine; public class click001 : MonoBehaviour {
public bool WindowShow = false;
private Rect rect = new Rect(, , , ); public Renderer rend; public int fontSize;
public FontStyle fontStyle;
public RectOffset margin;
public RectOffset padding;
public Font font; void Start()
{
//获取renderer组件
rend = GetComponent<Renderer>();
} void OnGUI()
{ //窗口id 窗口大小 窗口回调(定义窗口内视图) 窗口标题
if (WindowShow)
{
GUI.skin.window.font = font;
GUI.skin.window.fontStyle = fontStyle;
GUI.skin.window.fontSize = fontSize;
GUI.skin.window.margin = margin;
GUI.skin.window.padding = padding; if (gameObject.tag == "pipe")
{
GUI.Window(, rect, onWindowOne, "管道");
}
else if(gameObject.tag == "stand")
{
GUI.Window(, rect, onWindowOne, "支架");
}
else if(gameObject.tag == "base")
{
GUI.Window(, rect, onWindowOne, "底座");
}
else if(gameObject.tag == "valve")
{
GUI.Window(, rect, onWindowOne, "阀门");
}
} } void onWindowOne(int winId)
{ GUI.skin.label.font = font;
GUI.skin.label.fontStyle = fontStyle;
GUI.skin.label.fontSize = fontSize;
GUI.skin.label.margin = margin;
GUI.skin.label.padding = padding; if (gameObject.tag == "pipe")
{
GUI.Label(new Rect(, , , ), "当前窗口是管道");
}
else if (gameObject.tag == "stand")
{
GUI.Label(new Rect(, , , ), "当前窗口是支架");
}
else if (gameObject.tag == "base")
{
GUI.Label(new Rect(, , , ), "当前窗口是底座");
}
else if (gameObject.tag == "valve")
{
GUI.Label(new Rect(, , , ), "当前窗口是阀门");
} GUI.skin.button.font = font;
//GUI.Label(new Rect(10, 10, 140, 40), "当前窗口id是" + winId);
if (GUI.Button(new Rect(, , , ), "按钮1"))
{
Debug.Log("当前窗口id" + winId);
}
//定义窗体可以活动的范围 这个功能不知道为什么没有实现
//GUI.DragWindow(new Rect(0, 0, 10000, 10000));
} void OnMouseDown()
{
if (WindowShow)
{
WindowShow = false;
}
else
{
WindowShow = true;
} }
}

unity3d GUI字体设置的更多相关文章

  1. GUI颜色、字体设置对话框

    %颜色设置对话框 uisetcolor %c 红色 c=uisetcolor %默认规定颜色 c=uisetcolor([ ]); %设置曲线颜色 h = plot([:]); c = uisetco ...

  2. CFileDialog(文件夹对话框类)和CFontDialog(字体设置对话框类)的使用学习

    CFileDialog(文件夹对话框类) 主要用于文件的保存,另存,打开,关闭等功能 功能“另存为”的实现: void CTXTDlg::OnFileSaveas() { LPCTSTR szFilt ...

  3. Ubuntu 14 Chrome字体设置备份

    Ubuntu 14 Chrome字体设置备份 1.设置 -> 显示高级设置 -> 自定义字体 -> (1) 标准字体:YaHei Consolas Hybrid,14 (2) Ser ...

  4. [JAVA] java仿windows 字体设置选项卡

    想用java做一个像windows里一样的txt编辑软件,涉及到字体设置选项卡,在网上找了很久都没找到,就生气啦自己写一个,现在贴这里分享一下,下次再遇到这样的问题就不用自己亲自打代码啦! packa ...

  5. Eclipse的中文字体设置

    打开eclipse中文字体很小,简直难以辨认.在网上搜索发现这是由于Eclipse 用的字体是 Consolas,显示中文的时候默认太小了.解决方式有两种:一.把字体设置为Courier New  操 ...

  6. VBA在WORD中给表格外的字体设置为标题

    使用VB可以将表外的字体设置标题字体实际操作如下: VB代码如下: Sub oliver_1() Selection.EndKey Unit:=wdStory '光标移到文末 To ActiveDoc ...

  7. SecureCRT学习之道:SecureCRT经常使用快捷键设置与字体设置方法

    1:假设不想每次登陆都输入password,能够在你打开的session里邮件session option->login action 选中automate logon 双击ogin 和assw ...

  8. iOS 字体设置

    使用无衬线字体 body {     font-family: "Helvetica Neue", Helvetica, STHeiTi, sans-serif; }  iOS 4 ...

  9. SecureCRT学习之道:SecureCRT常用快捷键设置与字体设置方法

    1:如果不想每次登陆都输入密码,可以在你打开的session里邮件session option->login action 选中automate logon 双击ogin 和assword分别输 ...

随机推荐

  1. static 不被实例调用

    static - JavaScript | MDN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/ ...

  2. plus.os.name 无法正确执行的问题

    使用HTML5+开发App的时候, 如果碰到正确的代码却无法出现预期的执行效果, 请检查模块权限配置是否OK? 比如plus.os.name, 需要Device权限 ;

  3. python 创建一个实例:步骤二 添加行为方法,编写方法

    添加方法 class Person(): def __init__(self,name,job=None,pay=0): self.name= name self.job = job self.pay ...

  4. GStreamer 从摄像头获取图像 转264

    1.这里有个简单的例子,可以看看GStreamer如何编程的. 2.GStreamer  GstAppSink的官方Document,翻译了一下它的描述部分,点击这里. 3.GStreamer  Gs ...

  5. IOS平台的几个推送服务的对比

    http://blog.163.com/scuqifuguang@126/blog/static/171370086201399113833299/        最近研究了一下极光推送(JPush) ...

  6. Rocketmq消息持久化

    本文编写,参考:https://my.oschina.net/bieber/blog/725646 producer Send()的Message最终将由broker处理,处理类为:SendMessa ...

  7. 使用vscode写typescript(node.js环境)起手式

    动机 一直想把typescript在服务端开发中用起来,主要原因有: javascript很灵活,但记忆力不好的话,的确会让你头疼,看着一月前自己写的代码,一脸茫然. 类型检查有利有敝,但在团队开发中 ...

  8. wampserver发布常见问题

    1 之前使用wamp在本地通过localhost访问PHP网站,一直很正常,最近想要发布至服务器,需要域名解析,发现PHP网站无法使用ip登陆,比如输入ip+端口地址,会报错:you don't ha ...

  9. html5--1.10绝对路径和相对路径

    html5--1.10绝对路径和相对路径 学习要点: 绝对路径和相对路径 1.绝对路径 需要指出链接资源的绝对位置,与你的HTML文档的位置无关: 1. 服务器中的位置:href="http ...

  10. packettotal.com - PacketTotal - A Free Online PCAP Analysis Engine

    找相似的pcap文件:https://packettotal.com/app/analysis?id=aff96903aae4b73364e027c8a3e85060&name=similar ...