Пример #1
0
    /// <summary>
    /// 商品を購入した
    /// </summary>
    /// <param name="PurchaseEvent">購入イベント情報</param>
    public override void OnPurchaseProduct(PurchaseEventArgs PurchaseEvent)
    {
        PurchaseInfo Info = JsonUtility.FromJson <PurchaseInfo>(PurchaseEvent.purchasedProduct.receipt);

        Debug.Log("Store:" + Info.Store);
        Debug.Log("Payload:" + Info.Payload);

        switch (PurchaseEvent.purchasedProduct.definition.id)
        {
        case ProductIDs.AddMoneyItem:

            StartCoroutine(APICall.VerifyAddGoldPurchase(Info, (Result) =>
            {
                if (!Result.success)
                {
                    Debug.LogError("Verify Error...");
                    SimpleDialog.Show("購入エラー");
                    return;
                }
                UserData.Instance.Gold = Result.gold;
                StoreController.ConfirmPendingPurchase(StoreController.products.WithID(ProductIDs.AddMoneyItem));
                SimpleDialog.Show("購入しました。");
            }));
            break;
        }
    }
Пример #2
0
    //------------------------------- DIALOG LAUNCHING ---------------------------------
    //
    //    Before invoking this application one needs to open any part/empty part in NX
    //    because of the behavior of the blocks.
    //
    //    Make sure the dlx file is in one of the following locations:
    //        1.) From where NX session is launched
    //        2.) $UGII_USER_DIR/application
    //        3.) For released applications, using UGII_CUSTOM_DIRECTORY_FILE is highly
    //            recommended. This variable is set to a full directory path to a file
    //            containing a list of root directories for all custom applications.
    //            e.g., UGII_CUSTOM_DIRECTORY_FILE=$UGII_BASE_DIR\ugii\menus\custom_dirs.dat
    //
    //    You can create the dialog using one of the following way:
    //
    //    1. Journal Replay
    //
    //        1) Replay this file through Tool->Journal->Play Menu.
    //
    //    2. USER EXIT
    //
    //        1) Create the Shared Library -- Refer "Block UI Styler programmer's guide"
    //        2) Invoke the Shared Library through File->Execute->NX Open menu.
    //
    //------------------------------------------------------------------------------
    public static void Main()
    {
        SimpleDialog theSimpleDialog = null;

        try
        {
            theSimpleDialog = new SimpleDialog();
            // The following method shows the dialog immediately
            theSimpleDialog.Show();
        }
        catch (Exception ex)
        {
            //---- Enter your exception handling code here -----
            theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
        }
        finally
        {
            if (theSimpleDialog != null)
            {
                theSimpleDialog.Dispose();
            }
            theSimpleDialog = null;
        }
    }
 public void OnInitializeFailed(InitializationFailureReason error)
 {
     SimpleDialog.Show("ストアの初期化に失敗しました。\nReasion:" + error.ToString());
     Debug.LogError("Store Initialize Failed.");
     Debug.LogError("Reason:" + error.ToString());
 }
 private void openSimpleDialog(object sender, EventArgs e)
 {
     SimpleDialog.Show();
 }