Exemplo n.º 1
0
        public static void drawGUI(ScriptingDefineSymbols self, ReorderableList m_lst)
        {
            try {
                EditorGUILayout.Space();

                SerializedObject serializedObject = new SerializedObject(self);
                serializedObject.Update();

                // リスト・配列の変更可能なリストの表示
                m_lst.DoLayoutList();

                serializedObject.ApplyModifiedProperties();
            }
            catch (System.Exception e) {
                UnityEngine.Debug.LogError(e);
            }
        }
Exemplo n.º 2
0
        public static ReorderableList makeReorderableList(ScriptingDefineSymbols self)
        {
            ReorderableList rlist;

            rlist = new ReorderableList(self.m_lst, typeof(ScriptingDefineSymbols.Data));

            var paddingY = 4.0f;
            var ctrlH    = EditorGUIUtility.singleLineHeight;

            rlist.drawHeaderCallback = (rect) => {
                EditorGUI.LabelField(rect, "ScriptingDefineSymbols");
            };
            rlist.drawElementCallback = (rect, index, isActive, isFocused) => {
                var item = self.m_lst[index];
                var padH = paddingY * 0.5f;
                var h    = EditorGUIUtility.singleLineHeight + paddingY;
                var r1   = new Rect(rect.x, padH + rect.y + (h * 0), rect.width, ctrlH);

                //	var r4 = new Rect( rect.x, padH + rect.y + ( h * 0 ), 16, ctrlH );
                //	var _toggle = EditorGUI.Toggle( r4, item.toggle );
                EditorGUI.BeginChangeCheck();

                var _no = EditorGUI.TextField(r1, item.name);

                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(self, "Undo ");

                    item.name = _no;

                    EditorUtility.SetDirty(self);
                }
            };

            rlist.elementHeight = ((ctrlH + paddingY));

            return(rlist);
        }