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. 九度OJ 1036:Old Bill (老比尔) (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2691 解决:1432 题目描述: Among grandfather's papers a bill was found.     72 ...

  2. Netty入门 - 秒懂

    目录 Netty 入门 前言: 建立项目 编写一个Discard Handler 处理器 编写一个Discard 服务器 线程组 启动帮助类 设置Channel 通道的选项 测试:发送消息到Disca ...

  3. 算法(Algorithms)第4版 练习 1.3.27 1.3.28

    代码实现: //1.3.27 /** * return the value of the maximum key in the list * * @param list the linked list ...

  4. ES6 Set数据结构

    Set ES6 提供了新的数据结构 Set.它类似于数组,但是成员的值都是唯一的,没有重复的值. const s = new Set(); // const声明一个只读的常量.一旦声明,常量的值就不能 ...

  5. html5 canvas画饼

    1. [图片] lxdpie.jpg ​2. [文件] lqdpie.html ~ 801B     下载(7) <!DOCTYPE HTML PUBLIC "-//W3C//DTD ...

  6. ***静态成员的定义及初始化 for c++ for新用法

    静态成员的初始化要在类外不然报错error: ISO C++ forbids in-class initialization of non-const static member '***' 但是声明 ...

  7. MySQL记录_20160919

    1.首先先看下什么是MySQL. MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于 Oracle 旗下产品.MySQL 最流行的关系型数据库管理系统,其开放源码这一特点 ...

  8. ACM学习历程——HDU3333 Turing Tree(线段树 && 离线操作)

    Problem Description After inventing Turing Tree, 3xian always felt boring when solving problems abou ...

  9. bzoj 1049: 数字序列 dp

    题目大意: 给定一个长度为n的整数序列.在改变的数最小的和改变的幅度最小的前提下把它变成一个单调严格上升的序列.求改变的最小的数和这个幅度. 题解: (貌似以前考试考过这道题) 其实这道题就是两道题拼 ...

  10. HP SiteScope安装

    下载地址以及安装方法见 http://www.jianshu.com/p/fce30e333578 数据库连接URL:jdbc:mysql://mysql_ip:mysql_port/database ...