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. iOS怎样获取任何App的资源图片?

    1.打开iTunes,并与手机相连接 2.按照下图所示执行搜索并下载App 3.到Mac的 /Users/apple/Music/iTunes/iTunes Media/Mobile Applicat ...

  2. 十分钟git-服务器搭建ssh登陆

    QQ820688215 微信公众号: 1首先,创建一个操作系统用户 git,并为其建立一个 .ssh 目录. $ sudo adduser git $ su git $ cd $ mkdir .ssh ...

  3. SAP流水号

    [转]编号范围对象维护 Tcode: SNRO OYSM   1.Number Range的通用Tcode:SNRO   2.Number Range的通用读取函数:NUMBER_GET_NEXT 3 ...

  4. (转)jQuery的deferred对象详解

    作者: 阮一峰 日期: 2011年8月16日 jQuery的开发速度很快,几乎每半年一个大版本,每两个月一个小版本. 每个版本都会引入一些新功能.今天我想介绍的,就是从jQuery 1.5.0版本开始 ...

  5. Java for LeetCode 099 Recover Binary Search Tree

    Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing ...

  6. linux版本查看命令

    uname -a显示电脑以及操作系统相关信息 cat /proc/version显示正在运行的内核版本 cat /etc/issue或cat /etc/redhat-release  Linux查看版 ...

  7. ubuntu下安装redis以及redis客户端在mac下的使用

    ubuntu下安装redis http://blog.fens.me/linux-redis-install/ 此方式利用brew安装包去获取最新的rdm客户端 资源失效了 https://www.j ...

  8. 最受欢迎的牛 usaco

    题面网上到处都是: 主要来谈谈怎么做,首先利用tarjan求强连通分量缩点,缩点后找到出度为0的点,若不止一个,则输出0,否则输出这个点包含的缩点前的点的个数: 为什么这么做,是由这道题的问法决定的, ...

  9. Linux--struct file结构体【转】

    本文转载自:https://www.cnblogs.com/hanxiaoyu/p/5677677.html struct file(file结构体): struct file结构体定义在includ ...

  10. 吴恩达机器学习笔记(十二) —— Application Example: Photo OCR(完)

    主要内容: 一.Photo OCR 二.Getting lots of data:artificial data synthesis 三.Ceiling analysis 一.Photo OCR Ph ...