public static void GetInvitationsTo(BigDB bigDb, InvitationType type, string recipient, Callback <Invitation[]> callback) { bigDb.LoadRange(InvitationsTable, "ByRecipient", new object[] { (int)type, recipient }, null, null, 100, invitations => { callback(invitations.Select(dbo => new Invitation(dbo)).ToArray()); }); }
public static void GetInvitationsFrom(BigDB bigDb, InvitationType type, string sender, Callback <Invitation[]> callback) { bigDb.LoadRange(InvitationsTable, "BySender", new object[] { (int)type, sender }, null, null, 100, invitations => { callback(invitations.Select(dbo => new Invitation(dbo)).ToArray()); }); }
public AchievementManager(BigDB db, Player player) { bigDB = db; owner = player; // load data for all achievements from Database bigDB.LoadRange("Achievements", "IDs", null, null, null, 100, delegate(DatabaseObject[] results) { if (results != null) { foreach (DatabaseObject achievData in results) { if (owner.achievements.Contains(achievData.Key)) { continue; } Achievement achiev = achievList[achievData.Key]; achiev.init(achievData, this); achievements.Add(achiev); achiev.checkConditions(); } } else { // todo } }, delegate(PlayerIOError error) { // todo Console.WriteLine(error.Message); }); }
public static Task <DatabaseObject[]> LoadRangeAsync(this BigDB bigDB, string table, string index, object[] indexPath, object start, object stop, int limit) { var tcs = new TaskCompletionSource <DatabaseObject[]>(); bigDB.LoadRange(table, index, indexPath, start, stop, limit, tcs.SetResult, tcs.SetException); return(tcs.Task); }
public static void GetMail(BigDB bigDb, string connectUserId, Callback <EEMail[]> callback) { bigDb.LoadRange("Mails", "MyMails", new object[] { connectUserId }, null, null, 1000, objs => { callback(DeleteMails(bigDb, objs.Select(obj => new EEMail { Key = obj.Key, From = obj.GetString("From"), To = obj.GetString("To"), Date = obj.GetDateTime("Date", default(DateTime)), Subject = obj.GetString("Subject", ""), Body = obj.GetString("Body", "") }).ToArray())); }); }
private static void GetNotifications(BigDB bigDb, string channel, Callback <EENotification[]> callback) { bigDb.LoadRange("Notifications", "ByChannel", new object[] { channel }, null, null, 1000, items => { callback(DeleteNotifications(bigDb, items.Select(i => new EENotification { Key = i.Key, Channel = i.GetString("Channel"), PublishDate = i.GetDateTime("PublishDate"), Title = i.GetString("Title", ""), RoomId = i.GetString("RoomId", ""), ImageUrl = i.GetString("ImageUrl", ""), Body = i.GetString("Body") }).ToArray())); }); }