zoukankan      html  css  js  c++  java
  • EditorGUILayout.EnumPopup 枚举弹出选择菜单

    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.

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

    EditorGUILayout.EnumPopup 枚举弹出选择菜单

    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 = 0,
        SPHERE = 1,
        PLANE = 2
    }
    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;
            }
        }
    }
     
  • 相关阅读:
    iNeuOS工业互联平台,WEB组态(iNeuView)集成rtmp和websocket视频元件,支持海康、大华等摄像头实时显示视频
    MyBatis之TypeHandler用法
    视频监控安防专网事件预警运维系统开发方案
    Qmgo 开源了! 更好用的 Go 语言 MongoDB driver
    前端使用axios传递数组后端使用List接收
    jdk1.6手册java8中英手册java9英文手册.chm(下载)
    自动化运维工具Ansible (一)
    初级模拟电路:4-11 混合π模型
    简单体验一个高性能,简单,轻量的ORM库- Dapper (无依赖其它库,非常方便高效)
    Python计算大文件行数方法及性能比较
  • 原文地址:https://www.cnblogs.com/123ing/p/4123664.html
Copyright © 2011-2022 走看看