public frmJpegLoader( string imagePath, int width, int height, SkiStuntLevel level ) { InitializeComponent(); this.imagePath = imagePath; this.imageWidth = width; this.imageHeight = height; this.level = level; // We only really need a reference to the active level so we can call .save() when an image is deleted/added. noImage = !File.Exists( imagePath ); lblDefault.Visible = noImage; btnExport.Enabled = !noImage; btnNoImage.Enabled = !noImage; jpegViewer.BackgroundImage = noImage ? null : new Bitmap( imagePath ); }
public frmTextureSelect( SkiStuntLevel level, LevelPolygon polygon ) { InitializeComponent(); this.level = level; this.polygon = polygon; if( polygon.TextureID < 0 ) { curTexIndex = 0; radColor.Select(); } else { curTexIndex = polygon.TextureID; radTexture.Select(); } resetTextboxValues(); redrawPreviewBox(); }
public static SkiStuntLevel LoadFolder( string folder ) { SkiStuntLevel level = new SkiStuntLevel( folder ); if( ! File.Exists( folder + "\\studioFile.txt" ) ) return level; StreamReader studioFile = new StreamReader( folder + "\\studioFile.txt", false ); level.LevelTitle = studioFile.ReadLine(); level.GoalText = studioFile.ReadLine(); level.HintText = studioFile.ReadLine(); level.PlayerStart.x = float.Parse( studioFile.ReadLine() ); level.PlayerStart.y = float.Parse( studioFile.ReadLine() ); level.endzoneA.x = float.Parse( studioFile.ReadLine() ); level.endzoneA.y = float.Parse( studioFile.ReadLine() ); level.endzoneB.x = float.Parse( studioFile.ReadLine() ); level.endzoneB.y = float.Parse( studioFile.ReadLine() ); level.EndzoneRequirements = (EndzoneRequirementType)uint.Parse( studioFile.ReadLine() ); int vertexCount = int.Parse( studioFile.ReadLine() ); for( int i = 0 ; i < vertexCount ; ++i ) { level.vertices.Add( new LevelVertex ( float.Parse( studioFile.ReadLine() ), float.Parse( studioFile.ReadLine() ), int .Parse( studioFile.ReadLine() ) )); } int polygonCount = int.Parse( studioFile.ReadLine() ); for( int i = 0 ; i < polygonCount ; ++i ) { LevelPolygon p = new LevelPolygon(); p.Friction = float.Parse( studioFile.ReadLine() ); p.Bounce = float.Parse( studioFile.ReadLine() ); p.Solidity = float.Parse( studioFile.ReadLine() ); p.SolidAtAll = bool.Parse( studioFile.ReadLine() ); p.TextureID = int.Parse( studioFile.ReadLine() ); if( p.TextureID >= 0 ) { p.TextureOffsetX = float.Parse( studioFile.ReadLine() ); p.TextureOffsetY = float.Parse( studioFile.ReadLine() ); p.TextureScaleX = float.Parse( studioFile.ReadLine() ); p.TextureScaleY = float.Parse( studioFile.ReadLine() ); } else { p.Color = Color.FromArgb( int.Parse( studioFile.ReadLine() ) ); } int polyVertCount = int.Parse( studioFile.ReadLine() ); for( int j = 0 ; j < polyVertCount ; ++j ) { p.AddVertex( level.vertices[ int.Parse( studioFile.ReadLine() ) ] ); } level.AddPolygon( p ); } int objectCount = int.Parse( studioFile.ReadLine() ); for( int i = 0 ; i < objectCount ; ++i ) { LevelObject o = new LevelObject(); o.x = float.Parse( studioFile.ReadLine() ); o.y = float.Parse( studioFile.ReadLine() ); o.rotation = float.Parse( studioFile.ReadLine() ); o.type = (LevelObject.ObjectType)uint.Parse( studioFile.ReadLine() ); o.anchor = (LevelObject.AnchorType)uint.Parse( studioFile.ReadLine() ); level.AddObject( o ); } studioFile.Close(); return level; }
/** */ private void btnNew_Click( object sender, EventArgs e ) { string newLevelFolder = getUnusedLevelFolderName(); string newLevelName = "New Level"; DialogResult r = Program.InputBox( "Ski Stunt Studio", "Enter a name for the new level:", ref newLevelName ); if( r != DialogResult.OK ) return; Directory.CreateDirectory( newLevelFolder ); SkiStuntLevel newLevel = new SkiStuntLevel( newLevelFolder ); newLevel.LevelTitle = newLevelName; newLevel.Save(); newLevel.Dispose(); Program.levelManager.UpdateLevelList(); repopulateLevelList(); }