/// <summary>
    /// 设置回购数据
    /// </summary>
    /// <param name="sellBackVO"></param>
    /// <param name="isList">是否列表模式</param>
    public void SetData(ShopSellBackVO sellBackVO, bool isList)
    {
        Init();
        m_SellBackVO    = sellBackVO;
        m_Quality.color = ColorUtil.GetColorByItemQuality(sellBackVO.ItemConfig.Quality);
        if (isList)
        {
            UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle((uint)m_SellBackVO.Tid), TableUtil.GetItemIconImage((uint)m_SellBackVO.Tid));
            UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle((uint)m_SellBackVO.Tid), TableUtil.GetItemIconImage((uint)m_SellBackVO.Tid));
        }
        else
        {
            UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle((uint)m_SellBackVO.Tid), TableUtil.GetItemSquareIconImage((uint)m_SellBackVO.Tid));
            UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle((uint)m_SellBackVO.Tid), TableUtil.GetItemSquareIconImage((uint)m_SellBackVO.Tid));
        }
        m_Num.text = sellBackVO.Num.ToString();
        UIUtil.SetIconImage(m_MoneyIcon, TableUtil.GetItemIconBundle((uint)sellBackVO.ItemConfig.SellCurrency), TableUtil.GetItemIconImage((uint)sellBackVO.ItemConfig.SellCurrency));
        m_Price.text = sellBackVO.ItemConfig.BuybackPrice.ToString();
        m_Name.text  = TableUtil.GetItemName((uint)m_SellBackVO.Tid);
        m_Level.text = TableUtil.ShowLevel(1);


        if (MoneyeEnough())
        {
            m_Price.color = new Color(30f / 255f, 170f / 255f, 33f / 255f, 1);
        }
        else
        {
            m_Price.color = Color.red;
        }
    }
예제 #2
0
    /// <summary>
    /// 同步商店回购信息
    /// </summary>
    /// <param name="buf"></param>
    public void OnShopSellBackInfoSync(KProtoBuf buf)
    {
        GetShopProxy().ClearSellBack();
        S2C_SYNC_BUY_BACK msg = (S2C_SYNC_BUY_BACK)buf;

        for (int i = 0; i < msg.goods_saled_info.Count; i++)
        {
            GoodsSaledInfo info           = msg.goods_saled_info[i];
            ShopSellBackVO shopSellBackVO = new ShopSellBackVO();
            shopSellBackVO.Uid        = info.uid;
            shopSellBackVO.Tid        = info.item_id;
            shopSellBackVO.Num        = info.num;
            shopSellBackVO.ShopId     = info.shop_id;
            shopSellBackVO.ExpireTime = info.expire_time;
            shopSellBackVO.ItemConfig = GetCfgEternityProxy().GetItemByKey((uint)info.item_id);
            GetShopProxy().AddSellBackData(info.uid, shopSellBackVO);
        }
        GameFacade.Instance.SendNotification(NotificationName.MSG_SHOP_CHANGE);
    }
예제 #3
0
 /// <summary>
 /// 添加回购数据
 /// </summary>
 /// <param name="uid"></param>
 /// <param name="sellBackVO"></param>
 public void AddSellBackData(ulong uid, ShopSellBackVO sellBackVO)
 {
     m_SellBackData.Add(uid, sellBackVO);
 }
예제 #4
0
    protected override void OnCellRenderer(int groupIndex, int cellIndex, object cellData, RectTransform cellView, bool selected)
    {
        Animator m_Animator = cellView.GetComponent <Animator>();

        if (m_Animator)
        {
            m_Animator.SetBool("IsOn", selected);
        }
        UIViewListLayout style = State.GetPageLayoutStyle(State.GetPageIndex());

        if (State.GetPageIndex() == 0)
        {
            ShopWindowVO       m_ShopWindowVO    = (ShopWindowVO)cellData;
            NpcShopElementGrid m_ShopElementGrid = cellView.GetOrAddComponent <NpcShopElementGrid>();
            if (style == UIViewListLayout.Grid)
            {
                m_ShopElementGrid.SetData(m_ShopWindowVO, selected, false);
            }
            else
            {
                m_ShopElementGrid.SetData(m_ShopWindowVO, selected, true);
            }
            CountDownCompent m_CountDownCompent = cellView.GetOrAddComponent <CountDownCompent>();
            m_CountDownCompent.SetTime(m_ShopWindowVO.RefreshTime);
            if (selected)
            {
                if (m_ShopWindowVO.IsOpen == 0 ||
                    m_ShopWindowVO.ServerLeftNum == 0 ||
                    !m_ShopElementGrid.MoneyeEnough() ||
                    m_ShopWindowVO.LimitCount == 0 ||
                    m_ShopWindowVO.LimitCount < m_ShopWindowVO.ShopItemConfig.Value.Bounds && m_ShopWindowVO.LimitCount > 0)
                {
                    State.GetAction(UIAction.Shop_Buy).Enabled = false;
                }
                else
                {
                    State.GetAction(UIAction.Shop_Buy).Enabled = true;
                }
                m_OpenShopParameter             = new OpenShopParameter();
                m_OpenShopParameter.OperateType = 0;
                m_OpenShopParameter.Tid         = m_ShopWindowVO.Tid;
                m_OpenShopParameter.Id          = m_ShopWindowVO.Oid;
                m_OpenShopParameter.MoneyType   = m_ShopWindowVO.ShopItemConfig.Value.MoneyType;
                m_OpenShopParameter.Price       = m_ShopWindowVO.ShopItemConfig.Value.BuyCost * m_ShopWindowVO.ShopItemConfig.Value.DisCount;
                m_OpenShopParameter.LimitCount  = (int)m_ShopWindowVO.LimitCount;
                m_OpenShopParameter.Stock       = (int)m_ShopWindowVO.ServerLeftNum;
                m_OpenShopParameter.Bounds      = m_ShopWindowVO.ShopItemConfig.Value.Bounds;
                m_OpenShopParameter.Category    = ItemTypeUtil.GetItemType(m_ShopWindowVO.ShopItemConfig.Value.ItemGood.Value.Type).MainType;
            }
        }
        else if (State.GetPageIndex() == 1)
        {
            ItemBase m_PackageItem = (ItemBase)cellData;
            NpcShopSellElementGrid m_SellElementGrid = cellView.GetOrAddComponent <NpcShopSellElementGrid>();
            if (style == UIViewListLayout.Grid)
            {
                m_SellElementGrid.SetData(m_PackageItem, selected, false);
            }
            else
            {
                m_SellElementGrid.SetData(m_PackageItem, selected, true);
            }
            if (selected)
            {
                if (m_PackageItem.Replicas != null && m_PackageItem.Replicas.Count > 0)
                {
                    State.GetAction(UIAction.Shop_Sell).Enabled = false;
                }
                else if (m_PackageItem.MainType == Category.Expendable)
                {
                    State.GetAction(UIAction.Shop_Sell).Enabled = false;
                }
                else
                {
                    State.GetAction(UIAction.Shop_Sell).Enabled = true;
                }
                m_OpenShopParameter             = new OpenShopParameter();
                m_OpenShopParameter.OperateType = 1;
                m_OpenShopParameter.Tid         = m_PackageItem.TID;
                m_OpenShopParameter.Id          = m_PackageItem.UID;
                if (m_PackageItem.ItemConfig.SellCurrency == 1100004)
                {
                    m_OpenShopParameter.MoneyType = 1;
                }
                else
                {
                    m_OpenShopParameter.MoneyType = 2;
                }
                m_OpenShopParameter.Price      = (int)m_PackageItem.ItemConfig.MoneyPrice;
                m_OpenShopParameter.LimitCount = (int)m_PackageItem.Count;
                m_OpenShopParameter.Stock      = (int)m_PackageItem.Count;
                m_OpenShopParameter.Bounds     = 1;
                m_OpenShopParameter.Category   = m_PackageItem.MainType;
            }
        }
        else
        {
            ShopSellBackVO   m_SellBack         = (ShopSellBackVO)cellData;
            CountDownCompent m_CountDownCompent = cellView.GetOrAddComponent <CountDownCompent>();
            m_CountDownCompent.SetTime(m_SellBack.ExpireTime);
            NpcShopSellBackElementGrid m_SellElementGrid = cellView.GetOrAddComponent <NpcShopSellBackElementGrid>();
            if (style == UIViewListLayout.Grid)
            {
                m_SellElementGrid.SetData(m_SellBack, false);
            }
            else
            {
                m_SellElementGrid.SetData(m_SellBack, true);
            }
            if (selected)
            {
                if (!m_SellElementGrid.MoneyeEnough())
                {
                    State.GetAction(UIAction.Shop_Buy).Enabled = false;
                }
                else
                {
                    State.GetAction(UIAction.Shop_Buy).Enabled = true;
                }
                m_OpenShopParameter             = new OpenShopParameter();
                m_OpenShopParameter.OperateType = 2;
                m_OpenShopParameter.Tid         = (uint)m_SellBack.Tid;
                m_OpenShopParameter.Id          = m_SellBack.Uid;
                if (m_SellBack.ItemConfig.SellCurrency == 1100004)
                {
                    m_OpenShopParameter.MoneyType = 1;
                }
                else
                {
                    m_OpenShopParameter.MoneyType = 2;
                }
                m_OpenShopParameter.Price      = m_SellBack.ItemConfig.BuybackPrice;
                m_OpenShopParameter.LimitCount = (int)m_SellBack.Num;
                m_OpenShopParameter.Stock      = (int)m_SellBack.Num;
                m_OpenShopParameter.Bounds     = 1;
                m_OpenShopParameter.Category   = ItemTypeUtil.GetItemType(m_SellBack.ItemConfig.Type).MainType;
            }
        }
    }