Exemple #1
0
        public static CCombobox CreateCombobox(string name, int x, int y, Transform parent, int w, int h, int depth)
        {
            GameObject obj = UnityEngine.Object.Instantiate(FuncUtil.GetUIAssetByPath(COMBOBOX_PATH)) as GameObject;

            if (obj == null)
            {
                return(null);
            }
            obj.transform.parent        = parent;
            obj.transform.localScale    = Vector3.one;
            obj.transform.localPosition = new Vector3(x, y, 0);
            CCombobox box = obj.GetComponent <CCombobox>();

            return(box);
        }
        protected override void DrawCustomProperties()
        {
            NGUIEditorTools.DrawProperty("Btn", serializedObject, "Btn");
            NGUIEditorTools.DrawProperty("List", serializedObject, "List");
            NGUIEditorTools.DrawProperty("Bg", serializedObject, "Bg");
            GUI.changed = false;
            NGUIEditorTools.DrawProperty("MaxListHeight", serializedObject, "_MaxListHeight");
            if (GUI.changed)
            {
                SerializedProperty sp = serializedObject.FindProperty("_MaxListHeight");
                foreach (GameObject go in Selection.gameObjects)
                {
                    CCombobox w = go.GetComponent <CCombobox>();
                    if (w != null)
                    {
                        w.MaxListHeight = sp.intValue;
                        return;
                    }
                }
            }

            base.DrawCustomProperties();
        }