-1

I have a list of Texture2D's

public static List<Texture2D> TEXTURES_BATS_UNLOCKED = new List<Texture2D>();

Basically it's a list of all the unlocked bat skins in a Pong game.

When a player buys a bat in the in-game store, the list should be updated. And I want the list to also be saved to a .settings file, that can later be read if the game is restarted. I know you can just assign bools if certain bats have been unlocked, but in this case it can be quite difficult to properly define.

I really just need to know if I can assign a

List<Texture2D> variable to a .settings file. Whenever I click the "browse" button to browse different data types, nothing shows up.

Nathan Ernst
  • 4,540
  • 25
  • 38
Johan Svensson
  • 339
  • 5
  • 15
  • I don't think you want to save the texture data. You don't really save the whole memory state of a game either when you click "save" in any successful modern game, it only saves the important bits − player health, position, story progression, discovered secrets, and in your case the id numbers of unlocks. You only want to save some numbers, not the whole content folder that you already load textures from. – user1306322 Oct 17 '13 at 19:47
  • Serialization? Exactly as explained below. Thanks. – Johan Svensson Oct 20 '13 at 10:36
  • I don't think you understand, and also I don't think that I can help you. – user1306322 Oct 20 '13 at 10:44
  • No problem. Thanks for your rating. Really does make my day brighter. – Johan Svensson Oct 20 '13 at 12:34

1 Answers1

0

It seems to me, you want serialization. It won't be in a human readable format, but lets see if it is good enough for you.
http://msdn.microsoft.com/en-us/library/vstudio/ms233843.aspx

EDIT Serialization is not the answer as it seems. Please check out: Serialize Texture2D programatically in XNA

Community
  • 1
  • 1
acsadam0404
  • 2,711
  • 1
  • 26
  • 36
  • After reviewing a bit on "serilization", you're basically saying to create a `byte`/`int`/`uint` (?) variable in the .settings file, and export the Texture2D list to bytes, and put those bytes in the .settings file, and later on startup read the bytes (deserilization) and convert them into a List? – Johan Svensson Oct 11 '13 at 18:57
  • Serialization is not the answer as it seems: http://stackoverflow.com/questions/8856528/serialize-texture2d-programatically-in-xna – acsadam0404 Oct 11 '13 at 19:05