public static void openDetailedHelp(LibraryMemberInfo memberInfo) { // if(memberInfo != null) { // if (memberInfo.Company == "Unity") { // string search= getHelpUrl(memberInfo); // if (search != null) // Help.ShowHelpPage("file:///unity/ScriptReference/" + search + ".html"); // } // } }
public static LibraryMemberInfo getAssociatedHelpMemberInfo(iCS_EditorObject edObj) { if (edObj != null) { if (edObj.IsPort) { // check for special types of ports. // TODO: support these. if (edObj.PortIndex == (int)PortIndex.Return && edObj.ParentNode.IsStaticField) { // return port will be same as parent node description. } else if (edObj.IsKindOfPackagePort && !edObj.IsInstanceNodePort && !edObj.IsProposedDataPort) { return(null); } else if (edObj.PortIndex >= (int)PortIndex.ParametersEnd) { return(null); } // Following port will contain the member info if (edObj.IsProposedDataPort) { // contained in edObj } else if (edObj.IsInputPort) { var consumerPorts = edObj.SegmentEndConsumerPorts; var aConsumer = consumerPorts.Length != 0 ? consumerPorts[0] : edObj; edObj = aConsumer.Parent; } else if (edObj.IsOutputPort) { edObj = edObj.SegmentProducerPort.Parent; } } LibraryMemberInfo memberInfo = null; // Try and Get Member Info from GetAssociatedDescriptor if (edObj.IsKindOfFunction || edObj.IsEventHandler) { memberInfo = edObj.GetLibraryObject() as LibraryMemberInfo; } return(memberInfo); } return(null); }
// ====================================================================== // Mouse in detected over a library item, show help in the Visual Editor. // ---------------------------------------------------------------------- public void libraryHelp(LibraryMemberInfo memInfo) { // EditorWindow edWin= EditorWindow.mouseOverWindow; // if(edWin!= null && iCS_Types.IsA<LibraryEditor>(edWin.GetType())) { // if(memInfo == null) { // helpWindowChange(); // } // else { // myIsLibraryHelp= true; // string title= HelpController.GetHelpTitle(memInfo); // string help= HelpController.getHelp(memInfo); // string parameters= HelpController.GetHelpParameters(memInfo); // myHelpText= title + "\n" + (String.IsNullOrEmpty(help) ? "\n" : help + "\n\n") + parameters; // Repaint(); // } // } }
public static string getHelp(LibraryMemberInfo memberInfo) { if (memberInfo != null) { // // Return help string if there is already one in the memberInfo // if (memberInfo.HelpSummaryCache != null) { // return memberInfo.HelpSummaryCache; // } // // // Try and use MemberInfo Description // if (!String.IsNullOrEmpty(memberInfo.StoredDescription)) { // return memberInfo.StoredDescription; // } // // // If there is no help string already in MemberInfo, try and look up Unity help // if (memberInfo.HelpSummaryCache==null && memberInfo.Company == "Unity") { // string search= getHelpUrl(memberInfo); // string summary=null; // unityHelpSummary.TryGetValue(search, out summary); // if (!String.IsNullOrEmpty(summary)) { // // cache and return the found help string // memberInfo.HelpSummaryCache= summary; // return summary; // } // } // // // If there is no help found yet, try and return help based on type // String typeHelp= getHelp(memberInfo.GetType()); // if (!String.IsNullOrEmpty(typeHelp)) { // memberInfo.HelpSummaryCache= typeHelp; // } // else // { // // Mark cache as empty string (vs null), so we do not search again // memberInfo.HelpSummaryCache= ""; // } // return typeHelp; } return(null); }
// ================================================================================= // Get the Unity help file url // --------------------------------------------------------------------------------- private static string getHelpUrl(LibraryMemberInfo memberInfo) { return(""); // string className=""; // string demarcator=""; // string methodName=""; // // if (memberInfo.IsMessage) { // className = memberInfo.ParentTypeInfo.ClassName; // demarcator= "."; // methodName= memberInfo.DisplayName; // } // else if (memberInfo.IsTypeInfo) { // // First level libray entries (classes and packages), just return className // className = memberInfo.ToTypeInfo.ClassName; // } // else if (memberInfo.IsMethod) { // if(memberInfo.ToMethodInfo.DeclaringType.Name == null) // className= memberInfo.ParentTypeInfo.ClassName; // else // className= memberInfo.ToMethodInfo.DeclaringType.Name; // // methodName= memberInfo.ToMethodInfo.MethodName; // if (memberInfo.IsProperty) { // // Property Nodes // demarcator="-"; // methodName= Regex.Replace(methodName, "get_", string.Empty); // methodName= Regex.Replace(methodName, "set_", string.Empty); // } // else if(memberInfo.IsConstructor) { // // Builders // demarcator="-ctor"; // methodName= ""; // } // else { // // Functions, etc. // demarcator= "."; // // Remap arithmetic operator names // if (methodName.Contains("op_")) { // demarcator="-"; // methodName= Regex.Replace(methodName, "op_Addition", "operator_add"); // methodName= Regex.Replace(methodName, "op_Division", "operator_divide"); // methodName= Regex.Replace(methodName, "op_Equality", "operator_eq"); // methodName= Regex.Replace(methodName, "op_Inequality", "operator_ne"); // methodName= Regex.Replace(methodName, "op_Multiply", "operator_multiply"); // methodName= Regex.Replace(methodName, "op_Subtraction", "operator_subtract"); // //methodName= Regex.Replace(methodName, "op_UnaryNegation", ???); // // TODO: else Debug.Log // // TODO: More opertators .. csharp operators. // } // } // } // else if (memberInfo.IsField) { // // Field Nodes // className= memberInfo.ParentTypeInfo.ClassName; // methodName= memberInfo.ToFieldInfo.MethodName; // if(memberInfo.ToFieldInfo.IsClassMember) // demarcator= "."; // else if(memberInfo.ToFieldInfo.IsInstanceMember) // demarcator= "-"; // else // demarcator= "."; // } // // return className + demarcator + methodName; }