https://metaplay.io logo
Scheduling In-Game Offers
# questions-and-feedback
a
Hello guys! I'm wondering, do the offers support scheduling? I'm trying to implement the "Preview/Review" phases for the offers, but it seems like MetaOfferGroups.GetActiveStates is not returning the offers in these states I was able to implement only the EndingSoon state, with GetActivationEndingSoonStartsAtTime, But I didn't find any "GetActivationPreviewStartsAtTime" or so. Thanks!
n
Hi! Offers support scheduling (specifically at the level of the offer groups) the same way as [config-driven events](https://docs.metaplay.io/feature-cookbooks/in-game-events/implementing-game-events.html). GetActiveStates returns only the currently-active groups, so it indeed doesn't return those in preview or review states. To work with the preview and review states, you can use the TryGetVisibleStatus helper, as in [this example in the events documentation](https://docs.metaplay.io/feature-cookbooks/in-game-events/implementing-game-events.html#step-8-implement-the-ui-visualization-for-the-event-phase). TryGetVisibleStatus takes the offer group's config info as a parameter. It's also possible to work directly with the offer group's schedule object (this is what TryGetVisibleStatus does internally to get the preview end time etc.) although it can be a bit verbose. Specifically if the offer group isn't active yet,
offerGroupInfo.ActivableParams.Schedule?.TryGetCurrentOrNextEnabledOccasion(player.GetCurrentLocalTime())?.EnabledRange.Start
gets the time when it would next become active (according to the schedule), or null if it either doesn't have a schedule or does not have a scheduled future occurrence.
a
Thank you, @Nuutti Hölttä for the help!
2 Views