public VergeTileGround ( VergeTileData data, Rectangle screenViewRect, Rectanglef mapSize ) { gridWidthSum = data.gridWidth; gridHeightSum = data.gridHeight; this.screenViewRect = screenViewRect; this.mapSize = mapSize; float gridScaleInWidth = mapSize.Width / (float)gridWidthSum; float gridScaleInHeight = mapSize.Height / (float)gridHeightSum; gridScale = Math.Max( gridScaleInWidth, gridScaleInHeight ); vertexTexIndexs = new int[data.vertexTexIndexs.Length]; data.vertexTexIndexs.CopyTo( vertexTexIndexs, 0 ); gridTexIndexs = new int[data.gridTexIndexs.Length]; data.gridTexIndexs.CopyTo( gridTexIndexs, 0 ); InitialTexList( data ); InitialGridTexData(); CreateSpriteBatches(); sourceWidth = gridTexData[0][0].sourceRect.Width; BaseGame.Device.DeviceReset += new EventHandler( Device_DeviceReset ); }
public VergeTileGround(VergeTileData data, Rectangle screenViewRect, Rectanglef mapSize) { gridWidthSum = data.gridWidth; gridHeightSum = data.gridHeight; this.screenViewRect = screenViewRect; this.mapSize = mapSize; float gridScaleInWidth = mapSize.Width / (float)gridWidthSum; float gridScaleInHeight = mapSize.Height / (float)gridHeightSum; gridScale = Math.Max(gridScaleInWidth, gridScaleInHeight); vertexTexIndexs = new int[data.vertexTexIndexs.Length]; data.vertexTexIndexs.CopyTo(vertexTexIndexs, 0); gridTexIndexs = new int[data.gridTexIndexs.Length]; data.gridTexIndexs.CopyTo(gridTexIndexs, 0); InitialTexList(data); InitialGridTexData(); CreateSpriteBatches(); sourceWidth = gridTexData[0][0].sourceRect.Width; BaseGame.Device.DeviceReset += new EventHandler(Device_DeviceReset); }
private void InitialTexList(VergeTileData data) { TexList = new Texture2D[data.texPaths.Length]; for (int i = 0; i < data.texPaths.Length; i++) { TexList[i] = Texture2D.FromFile(BaseGame.Device, data.texPaths[i]); } }
public static void Save ( Stream stream, VergeTileData data ) { if (serializer == null) serializer = new XmlSerializer( typeof( VergeTileData ) ); try { serializer.Serialize( stream, data ); } catch (Exception) { Log.Write( "Save VergeTileData error!" ); } finally { stream.Close(); } }
public static void Save(Stream stream, VergeTileData data) { if (serializer == null) { serializer = new XmlSerializer(typeof(VergeTileData)); } try { serializer.Serialize(stream, data); } catch (Exception) { Log.Write("Save VergeTileData error!"); } finally { stream.Close(); } }
public static VergeTileData Load(Stream stream) { if (serializer == null) { serializer = new XmlSerializer(typeof(VergeTileData)); } VergeTileData result = null; try { result = (VergeTileData)serializer.Deserialize(stream); } catch (Exception) { Log.Write("Load VergeTileData error!"); } finally { stream.Close(); } return(result); }
private void InitialTexList ( VergeTileData data ) { TexList = new Texture2D[data.texPaths.Length]; for (int i = 0; i < data.texPaths.Length; i++) { TexList[i] = Texture2D.FromFile( BaseGame.Device, data.texPaths[i] ); } }