Dawid Chemloul
10/29/2025, 9:26 AMprotected override void OnFinalizedActivation(MetaOfferGroupId groupId, IPlayerModelBase player)
{
MetaOfferGroupModelBase group = TryGetState(groupId);
foreach ((MetaOfferId offerId, MetaOfferPerGroupStateBase offerPerGroup) in group.OfferStates)
{
if (offerPerGroup.IsIncludedInGroupActivation(group.CurrentActivationIndex))
{
if (OfferStates.TryGetValue(offerId, out MetaOfferPerPlayerStateBase offerPerPlayer))
offerPerPlayer.OnActivationFinalized(player, group.LatestActivation.Value.EndAt.Value);
}
}
}
of PlayerMetaOfferGroupsModelBase
and cast offerPerPlayer to derived per player state type.
or am I missing something?Nuutti Hölttä
10/30/2025, 11:50 AMDawid Chemloul
10/30/2025, 1:28 PMNuutti Hölttä
11/06/2025, 11:00 AMPlayerMetaOfferGroupsModelBase<...>.OnFinalizedActivation similarly to how you describe. However, i don't think it's necessary for this custom code to involve the MetaOfferPerPlayerState (unless it actually needs some data from there) but just do things directly in the PlayerMetaOfferGroupsModelBase override. Maybe something along these lines:
protected override void OnFinalizedActivation(MetaOfferGroupId groupId, IPlayerModelBase player)
{
base.OnFinalizedActivation(groupId, player);
MetaOfferGroupModelBase group = TryGetState(groupId);
foreach ((MetaOfferId offerId, MetaOfferPerGroupStateBase offerPerGroup) in group.OfferStates)
{
if (offerPerGroup.IsIncludedInGroupActivation(group.CurrentActivationIndex))
OnFinalizedOfferActivation(groupId, offerId, player);
}
}
void OnFinalizedOfferActivation(MetaOfferGroupId groupId, MetaOfferId offerId, IPlayerModelBase player)
{
if (!player.GameConfig.MetaOfferGroups.TryGetValue(groupId, out MetaOfferGroupInfoBase groupInfo))
return; // unexpected, but tolerate
if (!player.GameConfig.MetaOffers.TryGetValue(offerId, out MetaOfferInfoBase offerInfo))
return; // unexpected, but tolerate
// ... trigger analytics event ...
}