简体   繁体   中英

Unable to load level data in WP7

I just discovered a problem with getting my levels to load in WP7. The issue has to do with isolated storage and how I wrote the data.

I have a level editor that I wrote as a Windows PC game. The levels are saved to a directory that I specify. I just read up on how WP7 deals with reading/writing files, and it's turning out to be a big issue, because there's no way that Wp7 can search the directory containing my levels. Basically, what I was hoping to do was create the levels using one program, and use a separate program (the actual game) to load these files. These are my questions:

-How can I go about getting my WP7 game to locate the levels? I could try to get the isolated storage path name, but it's not guaranteed to be the same every time, is it?

-Do I have to re-write my editor as a Windows Phone Game to make this all work properly?

If your issue is about transfering the files from your desktop level editor to the phone, you can add the files directly to your Visual Studio solution, and set their compile type to embedded resource. Then you can list them and load them dynamically from your code.

How can I get a list of all embedded resources defined in my application?

Isolated storage is isolated from one app to another. You can either write your editor into your game, use images to save the game levels, or save the game levels to a web service that is accessible between the editor and the app.

You could have the game download the levels from a web service so you can keep them up-to-date and add new levels dynamically. Just save the levels in isolated storage after downloading them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM