private static bool doesEventMatchPlatform(AllAccessEventDefinition allAccessEventDefinition) { switch (Application.platform) { case RuntimePlatform.OSXEditor: case RuntimePlatform.WindowsEditor: return(true); case RuntimePlatform.IPhonePlayer: return(allAccessEventDefinition.ApplyToAppleUsers); case RuntimePlatform.Android: return(allAccessEventDefinition.ApplyToGoogleUsers); default: return(false); } }
private bool tryGetCurrentlyActiveEvent(out AllAccessEventDefinition currentEvent) { currentEvent = null; bool flag = false; if (currentlyActiveEvent == null) { Dictionary <string, AllAccessEventDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <string, AllAccessEventDefinition> >(); foreach (KeyValuePair <string, AllAccessEventDefinition> item in dictionary) { if (doesEventMatchPlatform(item.Value)) { ScheduledEventDateDefinition scheduledEventDatedDef = Service.Get <IGameData>().Get <Dictionary <int, ScheduledEventDateDefinition> >()[item.Value.DateDefinitionKey.Id]; if (Service.Get <ContentSchedulerService>().IsDuringScheduleEventDates(scheduledEventDatedDef)) { currentEvent = item.Value; currentlyActiveEvent = item.Value; flag = true; } } } } else { DateTime target = Service.Get <ContentSchedulerService>().ScheduledEventDate(); ScheduledEventDateDefinition scheduledEventDatedDef = Service.Get <IGameData>().Get <Dictionary <int, ScheduledEventDateDefinition> >()[currentlyActiveEvent.DateDefinitionKey.Id]; if (DateTimeUtils.IsBefore(target, scheduledEventDatedDef.Dates.EndDate)) { currentEvent = currentlyActiveEvent; flag = true; } else { currentlyActiveEvent = null; flag = false; } } if (isAllAccessCurrentlyActive != flag) { updateMembershipDataValues(flag); } isAllAccessCurrentlyActive = flag; return(flag); }