Exemple #1
0
    static public void zhuanpanOK(uint[] items)
    {
        int cost = 0;

        if (items.Length == 1)
        {
            GlobalValue.Get(Constant.C_ZhuanPanOneGo, out cost);
        }
        else
        {
            GlobalValue.Get(Constant.C_ZhuanPanTenGo, out cost);
        }
        for (int i = 0; i < items.Length; ++i)
        {
            CommonEvent.ExcutePurchase((int)items[i], 1, cost / items.Length);
        }
        itemsList.Clear();
        itemsList.AddRange(items);
        if (Gozhuanpan != null)
        {
            Gozhuanpan(items);
        }
    }
Exemple #2
0
    void OnBuy(ButtonScript obj, object args, int param1, int param2)
    {
        if (crtSelectSellItem_ == null)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("NoGoodSelected"), PopText.WarningType.WT_Warning);
            return;
        }

        string name   = "";
        bool   isItem = false;

        if (crtSelectSellItem_.item_.itemId_ != 0)
        {
            name   = ItemData.GetData((int)crtSelectSellItem_.item_.itemId_).name_;
            isItem = true;
        }
        else
        {
            name = BabyData.GetData(crtSelectSellItem_.baby_.tableId_)._Name;
        }

        //超级会员才能买
        if (GamePlayer.Instance.vipLevel_ != 2)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("superVIPCanBuy"), PopText.WarningType.WT_Warning);
            return;
        }

        if (GamePlayer.Instance.GetIprop(PropertyType.PT_Diamond) < crtSelectSellItem_.sellPrice)
        {
            if (GamePlayer.Instance.Properties[(int)PropertyType.PT_MagicCurrency] < crtSelectSellItem_.sellPrice)
            {
                PopText.Instance.Show(LanguageManager.instance.GetValue("NoMoreDiamond"), PopText.WarningType.WT_Warning);
            }
            else
            {
                MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("xiaohaotimoli").Replace("{n}", crtSelectSellItem_.sellPrice.ToString()), delegate
                {
                    if (BagSystem.instance.BagIsFull() && isItem)
                    {
                        PopText.Instance.Show(LanguageManager.instance.GetValue("EN_BagFull"), PopText.WarningType.WT_Warning);
                        return;
                    }

                    NetConnection.Instance.buy(crtSelectSellItem_.guid_);
                    NetConnection.Instance.fetchSelling(searchContext_);
                    if (crtSelectSellItem_.item_ != null)
                    {
                        CommonEvent.ExcutePurchase((int)crtSelectSellItem_.item_.itemId_, (int)crtSelectSellItem_.item_.stack_, crtSelectSellItem_.sellPrice);
                    }
                });
            }
            return;
        }

        if (BagSystem.instance.BagIsFull() && isItem)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("EN_BagFull"), PopText.WarningType.WT_Warning);
            return;
        }

        MessageBoxUI.ShowMe(string.Format(LanguageManager.instance.GetValue("CostDiamondTip"), crtSelectSellItem_.sellPrice, name), () =>
        {
            NetConnection.Instance.buy(crtSelectSellItem_.guid_);
            NetConnection.Instance.fetchSelling(searchContext_);
            if (crtSelectSellItem_.item_ != null)
            {
                CommonEvent.ExcutePurchase((int)crtSelectSellItem_.item_.itemId_, (int)crtSelectSellItem_.item_.stack_, crtSelectSellItem_.sellPrice);
            }
        });
    }
Exemple #3
0
    void OnClicketermine(ButtonScript obj, object args, int param1, int param2)
    {
        //if(GamePlayer.Instance.GetIprop(PropertyType.PT_BagNum) <= BagSystem.instance.GetBagSize())
        //{
        //ErrorTipsUI.ShowMe(LanguageManager.instance.GetValue("bagfull"));
        //PopText.Instance.Show(LanguageManager.instance.GetValue("bagfull"));
        //return;
        //}
        string type = "";

        if (spData_._ShopPayType == ShopPayType.SPT_Diamond)
        {
            type = LanguageManager.instance.GetValue("zuanshi");
        }
        else if (spData_._ShopPayType == ShopPayType.SPT_Gold)
        {
            type = LanguageManager.instance.GetValue("jinbi");
        }
        else if (spData_._ShopPayType == ShopPayType.SPT_MagicCurrency)
        {
            type = LanguageManager.instance.GetValue("shuijing");
        }



        if (IsBalanceInadequate(SpData, count) == 1)
        {
            if (GamePlayer.Instance.GetIprop(PropertyType.PT_MagicCurrency) >= (count * SpData._Price))
            {
                MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("xiaohaotimoli").Replace("{n}", (count * SpData._Price).ToString()), () => {
                    NetConnection.Instance.shopBuyItem(SpData._Id, count);
                    gameObject.SetActive(false);
                });
            }
            else
            {
                PopText.Instance.Show(LanguageManager.instance.GetValue("zuanshibuzu"));
            }
        }
        else if (IsBalanceInadequate(SpData, count) == 2)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("jinbibuzu"));
        }
        else if (IsBalanceInadequate(SpData, count) == 3)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("noshuijing"));
        }
        else if (IsReachedNumber())
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("goumaicishu"));
        }
        else
        {
            MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("shopbuyitem").Replace("{n}", (count).ToString()).Replace("{n1}", SpData._Name).Replace("{n2}", (count * SpData._Price).ToString() + type), () => {
                NetConnection.Instance.shopBuyItem(SpData._Id, count);
                if (type.Equals(LanguageManager.instance.GetValue("zuanshi")))
                {
                    CommonEvent.ExcutePurchase(spData_._Itemid, count, spData_._Price);
                }

                gameObject.SetActive(false);
            });
        }
    }