public static ShopDataScript getInstance()
    {
        if (s_shopData == null)
        {
            s_shopData = new ShopDataScript();
        }

        return(s_shopData);
    }
    public void setGoodsId(int goods_id)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("BuyGoodsPanelScript_hotfix", "setGoodsId"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.BuyGoodsPanelScript_hotfix", "setGoodsId", null, goods_id);
            return;
        }

        m_shopData = ShopDataScript.getInstance().getShopDataById(goods_id);

        if (m_shopData != null)
        {
            m_text_goods_name.text = m_shopData.goods_name;

            m_text_goods_num.text = m_goods_num.ToString();

            List <string> list_str = new List <string>();
            CommonUtil.splitStr(m_shopData.props, list_str, ':');
            int prop_id = int.Parse(list_str[0]);

            // 道具图标
            {
                CommonUtil.setImageSprite(m_text_goods_icon, GameUtil.getPropIconPath(prop_id));
            }

            // 道具描述
            {
                if ((prop_id != 1) && (prop_id != 2))
                {
                    PropInfo propInfo = PropData.getInstance().getPropInfoById(prop_id);
                    if (propInfo != null)
                    {
                        m_text_goods_desc.text = propInfo.m_desc;
                    }
                }
            }

            refreshPrice();

            if (m_shopData.goods_type != 3)
            {
                m_buyCount.transform.localScale = new Vector3(0, 0, 0);

                m_text_shiduyule.transform.localScale = new Vector3(1, 1, 1);
            }
            else
            {
                m_text_shiduyule.transform.localScale = new Vector3(0, 0, 0);
            }
        }
    }
Пример #3
0
    public override void OnResponse(string data)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("GetShopRequest_hotfix", "OnResponse"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.GetShopRequest_hotfix", "OnResponse", null, data);
            return;
        }

        JsonData jsonData = JsonMapper.ToObject(data);

        ShopDataScript.getInstance().initJson(data);
        result = data;
        flag   = true;
    }
    public void onReceive_GetShop(string data)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("ShopPanelScript_hotfix", "onReceive_GetShop"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.ShopPanelScript_hotfix", "onReceive_GetShop", null, data);
            return;
        }

        ShopDataScript.getInstance().initJson(data);
        shopDataList = ShopDataScript.getInstance().getShopDataList();
        //去除1005;
        for (int i = 0; i < shopDataList.Count; i++)
        {
            ShopData shopData = shopDataList[i];
            if (shopData.goods_id == 1005)
            {
                shopDataList.Remove(shopData);
            }
        }

        Init();
    }