源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

93 lines
2.3 KiB

GamePlatformRes = GamePlatformRes or {}
local GamePlatformRes = GamePlatformRes
GamePlatformRes.Define =
{
UPDATE_BG = "phone/update.jpg",
LOGIN_BG = "phone/login.jpg",
CREATE_ROLE_BG = "phone/create_role.jpg",
LOAD_SCENE_BG = "phone/load_scene.jpg",
LOGIN_LOGO = "phone/login_logo.png",
HEAD_LOGO = "phone/head_logo.png",
}
GamePlatformRes.Data =
{
}
GamePlatformRes.APPRES =
{
}
GamePlatformRes.InitSucceed = false
function GamePlatformRes.Load()
local need_load_count = 0
local cur_load_count = 0
local check_load_finish = function()
cur_load_count = cur_load_count + 1
if cur_load_count >= need_load_count then
GamePlatformRes.InitSucceed = true
end
end
local loadback = function(res, result)
if result then
local real_res = res
if ClientConfig.phone_dir then
real_res = GamePlatformRes.APPRES[res]
end
GamePlatformRes.Data[real_res] = true
end
check_load_finish()
end
local plat_res = GameConfig:GetValue("PlatCustomRes") -- "login.jpg,login_logo.png"
if plat_res ~= "" then
local res_list = Split(plat_res,",")
need_load_count = #res_list
local phone_dir = ClientConfig.phone_dir or "phone"
for index,res_name in pairs(res_list) do
local app_path = phone_dir .. "/" .. res_name
local res_path = "phone/" .. res_name
if ClientConfig.phone_dir then
res_path = GamePlatformRes.APPRES[app_path]
end
if res_path then
local full_path = Util.DataPath .. res_path
local fils_exist = Util.FileExists(full_path)
if not fils_exist then
resMgr:CopyFileFormApp(app_path,res_path,loadback)
else
GamePlatformRes.Data[res_path] = true
check_load_finish()
end
else
check_load_finish()
end
end
else
GamePlatformRes.InitSucceed = true
end
end
function GamePlatformRes.LoadPlatImage(res_name,raw_image,load_callback,is_rawimage)
if ClientConfig.custom_logo_mode or GamePlatformRes.Data[res_name] then
local func = function( image )
if image and raw_image and not raw_image:IsDestroyed() then
if is_rawimage then
raw_image.texture = image
else
raw_image.sprite = Util.TextureToSprite(image)
end
raw_image:SetNativeSize()
end
if load_callback then
load_callback()
end
end
local local_path = Util.DataPath .. res_name
Util.LoadRawTexture(local_path,func)
end
end