protected virtual void DrawFeedbackHelp() { string helpText = FeedbackHelpAttribute.GetFeedbackHelpText(_feedbackListFeedback.GetType()); if ((!string.IsNullOrEmpty(helpText)) && (MMF_PlayerConfiguration.Instance.ShowInspectorTips)) { float newHeight = _helptextStyle.CalcHeight(new GUIContent(helpText), EditorGUIUtility.currentViewWidth); EditorGUILayout.LabelField(helpText, _helptextStyle); } if (_feedbackListFeedback.RequiresSetup) { _redWarningBoxStyle = GUI.skin.GetStyle("helpbox"); _savedBackground = _redWarningBoxStyle.normal.background; _savedTextColor = _redWarningBoxStyle.normal.textColor; _redWarningBoxStyle.normal.background = _redWarningBoxBackgroundTexture; _redWarningBoxStyle.normal.textColor = Color.black; _redWarningBoxStyle.fontSize = 11; _redWarningBoxStyle.padding = new RectOffset(8, 8, 8, 8); EditorGUILayout.Space(); EditorGUILayout.HelpBox(_feedbackListFeedback.RequiresSetupText, MessageType.Warning); _redWarningBoxStyle.normal.background = _savedBackground; _redWarningBoxStyle.normal.textColor = _savedTextColor; } }
public static int GetFieldInfo(MMF_Feedback target, out List <FieldInfo> fieldInfoList) { Type targetType = target.GetType(); int targetTypeHashCode = targetType.GetHashCode(); if (!FieldInfoList.TryGetValue(targetTypeHashCode, out fieldInfoList)) { IList <Type> typeTree = targetType.GetBaseTypes(); fieldInfoList = target.GetType().GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.NonPublic) .OrderByDescending(x => typeTree.IndexOf(x.DeclaringType)) .ToList(); FieldInfoList.Add(targetTypeHashCode, fieldInfoList); } return(fieldInfoList.Count); }
static public void Copy(MMF_Feedback feedback) { Type feedbackType = feedback.GetType(); MMF_Feedback newFeedback = (MMF_Feedback)Activator.CreateInstance(feedbackType); EditorUtility.CopySerializedManagedFieldsOnly(feedback, newFeedback); CopiedFeedbacks.Clear(); CopiedFeedbacks.Add(newFeedback); }