public string ToStruct()
        {
            StringBuilder result = new StringBuilder("{ ");

            result.Append(((StructEnums.NJD_EVAL)GetFlags()).ToString().Replace(", ", " | "));
            result.Append(", ");
            result.Append(Attach != null ? "&" + Attach.Name : "NULL");
            foreach (float value in Position.ToArray())
            {
                result.Append(", ");
                result.Append(value.ToC());
            }
            foreach (int value in Rotation.ToArray())
            {
                result.Append(", ");
                result.Append(value.ToCHex());
            }
            foreach (float value in Scale.ToArray())
            {
                result.Append(", ");
                result.Append(value.ToC());
            }
            result.Append(", ");
            result.Append(Children.Count > 0 ? "&" + Children[0].Name : "NULL");
            result.Append(", ");
            result.Append(Sibling != null ? "&" + Sibling.Name : "NULL");
            result.Append(" }");
            return(result.ToString());
        }
Exemple #2
0
 public void ToNJA(TextWriter writer, bool DX, List <string> labels, string[] textures = null)
 {
     for (int i = 1; i < Children.Count; i++)
     {
         Children[i - 1].Sibling = Children[i];
     }
     for (int i = Children.Count - 1; i >= 0; i--)
     {
         if (!labels.Contains(Children[i].Name))
         {
             labels.Add(Children[i].Name);
             Children[i].ToNJA(writer, DX, labels, textures);
             writer.WriteLine();
         }
     }
     if (Parent == null && Sibling != null && !labels.Contains(Sibling.Name))
     {
         labels.Add(Sibling.Name);
         Sibling.ToNJA(writer, DX, labels, textures);
         writer.WriteLine();
     }
     writer.WriteLine("OBJECT_START");
     if (Attach is BasicAttach)
     {
         BasicAttach basicattach = Attach as BasicAttach;
         basicattach.ToNJA(writer, DX, labels, textures);
     }
     writer.Write("OBJECT ");
     writer.Write(Name);
     writer.WriteLine("[]");
     writer.WriteLine("START");
     writer.WriteLine("EvalFlags ( " + ((StructEnums.NJD_EVAL)GetFlags()).ToString().Replace(", ", " | ") + " ),");
     writer.WriteLine("Model  " + (Attach != null ? "&" + Attach.Name : "NULL") + ",");
     writer.Write("OPosition ( ");
     foreach (float value in Position.ToArray())
     {
         writer.Write(value.ToC());
         writer.Write(", ");
     }
     writer.WriteLine("),");
     writer.Write("OAngle ( ");
     foreach (float value in Rotation.ToArray())
     {
         writer.Write(value.ToC());
         writer.Write(", ");
     }
     writer.WriteLine("),");
     writer.Write("OScale ( ");
     foreach (float value in Scale.ToArray())
     {
         writer.Write(value.ToC());
         writer.Write(", ");
     }
     writer.WriteLine("),");
     writer.WriteLine("Child " + (Children.Count > 0 ? Children[0].Name : "NULL") + ",");
     writer.WriteLine("Sibling " + (Sibling != null ? Sibling.Name : "NULL"));
     writer.WriteLine("END");
     writer.WriteLine("OBJECT_END");
 }