Exemple #1
0
 public void ToWorkshop(WorkshopBuilder b, ToWorkshopContext context)
 {
     if (_keyword)
     {
         b.AppendKeyword(Value);
     }
     else
     {
         b.Append(Value);
     }
 }
Exemple #2
0
        public override void ToWorkshop(WorkshopBuilder b, ToWorkshopContext context)
        {
            b.AppendKeyword(Localized ? "String" : "Custom String");
            b.Append("(\"" + (Localized ? b.Kw(Value) : Value) + "\"");

            if (ParameterValues.Length > 0)
            {
                b.Append(", ");
                ParametersToWorkshop(b);
            }

            b.Append(")");
        }
        public virtual string ToWorkshop(OutputLanguage language, ToWorkshopContext context)
        {
            // Get the parameters
            AddMissingParameters();
            List <string> parameters = AdditionalParameters().ToList();

            parameters.AddRange(ParameterValues.Select(p => p.ToWorkshop(language, ToWorkshopContext.NestedValue)));

            string result = Extras.Indent(Indent, true); // TODO: option for spaces or tab output.

            // Add a comment and newline
            if (Comment != null)
            {
                result += $"\"{Comment}\"\n" + Extras.Indent(Indent, true);
            }

            // Add the disabled tag if the element is disabled.
            if (!ElementList.IsValue && Disabled)
            {
                result += LanguageInfo.Translate(language, "disabled") + " ";
            }

            // Add the name of the element.
            result += LanguageInfo.Translate(language, Name);

            // Add the parameters.
            if (parameters.Count != 0)
            {
                result += "(" + string.Join(", ", parameters) + ")";
            }
            else if (AlwaysShowParentheses)
            {
                result += "()";
            }

            // Add the ; if the element is an action.
            if (!ElementList.IsValue)
            {
                result += ";";
            }
            return(result);
        }
        public virtual void ToWorkshop(WorkshopBuilder b, ToWorkshopContext context)
        {
            var action = Function as ElementJsonAction;

            if (action != null && (action.Indentation == "outdent" || action.Indentation == "drop"))
            {
                b.Outdent();
            }

            // Add a comment and newline
            if (Comment != null)
            {
                b.AppendLine($"\"{Comment}\"");
            }

            // Add the disabled tag if the element is disabled.
            if (Function is ElementJsonAction && Disabled)
            {
                b.AppendKeyword("disabled").Append(" ");
            }

            // Add the name of the element.
            b.AppendKeyword(Function.Name);

            // Add the parameters.
            AddMissingParameters();
            if (ParameterValues.Length > 0)
            {
                b.Append("(");
                ParametersToWorkshop(b);
                b.Append(")");
            }

            if (action != null)
            {
                b.AppendLine(";");
                if (action.Indentation == "indent" || action.Indentation == "drop")
                {
                    b.Indent();
                }
            }
        }
Exemple #5
0
        public string ToWorkshop(OutputLanguage language, ToWorkshopContext context)
        {
            string numTranslate(string name)
            {
                return(LanguageInfo.Translate(language, name) + WorkshopName.Substring(name.Length));
            }

            if (@Enum.Type == typeof(PlayerSelector) && WorkshopName.StartsWith("Slot"))
            {
                return(numTranslate("Slot"));
            }
            if (@Enum.Type == typeof(Button) && WorkshopName.StartsWith("Ability"))
            {
                return(numTranslate("Ability"));
            }
            if ((@Enum.Type == typeof(Team) || @Enum.Type == typeof(Color)) && WorkshopName.StartsWith("Team"))
            {
                return(numTranslate("Team"));
            }

            return(LanguageInfo.Translate(language, WorkshopName).RemoveStructuralChars());
        }
Exemple #6
0
 public string ToWorkshop(OutputLanguage outputLanguage, ToWorkshopContext context) => throw new NotImplementedException();
 public virtual string ToWorkshop(OutputLanguage language, ToWorkshopContext context) => Name;
 public void ToWorkshop(WorkshopBuilder builder, ToWorkshopContext context) => throw new NotImplementedException();
 public string ToWorkshop(OutputLanguage language, ToWorkshopContext context) => StartMarker.NumberOfActionsToMarker(EndMarker).ToString();
 public void ToWorkshop(WorkshopBuilder builder, ToWorkshopContext context) => builder.AppendKeyword(WorkshopName());
 public virtual void ToWorkshop(WorkshopBuilder b, ToWorkshopContext context) => b.Append(Name);
Exemple #12
0
 string IWorkshopTree.ToWorkshop(OutputLanguage language, ToWorkshopContext context) => throw new System.NotImplementedException();
 void IWorkshopTree.ToWorkshop(WorkshopBuilder b, ToWorkshopContext context) => throw new System.NotImplementedException();