阅读背景:

cocos2d Sprite类型:ImageView替换新的图片资源_jiangzuwei_love的博客_cocos2d image

来源:互联网 
-- 把所有图片添加进一个列表中
-- 为0时使用的图片
local tabImageType = 
{
    "shop/shop_sp_goldlarge_1.png", 
    "shop/shop_sp_goldlarge_2.png", 
    "shop/shop_sp_goldlarge_3.png", 
    "shop/shop_sp_goldlarge_4.png",
    "shop/shop_sp_goldlarge_5.png", 
    "shop/shop_sp_goldlarge_6.png", 
}

-- 为1时使用的图片
local tabGoldImageType = 
{
    "shop/shop_sp_goldlarge_1.png", 
    "shop/shop_sp_goldlarge_2.png", 
    "shop/shop_sp_goldlarge_3.png", 
    "shop/shop_sp_goldlarge_4.png",
    "shop/shop_sp_goldlarge_5.png", 
    "shop/shop_sp_goldlarge_6.png", 
    "shop/shop_sp_goldlarge_7.png", 
    "shop/shop_sp_goldlarge_8.png"
}

-- 根据ID来选择相对于图片,没有则选第一张
local imagetype = iteminfo["SortID"] or 1

 imagefile = tabImageType[imagetype]


-- 图片       
if nil ~= imagefile and cc.FileUtils:getInstance():isFileExist(imagefile) then
            csb:getChildByName("sp_image"):setSpriteFrame(cc.Sprite:create(imagefile):getSpriteFrame())
        end

-- 把所有图片添加进一个列表中
-- 为0时使用的图片
local tabImageType



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: