Example #1
0
        private void Awake()
        {
            if (_instance != null)
            {
                Destroy(this);
                return;
            }

            _instance = this;
        }
        private void Awake()
        {
            if (_instance != null)
            {
                Debug.LogWarning("An instance of PlayAssetDeliveryEventHandler is already present in the scene. " +
                                 "Self-destructing...");
                Destroy(this);
                return;
            }

            _instance = this;
        }
        // Proxied java calls. Method names are camelCase to match the corresponding java methods.
        public void onFailure(AndroidJavaObject exception)
        {
            var message = exception.Call <string>("getMessage");

            int errorCode;

            try
            {
                // If exception is not a TaskException, this call will throw an AndroidJavaException.
                errorCode = exception.Call <int>("getErrorCode");
            }
            catch (AndroidJavaException)
            {
                errorCode = PlayCoreConstants.InternalErrorCode;
            }

            PlayCoreEventHandler.HandleEvent(() => OnTaskFailed.Invoke(message, errorCode));
        }
 // Proxied java calls. Method names are camelCase to match the corresponding java methods.
 public void onSuccess(TAndroidJava result)
 {
     PlayCoreEventHandler.HandleEvent(() => OnTaskSucceeded.Invoke(result));
 }