public void init_necessary_textures(Player pl) { cManager.Unload(); for (int i = 0; i < armors_in_stock.Count; i++) { string texturename = armors_in_stock[i].get_my_texture_name(); armors_in_stock[i].set_texture(cManager.Load <Texture2D>("Icons/Armors/" + texturename)); } for (int i = 0; i < weapons_in_stock.Count; i++) { string texturename = weapons_in_stock[i].get_my_texture_name(); weapons_in_stock[i].set_texture(cManager.Load <Texture2D>("Icons/Weapons/" + texturename)); } for (int i = 0; i < scrolls_in_stock.Count; i++) { string texturename = scrolls_in_stock[i].get_my_texture_name(); scrolls_in_stock[i].set_texture(cManager.Load <Texture2D>("Icons/Scrolls/" + texturename)); } for (int i = 0; i < consumables_in_stock.Count; i++) { string texturename = consumables_in_stock[i].get_my_texture_name(); consumables_in_stock[i].set_texture(cManager.Load <Texture2D>("Icons/Consumables/" + texturename)); if (consumables_in_stock[i] is Potion) { Potion p = (Potion)consumables_in_stock[i]; string empty_texturename = p.get_my_empty_texture_name(); p.set_empty_texture(cManager.Load <Texture2D>("Icons/Consumables/" + empty_texturename)); } } /* This isn't needed for the time being, and who knows! It may never be. * List<Item> player_inventory = pl.retrieve_inventory(); * * for (int i = 0; i < player_inventory.Count; i++) * { * //do nothing for now. * } */ }
public void init_necessary_textures(Player pl) { cManager.Unload(); List <Item> player_inv = pl.retrieve_inventory(); for (int i = 0; i < player_inv.Count; i++) { if (player_inv[i] != null) { string texture_loc = "Icons/"; if (player_inv[i] is Armor) { texture_loc += "Armors/"; } if (player_inv[i] is Weapon) { texture_loc += "Weapons/"; } if (player_inv[i] is Potion) { texture_loc += "Consumables/"; } if (player_inv[i] is Scroll || player_inv[i] is Talisman) { texture_loc += "Scrolls/"; } texture_loc += player_inv[i].get_my_texture_name(); Texture2D current_texture = cManager.Load <Texture2D>(texture_loc); player_inv[i].set_texture(current_texture); //Set the empty texture for the potion if it is one. if (player_inv[i] is Potion) { Potion pt = (Potion)player_inv[i]; string empty_textureloc = "Icons/Consumables/" + pt.get_my_empty_texture_name(); pt.set_empty_texture(cManager.Load <Texture2D>(empty_textureloc)); } if (the_icoBar.item_is_on_bar(player_inv[i].get_my_IDno())) { the_icoBar.init_item_texture_by_id_number(player_inv[i].get_my_IDno(), current_texture); } } } if (pl.show_main_hand() != null) { Texture2D current_texture = cManager.Load <Texture2D>("Icons/Weapons/" + pl.show_main_hand().get_my_texture_name()); pl.show_main_hand().set_texture(current_texture); the_icoBar.init_item_texture_by_id_number(pl.show_main_hand().get_my_IDno(), current_texture); } if (pl.show_off_hand() != null) { Texture2D current_texture = cManager.Load <Texture2D>("Icons/Weapons/" + pl.show_off_hand().get_my_texture_name()); pl.show_off_hand().set_texture(current_texture); the_icoBar.init_item_texture_by_id_number(pl.show_off_hand().get_my_IDno(), current_texture); } if (pl.show_over_armor() != null) { Texture2D current_texture = cManager.Load <Texture2D>("Icons/Armors/" + pl.show_over_armor().get_my_texture_name()); pl.show_over_armor().set_texture(current_texture); the_icoBar.init_item_texture_by_id_number(pl.show_over_armor().get_my_IDno(), current_texture); } if (pl.show_under_armor() != null) { Texture2D current_texture = cManager.Load <Texture2D>("Icons/Armors/" + pl.show_under_armor().get_my_texture_name()); pl.show_under_armor().set_texture(current_texture); the_icoBar.init_item_texture_by_id_number(pl.show_under_armor().get_my_IDno(), current_texture); } if (pl.show_helmet() != null) { Texture2D current_texture = cManager.Load <Texture2D>("Icons/Armors/" + pl.show_helmet().get_my_texture_name()); pl.show_helmet().set_texture(current_texture); the_icoBar.init_item_texture_by_id_number(pl.show_helmet().get_my_IDno(), current_texture); } player_name = pl.my_chara_as_string(); switch (player_name) { case "Falsael": character_portrait = cManager.Load <Texture2D>("Player/Portraits/falsael_fine"); break; default: character_portrait = null; break; } }