Esempio n. 1
0
        public override void Login(
            string params_str, KingskyDelegate <ILoginResult> callback)
        {
            MethodArguments args = new MethodArguments();

            args.AddString("test", params_str);
            var loginCall = new JavaMethodCall <ILoginResult> (this, "Login");

            loginCall.Callback = callback;
            loginCall.Call(args);
        }
Esempio n. 2
0
        public string AddKingskyDelegate <T> (KingskyDelegate <T> callback) where T : IResult
        {
            if (callback == null)
            {
                return(null);
            }

            this.nextAsyncId++;
            this.kingskyDelegates.Add(this.nextAsyncId.ToString(), callback);
            return(this.nextAsyncId.ToString());
        }
Esempio n. 3
0
 public virtual void Init(
     HideUnityDelegate hideUnityDelegate,
     InitDelegate onInitComplete,
     KingskyDelegate <IPurchaseResult> onPurchaseCompleteDelegate
     , Action <bool> gameCenter,
     Dictionary <string, object> extras)
 {
     this.onHideUnityDelegate        = hideUnityDelegate;
     this.onInitCompleteDelegate     = onInitComplete;
     this.onPurchaseCompleteDelegate = onPurchaseCompleteDelegate;
     Social.localUser.Authenticate(gameCenter);
 }
Esempio n. 4
0
 public override void Init(
     HideUnityDelegate hideUnityDelegate,
     InitDelegate onInitComplete,
     KingskyDelegate <IPurchaseResult> onPurchaseCompleteDelegate
     , Action <bool> gameCenter
     , Dictionary <string, object> extras)
 {
     base.Init(
         hideUnityDelegate,
         onInitComplete,
         onPurchaseCompleteDelegate, gameCenter, extras);
 }
Esempio n. 5
0
        /// <summary>
        /// This is the preferred way to call FB.Init(). It will take the facebook app id specified in your "Facebook"
        /// => "Edit Settings" menu when it is called.
        /// </summary>
        /// <param name="onInitComplete">
        /// Delegate is called when FB.Init() finished initializing everything. By passing in a delegate you can find
        /// out when you can safely call the other methods.
        /// </param>
        /// <param name="onHideUnity">A delegate to invoke when unity is hidden.</param>
        /// <param name="authResponse">Auth response.</param>
//		public static void Init(InitDelegate onInitComplete = null, HideUnityDelegate onHideUnity = null)
//		{
//			Init(
//				onHideUnity,
//				onInitComplete);
//		}


        /// <summary>
        /// If you need a more programmatic way to set the facebook app id and other setting call this function.
        /// Useful for a build pipeline that requires no human input.
        /// </summary>
        /// <param name="appId">App identifier.</param>
        /// <param name="cookie">If set to <c>true</c> cookie.</param>
        /// <param name="logging">If set to <c>true</c> logging.</param>
        /// <param name="status">If set to <c>true</c> status.</param>
        /// <param name="xfbml">If set to <c>true</c> xfbml.</param>
        /// <param name="frictionlessRequests">If set to <c>true</c> frictionless requests.</param>
        /// <param name="authResponse">Auth response.</param>
        /// <param name="onHideUnity">
        /// A delegate to invoke when unity is hidden.
        /// </param>
        /// <param name="onInitComplete">
        /// Delegate is called when FB.Init() finished initializing everything. By passing in a delegate you can find
        /// out when you can safely call the other methods.
        /// </param>
        public static void Init(
            HideUnityDelegate onHideUnity = null,
            InitDelegate onInitComplete   = null,
            KingskyDelegate <IPurchaseResult> onPurchaseCompleteDelegate = null,
            Action <bool> gameCenter           = null,
            Dictionary <string, object> extras = null, Facebook.Unity.InitDelegate onInitCompleteFacebook = null, Facebook.Unity.HideUnityDelegate onHideUnityFacebook = null, string authResponseFacebook = null)
        {
//			if (string.IsNullOrEmpty(appId))
//			{
//				throw new ArgumentException("appId cannot be null or empty!");
//			}
            FB.Init(onInitCompleteFacebook, onHideUnityFacebook, authResponseFacebook);

            SGCross.onInitComplete             = onInitComplete;
            SGCross.onHideUnity                = onHideUnity;
            SGCross.onPurchaseCompleteDelegate = onPurchaseCompleteDelegate;
            SGCross.gameCenter = gameCenter;
            SGCross.extras     = extras;

            if (!isInitCalled)
            {
                                #if UNITY_EDITOR
                ComponentFactory.GetComponent <EditorSupergoodLoader>();
//				#elif UNITY_WEBPLAYER || UNITY_WEBGL
                //				ComponentFactory.GetComponent<CanvasSupergoodLoader>();
                                #elif UNITY_IOS
                ComponentFactory.GetComponent <IOSSupergoodLoader>();
                                #elif UNITY_ANDROID
                ComponentFactory.GetComponent <AndroidSupergoodLoader>();
                                #else
                throw new NotImplementedException("Supergood API does not yet support this platform");
                                #endif
                SGConfig.CreateInstant();
                AnalyticsManager analyticsManager = AnalyticsManager.Instant;
                isInitCalled = true;
                return;
            }

            Debug.LogWarning("KS.Init() has already been called.  You only need to call this once and only once.");

            // Init again if possible just in case something bad actually happened.
            if (SuperGoodImpl != null)
            {
                OnDllLoaded();
            }
        }
Esempio n. 6
0
        public override void Init(
            HideUnityDelegate hideUnityDelegate,
            InitDelegate onInitComplete,
            KingskyDelegate <IPurchaseResult> onPurchaseCompleteDelegate
            , Action <bool> gameCenter
            , Dictionary <string, object> extras)
        {
            GooglePlayGames.PlayGamesPlatform.Activate();
            base.Init(
                hideUnityDelegate,
                onInitComplete,
                onPurchaseCompleteDelegate, gameCenter, extras);

            var args = new MethodArguments();

            args.AddDictionary("configInfo", extras);
            var initCall = new JavaMethodCall <IResult> (this, "Init");

            initCall.Call(args);
        }
Esempio n. 7
0
 public abstract void Purchase(string pid, Dictionary <string, object> extras, KingskyDelegate <IPurchaseResult> callback);
Esempio n. 8
0
 public abstract void Login(string params_str, KingskyDelegate <ILoginResult> callback);
Esempio n. 9
0
        public override void Purchase(string pid, Dictionary <string, object> extras, KingskyDelegate <IPurchaseResult> callback)
        {
            MethodArguments args = new MethodArguments();

            args.AddString(PurchaseResult.IAP_PID_TAG, pid);
            args.AddDictionary(PurchaseResult.EXTRAS, extras);
            var purchaseCall = new JavaMethodCall <IPurchaseResult>(this, "Purchase");

            purchaseCall.Callback = callback;
            purchaseCall.Call(args);
        }
Esempio n. 10
0
 public static void Purchase(string pid, Dictionary <string, object> extras, KingskyDelegate <IPurchaseResult> callback = null)
 {
     SuperGoodImpl.Purchase(pid, extras, callback);
 }
Esempio n. 11
0
 public static void Login(
     string permissions = null,
     KingskyDelegate <ILoginResult> callback = null)
 {
     SuperGoodImpl.Login(permissions, callback);
 }
Esempio n. 12
0
 public override void Login(
     string params_str, KingskyDelegate <ILoginResult> callback)
 {
 }
Esempio n. 13
0
 public override void Login(
     string params_str, KingskyDelegate <ILoginResult> callback)
 {
     IOSSupergood.KSLogIn(this.AddCallback(callback), "aaaaa");
 }
Esempio n. 14
0
        private int AddCallback <T>(KingskyDelegate <T> callback) where T : IResult
        {
            string asyncId = this.CallbackManager.AddKingskyDelegate(callback);

            return(Convert.ToInt32(asyncId));
        }
Esempio n. 15
0
        public override void Purchase(string pid, Dictionary <string, object> extras, KingskyDelegate <IPurchaseResult> callback)
        {
            extras.Add(PurchaseResult.IAP_PID_TAG, pid);
            NativeDict dict = MarshallDict(extras);

            IOSSupergood.KSIOSPurchase(this.AddCallback(callback), dict.NumEntries, dict.Keys, dict.Values);
        }