private void AddDeltaEvent(string collection, Dictionary <string, object> fields) { if (!DDNA.Instance.HasStarted) { Debug.LogWarning("Attempting to record " + collection + " event before starting DeltaDNA."); return; } if (collection.StartsWith(KongregateAPI.KONGREGATE_SWRVE_PREFIX) || collection.StartsWith(KongregateAPI.KONGREGATE_DELTA_PREFIX)) { Debug.Log("Sending Delta only event: " + collection); String qualifiedEventName = collection.Replace(KongregateAPI.KONGREGATE_SWRVE_PREFIX, ""); qualifiedEventName = qualifiedEventName.Replace(KongregateAPI.KONGREGATE_DELTA_PREFIX, ""); collection = qualifiedEventName; } String eventName = KongDeltaUtils.eventNameToDeltaName(collection); if (KongDeltaUtils.deltaEventFilter(eventName) /*|| KongDeltaUtils.deltaRemoteFilterList(eventName)*/) { Debug.Log("Delta Filtered Event: " + collection); return; } Dictionary <string, object> eventPayload = KongDeltaUtils.fieldsToDeltaFields(fields, eventName); DDNA.Instance.RecordEvent(eventName, eventPayload) .Add(new GameParametersHandler(gameParameters => { if (_paramListener != null) { _paramListener(gameParameters); } })) .Add(new ImageMessageHandler(DDNA.Instance, imageMessage => { Debug.Log("Delta Image Message Received"); // the image message is already prepared so it will show instantly imageMessage.Show(); imageMessage.OnAction += eventArgs => { if (_buttonListener != null) { _buttonListener(eventArgs.ID, eventArgs.ActionType, eventArgs.ActionValue); } }; })) .Run(); }
protected void addIAPEvent(string collection, string productId, Dictionary <string, object> gameFields, Dictionary <string, object> iapFields, string receipt, string receiptSignature) { Dictionary <string, object> eventMap = new Dictionary <string, object>(); double usdCost = KongDeltaUtils.parseItemPrice(productId); eventMap.Add(Analytics.USD_COST, usdCost); /* Ignore Local Price for now * ProductInfoCache.Product product = mProductInfoCache.getProductInfo(productId); * eventMap.Add(Analytics.LOCAL_CURRENCY_COST, product != null ? product.getLocalCost() : null); * eventMap.Add(Analytics.LOCAL_CURRENCY_TYPE, product != null ? product.getLocalCurrency() : null); */ eventMap.Add(Analytics.PRODUCT_ID, productId); if (gameFields != null) { foreach (string key in gameFields.Keys) { eventMap.Add(key, gameFields [key]); } } if (iapFields != null) { foreach (string key in iapFields.Keys) { eventMap.Add(key, iapFields [key]); } } AddDeltaEvent(collection, eventMap); if (Analytics.EVENT_IAP_TRANSACTIONS.Equals(collection)) { iapEvent(productId, usdCost, eventMap, receipt, receiptSignature); Debug.Log("IAP FLOW STEP: completed: " + collection); } }