All hi I have when writing to the database, for some reason its zero copy is created
public class DataBase : DataBaseSleepingBag
{
public ulong userID;
public List<DataBaseSleepingBag> dataBaseSleepingbag = new List<DataBaseSleepingBag>();
public DataBase()
{
}
}
public class DataBaseSleepingBag
{
public UnityEngine.Vector3 sethome;
public ulong sleepingBagID;
public int sleepingBagName;
}
private StoreData DataBasePlayer = new StoreData();
class StoreData
{
public Dictionary<ulong, DataBase> InfoData = new Dictionary<ulong, DataBase>();
}
// Structure
// Execution code
void CreateBase(BasePlayer player, UnityEngine.Vector3 pos, ulong sleepID, int bedName)
{
var data = new DataBase
{
userID = player.userID,
dataBaseSleepingbag = new List<DataBaseSleepingBag>()
{
new DataBaseSleepingBag
{
sethome = pos,
sleepingBagID = sleepID,
sleepingBagName = bedName
}
}
};
DataBasePlayer.InfoData.Add(player.userID, data);
SaveData();
}
// Result
{
"InfoData": {
"76561############": {
"userID": 76561############,
"dataBaseSleepingbag": [
{
"sethome": {
"x": 982.0172,
"y": 0.304811954,
"z": -895.9628
},
"sleepingBagID": 65681,
"sleepingBagName": 1
}
],
//???????????In connection with what it appears?
"sethome": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"sleepingBagID": 0,
"sleepingBagName": 0
}
//??????In connection with what it appears?
}
}