public static RESULT Buy(int index, PBConnect_buyShopItem.DelegateConnectCallback callback)
    {
        RESULT r = Check(index);

        if (r != RESULT.OK)
        {
            return(r);
        }

        Assert.assert(_callback == null);
        _callback = callback;

        BuyShopItemRequest request = new BuyShopItemRequest();

        request.api = (new Model_ApiRequest()).api;

        ShopItem item = InstancePlayer.instance.model_User.model_shop.GetItem(index);

        request.posId = item.posId;

        request.shopId = (int)InstancePlayer.instance.model_User.model_shop.shopType;

        (new PBConnect_buyShopItem()).Send(request, OnBuy);

        return(r);
    }
 private static void OnSyncUser(bool success, System.Object content)
 {
     if (success)
     {
         PBConnect_buyShopItem.DelegateConnectCallback cb = _callback;
         _callback = null;
         cb(success, content);
     }
     else
     {
         PBConnect_buyShopItem.DelegateConnectCallback cb = _callback;
         _callback = null;
         cb(success, content);
     }
 }
    private static void OnBuy(bool success, System.Object content)
    {
        if (success)
        {
            SyncRequest request = new SyncRequest();
            request.api = new Model_ApiRequest().api;

            PBConnect_sync.FillSyncRequest(dropPrizeItems, request);

            (new PBConnect_sync()).Send(request, OnSyncUser);
        }
        else
        {
            PBConnect_buyShopItem.DelegateConnectCallback cb = _callback;
            _callback = null;
            cb(success, content);
        }
    }