Esempio n. 1
0
        public static V2DWorld CreateFromXml(string xmlPath)
        {
            XmlSerializer s = new XmlSerializer(typeof(V2DWorld));
            TextReader    r = new StreamReader(xmlPath);
            V2DWorld      w = (V2DWorld)s.Deserialize(r);

            r.Close();
            return(w);
        }
Esempio n. 2
0
 private void WriteTextures(V2DWorld v2dWorld)
 {
     List<string> parsed = new List<string>();
     foreach (string key in usedImages.Keys)
     {
         V2DTexture t = new V2DTexture();
         t.Source = key;// usedImages[key];
         v2dWorld.textures.Add(t);
     }
 }
Esempio n. 3
0
        private void WriteDefinitions(V2DWorld v2dWorld)
        {
            foreach (Definition2D def in v2d.definitions)
            {
				V2DDefinition d;
				if (def is Text2D)
				{
					V2DText v2t = new V2DText();
					d = v2t;
					v2t.TextRuns = ((Text2D)def).TextRuns;
				}
				else
				{
					d = new V2DDefinition();
					d.V2DShapes.Clear();
					for (int i = 0; i < def.Shapes.Count; i++)
					{
						d.V2DShapes.Add(def.Shapes[i].GetV2DShape());
					}

					d.Instances.Clear();
					if (def.Children.Count > 0)
					{
						for (int i = 0; i < def.Children.Count; i++)
						{
							d.Instances.Add(GetV2DInstance(def.Children[i]));
						}
					}
				}

				v2dWorld.definitions.Add(d);
				d.Name = def.DefinitionName;
				d.Id = def.Id;
				d.LinkageName = def.LinkageName;// paths.ContainsKey(def.Id) ? paths[def.Id] : "";
				d.FrameCount = def.FrameCount;
				d.OffsetX = def.Bounds.Point.X;
				d.OffsetY = def.Bounds.Point.Y;
				d.Width = def.Bounds.Size.Width;
				d.Height = def.Bounds.Size.Height;

				d.Joints.Clear();
				if (def.Joints.Count > 0)
				{
					WriteJointData(d.Joints, def);
				}
            }
        }
Esempio n. 4
0
 private void EnsureV2DWorld()
 {
     if (SymbolImport != null && v2dWorld == null)
     {
         // ** note: unnamed elements may actually fall out of scope and get gc/disposed, so need a ref
         // todo: use multiple content loaders per screen and unload where needed.
         //V2DContent content = V2DGame.instance.Content.Load<V2DContent>(SymbolImport.assetName);
         content = V2DGame.instance.Content.Load<V2DContent>(SymbolImport.assetName);
         v2dWorld = content.v2dWorld;
         textures = content.textures;
         v2dWorld.RootInstance.Definition = v2dWorld.GetDefinitionByName(V2DGame.ROOT_NAME);
     }
 }
Esempio n. 5
0
 public Screen(V2DContent v2dContent)
 {
     this.v2dWorld = v2dContent.v2dWorld;
     this.textures = v2dContent.textures;
     SetAttributes();
 }
Esempio n. 6
0
 public GenV2DWorld(VexTree v2d, Dictionary<string, IDefinition> usedImages)
 {
     this.v2d = v2d;
     this.usedImages = usedImages;
     v2dWorld = new V2DWorld();
 }