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. Elasticsearch基本语法

    match和match_phrase区别 match: 索引中只要有任意一个匹配拆分后词就可以出现在结果中,只是匹配度越高的排越前面 match_phrase: 索引中必须同时匹配拆分后词就可以出现在 ...

  2. http://blog.csdn.net/wh211212/article/details/53005321

    http://blog.csdn.net/wh211212/article/details/53005321

  3. 【linux】如何给sudo的root设置环境变量

    如果系统不能通过root登陆,而是需要使用其他用户sudo的方式登陆root,那么root的环境变量很难设置,修改/etc/profile也没有用.可以通过下面这个方式解决 修改sudoer的配置文件 ...

  4. <再看TCP/IP第一卷>关于网络层及协议细节---IP协议

    说到关于IP协议,就必须先说IP协议的两个特性: (一)不可靠性(unreliable) 不可靠性的意思是它不能保证IP数据报能成功地到达目的地,IP所能做的只是提供最好的传输服务,IP有一个简单的错 ...

  5. windows下的git使用指令

    经常使用mac和linux 这次使用window开发了一些小项目 废话不多说: git init git add . git commit -m 'note' git remote add origi ...

  6. ps炫光素材

    炫光闪电笔刷,炫光闪电笔刷,雷电笔刷,自然闪电Photoshop笔刷下载ps炫光素材 素材下载:http://www.huiyi8.com/sc/8695.html

  7. 蓝天白云大草原风景PSD背景素材

    蓝天白云大草原风景PSD源文件背景素材,蓝天白云,大草原,风景,背景素材,自然风景,草原景色,绿色清新背景 地址:http://www.huiyi8.com/psd/

  8. html5--1.9 img元素嵌入图片

    html5--1.9 img元素嵌入图片 学习要点: img元素嵌入图片学习一个新属性:title 1.img的属性 1.src:必要属性,制定图片来源的路径; 2.alt属性:当图片无法显示时的替代 ...

  9. c++queue容器介绍

    一.queue模版类的定义在<queue>头文件中. queue与stack模版非常类似,queue模版也需要定义两个模版参数,一个是元素类型,一个是容器类型,元素类型是必要的,容器类型是 ...

  10. int型变量,不使用中间变量完成互换

    package com.t_02; /** * 定义两个int类型的数,完成交换,不使用第三方变量 * @author Administrator * */ public class t1 { pub ...