public override void CheckMouse(Form1 Window, Sprite Mouse) { foreach (Sprite sprite in Buttons) { if ((Cursor.Position.X <= sprite.Position.X + sprite.SpriteBtm.Width && Cursor.Position.X >= sprite.Position.X) && (Cursor.Position.Y - global.MapOffset <= sprite.Position.Y + sprite.SpriteBtm.Height && Cursor.Position.Y - global.MapOffset >= sprite.Position.Y)) { if (Window.SpriteInFocus != sprite) { Window.Selection.ChangePosition(new Vector(sprite.Position.X - sprite.SpriteBtm.Width / 7, sprite.Position.Y - sprite.SpriteBtm.Height / 7)); Window.Selection.ChangeImage(FTR.Properties.Resources.Selection); Window.SpriteInFocus = sprite; AllSprites.Remove(sprite); AllSprites.Add(sprite); Window.IsSelectionActive = true; } return; } } if (Window.IsSelectionActive) { Window.IsSelectionActive = false; Window.SpriteInFocus = null; Window.Selection.ChangeImage(FTR.Properties.Resources.Empty); } }
public override void Clear() { AllSprites.Clear(); Stars.Clear(); Buttons.Clear(); GC.Collect(); }
public override void LoadAssets() { System.Resources.ResourceManager rm = FTR.Properties.Resources.ResourceManager; BackgroundImg = FTR.Properties.Resources.Menu_Sky; BText = global.ScaleImage(FTR.Properties.Resources.BackToMenuText); Pad = global.ScaleImage(FTR.Properties.Resources.NumPad01); ButtonBack = new Sprite(new Vector((global.form_menu.Map.Width / 10) - BText.Size.Width / 2, global.form_menu.Map.Height - BText.Size.Height), new Vector(1, 1), BText, "ButtonLevel"); AllSprites.Add(ButtonBack); MakeStars(); LevelPads[0] = new Sprite(new Vector(Pad.Width, Pad.Height / 2), new Vector(1, 1), Pad, "LevelPad"); Moon = new Sprite(new Vector(1735f * global.ScreenScale.X, 95.416f * global.ScreenScale.Y), new Vector(0.8f, 0.8f), global.ScaleImage(FTR.Properties.Resources.Moon), "Moon"); AllSprites.Add(Moon); AllSprites.Add(LevelPads[0]); Buttons.Add(LevelPads[0]); for (int i = 1; i < 10; i++) { string name = "NumPad0" + (i + 1).ToString(); Pad = global.ScaleImage((Image)rm.GetObject(name)); if (i < 5) { LevelPads[i] = new Sprite(new Vector(LevelPads[i - 1].Position.X + 3 * Pad.Width / 2, Pad.Height / 2), new Vector(1, 1), Pad, "LevelPad"); } else { LevelPads[i] = new Sprite(new Vector(LevelPads[i - 5].Position.X, Pad.Height * 2), new Vector(1, 1), Pad, "LevelPad"); } AllSprites.Add(LevelPads[i]); Buttons.Add(LevelPads[i]); } Buttons.Add(ButtonBack); }
public override void Clear() { BackgroundImg = null; AllSprites.Clear(); Stars.Clear(); Buttons.Clear(); GC.Collect(); }
static Stuff() { Maps = new List <HexMap>(Resources.LoadAll <HexMap>("Maps")); Particles = new List <GameObject>(Resources.LoadAll <GameObject>("Particles")); Prefabs = new List <GameObject>(Resources.LoadAll <GameObject>("Blender")); Prefabs.AddRange(Resources.LoadAll <GameObject>("Prefabs")); Sprites = new AllSprites(); }
public override void LoadAssets() { System.Resources.ResourceManager rm = FTR.Properties.Resources.ResourceManager; MakeStars(); BackgroundImg = FTR.Properties.Resources.Menu_Sky; BText = global.ScaleImage(FTR.Properties.Resources.BackToMenuText); PText = global.ScaleImage(FTR.Properties.Resources.Generate); Field = global.ScaleImage(FTR.Properties.Resources.FieldHUD); ButtonProcceed = new Sprite(new Vector(1, 1), new Vector(1, 1), PText, "Button"); AllSprites.Add(ButtonProcceed); Hud = new Sprite(new Vector(0, 0), new Vector(1, 1), global.ScaleImage(FTR.Properties.Resources.Generator_HUD), "HUD"); AllSprites.Add(Hud); for (int i = 0; i < 7; i++) { SlotField[i] = new Sprite(new Vector(200f * global.ScreenScale.X, 100f * global.ScreenScale.Y + Field.Width * i), new Vector(1, 1), Field, "Field"); AllSprites.Add(SlotField[i]); string Name = "HUD_" + (i + 4).ToString(); Image Num = global.ScaleImage((Image)rm.GetObject(Name)); HUDNums[i] = new Sprite(new Vector(SlotField[i].Position.X + Field.Width / 2.8f, SlotField[i].Position.Y + Field.Height / 4), new Vector(1, 1), Num, "ButtonSlots"); AllSprites.Add(HUDNums[i]); SlotField[i + 7] = new Sprite(new Vector(550f * global.ScreenScale.X, 100f * global.ScreenScale.Y + Field.Width * i), new Vector(1, 1), Field, "Field"); AllSprites.Add(SlotField[i + 7]); HUDNums[i + 7] = new Sprite(new Vector(SlotField[i + 7].Position.X + Field.Width / 2.8f, SlotField[i + 7].Position.Y + Field.Height / 4), new Vector(1, 1), Num, "ButtonSlots"); AllSprites.Add(HUDNums[i + 7]); Buttons.Add(SlotField[i]); Buttons.Add(SlotField[i + 7]); } Image Quanity = (Image)(new Bitmap(FTR.Properties.Resources.Quanity0, new Size((int)Math.Floor(FTR.Properties.Resources.Quanity0.Width * global.ScreenScale.X), (int)Math.Floor(FTR.Properties.Resources.Quanity0.Height * global.ScreenScale.Y)))); for (int i = 0; i < 7; i++) { ScreenCounts[i] = new Sprite(new Vector(Counters[i, 0] * global.ScreenScale.X, Counters[i, 1] * global.ScreenScale.Y), new Vector(1.3f, 1.3f), Quanity, "Count"); AllSprites.Add(ScreenCounts[i]); } SlotField[0].ChangeImage(FTR.Properties.Resources.FieldHUD_Selected); SlotField[7].ChangeImage(FTR.Properties.Resources.FieldHUD_Selected); ButtonBack = new Sprite(new Vector((global.form_menu.Map.Width / 10) - BText.Size.Width / 2, global.form_menu.Map.Height - BText.Size.Height), new Vector(1, 1), BText, "ButtonBack"); AllSprites.Add(ButtonBack); Buttons.Add(ButtonBack); Buttons.Add(ButtonProcceed); for (int i = 0; i < 14; i++) { Image preview; string Tag; if (i % 2 == 0) { Tag = "TetAdd"; preview = global.ScaleImage(FTR.Properties.Resources.TetrAdd); } else { Tag = "TetRemove"; preview = global.ScaleImage(FTR.Properties.Resources.TetrRemove); } AddTetromino[i] = new Sprite(new Vector(Controls[i, 0] * global.ScreenScale.X, Controls[i, 1] * global.ScreenScale.Y), new Vector(0.5f, 0.5f), preview, Tag); AllSprites.Add(AddTetromino[i]); Buttons.Add(AddTetromino[i]); } }
public override void CheckMouse(Form1 Window, Sprite Mouse) { foreach (Sprite sprite in Buttons) { if ((Cursor.Position.X <= sprite.Position.X + sprite.SpriteBtm.Width && Cursor.Position.X >= sprite.Position.X) && (Cursor.Position.Y - global.MapOffset <= sprite.Position.Y + sprite.SpriteBtm.Height && Cursor.Position.Y - global.MapOffset >= sprite.Position.Y)) { if (Window.SpriteInFocus != sprite) { if (sprite.Tag != "ButtonSettings") { Window.Selection.ChangePosition(new Vector(sprite.Position.X - sprite.SpriteBtm.Width / 5, sprite.Position.Y - sprite.SpriteBtm.Height / 5)); } else { Window.Selection.ChangePosition(new Vector(sprite.Position.X - sprite.SpriteBtm.Width / 2, sprite.Position.Y - sprite.SpriteBtm.Height / 4)); } if (sprite != Moon) { Window.Selection.ChangeImage(FTR.Properties.Resources.Selection); } Window.SpriteInFocus = sprite; AllSprites.Remove(sprite); AllSprites.Add(sprite); Buttons.Remove(sprite); Buttons.Insert(0, sprite); Window.IsSelectionActive = true; //Window.PlaySound("Select"); } return; } } if (Window.IsSelectionActive) { Window.IsSelectionActive = false; Window.SpriteInFocus = null; Window.Selection.ChangeImage(FTR.Properties.Resources.Empty); } }
public override void LoadAssets() { MakeStars(); global.form_menu.ChangeAmbient(Properties.Resources.GiveUp, false); BackgroundImg = FTR.Properties.Resources.room; BText = global.ScaleImage(FTR.Properties.Resources.BackToMenuText); ButtonBack = new Sprite(new Vector((global.form_menu.Map.Width / 10) - BText.Size.Width / 2, global.form_menu.Map.Height - BText.Size.Height), new Vector(1, 1), BText, "ButtonLevel"); AllSprites.Add(ButtonBack); Buttons.Add(ButtonBack); }
public override void LoadAssets() { MakeStars(); BackgroundImg = FTR.Properties.Resources.ForestSunset; BText = global.ScaleImage(FTR.Properties.Resources.BackToMenuText); Bar = global.ScaleImage(FTR.Properties.Resources.VolumeBar5); Image Add = global.ScaleImage(FTR.Properties.Resources.VolumeAdd); Image Sub = global.ScaleImage(FTR.Properties.Resources.VolumeSubtract); ButtonBack = new Sprite(new Vector((global.form_menu.Map.Width / 10) - BText.Size.Width / 2, global.form_menu.Map.Height - BText.Size.Height), new Vector(1, 1), BText, "ButtonLevel"); AllSprites.Add(ButtonBack); ButtonAdd = new Sprite(new Vector(((global.form_menu.Map.Width / 2) + Bar.Width / 2 + Add.Width / 2), (global.form_menu.Map.Height / 2)), new Vector(1, 1), Add, "VolumeControl"); AllSprites.Add(ButtonAdd); ButtonDistract = new Sprite(new Vector(((global.form_menu.Map.Width / 2) - Bar.Width / 2 - Sub.Width * 1.5f), (global.form_menu.Map.Height / 2)), new Vector(1, 1), Sub, "VolumeControl"); AllSprites.Add(ButtonDistract); VolumeBar = new Sprite(new Vector((960 * global.ScreenScale.X - Bar.Width / 2), global.form_menu.Map.Height / 2), new Vector(1, 1), Bar, "VolumeBar"); AllSprites.Add(VolumeBar); TrackBar(global.form_menu.GetVolume); VolumeText = new Sprite(new Vector(((global.form_menu.Map.Width / 2) - global.ScaleImage(FTR.Properties.Resources.VolumeText).Width / 2), global.form_menu.Map.Height / 2 - Bar.Height), new Vector(1, 1), global.ScaleImage(FTR.Properties.Resources.VolumeText), "VolumeText"); AllSprites.Add(VolumeText); Buttons.Add(ButtonBack); Buttons.Add(ButtonAdd); Buttons.Add(ButtonDistract); }
public override void LoadAssets() { MakeStars(); BIcon = global.ScaleImage(FTR.Properties.Resources.Exit); CText = global.ScaleImage(FTR.Properties.Resources.WinScreen); RIcon = global.ScaleImage(FTR.Properties.Resources.Retry); Moon = new Sprite(new Vector(global.ScreenScale.X * (1.1f * MoonCoords.X + 800), global.ScreenScale.Y * (float)((Math.Pow(MoonCoords.X, 2)) / 6000) - 25f), new Vector(0.8f, 0.8f), global.ScaleImage(FTR.Properties.Resources.Moon), "Moon"); AllSprites.Add(Moon); ButtonBack = new Sprite(new Vector((global.form_menu.Map.Width / 2) - CText.Size.Width / 2 + 9 * BIcon.Width, global.form_menu.Map.Height / 2 - CText.Size.Height / 2 + 8 * BIcon.Height / 3), new Vector(1, 1), BIcon, "ButtonReturn"); AllSprites.Add(ButtonBack); ButtonRetry = new Sprite(new Vector((global.form_menu.Map.Width / 2) - CText.Size.Width / 2 + 4 * RIcon.Width, global.form_menu.Map.Height / 2 - CText.Size.Height / 2 + 8 * RIcon.Height / 3), new Vector(1, 1), RIcon, "ButtonReturn"); AllSprites.Add(ButtonRetry); TCredits = new Sprite(new Vector((global.form_menu.Map.Width / 2) - CText.Size.Width / 2, global.form_menu.Map.Height / 2 - CText.Size.Height / 2), new Vector(1, 1), CText, "LevelCompletedText"); AllSprites.Add(TCredits); Buttons.Add(ButtonBack); Buttons.Add(ButtonRetry); }
public override void LoadAssets() { BackgroundImg = FTR.Properties.Resources.Menu_Sky; LSText = global.ScaleImage(FTR.Properties.Resources.LevelSelectText); CText = global.ScaleImage(FTR.Properties.Resources.CreditsText); EText = global.ScaleImage(FTR.Properties.Resources.ExitText); MakeStars(); ButtonLevel = new Sprite(new Vector(1, 1), new Vector(1, 1), LSText, "ButtonLevel"); AllSprites.Add(ButtonLevel); ButtonCredits = new Sprite(new Vector(1, 1), new Vector(1, 1), CText, "ButtonCredits"); AllSprites.Add(ButtonCredits); ButtonExit = new Sprite(new Vector(1, 1), new Vector(1, 1), EText, "ButtonExit"); AllSprites.Add(ButtonExit); Moon = new Sprite(new Vector(1735f * global.ScreenScale.X, 95.416f * global.ScreenScale.Y), new Vector(0.8f, 0.8f), global.ScaleImage(FTR.Properties.Resources.Moon), "Moon"); AllSprites.Add(Moon); Settings = new Sprite(new Vector(1, 1), new Vector(1, 1), global.ScaleImage(FTR.Properties.Resources.Settings), "ButtonSettings"); AllSprites.Add(Settings); Buttons.Add(ButtonLevel); Buttons.Add(ButtonCredits); Buttons.Add(ButtonExit); Buttons.Add(Settings); Buttons.Add(Moon); }
public override void LoadAssets() { MakeStars(); BackgroundImg = FTR.Properties.Resources.JustSky; BText = global.ScaleImage(FTR.Properties.Resources.BackToMenuText); CText = global.ScaleImage(FTR.Properties.Resources.Credits); ButtonBack = new Sprite(new Vector((global.form_menu.Map.Width / 10) - BText.Size.Width / 2, global.form_menu.Map.Height - BText.Size.Height), new Vector(1, 1), BText, "ButtonLevel"); AllSprites.Add(ButtonBack); TCredits = new Sprite(new Vector((global.form_menu.Map.Width / 2) - CText.Size.Width / 2, global.form_menu.Map.Height / 2 - CText.Size.Height / 2), new Vector(1, 1), CText, "ButtonLevel"); AllSprites.Add(TCredits); Buttons.Add(ButtonBack); }