整理
This commit is contained in:
parent
8548033f82
commit
4727b573f1
@ -2,12 +2,4 @@ local VersionCompatible = {}
|
|||||||
|
|
||||||
local CLIENT_VERSION = CS.BF.BFMain.CLIENT_VERSION or 0
|
local CLIENT_VERSION = CS.BF.BFMain.CLIENT_VERSION or 0
|
||||||
|
|
||||||
function VersionCompatible:canUpdateMailVersion()
|
|
||||||
return CLIENT_VERSION > 1
|
|
||||||
end
|
|
||||||
|
|
||||||
function VersionCompatible:supportDataEncryptVersion()
|
|
||||||
return CLIENT_VERSION > 1
|
|
||||||
end
|
|
||||||
|
|
||||||
return VersionCompatible
|
return VersionCompatible
|
||||||
|
|||||||
@ -380,28 +380,6 @@ function GFunc.getPerByW3(ratio)
|
|||||||
return ratio*0.0001
|
return ratio*0.0001
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function GFunc.getRoundingNumByW(num)
|
|
||||||
-- if num <= 0 then
|
|
||||||
-- return 0
|
|
||||||
-- end
|
|
||||||
-- if num < 10000 then
|
|
||||||
-- return GFunc.getRoundingNumByW(num*100) // 100
|
|
||||||
-- end
|
|
||||||
-- local remainder = num%10000
|
|
||||||
-- if remainder < 5000 then
|
|
||||||
-- return num - remainder
|
|
||||||
-- elseif remainder > 5000 then
|
|
||||||
-- return num - remainder + 10000
|
|
||||||
-- else
|
|
||||||
-- local integer = (num - remainder)*0.0001
|
|
||||||
-- if integer%2 == 0 then
|
|
||||||
-- return num - remainder
|
|
||||||
-- else
|
|
||||||
-- return num - remainder + 10000
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
|
|
||||||
function GFunc.getPerStr(key, str)
|
function GFunc.getPerStr(key, str)
|
||||||
if key == GConst.BattleConst.BUFF_NAME.ATKP_ADD or
|
if key == GConst.BattleConst.BUFF_NAME.ATKP_ADD or
|
||||||
key == GConst.BattleConst.BUFF_NAME.ATKP_COLOR_ADD or
|
key == GConst.BattleConst.BUFF_NAME.ATKP_COLOR_ADD or
|
||||||
@ -600,17 +578,9 @@ function GFunc.showItemNotEnough(itemId)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function GFunc.showJewelryNotEnough(itemId)
|
|
||||||
local gemTextInfo = I18N:getConfig("jewelry")[itemId]
|
|
||||||
if gemTextInfo then
|
|
||||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ITEM_NOT_ENOUGH, gemTextInfo.name))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function GFunc.checkCost(id, num, showToast, giftType)
|
function GFunc.checkCost(id, num, showToast, giftType)
|
||||||
if num <= 0 then
|
if num <= 0 then
|
||||||
-- BIReport:postDataException(id, num, giftType)
|
return false
|
||||||
-- return false
|
|
||||||
end
|
end
|
||||||
local count = DataManager.BagData.ItemData:getItemNumById(id)
|
local count = DataManager.BagData.ItemData:getItemNumById(id)
|
||||||
if count < num then
|
if count < num then
|
||||||
@ -623,14 +593,6 @@ function GFunc.checkCost(id, num, showToast, giftType)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function GFunc.checkCostNum(id, num, giftType)
|
|
||||||
if num <= 0 then
|
|
||||||
-- BIReport:postDataException(id, num, giftType)
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
---- 获得奖励的统一接口
|
---- 获得奖励的统一接口
|
||||||
function GFunc.addRewards(rewards, itemGetType)
|
function GFunc.addRewards(rewards, itemGetType)
|
||||||
if rewards == nil then
|
if rewards == nil then
|
||||||
@ -959,39 +921,27 @@ function GFunc.miningTipsMovePosY(obj, delay,callBack)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function GFunc.dataEncrypt(data)
|
function GFunc.dataEncrypt(data)
|
||||||
if not VersionCompatible:supportDataEncryptVersion() then
|
|
||||||
return data
|
|
||||||
end
|
|
||||||
local numStr = CS.Security.XXTEA.Encrypt(tostring(data), GConst.SECRET_KEY)
|
local numStr = CS.Security.XXTEA.Encrypt(tostring(data), GConst.SECRET_KEY)
|
||||||
return numStr
|
return numStr
|
||||||
end
|
end
|
||||||
|
|
||||||
function GFunc.dataDecrypt(data)
|
function GFunc.dataDecrypt(data)
|
||||||
if not VersionCompatible:supportDataEncryptVersion() then
|
|
||||||
return data
|
|
||||||
end
|
|
||||||
local numStr = CS.Security.XXTEA.Decrypt(data, GConst.SECRET_KEY)
|
local numStr = CS.Security.XXTEA.Decrypt(data, GConst.SECRET_KEY)
|
||||||
return tonumber(numStr)
|
return tonumber(numStr)
|
||||||
end
|
end
|
||||||
|
|
||||||
function GFunc.getTickCount()
|
function GFunc.getTickCount()
|
||||||
if not VersionCompatible:supportDataEncryptVersion() then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
return math.floor(UnityTime.realtimeSinceStartup)
|
return math.floor(UnityTime.realtimeSinceStartup)
|
||||||
end
|
end
|
||||||
|
|
||||||
function GFunc.IsGotServerTime()
|
function GFunc.IsGotServerTime()
|
||||||
if not VersionCompatible:supportDataEncryptVersion() then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
if not CS.BF.BFMain.IsGotServerTime then
|
if not CS.BF.BFMain.IsGotServerTime then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
---得到展示奖励的图集名称,图片资源id
|
---得到展示奖励的图集名称,图片资源id
|
||||||
function GFunc.getFrameRes(type, id)
|
function GFunc.getFrameRes(type, id)
|
||||||
if type == GConst.REWARD_TYPE.REWARD_NONE then
|
if type == GConst.REWARD_TYPE.REWARD_NONE then
|
||||||
return
|
return
|
||||||
@ -1034,7 +984,7 @@ function GFunc.getFrameRes(type, id)
|
|||||||
return atlasPath, GConst.HERO_FRAME[ GConst.QUALITY[qlt] ] or "frame_1", qlt
|
return atlasPath, GConst.HERO_FRAME[ GConst.QUALITY[qlt] ] or "frame_1", qlt
|
||||||
end
|
end
|
||||||
|
|
||||||
---得到展示奖励的图集名称,图片资源id
|
---得到展示奖励的图集名称,图片资源id
|
||||||
function GFunc.getQuality(type, id)
|
function GFunc.getQuality(type, id)
|
||||||
if type == GConst.REWARD_TYPE.REWARD_NONE then
|
if type == GConst.REWARD_TYPE.REWARD_NONE then
|
||||||
return
|
return
|
||||||
@ -1084,7 +1034,7 @@ function GFunc.getQuality(type, id)
|
|||||||
return qlt
|
return qlt
|
||||||
end
|
end
|
||||||
|
|
||||||
---得到展示奖励的图集名称,图片资源id
|
---得到展示奖励的图集名称,图片资源id
|
||||||
function GFunc.getRewardIconRes(type, id)
|
function GFunc.getRewardIconRes(type, id)
|
||||||
if type == GConst.REWARD_TYPE.REWARD_NONE then
|
if type == GConst.REWARD_TYPE.REWARD_NONE then
|
||||||
return
|
return
|
||||||
@ -1143,7 +1093,7 @@ function GFunc.getLegacyIconRes(legacyId)
|
|||||||
return GConst.ATLAS_PATH.ICON_LEGACY, tostring(config.icon)
|
return GConst.ATLAS_PATH.ICON_LEGACY, tostring(config.icon)
|
||||||
end
|
end
|
||||||
|
|
||||||
---得到展示奖励的图集名称,图片资源id
|
---得到展示奖励的图集名称,图片资源id
|
||||||
function GFunc.getRewardName(type, id)
|
function GFunc.getRewardName(type, id)
|
||||||
if type == GConst.REWARD_TYPE.REWARD_NONE then
|
if type == GConst.REWARD_TYPE.REWARD_NONE then
|
||||||
return
|
return
|
||||||
@ -1162,23 +1112,6 @@ function GFunc.getRewardName(type, id)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function GFunc.performDurationDelay(obj, delay, callback)
|
|
||||||
if obj.sequence then
|
|
||||||
obj.sequence:Kill()
|
|
||||||
obj.sequence = nil
|
|
||||||
end
|
|
||||||
local sequence = obj:createBindTweenSequence()
|
|
||||||
delay = delay or 0
|
|
||||||
delay = math.max(0, delay)
|
|
||||||
obj.sequence = sequence
|
|
||||||
|
|
||||||
sequence:AppendInterval(delay or 0)
|
|
||||||
sequence:OnComplete(callback)
|
|
||||||
|
|
||||||
return sequence
|
|
||||||
end
|
|
||||||
|
|
||||||
function GFunc.compareVersionThan(version1, version2, include)
|
function GFunc.compareVersionThan(version1, version2, include)
|
||||||
if not version1 or not version2 then
|
if not version1 or not version2 then
|
||||||
return false
|
return false
|
||||||
@ -1266,14 +1199,6 @@ function GFunc.getArray()
|
|||||||
return array
|
return array
|
||||||
end
|
end
|
||||||
|
|
||||||
function GFunc.showProbability()
|
|
||||||
local language = I18N:getCurLanguage()
|
|
||||||
if language == "ko" or language == "ja" then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
function GFunc.getTable(struct)
|
function GFunc.getTable(struct)
|
||||||
local t = {}
|
local t = {}
|
||||||
if struct then
|
if struct then
|
||||||
@ -1503,6 +1428,7 @@ function GFunc.getCalcMinVal(arr)
|
|||||||
end
|
end
|
||||||
return min
|
return min
|
||||||
end
|
end
|
||||||
|
|
||||||
---计算最大值
|
---计算最大值
|
||||||
function GFunc.getCalcMaxVal(arr)
|
function GFunc.getCalcMaxVal(arr)
|
||||||
local max = arr[1] or 0
|
local max = arr[1] or 0
|
||||||
@ -1588,14 +1514,6 @@ function GFunc.checkTableValueSame(standardTable, compareTable, debug)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取挖矿研究得到的属性加成
|
|
||||||
function GFunc.getMainHeroAttributeVal(key)
|
|
||||||
local mainEntity = DataManager.HeroData:getMainHeroEntity()
|
|
||||||
local allAttr = mainEntity:getAllAttr()
|
|
||||||
local result = allAttr[key]
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
function GFunc.showCurrencyFlyAction(rewards, pos)
|
function GFunc.showCurrencyFlyAction(rewards, pos)
|
||||||
local flyPos = {}
|
local flyPos = {}
|
||||||
if not pos then
|
if not pos then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user