-
-
Save ScottLilly/e47365a4ea2cc62e132315e2e10af1e0 to your computer and use it in GitHub Desktop.
ForgottenLand location images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Reflection; | |
private void changeBackground() | |
{ | |
string imageName = ""; | |
if(_player.CurrentLocation.ID == 1) | |
{ | |
imageName = "cave.png"; | |
} | |
else if (_player.CurrentLocation.ID == 2) | |
{ | |
imageName = "city.png"; | |
} | |
else if (_player.CurrentLocation.ID == 3) | |
{ | |
imageName = "death Gate.png"; | |
} | |
else if (_player.CurrentLocation.ID == 4) | |
{ | |
imageName = "Fog.png"; | |
} | |
else if (_player.CurrentLocation.ID == 5) | |
{ | |
imageName = "castle.png"; | |
} | |
else if (_player.CurrentLocation.ID == 6) | |
{ | |
imageName = "library.png"; | |
} | |
else if (_player.CurrentLocation.ID == 7) | |
{ | |
imageName = "ruins.png"; | |
} | |
else if (_player.CurrentLocation.ID == 8) | |
{ | |
imageName = "swamp.png"; | |
} | |
else if (_player.CurrentLocation.ID == 9) | |
{ | |
imageName = "finile gate.png"; | |
} | |
if (imageName != "") | |
{ | |
if(pbMain.Image != null) | |
{ | |
pbMain.Image.Dispose(); | |
} | |
using (Stream resourceStream = | |
Assembly.GetExecutingAssembly().GetManifestResourceStream(Assembly.GetExecutingAssembly().GetName().Name + ".Resources." + imageName)) | |
{ | |
if (resourceStream != null) | |
{ | |
pbMain.Image = new Bitmap(resourceStream); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment