Ejemplo n.º 1
0
    private void instantiateWidget(GameObject widgetPrefab, CellPhoneRecurringLocationActivityDefinition definition)
    {
        GameObject gameObject = UnityEngine.Object.Instantiate(widgetPrefab, base.transform, worldPositionStays: false);

        currentLoadedWidget = gameObject.GetComponent <CellPhoneActivitiyScreenStartingSoonWidget>();
        currentLoadedWidget.SetWidgetData(definition);
        currentLoadedWidget.CountdownCompleteAction += onWidgetCountdownComplete;
    }
Ejemplo n.º 2
0
    public static CellPhoneRecurringLocationActivityDefinition GetActiveRecurringActivityDefinition(List <CellPhoneRecurringLocationActivityDefinition> activities)
    {
        CellPhoneRecurringLocationActivityDefinition result = null;

        for (int i = 0; i < activities.Count; i++)
        {
            DateTime dateTime = Service.Get <ContentSchedulerService>().ScheduledEventDate();
            if (CronExpressionEvaluator.EvaluatesTrue(dateTime, activities[i].ShowWidgetScheduleCron) && DateTimeUtils.DoesDateFallBetween(dateTime, activities[i].GetStartingDate().Date, activities[i].GetEndingDate().Date))
            {
                result = activities[i];
                break;
            }
        }
        return(result);
    }
Ejemplo n.º 3
0
    private IEnumerator loadWidget()
    {
        CellPhoneRecurringLocationActivityDefinition widgetDefinition = GetActiveRecurringActivityDefinition(recurringActivityDefinitions);

        if (widgetDefinition != null)
        {
            AssetRequest <GameObject> assetRequest = Content.LoadAsync(widgetDefinition.WidgetPrefabKey);
            yield return(assetRequest);

            removeCurrentWidget();
            instantiateWidget(assetRequest.Asset, widgetDefinition);
        }
        else
        {
            removeCurrentWidget();
            UnityEngine.Object.Destroy(base.gameObject);
        }
    }