Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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>");
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 private void Draw(KLTagDefinition tag)
 {
     KLEditorUtils.DrawTag(tag);
 }
Exemplo n.º 7
0
 private GUIContent GenerateDropdownContentForTag(KLTagDefinition tag)
 {
     return(new GUIContent(tag.name));
 }