Example #1
0
    private bool baseConditionMet(LoginZoneDefinition.LoginZoneCondition condition)
    {
        ScheduledEventDateDefinition scheduledEventDateDefinition = Service.Get <IGameData>().Get <Dictionary <int, ScheduledEventDateDefinition> >()[condition.DateDefinitionKey.Id];

        if (!DateTimeUtils.DoesDateFallBetween(contentSchedulerService.ScheduledEventDate(), scheduledEventDateDefinition.Dates.StartDate, scheduledEventDateDefinition.Dates.EndDate))
        {
            return(false);
        }
        bool   result = false;
        string key    = condition.PlayerPrefsKey;

        if (condition.AddPlayerNameToKey)
        {
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
            string displayName = cPDataEntityCollection.GetComponent <DisplayNameData>(cPDataEntityCollection.LocalPlayerHandle).DisplayName;
            key = displayName + condition.PlayerPrefsKey;
        }
        switch (condition.TypeOfCondition)
        {
        case LoginZoneDefinition.ConditionType.PlayerPrefExist:
            result = PlayerPrefs.HasKey(key);
            break;

        case LoginZoneDefinition.ConditionType.PlayerPrefDoesNotExist:
            result = !PlayerPrefs.HasKey(key);
            break;
        }
        return(result);
    }
        public bool IsAvailable()
        {
            DateTime target = Service.Get <ContentSchedulerService>().ScheduledEventDate();
            ScheduledEventDateDefinition definitionById = Service.Get <IGameData>().GetDefinitionById(EventItemDefinition.DateDefinitionKey);

            return(DateTimeUtils.DoesDateFallBetween(target, definitionById.Dates.StartDate, definitionById.Dates.EndDate));
        }
Example #3
0
 public ContentSchedulerService(ICollection <DateTime> days, int fallbackTimeOffsetHours, ScheduledEventDateDefinition supported)
 {
     this.days = new List <DateTime>(days);
     FallbackTimeOffsetHours = fallbackTimeOffsetHours;
     this.supported          = supported;
     currentDate             = today();
 }
 private void Start()
 {
     network        = Service.Get <INetworkServicesManager>();
     localizer      = Service.Get <Localizer>();
     DateDefinition = Service.Get <IGameData>().Get <Dictionary <int, ScheduledEventDateDefinition> >()[DateDefinition.Id];
     CheckWithinDateRange();
 }
    private PrefabContentKey getMarketingLoadingScreenKey()
    {
        Dictionary <int, MarketingLoadingScreenDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, MarketingLoadingScreenDefinition> >();
        List <PrefabContentKey> list = new List <PrefabContentKey>();

        foreach (MarketingLoadingScreenDefinition value in dictionary.Values)
        {
            if (value.ScreenPrefabContentKeys != null && value.ScreenPrefabContentKeys.Length > 0)
            {
                ScheduledEventDateDefinition scheduledEventDatedDef = Service.Get <IGameData>().Get <Dictionary <int, ScheduledEventDateDefinition> >()[value.DateDefinitionKey.Id];
                if (Service.Get <ContentSchedulerService>().IsDuringScheduleEventDates(scheduledEventDatedDef))
                {
                    for (int i = 0; i < value.ScreenPrefabContentKeys.Length; i++)
                    {
                        list.Add(value.ScreenPrefabContentKeys[i]);
                    }
                }
            }
        }
        if (list.Count > 0)
        {
            int index = UnityEngine.Random.Range(0, list.Count);
            return(list[index]);
        }
        return(null);
    }
Example #6
0
 public MembershipService(ScheduledEventDateDefinition supported)
 {
     this.supported = supported;
     cs = Service.Get<CommerceService>();
     if (IsPurchaseFunnelAvailable() && cs != null)
     {
         Service.Get<EventDispatcher>().AddListener<CommerceServiceEvents.PurchaseVerified>(PurchaseWasVerified);
         Service.Get<EventDispatcher>().AddListener<CommerceServiceErrors.PurchaseVerifiedError>(PurchaseWasVerifiedError);
         Service.Get<EventDispatcher>().AddListener<CommerceServiceEvents.UnexpectedPurchase>(UnexpectedPurchaseEvent);
         Service.Get<EventDispatcher>().AddListener<CommerceServiceEvents.ProductsLoaded>(ProducstWereLoadedVerified);
         Service.Get<EventDispatcher>().AddListener<CommerceServiceErrors.ProductsLoadedError>(ProducstWereLoadedError);
         Service.Get<EventDispatcher>().AddListener<CommerceServiceEvents.BillingEnabled>(BillingEnabled);
         Service.Get<EventDispatcher>().AddListener<CommerceServiceErrors.BillingEnabledError>(BillingEnabledError);
         Service.Get<EventDispatcher>().AddListener<CommerceServiceEvents.RestoreVerified>(RestoreWasVerified);
         Service.Get<EventDispatcher>().AddListener<CommerceServiceErrors.RestoreVerifiedError>(RestoreWasVerifiedError);
         Service.Get<EventDispatcher>().AddListener<NetworkErrors.InvalidSubscriptionError>(onInvalidSubscriptionError);
         Service.Get<EventDispatcher>().AddListener<IAPServiceErrors.MembershipGrantError>(onMembershipGrantError);
         if (cs.CommerceProcessor.IsBillingSupported())
         {
             LoadProducts();
         }
     }
     overrideSimCountryCode = new DevCacheableType<string>("cp.OverrideSimCountryCode", "");
     overrideSimCarrierName = new DevCacheableType<string>("cp.OverrideSimCarrierName", "");
     MembershipFunnelName = "membership_offer";
 }
Example #7
0
 public TimeSpan GetRemainingTime()
 {
     if (tryGetCurrentlyActiveEvent(out AllAccessEventDefinition currentEvent))
     {
         DateTime dateTime = Service.Get <ContentSchedulerService>().ScheduledEventDate();
         ScheduledEventDateDefinition scheduledEventDateDefinition = Service.Get <IGameData>().Get <Dictionary <int, ScheduledEventDateDefinition> >()[currentEvent.DateDefinitionKey.Id];
         return((scheduledEventDateDefinition.Dates.EndDate.Date > dateTime) ? (scheduledEventDateDefinition.Dates.EndDate.Date - dateTime) : TimeSpan.Zero);
     }
     return(TimeSpan.Zero);
 }
Example #8
0
 public bool IsBeforeScheduleEventDates(ScheduledEventDateDefinition scheduledEventDatedDef)
 {
     if (scheduledEventDatedDef != null)
     {
         DateTime         target    = ScheduledEventDate();
         DateUnityWrapper startDate = scheduledEventDatedDef.Dates.StartDate;
         if (DateTimeUtils.IsBefore(target, startDate))
         {
             return(true);
         }
     }
     return(false);
 }
Example #9
0
 public bool IsAfterScheduleEventDates(ScheduledEventDateDefinition scheduledEventDatedDef)
 {
     if (scheduledEventDatedDef != null)
     {
         DateTime         target  = ScheduledEventDate();
         DateUnityWrapper endDate = scheduledEventDatedDef.Dates.EndDate;
         if (DateTimeUtils.IsAfter(target, endDate))
         {
             return(true);
         }
     }
     return(false);
 }
Example #10
0
 public bool IsDuringScheduleEventDates(ScheduledEventDateDefinition scheduledEventDatedDef)
 {
     if (scheduledEventDatedDef != null)
     {
         DateTime         target    = ScheduledEventDate();
         DateUnityWrapper startDate = scheduledEventDatedDef.Dates.StartDate;
         DateUnityWrapper endDate   = scheduledEventDatedDef.Dates.EndDate;
         if (DateTimeUtils.DoesDateFallBetween(target, startDate, endDate))
         {
             return(true);
         }
     }
     return(false);
 }
Example #11
0
 private void parseLoginZoneDefinitions()
 {
     LoginZoneDefinition[] array = Service.Get <IGameData>().Get <LoginZoneDefinition[]>();
     for (int i = 0; i < array.Length; i++)
     {
         ScheduledEventDateDefinition scheduledEventDateDefinition = Service.Get <IGameData>().Get <Dictionary <int, ScheduledEventDateDefinition> >()[array[i].ScheduledEventDateKey.Id];
         if (contentSchedulerService.IsDuringScheduleEventDates(scheduledEventDateDefinition) && (!hasConditions(array[i]) || anyConditionsMet(array[i].ANYConditions)))
         {
             if (array[i].Zone != null)
             {
                 gameStateController.LoginZone = array[i].Zone.Id;
                 return;
             }
             Log.LogErrorFormatted(this, "The Zone for the event {0} is missing", scheduledEventDateDefinition.name);
         }
     }
     gameStateController.LoginZone = "";
 }
Example #12
0
    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);
    }
Example #13
0
        private void OnDefinitionsLoaded()
        {
            PrefabContentKey key = DefaultHomeScreen;
            Dictionary <string, HomeScreenTakeoverDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <string, HomeScreenTakeoverDefinition> >();

            foreach (KeyValuePair <string, HomeScreenTakeoverDefinition> item in dictionary)
            {
                ScheduledEventDateDefinition scheduledEventDatedDef = Service.Get <IGameData>().Get <Dictionary <int, ScheduledEventDateDefinition> >()[item.Value.DateDefinitionKey.Id];
                if (Service.Get <ContentSchedulerService>().IsDuringScheduleEventDates(scheduledEventDatedDef))
                {
                    if (Content.ContainsKey(item.Value.TakeOverPrefabContentKey))
                    {
                        key = item.Value.TakeOverPrefabContentKey;
                        break;
                    }
                    Log.LogErrorFormatted(this, "The home screen prefab {0} for the scheduled event {1} is was not found, falling back to another", item.Value.TakeOverPrefabContentKey, item.Value.name);
                }
            }
            Content.LoadAsync(onHomeScreenPrefabLoaded, key);
        }
Example #14
0
        public override IEnumerator PerformFirstPass()
        {
            CommerceService commerceService = new CommerceService();

            commerceService.Setup();
            Dictionary <int, ScheduledEventDateDefinition> dictionary = Service.Get <IGameData>().Get <Dictionary <int, ScheduledEventDateDefinition> >();
            ScheduledEventDateDefinition value = null;

            dictionary.TryGetValue(SupportWindow.Id, out value);
            Service.Set(commerceService);
            Service.Set(new MembershipService(value));
            if (Service.Get <GameSettings>().FirstSession)
            {
                Service.Get <MembershipService>().AccountFunnelName = "account_creation";
            }
            else
            {
                Service.Get <MembershipService>().AccountFunnelName = "login";
            }
            yield break;
        }
 private void parseUnlockDefinitions()
 {
     foreach (ClaimableRewardDefinition value in claimableRewardDefinition.Values)
     {
         if (value.ClaimOnLogin && (!value.IsMemberOnly || isMember()))
         {
             DateTime target = contentSchedulerService.ScheduledEventDate();
             ScheduledEventDateDefinition definitionById = Service.Get <IGameData>().GetDefinitionById(value.DateDefinitionKey);
             if (DateTimeUtils.DoesDateFallBetween(target, definitionById.Dates.StartDate, definitionById.Dates.EndDate) && (claimedRewardIdsData == null || !claimedRewardIdsData.RewardIds.Contains(value.Id)))
             {
                 rewardsToClaimById.Enqueue(value.Id);
             }
         }
     }
     if (rewardsToClaimById.Count > 0)
     {
         claimNextReward();
     }
     else
     {
         showRewardsComplete();
     }
 }
        public override IEnumerator PerformFirstPass()
        {
            string dailyChallengesScheduleManifestPath           = DailyChallengeService.GetDateManifestMapPath();
            AssetRequest <DatedManifestMap> scheduleAssetRequest = Content.LoadAsync <DatedManifestMap>(dailyChallengesScheduleManifestPath);

            yield return(scheduleAssetRequest);

            Dictionary <int, ScheduledEventDateDefinition> events = Service.Get <IGameData>().Get <Dictionary <int, ScheduledEventDateDefinition> >();
            ScheduledEventDateDefinition def = null;

            events.TryGetValue(SupportWindow.Id, out def);
            ContentSchedulerService service = new ContentSchedulerService(scheduleAssetRequest.Asset.Map.Keys, PenguinStandardTimeOffsetHours, def);

            Service.Set(service);
            bool   offlineMode  = service.HasSupportEndded();
            string offline_mode = CommandLineArgs.GetValueForKey("offline_mode");

            if (!string.IsNullOrEmpty(offline_mode))
            {
                offlineMode = offline_mode.ToLower().Trim() == "true";
            }
            Service.Get <GameSettings>().SetOfflineMode(offlineMode);
        }
Example #17
0
 private void Awake()
 {
     dateDefinition = Service.Get <IGameData>().Get <Dictionary <int, ScheduledEventDateDefinition> >()[DateDefinitionKey.Id];
 }
Example #18
0
 private void Awake()
 {
     eventChannel   = new EventChannel(Service.Get <EventDispatcher>());
     dateDefinition = Service.Get <IGameData>().Get <Dictionary <int, ScheduledEventDateDefinition> >()[DateDefinitionKey.Id];
     eventChannel.AddListener <PlayerSpawnedEvents.LocalPlayerSpawned>(onLocalPlayerSpawned);
 }
Example #19
0
    public bool IsAfterScheduleEventDates(ScheduledEventDateDefinitionKey scheduledEventDateDefinitionKey)
    {
        ScheduledEventDateDefinition definitionById = Service.Get <IGameData>().GetDefinitionById(scheduledEventDateDefinitionKey);

        return(IsAfterScheduleEventDates(definitionById));
    }
        private void setEndTime(CellPhoneSaleActivityDefinition saleData)
        {
            ScheduledEventDateDefinition availableDates = saleData.AvailableDates;

            endTime = availableDates.Dates.EndDate.Date;
        }
        public override string ToString()
        {
            ScheduledEventDateDefinition scheduledEventDateDefinition = Service.Get <IGameData>().Get <Dictionary <int, ScheduledEventDateDefinition> >()[DateDefinitionKey.Id];

            return($"[AllAccessEventDefinition] Id: {Id}, Start: {scheduledEventDateDefinition.Dates.StartDate}, End: {scheduledEventDateDefinition.Dates.EndDate}, Google={ApplyToGoogleUsers}, Apple={ApplyToAppleUsers}");
        }