Пример #1
0
        public static async Task <LogicArrayList <AllianceHeaderEntry> > GetAllianceHeaderList(LogicArrayList <LogicLong> ids)
        {
            LogicArrayList <AllianceHeaderEntry> allianceList = new LogicArrayList <AllianceHeaderEntry>(ids.Size());

            Task <IOperationResult <string> >[] results = new Task <IOperationResult <string> > [ids.Size()];

            for (int i = 0; i < ids.Size(); i++)
            {
                results[i] = ServerSearch.AllianceDatabase.Get(ids[i]);
            }

            for (int i = 0; i < ids.Size(); i++)
            {
                IOperationResult <string> result = await results[i];

                if (result.Success)
                {
                    LogicJSONObject     jsonObject          = LogicJSONParser.ParseObject(result.Value);
                    AllianceHeaderEntry allianceHeaderEntry = new AllianceHeaderEntry();

                    allianceHeaderEntry.Load(jsonObject);
                    allianceHeaderEntry.SetAllianceId(new LogicLong(jsonObject.GetJSONNumber(CouchbaseDocument.JSON_ATTRIBUTE_ID_HIGH).GetIntValue(),
                                                                    jsonObject.GetJSONNumber(CouchbaseDocument.JSON_ATTRIBUTE_ID_LOW).GetIntValue()));
                    allianceList.Add(allianceHeaderEntry);
                }
            }

            return(allianceList);
        }
Пример #2
0
        public static AllianceHeaderEntry LoadAllianceHeaderEntry(JObject jsonObject)
        {
            AllianceHeaderEntry allianceHeaderEntry = new AllianceHeaderEntry();

            allianceHeaderEntry.SetAllianceId(new LogicLong((int)jsonObject[CouchbaseDocument.JSON_ATTRIBUTE_ID_HIGH],
                                                            (int)jsonObject[CouchbaseDocument.JSON_ATTRIBUTE_ID_LOW]));
            allianceHeaderEntry.SetAllianceName((string)jsonObject["alliance_name"]);
            allianceHeaderEntry.SetAllianceBadgeId((int)jsonObject["badge_id"]);
            allianceHeaderEntry.SetAllianceType((AllianceType)(int)jsonObject["type"]);
            allianceHeaderEntry.SetNumberOfMembers((int)jsonObject["member_count"]);
            allianceHeaderEntry.SetScore((int)jsonObject["score"]);
            allianceHeaderEntry.SetDuelScore((int)jsonObject["duel_score"]);
            allianceHeaderEntry.SetAllianceLevel((int)jsonObject["xp_level"]);

            return(allianceHeaderEntry);
        }