private void Awake() { if (this._destroyed) { return; } UpsightManager[] objectsOfType = (UpsightManager[])Object.FindObjectsOfType <UpsightManager>(); bool flag = false; if (objectsOfType.Length > 1) { foreach (UpsightManager upsightManager in objectsOfType) { if (((Object)((Component)upsightManager).get_gameObject()).get_name() == nameof(UpsightManager) && !flag) { flag = true; } else if (!upsightManager._destroyed) { upsightManager._destroyed = true; Object.Destroy((Object)upsightManager); } } } if (!flag) { UpsightManager.init(); } else { UpsightManager.initialized = true; } }
static Upsight() { UpsightManager.noop(); #if UNITY_EDITOR Debug.Log("Note: the Upsight plugin is a native code plugin. It will only return data, fire events and show content when run on an actual iOS or Android device."); #endif }
private void sessionDidResume() { if (UpsightManager.sessionDidResumeEvent == null) { return; } UpsightManager.sessionDidResumeEvent(); }
private void sessionDidStart() { if (UpsightManager.sessionDidStartEvent == null) { return; } UpsightManager.sessionDidStartEvent(); }
private void billboardDidReceiveData(string json) { if (UpsightManager.billboardDidReceiveDataEvent == null) { return; } UpsightManager.billboardDidReceiveDataEvent(UpsightData.FromJson(json)); }
private void billboardDidReceivePurchase(string json) { if (UpsightManager.billboardDidReceivePurchaseEvent == null) { return; } UpsightManager.billboardDidReceivePurchaseEvent(UpsightPurchase.purchaseFromJson(json)); }
private void billboardDidReceiveReward(string json) { if (UpsightManager.billboardDidReceiveRewardEvent == null) { return; } UpsightManager.billboardDidReceiveRewardEvent(UpsightReward.rewardFromJson(json)); }
private void onBillboardDismiss(string scope) { if (UpsightManager.onBillboardDismissEvent == null) { return; } UpsightManager.onBillboardDismissEvent(scope); }
private void onBillboardAppear(string json) { string scope; UpsightContentAttributes contentAttributes = UpsightContentAttributes.FromJson(json, out scope); if (UpsightManager.onBillboardAppearEvent == null) { return; } UpsightManager.onBillboardAppearEvent(scope, contentAttributes); }
static Upsight() { if (Application.platform != RuntimePlatform.Android) { return; } UpsightManager.noop(); // find the plugin instance using (var pluginClass = new AndroidJavaClass("com.upsight.unity.UpsightPlugin")) _plugin = pluginClass.CallStatic <AndroidJavaObject>("instance"); }
private void managedVariablesDidSynchronize(string json) { if (UpsightManager.managedVariablesDidSynchronizeEvent == null) { return; } List <string> stringList = (List <string>)null; if (json != null && 0 < json.Length) { List <object> jsonArray = Json.ToJsonArray(json); stringList = new List <string>(); using (List <object> .Enumerator enumerator = jsonArray.GetEnumerator()) { while (enumerator.MoveNext()) { object current = enumerator.Current; stringList.Add(current.ToString()); } } } UpsightManager.managedVariablesDidSynchronizeEvent(stringList); }
public static void init() { if (Application.get_platform() != 11) { return; } try { using (AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.upsight.android.unity.UpsightPlugin")) { if (((AndroidJavaObject)androidJavaClass).CallStatic <bool>("isEnabled", new object[0]) == null) { Debug.LogWarning((object)"Upsight.init() was called but the SDK is currently disabled from the Upsight SDK Management Extension. Upsight will not initialize."); return; } } } catch { Debug.LogError((object)"Error while checking if the Upsight SDK is enabled. Unable to initialize"); return; } if (Upsight.Initialized) { return; } Upsight.Initialized = true; UpsightManager.init(); try { Upsight._pluginBase = new AndroidJavaObject("com.upsight.android.unity.UpsightPlugin", new object[0]); if (Upsight._pluginBase != null) { if (!(AndroidJNI.ExceptionOccurred() != IntPtr.Zero)) { goto label_15; } } Debug.LogError((object)"Upsight initialization failed! JNI Exception thrown:"); AndroidJNI.ExceptionDescribe(); Upsight._pluginBase = (AndroidJavaObject)null; AndroidJNI.ExceptionClear(); return; } catch (Exception ex) { Debug.LogError((object)"Upsight initialization failed!"); Debug.LogException(ex); Upsight._pluginBase = (AndroidJavaObject)null; return; } label_15: try { Upsight._pluginMarketingExtension = new AndroidJavaObject("com.upsight.android.unity.UpsightMarketingManager", new object[0]); if (Upsight._pluginMarketingExtension != null) { Upsight._pluginBase.Call("registerExtension", new object[1] { (object)Upsight._pluginMarketingExtension }); } } catch { Debug.LogWarning((object)"Upsight Marketing Extension not included."); Upsight._pluginMarketingExtension = (AndroidJavaObject)null; } try { Upsight._pluginPushExtension = new AndroidJavaObject("com.upsight.android.unity.UpsightPushManager", new object[0]); if (Upsight._pluginPushExtension == null) { return; } Upsight._pluginBase.Call("registerExtension", new object[1] { (object)Upsight._pluginPushExtension }); } catch { Debug.LogWarning((object)"Upsight Push Extension not included."); Upsight._pluginPushExtension = (AndroidJavaObject)null; } }