コード例 #1
0
ファイル: MemberEditor.cs プロジェクト: d5j6/tntdoc_github
    void ParametersAndReturnGUI(MemberSession member, int sectionIndex, bool readOnly)
    {
        MemberSubSection section = member.Model.SubSections[sectionIndex];

        // Parameters
        if (section.Parameters.Count > 0)
        {
            GUILayout.Label("Parameters", DocBrowser.styles.docSectionHeader);

            // Handle dragging parameter into first slot
            Rect dragTargetRect = GUILayoutUtility.GetRect(10, 0);
            dragTargetRect.y     -= 6;
            dragTargetRect.height = 14;
            DocBrowser.DragTarget(dragTargetRect, typeof(ParameterWithDoc), section.Parameters, 0);

            ParameterWithDoc paramToRemove = null;
            for (int i = 0; i < section.Parameters.Count; i++)
            {
                ParameterWithDoc p     = section.Parameters[i];
                string           label = "<b>" + p.Name + " : </b>" + (p.HasAsm ? Extensions.GetNiceName(p.TypeString) : "?");
                bool             remove;
                p.Doc = ParamOrReturnGUI(p.HasAsm, p.HasDoc, label, p.Doc, member.Language, readOnly, out remove, section.Parameters, i);
                if (remove)
                {
                    paramToRemove = p;
                }
            }
            if (paramToRemove != null)
            {
                section.Parameters.Remove(paramToRemove);
            }
        }

        // Returns
        if (section.ReturnDoc != null)
        {
            GUILayout.Label("Returns", DocBrowser.styles.docSectionHeader);
            ReturnWithDoc p     = section.ReturnDoc;
            string        label = (p.HasAsm ? Extensions.GetNiceName(p.ReturnType) : "?");
            bool          remove;
            p.Doc = ParamOrReturnGUI(p.HasAsm, p.HasDoc, label, p.Doc, member.Language, readOnly, out remove);
            if (remove)
            {
                section.ReturnDoc = null;
            }
        }

        EditorGUILayout.Space();
    }
コード例 #2
0
 private static XElement FormattedXML(ReturnWithDoc returnWithDoc)
 {
     return(new XElement("ReturnWithDoc", new XAttribute("type", returnWithDoc.ReturnType), new XElement("doc", new XCData(returnWithDoc.Doc))));
 }