Example #1
0
    public RandomShopInfo(ScRandomShopInfo info)
    {
        shopId   = info.shopId;
        type     = 2;
        isRandom = true;

        var msg = Module_Shop.instance.GetTargetShop(info.shopId);

        if (msg != null)
        {
            icon = msg.icon;
            pos  = msg.pos;
            name = msg.name;
        }
        refreshCount    = info.refreshCount;
        refreshCurrency = info.refreshCurrencyType;
        refreshNum      = info.refreshCurrencyNum;
        nextRefreshTime = info.nextRefreshTimeSec;
        items           = info.itemList;
    }
Example #2
0
    /// <summary>
    /// 刷新随机商店
    /// </summary>
    /// <param name="p"></param>
    void _Packet(ScRandomShopInfo p)
    {
        if (p == null)
        {
            return;
        }

        ScRandomShopInfo info = null;

        p.CopyTo(ref info);

        var msg = (ShopMessage)info;

        if (msg == null)
        {
            return;
        }

        foreach (var item in m_allShops)
        {
            var idx = item.Value.FindIndex(o => o.shopId == info.shopId);
            if (idx > -1)
            {
                item.Value[idx] = msg;
            }
        }

        //记录刷新时间
        if (m_receiveTime.ContainsKey(msg.shopId))
        {
            m_receiveTime[msg.shopId] = Time.realtimeSinceStartup;
        }
        else
        {
            m_receiveTime.Add(msg.shopId, Time.realtimeSinceStartup);
        }

        SetCurrentShop(msg);
    }