Exemplo n.º 1
0
    public static void CheckReceipt()
    {
        if (!string.IsNullOrEmpty(PlayerPrefs.GetString("LatestReceipt")))
        {
            string  receipt = PlayerPrefs.GetString("LatestReceipt").Replace("\r", "");
            byte[]  rec     = System.Convert.FromBase64String(receipt);
            string  jsonStr = System.Text.Encoding.UTF8.GetString(rec);
            JObject json    = Statics.GetObjCJson(jsonStr);
            rec     = System.Convert.FromBase64String(json["purchase-info"].ToString());
            jsonStr = System.Text.Encoding.UTF8.GetString(rec);
            json    = Statics.GetObjCJson(jsonStr);
//            Debug.Log("------------------------------resend");
//            Debug.Log(json.ToString());
            if (json["bid"].ToString() == "com.courage2017.mywuxia")
            {
                if (string.IsNullOrEmpty(PlayerPrefs.GetString(json["original-transaction-id"].ToString())))
                {
                    UnlockProducts(json["product-id"].ToString());
                    PlayerPrefs.SetString(json["original-transaction-id"].ToString(), "true");
                }
                else
                {
                    IOSNativePopUpManager.showMessage("提示", "已使用过的内购通知");
                    SendEvent("ReceiptUsed", json["original-transaction-id"].ToString(), DbManager.Instance.HostData.Name);
                }
            }
            else
            {
                IOSNativePopUpManager.showMessage("提示", "不属于本游戏的内购项目");
                SendEvent("NotMyReceipt", json["bid"].ToString(), DbManager.Instance.HostData.Name);
            }
            PlayerPrefs.SetString("LatestReceipt", ""); //标记receipt为已经处理完毕
            SendEvent("VerificationReceipt", DbManager.Instance.HostData.Lv.ToString(), DbManager.Instance.HostData.Name);
        }
    }
Exemplo n.º 2
0
    private static void OnTransactionComplete(IOSStoreKitResponse responce)
    {
        Debug.Log("OnTransactionComplete: " + responce.productIdentifier);
        Debug.Log("OnTransactionComplete: state: " + responce.state);

        switch (responce.state)
        {
        case InAppPurchaseState.Purchased:
        case InAppPurchaseState.Restored:
            //Our product been succsesly purchased or restored
            //So we need to provide content to our user depends on productIdentifier
            UnlockProducts(responce.productIdentifier);
            break;

        case InAppPurchaseState.Deferred:
            //iOS 8 introduces Ask to Buy, which lets parents approve any purchases initiated by children
            //You should update your UI to reflect this deferred state, and expect another Transaction Complete  to be called again with a new transaction state
            //reflecting the parent’s decision or after the transaction times out. Avoid blocking your UI or gameplay while waiting for the transaction to be updated.
            break;

        case InAppPurchaseState.Failed:
            //Our purchase flow is failed.
            //We can unlock intrefase and repor user that the purchase is failed.
            Debug.Log("Transaction failed with error, code: " + responce.error.code);
            Debug.Log("Transaction failed with error, description: " + responce.error.description);
            break;
        }

        IOSNativePopUpManager.showMessage("Store Kit Response", "product " + responce.productIdentifier + " state: " + responce.state.ToString());
    }
Exemplo n.º 3
0
    private void onRatePopUpClose(CEvent e)
    {
        (e.dispatcher as IOSRateUsPopUp).removeEventListener(BaseEvent.COMPLETE, onRatePopUpClose);
        string result = e.data.ToString();

        IOSNativePopUpManager.showMessage("Result", result + " button pressed");
    }
    private void CheckMatchState(GK_RTM_Match macth)
    {
        IOSNativePopUpManager.dismissCurrentAlert();
        if (macth != null)
        {
            if (macth.ExpectedPlayerCount == 0)
            {
                IOSNativePopUpManager.showMessage("Match Started", "let's play now\n   Macth.ExpectedPlayerCount): " + macth.ExpectedPlayerCount);



                m.enabled = true;
                b.enabled = false;
                d.enabled = true;


                ISN_Logger.Log("Sending HelloPackage ");
                HelloPackage p = new HelloPackage();
                p.send();
            }
            else
            {
                IOSNativePopUpManager.showMessage("Match Created", "Macth.ExpectedPlayerCount): " + macth.ExpectedPlayerCount);
            }
        }
    }
Exemplo n.º 5
0
 void HandleOnAuthFinished(ISN_Result r)
 {
     if (r.IsSucceeded)
     {
         IOSNativePopUpManager.showMessage("Player Authenticated", "ID: " + GameCenterManager.Player.Id + "\n" + "Name: " + GameCenterManager.Player.DisplayName);
     }
 }
Exemplo n.º 6
0
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------

    void Awake()
    {
        ISN_ReplayKit.ActionRecordStarted     += HandleActionRecordStarted;
        ISN_ReplayKit.ActionRecordStoped      += HandleActionRecordStoped;
        ISN_ReplayKit.ActionRecordInterrupted += HandleActionRecordInterrupted;

        IOSNativePopUpManager.showMessage("Welcome", "Hey there, welcome to the ReplayKit testing scene!");
    }
Exemplo n.º 7
0
 void OnScoreSubmitted(GK_LeaderboardResult result)
 {
     if (result.IsSucceeded)
     {
         GK_Score score = result.Leaderboard.GetCurrentPlayerScore(GK_TimeSpan.ALL_TIME, GK_CollectionType.GLOBAL);
         IOSNativePopUpManager.showMessage("Leaderboard " + score.LeaderboardId, "Score: " + score.LongScore + "\n" + "Rank:" + score.Rank);
     }
 }
Exemplo n.º 8
0
    private static void onVerificationResponce(CEvent e)
    {
        IOSStoreKitVerificationResponse responce = e.data as IOSStoreKitVerificationResponse;

        IOSNativePopUpManager.showMessage("Verification", "Transaction verification status: " + responce.status.ToString());

        Debug.Log("ORIGINAL JSON ON: " + responce.originalJSON);
    }
Exemplo n.º 9
0
    //--------------------------------------
    //  GET/SET
    //--------------------------------------

    //--------------------------------------
    //  EVENTS
    //--------------------------------------

    void OnAuthFinished(ISN_Result res)
    {
        if (res.IsSucceeded)
        {
            IOSNativePopUpManager.showMessage("Player Authed ", "ID: " + GameCenterManager.player.playerId + "\n" + "Name: " + GameCenterManager.player.displayName);
            cleanUpScene();
        }
    }
    //--------------------------------------
    //  GET/SET
    //--------------------------------------

    //--------------------------------------
    //  EVENTS
    //--------------------------------------

    void OnAuthFinished(SA.Common.Models.Result res)
    {
        if (res.IsSucceeded)
        {
            IOSNativePopUpManager.showMessage("Player Authed ", "ID: " + GameCenterManager.Player.Id + "\n" + "Name: " + GameCenterManager.Player.DisplayName);
            cleanUpScene();
        }
    }
Exemplo n.º 11
0
 void HandleOnPlayerScoreLoaded(GK_PlayerScoreLoadedResult result)
 {
     if (result.IsSucceeded)
     {
         GK_Score score = result.loadedScore;
         IOSNativePopUpManager.showMessage("Leaderboard " + score.leaderboardId, "Score: " + score.score + "\n" + "Rank:" + score.rank);
     }
 }
Exemplo n.º 12
0
    private void OnAuth(CEvent e)
    {
        ISN_Result r = e.data as ISN_Result;

        if (r.IsSucceeded)
        {
            IOSNativePopUpManager.showMessage("Player Authed ", "ID: " + GameCenterManager.player.playerId + "\n" + "Name: " + GameCenterManager.player.displayName);
        }
    }
Exemplo n.º 13
0
    void NoConnection()
    {
        IOSNativePopUpManager.showMessage("Connection Fail", "Connect your device to the internet and try again");

        if (!storeKitInited)
        {
            iOS_IAP_Payment_Manager.init();
        }
    }
Exemplo n.º 14
0
    private void OnLeaderBoarScoreLoaded(CEvent e)
    {
        ISN_PlayerScoreLoadedResult result = e.data as ISN_PlayerScoreLoadedResult;

        if (result.IsSucceeded)
        {
            GCScore score = result.loadedScore;
            IOSNativePopUpManager.showMessage("Leader Board " + score.leaderboardId, "Score: " + score.score + "\n" + "Rank:" + score.rank);
        }
    }
Exemplo n.º 15
0
 private void GetLocale(ISN_Locale locale)
 {
     ISN_Logger.Log("GetLocale");
     ISN_Logger.Log(locale.DisplayCountry);
     IOSNativePopUpManager.showMessage("Locale Info:", "Country:" + locale.CountryCode + "/"
                                       + locale.DisplayCountry + "  :   " + "Language:"
                                       + locale.LanguageCode + "/"
                                       + locale.DisplayLanguage);
     IOSNativeUtility.OnLocaleLoaded -= GetLocale;
 }
 void HandleOnAuthFinished(ISN_Result result)
 {
     if (result.IsSucceeded)
     {
         Debug.Log("Player Authed");
     }
     else
     {
         IOSNativePopUpManager.showMessage("Game Center ", "Player authentication failed");
     }
 }
Exemplo n.º 17
0
 private static void OnStoreKitInitComplete(ISN_Result result)
 {
     if (result.IsSucceeded)
     {
         IOSNativePopUpManager.showMessage("StoreKit Init Succeeded", "Available products count: " + IOSInAppPurchaseManager.instance.products.Count.ToString());
     }
     else
     {
         IOSNativePopUpManager.showMessage("StoreKit Init Failed", "Error code: " + result.error.code + "\n" + "Error description:" + result.error.description);
     }
 }
Exemplo n.º 18
0
 private static void OnRestoreComplete(IOSStoreKitRestoreResponce res)
 {
     if (res.IsSucceeded)
     {
         IOSNativePopUpManager.showMessage("Success", "Restore Compleated");
     }
     else
     {
         IOSNativePopUpManager.showMessage("Error: " + res.error.code, res.error.description);
     }
 }
Exemplo n.º 19
0
 private void OnMailResult(SA.Common.Models.Result result)
 {
     if (result.IsSucceeded)
     {
         IOSNativePopUpManager.showMessage("Posting example", "Mail Sent");
     }
     else
     {
         IOSNativePopUpManager.showMessage("Posting example", "Mail Failed :(");
     }
 }
Exemplo n.º 20
0
 private static void OnRestoreComplete(IOSStoreKitRestoreResult res)
 {
     if (res.IsSucceeded)
     {
         IOSNativePopUpManager.showMessage("Success", "Restore Compleated");
     }
     else
     {
         IOSNativePopUpManager.showMessage("Error: ", "Restore Failed");
     }
 }
 void HandleActionMatchStarted(GK_RTM_MatchStartedResult result)
 {
     if (result.IsSucceeded)
     {
         CheckMatchState(result.Match);
     }
     else
     {
         IOSNativePopUpManager.showMessage("Match Start Error", result.Error.Message);
     }
 }
Exemplo n.º 22
0
 void HandleOnFacebookPostResult(SA.Common.Models.Result res)
 {
     if (res.IsSucceeded)
     {
         IOSNativePopUpManager.showMessage("Posting example", "Post Success!");
     }
     else
     {
         IOSNativePopUpManager.showMessage("Posting example", "Post Failed :(");
     }
 }
Exemplo n.º 23
0
    //--------------------------------------
    //  GET/SET
    //--------------------------------------

    //--------------------------------------
    //  EVENTS
    //--------------------------------------



    private void OnCloundInitAction(SA.Common.Models.Result result)
    {
        if (result.IsSucceeded)
        {
            IOSNativePopUpManager.showMessage("iCloud", "Initialization Success!");
        }
        else
        {
            IOSNativePopUpManager.showMessage("iCloud", "Initialization Failed!");
        }
    }
Exemplo n.º 24
0
 void OnAuthFinished(ISN_Result res)
 {
     if (res.IsSucceeded)
     {
         IOSNativePopUpManager.showMessage("Player Authed ", "ID: " + GameCenterManager.player.playerId + "\n" + "Alias: " + GameCenterManager.player.alias);
     }
     else
     {
         IOSNativePopUpManager.showMessage("Game Cneter ", "Player auntification failed");
     }
 }
Exemplo n.º 25
0
 private void OnCloudDataReceivedAction(iCloudData data)
 {
     if (data.IsEmpty)
     {
         IOSNativePopUpManager.showMessage(data.Key, "data is empty");
     }
     else
     {
         IOSNativePopUpManager.showMessage(data.Key, data.StringValue);
     }
 }
Exemplo n.º 26
0
    private void OnGCDataReceived(CEvent e)
    {
#if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE
        GameCenterDataPackage package = e.data as GameCenterDataPackage;

        System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
        string str = enc.GetString(package.buffer);

        IOSNativePopUpManager.showMessage("Data received", "player ID: " + package.playerID + " \n " + "data: " + str);
#endif
    }
Exemplo n.º 27
0
 private void OnMailResult(ISN_Result result)
 {
     if (result.IsSucceeded)
     {
         IOSNativePopUpManager.showMessage("Positng example", "Mail Sended");
     }
     else
     {
         IOSNativePopUpManager.showMessage("Positng example", "Mail Failed :(");
     }
 }
Exemplo n.º 28
0
 void HandleOnTwitterPostResult(ISN_Result res)
 {
     if (res.IsSucceeded)
     {
         IOSNativePopUpManager.showMessage("Posting example", "Post Success!");
     }
     else
     {
         IOSNativePopUpManager.showMessage("Posting example", "Post Failed :(");
     }
 }
 void HandleOnAuthFinished(SA.Common.Models.Result result)
 {
     if (result.IsSucceeded)
     {
         ISN_Logger.Log("Player Authed");
     }
     else
     {
         IOSNativePopUpManager.showMessage("Game Center ", "Player authentication failed");
     }
 }
Exemplo n.º 30
0
 private void OnAuthFinished(ISN_Result res)
 {
     if (res.IsSucceeded)
     {
         IOSNativePopUpManager.showMessage("Player Authed ", "ID: " + GameCenterManager.Player.Id + "\n" + "Name: " + GameCenterManager.Player.DisplayName);
     }
     else
     {
         IOSNativePopUpManager.showMessage("Game Center ", "Player authentication failed");
     }
 }