Пример #1
0
        internal DDNAImpl(DDNA ddna) : base(ddna)
        {
            string eventStorePath = null;

            if (Settings.UseEventStore)
            {
                eventStorePath = Settings.EVENT_STORAGE_PATH
                                 .Replace("{persistent_path}", Application.persistentDataPath);
                if (!Utils.IsDirectoryWritable(eventStorePath))
                {
                    Logger.LogWarning("Event store path unwritable, event caching disabled.");
                    Settings.UseEventStore = false;
                }
            }

            eventStore = new EventStore(eventStorePath);
            if (Settings.UseEventStore && !eventStore.IsInitialised)
            {
                // failed to access files for some reason
                Logger.LogWarning("Failed to access event store path, event caching disabled.");
                Settings.UseEventStore = false;
                eventStore             = new EventStore(eventStorePath);
            }
            engageCache = new EngageCache(Settings);
            actionStore = new ActionStore(Settings.ACTIONS_STORAGE_PATH
                                          .Replace("{persistent_path}", Application.persistentDataPath));
            ImageMessageStore     = new ImageMessageStore(ddna);
            executionCountManager = new ExecutionCountManager();

            EngageFactory = new EngageFactory(this);
        }
            public void Build(DDNA ddna, JSONObject configuration)
            {
                store = ddna.GetImageMessageStore();

                try {
                    this.URL           = configuration["url"] as string;
                    this.Width         = (int)((long)configuration["width"]);
                    this.Height        = (int)((long)configuration["height"]);
                    this.configuration = configuration["spritemap"] as JSONObject;
                } catch (KeyNotFoundException exception) {
                    Logger.LogError("Invalid format: " + exception.Message);
                }
            }
Пример #3
0
        override internal void DownloadImageAssets()
        {
            Logger.LogDebug("Downloading image assets");

            StartCoroutine(ImageMessageStore.Prefetch(
                               () => {
                Logger.LogDebug("Image cache populated");
                ddna.NotifyOnImageCachePopulated();
            },
                               e => {
                Logger.LogDebug("Image caching failed due to " + e);
                ddna.NotifyOnImageCachingFailed(e);
            },
                               cacheImages.ToArray()));
        }
Пример #4
0
 override internal void ClearPersistentData()
 {
     if (eventStore != null)
     {
         eventStore.ClearAll();
     }
     if (engageCache != null)
     {
         engageCache.Clear();
     }
     if (ImageMessageStore != null)
     {
         ImageMessageStore.Clear();
     }
 }
Пример #5
0
        internal DDNAImpl(DDNA ddna) : base(ddna)
        {
            string eventStorePath = null;

            if (Settings.UseEventStore)
            {
                eventStorePath = Settings.EVENT_STORAGE_PATH
                                 .Replace("{persistent_path}", Application.persistentDataPath);
                if (!Utils.IsDirectoryWritable(eventStorePath))
                {
                    Logger.LogWarning("Event store path unwritable, event caching disabled.");
                    Settings.UseEventStore = false;
                }
            }

            eventStore = new EventStore(eventStorePath);
            if (Settings.UseEventStore && !eventStore.IsInitialised)
            {
                // failed to access files for some reason
                Logger.LogWarning("Failed to access event store path, event caching disabled.");
                Settings.UseEventStore = false;
                eventStore             = new EventStore(eventStorePath);
            }
            engageCache = new EngageCache(Settings);
            actionStore = new ActionStore(Settings.ACTIONS_STORAGE_PATH
                                          .Replace("{persistent_path}", Application.persistentDataPath));
            ImageMessageStore     = new ImageMessageStore(ddna);
            executionCountManager = new ExecutionCountManager();

            #if DDNA_SMARTADS
            // initialise SmartAds so it can register for events
            var smartAds = SmartAds.Instance.Config(engageCache);
            smartAds.transform.parent = gameObject.transform;

            EngageFactory = new EngageFactory(this, smartAds);

            Application.RequestAdvertisingIdentifierAsync(
                (string advertisingId, bool trackingEnabled, string error) => {
                if (trackingEnabled)
                {
                    PlayerPrefs.SetString(DDNA.PF_KEY_ADVERTISING_ID, advertisingId);
                }
            }
                );
            #else
            EngageFactory = new EngageFactory(this, null);
            #endif
        }
Пример #6
0
 override internal void ClearPersistentData()
 {
     if (eventStore != null)
     {
         eventStore.ClearAll();
     }
     if (engageCache != null)
     {
         engageCache.Clear();
     }
     if (actionStore != null)
     {
         actionStore.Clear();
     }
     if (ImageMessageStore != null)
     {
         ImageMessageStore.Clear();
     }
     if (executionCountManager != null)
     {
         executionCountManager.Clear();
     }
 }
Пример #7
0
 public void SetUp()
 {
     store = new ImageMessageStore();
 }