zoukankan      html  css  js  c++  java
  • unity, inspector listview

    inspector中实现列表框:

    public override void OnInspectorGUI(){

            bool isDoubleClick=false;
            Event e = Event.current;
            if (e.type == EventType.mouseDown && Event.current.button == 0) {//left button down
                if(e.clickCount==2){//double click
                    isDoubleClick=true;
                }    
            }//got isDoubleClick

            Rect scrollviewRect=EditorGUILayout.BeginVertical ();
            {
                scrollPosition = EditorGUILayout.BeginScrollView (scrollPosition, "box", GUILayout.Height (150));
                {
                
                    //ref: http://answers.unity3d.com/questions/37223/how-do-i-center-a-gui-label.html
                    //ref: http://iaimstar.iteye.com/blog/2222128
                    GUIStyle _style = GUI.skin.GetStyle ("MenuItemMixed");

                    m_selectIndex = GUILayout.SelectionGrid (m_selectIndex, list.ToArray (), 1, _style);
                }
                EditorGUILayout.EndScrollView ();
                if (scrollviewRect.Contains (e.mousePosition)) {
                    if(isDoubleClick){
                       Debug.Log(list[m_selectIndex]);
                    }
                }
            }
            EditorGUILayout.EndVertical ();

    }

  • 相关阅读:
    网络流24题之 1738: 最小路径覆盖问题
    POJ 1966 Cable TV Network
    网络流24题- 魔术球问题
    网络流24题之 圆桌问题
    可持久化线段树维护启发式合并的可持久化并查集
    HDU 6166 Senior Pan
    ACM对拍cpp程序
    双联通分量复习
    欧拉回路求路径POJ 2230
    LCA的两种求法
  • 原文地址:https://www.cnblogs.com/wantnon/p/5341513.html
Copyright © 2011-2022 走看看