/* * Fetch */ private void OnPerformQuerySuccess(string data) { string[] DataArray = data.Split(new string[] { SA.Common.Data.Converter.DATA_SPLITTER2 }, StringSplitOptions.None); int dbId = System.Convert.ToInt32(DataArray[0]); CK_Database db = CK_Database.GetDatabaseByInternalId(dbId); List <CK_Record> records = new List <CK_Record>(); for (int i = 1; i < DataArray.Length; i += 2) { if (DataArray[i] == SA.Common.Data.Converter.DATA_EOF) { break; } string name = DataArray[i]; string recordData = DataArray[i + 1]; CK_Record record = new CK_Record(name, recordData); records.Add(record); } CK_QueryResult result = new CK_QueryResult(records); db.FireQueryCompleteResult(result); }
void Awake() { DontDestroyOnLoad(gameObject); _PublicDB = new CK_Database(PUBLIC_DB_KEY); _PrivateDB = new CK_Database(PRIVATE_DB_KEY); }
protected override void Awake() { base.Awake(); _PublicDB = new CK_Database(PUBLIC_DB_KEY); _PrivateDB = new CK_Database(PRIVATE_DB_KEY); }
/* * Delete */ private void OnDeleteRecordSuccess(string data) { string[] values = SA.Common.Data.Converter.ParseArray(data); int dbId = System.Convert.ToInt32(values[0]); int recordId = System.Convert.ToInt32(values[1]); CK_Database db = CK_Database.GetDatabaseByInternalId(dbId); CK_RecordDeleteResult result = new CK_RecordDeleteResult(recordId); db.FireDeleteRecordResult(result); }
//-------------------------------------- // Internal Events //-------------------------------------- /* * Save */ private void OnSaveRecordSuccess(string data) { string[] values = IOSNative.ParseArray(data); int dbId = System.Convert.ToInt32(values[0]); int recordId = System.Convert.ToInt32(values[1]); CK_Database db = CK_Database.GetDatabaseByInternalId(dbId); CK_RecordResult result = new CK_RecordResult(recordId); db.FireSaveRecordResult(result); }
private void OnFetchRecordSuccess(string data) { string[] DataArray = data.Split(new string[] { SA.Common.Data.Converter.DATA_SPLITTER2 }, StringSplitOptions.None); int dbId = System.Convert.ToInt32(DataArray[0]); string name = DataArray[1]; string recordData = DataArray[2]; CK_Database db = CK_Database.GetDatabaseByInternalId(dbId); CK_Record record = new CK_Record(name, recordData); CK_RecordResult result = new CK_RecordResult(record.Internal_Id); db.FireFetchRecordResult(result); }
private void OnFetchRecordFailed(string data) { string[] DataArray = data.Split(new string[] { SA.Common.Data.Converter.DATA_SPLITTER2 }, StringSplitOptions.None); int dbId = System.Convert.ToInt32(DataArray[0]); CK_Database db = CK_Database.GetDatabaseByInternalId(dbId); string errorData = DataArray[1]; CK_RecordResult result = new CK_RecordResult(errorData); db.FireFetchRecordResult(result); }
void OnGUI() { UpdateToStartPos(); GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Cloud Kit", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Create Record")) { CK_RecordID recordId = new CK_RecordID("1"); CK_Record record = new CK_Record(recordId, "Post"); record.SetObject("PostText", "Sample point of interest"); record.SetObject("PostTitle", "My favorite point of interest"); CK_Database database = ISN_CloudKit.Instance.PublicDB; database.SaveRecrod(record); database.ActionRecordSaved += Database_ActionRecordSaved; } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Delete Record")) { CK_RecordID recordId = new CK_RecordID("1"); CK_Database database = ISN_CloudKit.Instance.PublicDB; database.DeleteRecordWithID(recordId); database.ActionRecordDeleted += Database_ActionRecordDeleted; } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Fetch Record")) { CK_RecordID recordId = new CK_RecordID("1"); CK_Database database = ISN_CloudKit.Instance.PublicDB; database.FetchRecordWithID(recordId); database.ActionRecordFetchComplete += Database_ActionRecordFetchComplete; } }
public void SetDatabase(CK_Database database) { _Database = database; }
public void SetDatabase(CK_Database database) { _Database = database; }