Loading items from database :)

Posts 1–3 of 3 · Page 1 of 1
Loading items from database :)
Sorry for the music lol
this is on my rotmg remake





I want to know if there's a better way of doing it.
The slots in the database seem too much , maybe there's a way of shrinking it idk.
You can serialize data from your database, e.g. split string for each slot, make it with JSON or similar.

Usage:

Code:
// Then you can get slots based in index.
string[] idsFromDb = "0|5|10|15|20|25|30|35".Split("|");

List<int> serializedIds = new List<int>();

foreach (string idFromDb in idsFromDb) serializedIds.Add(Convert.ToInt32(idFromDb));

Console.WriteLine(serializedSlots[7]); // Output: "35" as INT.
Enjoy.
Quote Originally Posted by Devwarlt View Post
You can serialize data from your database, e.g. split string for each slot, make it with JSON or similar.

Usage:

Code:
// Then you can get slots based in index.
string[] idsFromDb = "0|5|10|15|20|25|30|35".Split("|");

List<int> serializedIds = new List<int>();

foreach (string idFromDb in idsFromDb) serializedIds.Add(Convert.ToInt32(idFromDb));

Console.WriteLine(serializedSlots[7]); // Output: "35" as INT.
Enjoy.
This seems like a good idea.
Will probably do, thanks alot.
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us