|
- ---
- -- ================================================================
- -- 文件名: IGameCommon.lua
- -- 描述: 子游戏引用大厅接口
- -- 作者: Administrator
- -- 创建日期: 2020-2-18
- -- 更新日期: 2020-2-18
- -- 备注:
- -- ================================================================
- --
- local IGameCommon = {};
-
- --[[
- 获取分享的二维码图片
- ]]
- function IGameCommon.getShareCRCodeTexture(callback)
- local clientConfig = app.serverConfigs.clientConfig
- local crCodeUrl = clientConfig and clientConfig.qrcode or ""
- if crCodeUrl == "" then
- showTooltip("未配置二维码地址")
- return
- end
- --download
- local urlfile = convertIconUrl(crCodeUrl)
- local fileName = getImageNameFromUrl(urlfile)
- local fullPath = cc.FileUtils:getInstance():getWritablePath()..fileName;
- local isExist = cc.FileSystem:fileExists(fullPath)
- if not isExist then
- getImageFromUrlWithTime(crCodeUrl, fileName, nil, function()
- local texture = loadTextureFromFile(fileName)
- if not texture then
- logD("IGameCommon getShareCRCodeTexture not found")
- return
- end
- if callback then
- callback(texture)
- end
- end)
- else
- local texture = loadTextureFromFile(fileName)
- if not texture then
- logD("IGameCommon getShareCRCodeTexture not found")
- return
- end
- if callback then
- callback(texture)
- end
- end
- end
-
- return IGameCommon;
|