private static void GenerateTagConstant(KLCodeWriter cw, KLTagDefinition tag) { string tagConstantName = GetTagConstantName(tag.name); GenerateTagSummary(cw, tag); if (tag.sourceContract != KLTagDefinition.SourceContract.Krilloud) { cw.WriteLine("[System.Obsolete(\"{0}\")]", tag.sourceContract); } cw.WriteLine(string.Format("public const string {0} = \"{1}\";", tagConstantName, tag.name)); }
public static void DrawTag(KLTagDefinition tag) { string text = string.Format("[{0}] {1}", tag.is3D ? "3D" : "2D", tag.name); string description = tag.description; var content = new GUIContent(text, description); var style = new GUIStyle(EditorStyles.miniLabel); style.normal.textColor = GetTagColor(tag, style.normal.textColor); EditorGUILayout.LabelField(content, style); }
private void AddTagToMenu(GenericMenu menu, KLTagDefinition tag) { bool isAdded = m_target.Tags.Contains(tag.name); if (isAdded) { menu.AddDisabledItem(GenerateDropdownContentForTag(tag)); } else { menu.AddItem(GenerateDropdownContentForTag(tag), false, OnAddTag, tag.name); } }
private static void GenerateTagSummary(KLCodeWriter cw, KLTagDefinition tag) { cw.WriteLine("/// <summary>"); cw.WriteLine("/// Tag: {0}", tag.name); if (!string.IsNullOrEmpty(tag.description)) { string description = SecurityElement.Escape(tag.description); cw.WriteLine("/// " + description); } cw.WriteLine("/// {0}", tag.is3D ? "3D" : "2D"); cw.WriteLine("/// </summary>"); }
public static Color GetTagColor(KLTagDefinition variable, Color defaultColor) { switch (variable.sourceContract) { case KLTagDefinition.SourceContract.Krilloud: return(defaultColor); case KLTagDefinition.SourceContract.Placeholder: return(Color.yellow); case KLTagDefinition.SourceContract.Cache: return(Color.red); } return(defaultColor); }
private void Draw(KLTagDefinition tag) { KLEditorUtils.DrawTag(tag); }
private GUIContent GenerateDropdownContentForTag(KLTagDefinition tag) { return(new GUIContent(tag.name)); }