コード例 #1
0
ファイル: ObjectField.cs プロジェクト: vinhphu3000/unitylib
        public override void Draw()
        {
            m_Foldout = EditorGUILayout.Foldout(m_Foldout, m_Label);

            if (m_Foldout)
            {
                YHEditorTools.PushIndentLevel(m_Deep + 1);
                YHEditorTools.PushLabelWidth(80);

                GUILayout.BeginVertical();

                //显示元素
                for (int i = 0; i < m_Elements.Count; ++i)
                {
                    object oldElementValue = m_Elements[i].value;
                    m_Elements[i].Draw();
                    if (m_Elements[i].value != oldElementValue)
                    {
                        ReflectionUtils.SetValue(m_Accesses[i], m_Value, m_Elements[i].value);
                    }
                }
                GUILayout.EndVertical();

                YHEditorTools.PopLabelWidth();
                YHEditorTools.PopIndentLevel();
            }
        }
コード例 #2
0
ファイル: ArrayField.cs プロジェクト: vinhphu3000/unitylib
        public override void Draw()
        {
            int len = m_Elements.Count;

            m_Foldout = EditorGUILayout.Foldout(m_Foldout, m_Label);


            if (m_Foldout)
            {
                YHEditorTools.PushIndentLevel(m_Deep + 1);
                YHEditorTools.PushLabelWidth(80);

                GUILayout.BeginVertical();
                //数组大小
                int newLen = EditorGUILayout.IntField("size", len);
                if (newLen != len)
                {
                    ChangeLength(newLen);
                }

                //数组元素
                for (int i = 0; i < m_Elements.Count; ++i)
                {
                    object oldElementValue = m_Elements[i].value;
                    m_Elements[i].Draw();
                    if (m_Elements[i].value != oldElementValue)
                    {
                        ReflectionUtils.InvokeMethod(m_Value, "SetValue", new object[] { m_Elements[i].value, i });
                    }
                }
                GUILayout.EndVertical();

                YHEditorTools.PopLabelWidth();
                YHEditorTools.PopIndentLevel();
            }
        }
コード例 #3
0
 public override void Draw()
 {
     YHEditorTools.PushIndentLevel(m_Deep);
     m_Value = YHGUI.DrawElement(m_Value, m_Type, m_Label);
     YHEditorTools.PopIndentLevel();
 }