private void RequestPresenceFieldsCallback(bgs.types.EntityId entityId, RPCContext context) { if (base.CheckRPCCallback("RequestPresenceFieldsCallback", context)) { QueryResponse queryResponse = QueryResponse.ParseFrom(context.Payload); foreach (Field field in queryResponse.FieldList) { this.m_presenceCache.SetCache(entityId, field.Key, field.Value); PresenceUpdate presenceUpdate = default(PresenceUpdate); presenceUpdate.entityId = entityId; presenceUpdate.programId = field.Key.Program; presenceUpdate.groupId = field.Key.Group; presenceUpdate.fieldId = field.Key.Field; presenceUpdate.index = field.Key.Index; presenceUpdate.boolVal = false; presenceUpdate.intVal = 0L; presenceUpdate.stringVal = string.Empty; presenceUpdate.valCleared = false; presenceUpdate.blobVal = new byte[0]; if (field.Value.HasBoolValue) { presenceUpdate.boolVal = field.Value.BoolValue; } else if (field.Value.HasIntValue) { presenceUpdate.intVal = field.Value.IntValue; } else if (!field.Value.HasFloatValue) { if (field.Value.HasStringValue) { presenceUpdate.stringVal = field.Value.StringValue; } else if (field.Value.HasBlobValue) { presenceUpdate.blobVal = field.Value.BlobValue; } else if (field.Value.HasMessageValue) { if (field.Key.Field == 8u) { this.FetchRichPresenceResource(field.Value); this.HandleRichPresenceUpdate(presenceUpdate, field.Key); } else { presenceUpdate.blobVal = field.Value.MessageValue; } } else if (field.Value.HasFourccValue) { presenceUpdate.stringVal = new BnetProgramId(field.Value.FourccValue).ToString(); } else if (!field.Value.HasUintValue) { if (field.Value.HasEntityidValue) { presenceUpdate.entityIdVal.hi = field.Value.EntityidValue.High; presenceUpdate.entityIdVal.lo = field.Value.EntityidValue.Low; } else { presenceUpdate.valCleared = true; } } } this.m_presenceUpdates.Add(presenceUpdate); } } }
private void RequestPresenceFieldsCallback(bgs.types.EntityId entityId, RPCContext context) { if (base.CheckRPCCallback("RequestPresenceFieldsCallback", context)) { foreach (Field fieldList in QueryResponse.ParseFrom(context.Payload).FieldList) { this.m_presenceCache.SetCache(entityId, fieldList.Key, fieldList.Value); PresenceUpdate boolValue = new PresenceUpdate() { entityId = entityId, programId = fieldList.Key.Program, groupId = fieldList.Key.Group, fieldId = fieldList.Key.Field, index = fieldList.Key.Index, boolVal = false, intVal = (long)0, stringVal = string.Empty, valCleared = false, blobVal = new byte[0] }; if (fieldList.Value.HasBoolValue) { boolValue.boolVal = fieldList.Value.BoolValue; } else if (fieldList.Value.HasIntValue) { boolValue.intVal = fieldList.Value.IntValue; } else if (!fieldList.Value.HasFloatValue) { if (fieldList.Value.HasStringValue) { boolValue.stringVal = fieldList.Value.StringValue; } else if (fieldList.Value.HasBlobValue) { boolValue.blobVal = fieldList.Value.BlobValue; } else if (fieldList.Value.HasMessageValue) { if (fieldList.Key.Field != 8) { boolValue.blobVal = fieldList.Value.MessageValue; } else { this.FetchRichPresenceResource(fieldList.Value); this.HandleRichPresenceUpdate(boolValue, fieldList.Key); } } else if (fieldList.Value.HasFourccValue) { boolValue.stringVal = (new BnetProgramId(fieldList.Value.FourccValue)).ToString(); } else if (!fieldList.Value.HasUintValue) { if (!fieldList.Value.HasEntityidValue) { boolValue.valCleared = true; } else { boolValue.entityIdVal.hi = fieldList.Value.EntityidValue.High; boolValue.entityIdVal.lo = fieldList.Value.EntityidValue.Low; } } } this.m_presenceUpdates.Add(boolValue); } } }