示例#1
0
 public override string ToString()
 {
     return(Name.ToString() + ", " +
            ParentName.ToString() + ", " +
            ContentFlags.ToString() + ", " +
            streamingExtentsMin.ToString() + ", " +
            streamingExtentsMax.ToString() + ", " +
            entitiesExtentsMin.ToString() + ", " +
            entitiesExtentsMax.ToString());// + ", " +
 }
示例#2
0
 public void WriteXml(StringBuilder sb, int indent)
 {
     CacheDatXml.StringTag(sb, indent, "name", CacheDatXml.HashString(Name));
     CacheDatXml.StringTag(sb, indent, "parent", CacheDatXml.HashString(ParentName));
     CacheDatXml.ValueTag(sb, indent, "contentFlags", ContentFlags.ToString());
     CacheDatXml.SelfClosingTag(sb, indent, "streamingExtentsMin " + FloatUtil.GetVector3XmlString(streamingExtentsMin));
     CacheDatXml.SelfClosingTag(sb, indent, "streamingExtentsMax " + FloatUtil.GetVector3XmlString(streamingExtentsMax));
     CacheDatXml.SelfClosingTag(sb, indent, "entitiesExtentsMin " + FloatUtil.GetVector3XmlString(entitiesExtentsMin));
     CacheDatXml.SelfClosingTag(sb, indent, "entitiesExtentsMax " + FloatUtil.GetVector3XmlString(entitiesExtentsMax));
     CacheDatXml.ValueTag(sb, indent, "unk1", Unk1.ToString());
     CacheDatXml.ValueTag(sb, indent, "unk2", Unk2.ToString());
     CacheDatXml.ValueTag(sb, indent, "unk3", Unk3.ToString());
     CacheDatXml.ValueTag(sb, indent, "unk4", Unk4.ToString());
 }
示例#3
0
        public void Save(string outputpath)
        {
            string filename = outputpath + Name + ".ymap.xml";


            if (File.Exists(filename))
            {
                if (MessageBox.Show("The file " + filename + " already exists. Do you want to overwrite it?", "Confirm file overwrite", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return; //skip this one...
                }
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            sb.AppendLine("<CMapData>");
            sb.AppendLine(" <name>" + Name + "</name>");
            sb.AppendLine(" <parent>" + ParentName + "</parent>");
            sb.AppendLine(" <flags value=\"" + Flags.ToString() + "\"/>");
            sb.AppendLine(" <contentFlags value=\"" + ContentFlags.ToString() + "\"/>");
            sb.AppendLine(" <streamingExtentsMin x=\"" + FStr(StreamingExtentsMinX) + "\" y=\"" + FStr(StreamingExtentsMinY) + "\" z=\"" + FStr(StreamingExtentsMinZ) + "\"/>");
            sb.AppendLine(" <streamingExtentsMax x=\"" + FStr(StreamingExtentsMaxX) + "\" y=\"" + FStr(StreamingExtentsMaxY) + "\" z=\"" + FStr(StreamingExtentsMaxZ) + "\"/>");
            sb.AppendLine(" <entitiesExtentsMin x=\"" + FStr(EntitiesExtentsMinX) + "\" y=\"" + FStr(EntitiesExtentsMinY) + "\" z=\"" + FStr(EntitiesExtentsMinZ) + "\"/>");
            sb.AppendLine(" <entitiesExtentsMax x=\"" + FStr(EntitiesExtentsMaxX) + "\" y=\"" + FStr(EntitiesExtentsMaxY) + "\" z=\"" + FStr(EntitiesExtentsMaxZ) + "\"/>");
            sb.AppendLine(" <entities>");
            foreach (var ent in AllEntities)
            {
                sb.AppendLine("  <Item type=\"CEntityDef\">");
                sb.AppendLine("   <archetypeName>" + ent.Name + "</archetypeName>");
                sb.AppendLine("   <flags value=\"" + ent.Flags.ToString() + "\"/>");
                sb.AppendLine("   <guid value=\"0\"/>");
                sb.AppendLine("   <position x=\"" + FStr(ent.PosX) + "\" y=\"" + FStr(ent.PosY) + "\" z=\"" + FStr(ent.PosZ) + "\"/>");
                sb.AppendLine("   <rotation x=\"" + FStr(ent.RotX) + "\" y=\"" + FStr(ent.RotY) + "\" z=\"" + FStr(ent.RotZ) + "\" w=\"" + FStr(ent.RotW) + "\"/>");
                sb.AppendLine("   <scaleXY value=\"1.0\"/>");
                sb.AppendLine("   <scaleZ value=\"1.0\"/>");
                sb.AppendLine("   <parentIndex value=\"" + ent.NewParentIndex.ToString() + "\"/>");
                sb.AppendLine("   <lodDist value=\"" + FStr(ent.LODDist) + "\"/>");
                sb.AppendLine("   <childLodDist value=\"" + FStr(ent.ChildLODDist) + "\"/>");
                sb.AppendLine("   <lodLevel>" + ent.LODLevel + "</lodLevel>");
                sb.AppendLine("   <numChildren value=\"" + ent.NumChildren.ToString() + "\"/>");
                sb.AppendLine("   <priorityLevel>PRI_REQUIRED</priorityLevel>");
                sb.AppendLine("   <extensions/>");
                sb.AppendLine("   <ambientOcclusionMultiplier value=\"255\"/>");
                sb.AppendLine("   <artificialAmbientOcclusion value=\"255\"/>");
                sb.AppendLine("   <tintValue value=\"0\"/>");
                sb.AppendLine("  </Item>");
            }
            sb.AppendLine(" </entities>");
            sb.AppendLine(" <containerLods/>");
            sb.AppendLine(" <boxOccluders/>");
            sb.AppendLine(" <occludeModels/>");
            sb.AppendLine(" <physicsDictionaries/>");
            sb.AppendLine(" <instancedData>");
            sb.AppendLine("  <ImapLink/>");
            sb.AppendLine("  <PropInstanceList/>");
            sb.AppendLine("  <GrassInstanceList/>");
            sb.AppendLine(" </instancedData>");
            sb.AppendLine(" <timeCycleModifiers/>");
            if (CarGenerators.Count > 0)
            {
                sb.AppendLine(" <carGenerators>");
                foreach (var cg in CarGenerators)
                {
                    sb.AppendLine("  <Item>");
                    sb.AppendLine("   <position x=\"" + FStr(cg.PosX) + "\" y=\"" + FStr(cg.PosY) + "\" z=\"" + FStr(cg.PosZ) + "\"/>");
                    sb.AppendLine("   <orientX value=\"" + FStr(cg.RotX) + "\"/>");
                    sb.AppendLine("   <orientY value=\"" + FStr(cg.RotY) + "\"/>");
                    sb.AppendLine("   <perpendicularLength value=\"" + FStr(cg.Length) + "\"/>");
                    //if (!string.IsNullOrEmpty(cg.ModelName))
                    //{
                    //    sb.AppendLine("   <carModel>" + cg.ModelName + "</carModel>"); //need to do translation!
                    //}
                    //else
                    {
                        sb.AppendLine("   <carModel/>");
                    }
                    sb.AppendLine("   <flags value=\"" + cg.Flags.ToString() + "\"/>");
                    sb.AppendLine("   <bodyColorRemap1 value=\"" + cg.CarColor1.ToString() + "\"/>");
                    sb.AppendLine("   <bodyColorRemap2 value=\"" + cg.CarColor2.ToString() + "\"/>");
                    sb.AppendLine("   <bodyColorRemap3 value=\"" + cg.CarColor3.ToString() + "\"/>");
                    sb.AppendLine("   <bodyColorRemap4 value=\"" + cg.CarColor4.ToString() + "\"/>");
                    sb.AppendLine("   <popGroup/>");
                    sb.AppendLine("   <livery value=\"-1\"/>");
                    sb.AppendLine("  </Item>");
                }
                sb.AppendLine(" </carGenerators>");
            }
            else
            {
                sb.AppendLine(" <carGenerators/>");
            }
            sb.AppendLine(" <LODLightsSOA>");
            sb.AppendLine("  <direction/>");
            sb.AppendLine("  <falloff/>");
            sb.AppendLine("  <falloffExponent/>");
            sb.AppendLine("  <timeAndStateFlags/>");
            sb.AppendLine("  <hash/>");
            sb.AppendLine("  <coneInnerAngle/>");
            sb.AppendLine("  <coneOuterAngleOrCapExt/>");
            sb.AppendLine("  <coronaIntensity/>");
            sb.AppendLine(" </LODLightsSOA>");
            sb.AppendLine(" <DistantLODLightsSOA>");
            sb.AppendLine("  <position/>");
            sb.AppendLine("  <RGBI/>");
            sb.AppendLine("  <numStreetLights value=\"0\"/>");
            sb.AppendLine("  <category value=\"0\"/>");
            sb.AppendLine(" </DistantLODLightsSOA>");
            sb.AppendLine(" <block>");
            sb.AppendLine("  <version value=\"0\"/>");
            sb.AppendLine("  <flags value=\"0\"/>");
            sb.AppendLine("  <name>" + Name + "</name>");
            sb.AppendLine("  <exportedBy>VIPL by dexyfex</exportedBy>");
            sb.AppendLine("  <owner/>");
            sb.AppendLine("  <time>" + DateTime.UtcNow.ToString("dd MMMM yyyy HH:mm") + "</time>");
            sb.AppendLine(" </block>");
            sb.AppendLine("</CMapData>");

            File.WriteAllText(filename, sb.ToString());
        }