I have a DatabaseArray of DatabaseObjects and each of those objects don't have a reference back to the parent array (that I'm aware of).
Is there a way for a DatabaseObject to remove itself?
by CoderBrandon » May 20th, 2011, 3:12 am
by Oliver » May 20th, 2011, 11:09 am
by CoderBrandon » May 20th, 2011, 5:22 pm
areaKEY={
size:{
x:40,
y:40
},
resources:{
0:{
position:{
x:34,
y:20
},
guid:"dda0b115-5016-4e11-9f5d-3c9909794c09",
amount:2,
resourceKey:"MetalScrap"
},
1:{
position:{
x:27,
y:7
},
guid:"b5f9d643-88ed-411d-a90f-7703a91db35d",
amount:1,
resourceKey:"GlassScrap"
}, etc
//class variable of room
private SortedDictionary<string, AreaResource> areaResources = new SortedDictionary<string, AreaResource>();
//on the callback from loadRange
DatabaseArray allResources = dbo.GetArray("resources");
foreach (DatabaseObject singleResource in allResources) {
AreaResource temp = new AreaResource((DatabaseObject)(singleResource));
areaResources.Add(temp.guid, temp);
}
//class AreaResource
//class variable reference to BigDB object
private DatabaseObject dbo;
//inside some logic to determine removal status
dbo.remove()
by Oliver » May 24th, 2011, 3:58 pm