Пример #1
0
 private void UpdateMoneys()
 {
     if (m_Money1 && m_Money1.Label)
     {
         m_Money1.Label.text = CurrencyUtil.GetRechargeCurrencyCount().ToString();
     }
     if (m_Money2 && m_Money2.Label)
     {
         m_Money2.Label.text = CurrencyUtil.GetGameCurrencyCount().ToString();
     }
 }
Пример #2
0
    /// <summary>
    /// 通过金币判断是否可以加速
    /// </summary>
    /// <param name="id">蓝图ID</param>
    /// <returns></returns>
    public bool BeSpeedUpByMoney(int id)
    {
        long needCout = GetNeedGlod(id);
        long gold     = CurrencyUtil.GetRechargeCurrencyCount();

        if (gold < needCout)
        {
            return(false);
        }
        return(true);
    }
Пример #3
0
    /// <summary>
    /// 货币是否充足
    /// </summary>
    /// <param name="MoneyType"></param>
    /// <returns></returns>
    public bool MoneyeEnough()
    {
        long m_OwnMoney = 0;

        if (m_ShopItemData.MoneyType == 1)
        {
            m_OwnMoney = CurrencyUtil.GetGameCurrencyCount();
        }
        else if (m_ShopItemData.MoneyType == 2)
        {
            m_OwnMoney = CurrencyUtil.GetRechargeCurrencyCount();
        }
        if (m_GoodPrice <= m_OwnMoney)
        {
            return(true);
        }
        return(false);
    }
    /// <summary>
    /// 货币是否充足
    /// </summary>
    /// <returns></returns>
    public bool MoneyeEnough()
    {
        long m_OwnMoney = 0;

        if (m_SellBackVO.ItemConfig.SellCurrency == 1100004)
        {
            m_OwnMoney = CurrencyUtil.GetGameCurrencyCount();
        }
        else if (m_SellBackVO.ItemConfig.SellCurrency == 1000001)
        {
            m_OwnMoney = CurrencyUtil.GetRechargeCurrencyCount();
        }
        if (m_SellBackVO.ItemConfig.BuybackPrice <= m_OwnMoney)
        {
            return(true);
        }
        return(false);
    }
Пример #5
0
    public override void OnShow(object msg)
    {
        base.OnShow(msg);
        if (msg != null)
        {
            m_ShopParameter = (OpenShopParameter)msg;
        }
        m_ItemConfig = m_CfgEternityProxy.GetItemByKey(m_ShopParameter.Tid);
        m_Bounds     = m_ShopParameter.Bounds;
        if (m_ShopParameter.MoneyType == 1)
        {
            m_Money = (int)CurrencyUtil.GetGameCurrencyCount();
        }
        else
        {
            m_Money = (int)CurrencyUtil.GetRechargeCurrencyCount();
        }
        if (m_ShopParameter.OperateType == 1)
        {
            m_Max = m_ShopParameter.LimitCount;
        }
        else
        {
            GetGoodMax();
            if (m_Max == 0)
            {
                m_Min = 0;
            }
        }
        m_GoodName.text  = TableUtil.GetItemName(m_ShopParameter.Tid);
        m_GoodName.color = ColorUtil.GetColorByItemQuality(m_ItemConfig.Quality);
        UIUtil.SetIconImage(m_MoneyIcon, TableUtil.GetItemIconBundle((KNumMoneyType)m_ShopParameter.MoneyType), TableUtil.GetItemIconImage((KNumMoneyType)m_ShopParameter.MoneyType));
        m_InputBox.onValueChanged.RemoveAllListeners();
        m_CurrentNum      = m_Bounds;
        m_InputBox.text   = m_Bounds.ToString();
        m_TotalPrice.text = Mathf.CeilToInt(m_CurrentNum * (m_ShopParameter.Price / m_ShopParameter.Bounds)).ToString();

        m_InputBox.onValueChanged.AddListener((str) =>
        {
            if (str.Length > 0)
            {
                m_CurrentNum = int.Parse(str);
                if (m_CurrentNum < m_Min)
                {
                    m_CurrentNum = m_Min;
                }
                else if (m_CurrentNum > m_Max)
                {
                    m_CurrentNum = m_Max;
                }
                m_InputBox.text = m_CurrentNum.ToString();
                m_BtnLeft.GetComponent <Button>().interactable  = m_CurrentNum > m_Bounds;
                m_BtnRight.GetComponent <Button>().interactable = m_CurrentNum < m_Max;
                SetHotKeyEnabled("left", m_CurrentNum > m_Bounds);
                SetHotKeyEnabled("Right", m_CurrentNum < m_Max);
                int m_Price       = Mathf.CeilToInt(m_CurrentNum * (m_ShopParameter.Price / m_ShopParameter.Bounds));
                m_TotalPrice.text = m_Price.ToString();
                if (m_ShopParameter.OperateType != 1)
                {
                    SetHotKeyEnabled("confirm", m_Money >= m_Price && m_CurrentNum > 0);
                }
                else
                {
                    SetHotKeyEnabled("confirm", true);
                }
            }
            else
            {
                m_CurrentNum      = 0;
                int m_Price       = 0;
                m_TotalPrice.text = m_Price.ToString();
                SetHotKeyEnabled("confirm", false);
            }
        });
        UIEventListener.UIEventListener.AttachListener(m_BtnLeft).onDown  = OnLeftDonw;
        UIEventListener.UIEventListener.AttachListener(m_BtnLeft).onUp    = OnUp;
        UIEventListener.UIEventListener.AttachListener(m_BtnRight).onDown = OnRightDown;
        UIEventListener.UIEventListener.AttachListener(m_BtnRight).onUp   = OnUp;
    }