http://www.unity蛮牛.com/thread-25490-1-1.html

http://www.unity蛮牛.com/m/Script/EditorGUILayout.EnumPopup.html

EditorGUILayout.EnumPopup 枚举弹出选择菜单

static function EnumPopup (selected : System.Enum, params options : GUILayoutOption[]) : System.Enum
static function EnumPopup (selected : System.Enum, style : GUIStyle, params options : GUILayoutOption[]) : System.Enum
static function EnumPopup (label : string, selected : System.Enum, params options : GUILayoutOption[]) : System.Enum
static function EnumPopup (label : string, selected : System.Enum, style : GUIStyle, params options : GUILayoutOption[]) : System.Enum
static function EnumPopup (label : GUIContent, selected : System.Enum, params options : GUILayoutOption[]) : System.Enum
static function EnumPopup (label : GUIContent, selected : System.Enum, style : GUIStyle, params options : GUILayoutOption[]) : System.Enum

Parameters参数

  • label
    Optional label in front of the field. // 字段前面的可选标签。
  • selected
    The enum option the field shows. 
    枚举显示字段选项
  • style
    Optional GUIStyle. // 可选样式
  • options
    An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style. See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth,GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
    指定额外布局属性的可选列表。这里传递任意值,将覆盖样式定义的设置。

Returns

System.Enum - The enum option that has been selected by the user.

返回System.Enum,用户选择的枚举选项。

Description描述

Make an enum popup selection field.

制作一个枚举弹出选择字段。

Takes the currently selected enum value as a parameter and returns the enum value selected by the user.

采用当前选择的枚举值作为参数并返回用户选择的枚举值。

Create a primitive depending on the option selected. 
创建一个基本物体,取决于用户选择的选项

// Creates an instance of a primitive depending on the option selected by the user.
//创建一个基本物体的实例,取决于用户选择的选项
enum OPTIONS {
CUBE = ,
SPHERE = ,
PLANE =
}
class EditorGUILayoutEnumPopup extends EditorWindow {
var op : OPTIONS; @MenuItem("Examples/Editor GUILayout Enum Popup usage")
static function Init() {
var window = GetWindow(EditorGUILayoutEnumPopup);
window.Show();
}
function OnGUI() {
op = EditorGUILayout.EnumPopup("Primitive to create:", op);
if(GUILayout.Button("Create"))
InstantiatePrimitive(op);
}
function InstantiatePrimitive(op : OPTIONS) {
switch (op) {
case OPTIONS.CUBE:
var cube : GameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.transform.position = Vector3.zero;
break;
case OPTIONS.SPHERE:
var sphere : GameObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
sphere.transform.position = Vector3.zero;
break;
case OPTIONS.PLANE:
var plane : GameObject = GameObject.CreatePrimitive(PrimitiveType.Plane);
plane.transform.position = Vector3.zero;
break;
default:
Debug.LogError("Unrecognized Option");
break;
}
}
}
 

EditorGUILayout.EnumPopup 枚举弹出选择菜单的更多相关文章

  1. JQuery实现复制数据到剪贴板之各种麻花与右键点击弹出选择菜单

    1.如果小伙伴们只是想实现点击某个按钮(通过click事件)实现复制功能. 那小哥哥我在这里推荐大家使用2个非常好用的插件 (1)clipboard.js:纯js插件,无需flash,相对来说更轻量级 ...

  2. [WPF]DataGrid C#添加右键弹出选择菜单

    private void dataGrid_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { ContextMenu cont ...

  3. Android仿IOS底部弹出选择菜单ActionSheet

    使用Dialog的实现方式,解决原ActionSheet使用Fragment实现而出现的部分手机取消按钮被遮盖的问题 java部分代码: import android.app.Dialog; impo ...

  4. ListView的使用(二)长按弹出上下文菜单

    public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView ...

  5. [deviceone开发]-底部弹出选择

    一.简介 个人上传的第一个示例源码,两天空闲时间写的,一点简单组件,写的挺乱还没啥注释,仅供新手学习. 底部弹出选择,可滑动选择选项,如果停留在选项中间,可自动校正位置,加了一点简单的动画效果,需要的 ...

  6. 转:jQuery弹出二级菜单

    <html> <head> <meta http-equiv="content-type" content="text/html; char ...

  7. WPF:设置弹出子菜单的是否可用状态及效果

    需求: 设置弹出子菜单(二级)项仅首项可用,其他项均不可用:不可用是呈灰色效果. 注: 菜单项都是依据层级数据模板.具体格式如下: StackBlock{TextBlock{Image}.TextBl ...

  8. 安卓系统浏览器中select下拉按钮无法弹出选择面板奇怪问题解决

    今天遇到个让人崩溃的问题: 平台: 安卓 4.0 描述: 使用 appcan 开发 hybrid 应用,手机上点击下拉选框按钮无法弹出选择面板. 说明: 发现 webkit 内核 position:f ...

  9. 微信小程序弹出操作菜单

    微信小程序弹出操作菜单 比如在页面上放一个按钮,点击按钮弹出操作菜单,那么在按钮的 bindtap 事件里,执行下面的代码即可: wx.showActionSheet({ itemList: ['A' ...

随机推荐

  1. MFC学习-第一课 MFC运行机制

    最近由于兴趣爱好,学习了孙鑫的MFC教程的第一课.看完视频了,自己便用visual studio 2010尝试了MFC编程,其中遇到了一些问题. 1.vs2010不像vs6.0那样可以新建一个空的MF ...

  2. js实现观察者模式

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. UIProgressView(进度条控件)

    UIProgressView *pr=[[UIProgressView alloc]init]; pr.frame=CGRectMake(150.0, 190.0, 130.0, 30.0);//进度 ...

  4. python判断字符串

    python判断字符串 s为字符串s.isalnum() 所有字符都是数字或者字母s.isalpha() 所有字符都是字母s.isdigit() 所有字符都是数字s.islower() 所有字符都是小 ...

  5. OpenCV图像金字塔:高斯金字塔、拉普拉斯金字塔与图片尺寸缩放

    这篇已经写得很好,真心给作者点个赞.题目都是直接转过来的,直接去看吧. Reference Link : http://blog.csdn.net/poem_qianmo/article/detail ...

  6. Visual Studio低版本升级到Visual Studio 2012出现Warning LNK4075

    Warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification

  7. sublime中安装css 格式化插件

    HTML-CSS-JS Prettify解决问题 今天发现此插件依赖于nodejs,如果本机没有安装nodejs,会一直提示你安装,解决方法很简单,直接brew install nodejs即可 看看 ...

  8. Latex 表格内公式换行方法

    Latex 表格内的公式实现换行的方法       简单的两步走:   1.先将下面的语句放在latex正文的导言区: \newcommand{\tabincell}[2]{\begin{tabula ...

  9. sky

    UniSky入门资料 http://game.ceeger.com/forum/read.php?tid=4069

  10. LVS工作总结之原理篇–DR模式

    原文地址: http://www.chenqing.org/2012/11/%E3%80%90lvs%E3%80%91lvs%E5%B7%A5%E4%BD%9C%E6%80%BB%E7%BB%93%E ...