public override void DrawLabels(SpriteBatch spriteBatch) { spriteBatch.DrawString(Textures.GetFont("Small"), this.LabelText, (this.Position + new Vector2(22f, 140f)) + Level.Offset, Color.White, 0f, Vector2.Zero, 1f, 0, 0.9f); }
public virtual void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(Thumbnail, this.Position + Level.Offset + ImageOffset, null, this.ThumbnailColour, 0, Vector2.Zero, 1, SpriteEffects.None, 0.895f); spriteBatch.Draw(Textures.GetTexture("Button2"), this.Position + Level.Offset, null, this.Colour, 0f, Vector2.Zero, 1f, 0, 0.89f); DrawLabels(spriteBatch); }
private void Cannon(int FireRate) { if (this.Job.Contains("M")) { this.sqobject.Velocity = Vector2.Zero; } if (this.VariableD > 300 - (30 * FireRate)) { string d = "t"; Vector2 AddedDisplacement = new Vector2(-(Textures.GetTexture("LazerBullet").Width *sqobject.Size) - 1, (this.sqobject.Texture.Height / 2f) - 2); if (this.sqobject.Flipeffect == SpriteEffects.None) { d = "f"; AddedDisplacement += new Vector2((sqobject.Texture.Width * sqobject.Size) + Textures.GetTexture("LazerBullet").Width + 2, 0f); } EntityList.Add(new Entity("LazerBullet", "LazerBullet", "LazerBullet", this.sqobject.Position + AddedDisplacement, 1000, 1f, "Lazer", new SquareObject.Damage(1, 1, 1, 1), new SquareObject.Bounce(2, 2, 2, 2), 50f, 50, d, false, 0, 0, 0)); this.VariableD = 0f; this.sqobject.Velocity -= Math.Sign(AddedDisplacement.X) * new Vector2(6, 0f); } this.VariableD++; }
public static void LevelSelectOn() { //int i; //int j; LevelButton.CurrentGroup = 0; TextSprite.TextList = new List <TextSprite>(); Button.ButtonList = new List <Button>(); LevelButton.lvButtonList = new List <LevelButton>(); TextSprite ts = new TextSprite("Main Menu", "Medium", Color.White); Button.ButtonList.Add(new Button(ts, new Vector2(525f, 25f), 1)); ts = new TextSprite("Next", "Medium", Color.White); Button.ButtonList.Add(new Button(ts, new Vector2(565f, 550f), 1)); ts = new TextSprite("Previous", "Medium", Color.White); Button.ButtonList.Add(new Button(ts, new Vector2(40f, 550f), 1)); if (!ScreenManager.Custom && !ScreenManager.Editing) { ts = new TextSprite("Erase Save Data", "Medium", Color.White); Button.ButtonList.Add(new Button(ts, new Vector2(40f, 25f), 1)); } Button.ButtonList[2].Active = false; if (!ScreenManager.Editing && !ScreenManager.Custom) { SaveFile.LoadSaveFiles(); for (int j = 0; j < Level.maxLevels / 3; j++) { for (int i = 0; i < 3; i++) { int levelIndex = (j * 3) + i; int collected = 0; for (int h = 0; h < SaveFile.SaveData.MainCoastersCollected[levelIndex].Length; h++) { if (SaveFile.SaveData.MainCoastersCollected[levelIndex][h]) { collected++; } } string status = "Locked"; if (SaveFile.SaveData.LevelsCompleted > (levelIndex)) { if (collected == 3) { status = "Complete"; } else { status = "Unlocked"; } } if (SaveFile.SaveData.LevelsCompleted == (levelIndex)) { status = "Unlocked"; } LevelButton.lvButtonList.Add(new LevelButton(levelIndex + 1, new Vector2((float)((220 * (i % 3)) + 80), (float)((220 * (j % 2)) + 0x69)), status, collected)); } } } else { if (!Directory.Exists(LevelSaver.CustomLevelsPath)) { Directory.CreateDirectory(LevelSaver.CustomLevelsPath); string[] premadeCustoms = Directory.GetDirectories(@"Content\Levels\Custom"); foreach (string custom in premadeCustoms) { string[] parts = custom.Split('\\'); string customName = parts[parts.Length - 1]; Directory.CreateDirectory(LevelSaver.CustomLevelsPath + customName); if (File.Exists(custom + "\\LevelData.xml")) { File.Copy(custom + "\\LevelData.xml", LevelSaver.CustomLevelsPath + customName + "\\LevelData.xml", true); } if (File.Exists(custom + "\\Thumbnail.png")) { File.Copy(custom + "\\Thumbnail.png", LevelSaver.CustomLevelsPath + customName + "\\Thumbnail.png", true); } } } SteamIntegration.LoadWorkshopLevels(); //Load custom levels here String[] levels = Directory.GetDirectories(LevelSaver.CustomLevelsPath); int levelIndex = 0; Texture2D thumbnail; for (int j = 0; j < Math.Ceiling(levels.Length / 3f); j++) { for (int i = 0; i < 3; i++) { while (levelIndex < levels.Length && !File.Exists(levels[levelIndex] + "/LevelData.xml")) { // Delete folders that don't contain a level Directory.Delete(levels[levelIndex], true); levelIndex++; } if (levelIndex < levels.Length) { if (File.Exists(levels[levelIndex] + "/Thumbnail.png")) { FileStream filestream = new FileStream(levels[levelIndex] + "/Thumbnail.png", FileMode.Open); thumbnail = Texture2D.FromStream(MainMethod.device, filestream, 160, 120, true); filestream.Close(); } else { thumbnail = Textures.GetCustomThumbnail(); } LevelButton.lvButtonList.Add(new CustomLevelButton(levels[levelIndex], new Vector2((float)((220 * (i % 3)) + 80), (float)((220 * (j % 2)) + 0x69)), thumbnail)); levelIndex++; } } } int x = (LevelButton.lvButtonList.Count) % 3; int y = (int)Math.Floor((LevelButton.lvButtonList.Count) / 3f) % 2; int levelSuffix = LevelButton.lvButtonList.Count; string name = ""; do { levelSuffix++; name = "Untitled" + levelSuffix; } while (LevelButton.lvButtonList.Exists(item => (item as CustomLevelButton).Name == name)); LevelButton.lvButtonList.Add(new NewLevelButton(name, new Vector2((float)((220 * (x % 3)) + 80), (float)((220 * (y % 2)) + 0x69)))); } if (LevelButton.lvButtonList.Count < 7) { Button.ButtonList[1].Active = false; } }
public void Draw(SpriteBatch spriteBatch) { spriteBatch.DrawString(this.label.Spritefont, this.label.Text, this.label.Position, this.label.Colour, 0f, Vector2.Zero, 1f, 0, 0.94f); spriteBatch.DrawString(textSprite.Spritefont, textSprite.Text, textSprite.Position, textSprite.Colour, 0f, Vector2.Zero, 1f, 0, 0.991f); spriteBatch.Draw(Textures.GetTexture("1"), this.position, null, Color.White, 0f, Vector2.Zero, 1f, 0, 0.99f); }