예제 #1
0
    private bool CheckCanBuy()
    {
        if (ShopItemBase.SelectIndex == null || ShopItemBase.SelectIndex.Count == 0)
        {
            MsgInfoManager.Instance.ShowMsg((int)ERROR_TYPE.eT_NeedAItermID);
            return(false);
        }

        ShopSelectType type  = ShopItemBase.SelectIndex.ElementAt(0).Key;
        int            index = ShopItemBase.SelectIndex.ElementAt(0).Value;

        if (type == ShopSelectType.TypeUser)
        {
            UserPackageItem pack = (UserPackageItem)ShopItemAll[ShopSelectType.TypeUser];

            int count = 0, item = -1;
            PlayerManager.Instance.LocalPlayer.UserGameItemsCount.TryGetValue(index, out count);
            PlayerManager.Instance.LocalPlayer.UserGameItems.TryGetValue(index, out item);
            if (count == 0 || !ConfigReader.ItemXmlInfoDict.ContainsKey(item))
            {
                MsgInfoManager.Instance.ShowMsg((int)ERROR_TYPE.eT_NeedAItermID);
                return(false);
            }
        }
        return(true);
    }
예제 #2
0
    /// <summary>
    /// 出售物品
    /// </summary>
    /// <param name="item"></param>
    public void OnUserSellItem()
    {
        bool            isEmpty = true;
        UserPackageItem pack    = (UserPackageItem)ShopItemAll[ShopSelectType.TypeUser];

        foreach (var itemCount in PlayerManager.Instance.LocalPlayer.UserGameItemsCount.Values)
        {
            if (itemCount != 0)
            {
                isEmpty = false;
                break;
            }
        }

        if (isEmpty)
        {
            MsgInfoManager.Instance.ShowMsg((int)ERROR_TYPE.eT_BagIsEmpty);
            pack.SelectSelfCloseOtherSelect(pack, -1);
            return;//如果道具个数为空
        }

        if (ShopItemBase.SelectIndex == null || ShopItemBase.SelectIndex.Count == 0)
        {
            MsgInfoManager.Instance.ShowMsg((int)ERROR_TYPE.eT_NeedABagID);
            return;
        }

        ShopSelectType type  = ShopItemBase.SelectIndex.ElementAt(0).Key;
        int            index = ShopItemBase.SelectIndex.ElementAt(0).Value;

        if (type != ShopSelectType.TypeUser)
        {
            MsgInfoManager.Instance.ShowMsg((int)ERROR_TYPE.eT_NeedABagID);
            //GameMethod.DebugError("aaaaa");
            return;
        }
        int count = 0, item = -1;

        PlayerManager.Instance.LocalPlayer.UserGameItemsCount.TryGetValue(index, out count);
        PlayerManager.Instance.LocalPlayer.UserGameItems.TryGetValue(index, out item);
        if (count != 0 && ConfigReader.ItemXmlInfoDict.ContainsKey(item))
        {
            HolyGameLogic.Instance.EmsgToss_AskSellGoods(index);
        }
        else
        {
            MsgInfoManager.Instance.ShowMsg((int)ERROR_TYPE.eT_NeedABagID);
            ShopItemBase.SelectIndex.Clear();
        }
    }