public IEnumerator AddRecord(touchMe record) //adds a PrizmRecord to the GameObject doc { Debug.LogError("Adding to database"); //call method "addObjectToGroup" //come up with clever way of using enums for this Dictionary <string, string> dict = new Dictionary <string, string> () { { "location", record.dbEntry.location } }; var methodCall = Meteor.Method <ChannelResponse> .Call("addGameObject", sessionID, defaultRecordGroup, dict); yield return((Coroutine)methodCall); if (methodCall.Response.success) { Debug.LogError("call to 'addGameObject' succeeded! Response: " + methodCall.Response.message); string UniqueID = methodCall.Response.message; record.setName(UniqueID); //automatically sets isInDatase to be true (should only be called once) } else { Debug.LogError("call to 'addGameObject' failed! Response: " + methodCall.Response.message); } }
//removes record from GameObjects Collection by calling 'removeGameObject' //if you call this, you need to remove the record from PrizmRecordGroup.associates list as well public IEnumerator RemoveRecord(touchMe record) { Debug.LogError("Removing from database: " + record.dbEntry._id); var methodCall = Meteor.Method <ChannelResponse> .Call("removeGameObject", record.dbEntry._id); yield return((Coroutine)methodCall); if (methodCall.Response.success) { Debug.LogError("Successfully removed from database, message: " + methodCall.Response.message); } else { Debug.LogError("Error removing " + record.dbEntry._id + " from database"); } }
public IEnumerator AddRecord(touchMe record) { //adds a PrizmRecord to the GameObject doc Debug.LogError ("Adding to database"); //call method "addObjectToGroup" //come up with clever way of using enums for this Dictionary<string, string> dict = new Dictionary<string, string> () { {"location", record.dbEntry.location} }; var methodCall = Meteor.Method<ChannelResponse>.Call ("addGameObject", sessionID, defaultRecordGroup, dict); yield return (Coroutine)methodCall; if (methodCall.Response.success) { Debug.LogError("call to 'addGameObject' succeeded! Response: " + methodCall.Response.message); string UniqueID = methodCall.Response.message; record.setName(UniqueID); //automatically sets isInDatase to be true (should only be called once) } else { Debug.LogError("call to 'addGameObject' failed! Response: " + methodCall.Response.message); } }
//removes record from GameObjects Collection by calling 'removeGameObject' //if you call this, you need to remove the record from PrizmRecordGroup.associates list as well public IEnumerator RemoveRecord(touchMe record) { Debug.LogError ("Removing from database: " + record.dbEntry._id); var methodCall = Meteor.Method<ChannelResponse>.Call ("removeGameObject", record.dbEntry._id); yield return (Coroutine)methodCall; if (methodCall.Response.success) { Debug.LogError("Successfully removed from database, message: " + methodCall.Response.message); } else { Debug.LogError("Error removing " + record.dbEntry._id + " from database"); } }