master
罗家炜 2025-10-27 21:55:45 +08:00
parent 0c04e3e75e
commit 7333d09846
22 changed files with 671 additions and 73 deletions

View File

@ -474,3 +474,14 @@ function M:GetGiftDiamondRecord(data, callback)
end end
end) end)
end end
--获取客服信息
function M:GetServiceInfo(data, callback)
local _client = ControllerManager.WebClient
local _data = {}
_client:send(Protocol.WEB_GET_SERVICEINFO, _data, function(res)
if (callback ~= nil) then
callback(res)
end
end)
end

View File

@ -17,9 +17,34 @@ local function __ShowTip(_version_view, text, callback)
end end
end end
local function __update_check_size(data, onback, _version_view)
print("===================updateCheck")
local tex_tip = _version_view:GetChild("tex_info")
local totalSize = 0
for k, game_data in ipairs(data) do
local asset_path = game_data["bundle"]:gsub("\r\n", "")
asset_path = string.gsub(asset_path, "%.", "/")
local local_version = Version.DEFUALT
local server_version = Version(game_data["version"])
local version_update = Hotupdate(asset_path .. "/", local_version, server_version)
version_update.AssetName = game_data["name"]
version_update:SetTipCallback(function(text, callback)
__ShowTip(_version_view, text, callback)
end)
version_update:LoadAssetSize()
while (not version_update.Done) do
coroutine.step()
end
game_data["size"] = version_update.Size
totalSize = totalSize + version_update.Size
end
onback(totalSize, true)
end
local function __update_check(data, onback, _version_view) local function __update_check(data, onback, _version_view)
print("===================updateCheck") print("===================updateCheck")
local tex_tip = _version_view:GetChild("tex_info") local tex_tip = _version_view:GetChild("tex_info")
local download_size = 0
for k, game_data in ipairs(data) do for k, game_data in ipairs(data) do
local asset_path = game_data["bundle"]:gsub("\r\n", "") local asset_path = game_data["bundle"]:gsub("\r\n", "")
asset_path = string.gsub(asset_path, "%.", "/") asset_path = string.gsub(asset_path, "%.", "/")
@ -32,12 +57,18 @@ local function __update_check(data, onback, _version_view)
end) end)
version_update:LoadAsset() version_update:LoadAsset()
while (not version_update.Done) do while (not version_update.Done) do
if game_data["size"] then
printlog("lingmeng down", download_size, version_update.Progress, game_data["size"])
onback(
download_size + (version_update.Progress > 1 and 1 or version_update.Progress) * game_data["size"], false)
else
onback(version_update.Progress, false) onback(version_update.Progress, false)
tex_tip.text = version_update.TextTip tex_tip.text = version_update.TextTip
end
coroutine.step() coroutine.step()
end end
download_size = download_size + game_data["size"]
ResourcesManager.ReadAssetConfig(asset_path) ResourcesManager.ReadAssetConfig(asset_path)
onback(0, false)
end end
onback(1, true) onback(1, true)
end end
@ -58,20 +89,34 @@ function ExtendHotupdate.UpdateGameList(list, callback)
end end
local _version_view = UIPackage.CreateObjectFromURL("ui://Hotupdate/Version") local _version_view = UIPackage.CreateObjectFromURL("ui://Hotupdate/Version")
-- _version_view.x = (GRoot.inst.width - _version_view.width) / 2 _version_view:GetChild("tex_info").text = "正在检查游戏资源"
_version_view:GetChild("tex_info").text = "正在检查资源。。。"
local _pd = _version_view:GetChild("pb_progress") local _pd = _version_view:GetChild("pb_progress")
_pd.value = 0 _pd.value = 0
GRoot.inst:AddChild(_version_view) GRoot.inst:AddChild(_version_view)
_version_view:MakeFullScreen() _version_view:MakeFullScreen()
_version_view:AddRelation(GRoot.inst, RelationType.Size) _version_view:AddRelation(GRoot.inst, RelationType.Size)
coroutine.start(__update_check, list, function(progress, finish) local toltal_size = 0
_pd.value = progress * 100 _version_view:GetTransition('check'):Play(-1, 0, function()
end)
coroutine.start(__update_check_size, list, function(totalSize, finish)
if (finish) then if (finish) then
toltal_size = totalSize
_version_view:GetTransition('check'):Stop()
_version_view:GetChild("tex_info_check").text = ""
coroutine.start(__update_check, list, function(progress, finish)
if (finish) then
_pd.value = 100
callback() callback()
_version_view:Dispose() _version_view:Dispose()
_version_view = nil _version_view = nil
else
_pd.value = progress / toltal_size * 100
_version_view:GetChild("tex_info").text = string.format("%.1fMB / %.1fMB", progress / 1024 / 1024,
toltal_size / 1024 / 1024)
end
end, _version_view)
end end
end, _version_view) end, _version_view)
end end

View File

@ -47,6 +47,8 @@ Protocol = {
ACC_GET_USERINFO = "acc/get_change_user_info", ACC_GET_USERINFO = "acc/get_change_user_info",
---代理获取赠送房卡记录 ---代理获取赠送房卡记录
ACC_GET_DIAMONDRECORD = "acc/get_recharge_diamo_list", ACC_GET_DIAMONDRECORD = "acc/get_recharge_diamo_list",
---获取客服信息
WEB_GET_SERVICEINFO = "acc/get_customer_service",
----index---- ----index----
-- 获取公告 -- 获取公告
WEB_UPDATE_NOTICE = "index/get_notice", WEB_UPDATE_NOTICE = "index/get_notice",

View File

@ -499,7 +499,6 @@ function M:RecordItemDetailRender(round, allDate, rdata, obj)
obj:GetChild('text_round').text = round obj:GetChild('text_round').text = round
obj:GetChild('text_time').text = os.date("%Y-%m-%d\n%H:%M:%S", tonumber(allDate.createTime)) obj:GetChild('text_time').text = os.date("%Y-%m-%d\n%H:%M:%S", tonumber(allDate.createTime))
local list = obj:GetChild('list_score') local list = obj:GetChild('list_score')
rdata = json.decode(rdata)
list:RemoveChildrenToPool(); list:RemoveChildrenToPool();
for i = 1, #rdata do for i = 1, #rdata do
local obj2 = list:AddItemFromPool() local obj2 = list:AddItemFromPool()
@ -672,16 +671,26 @@ function M:RecursionGetNumberRecord(fgCtr, groupId, uid, index)
[tonumber(info[string.format("is_read_%s", uid)]) + 1] [tonumber(info[string.format("is_read_%s", uid)]) + 1]
info.totalScore = json.decode(info.totalScore) info.totalScore = json.decode(info.totalScore)
local totalScore local totalScore
for i = 1, #info.totalScore do local s_index = 1
if info.totalScore[i].accId == uid then for j = 1, #info.totalScore do
totalScore = info.totalScore[i].score if info.totalScore[j].accId == uid then
if i ~= 1 then totalScore = info.totalScore[j].score
if j ~= 1 then
s_index = j
local fristInfo = info.totalScore[1] local fristInfo = info.totalScore[1]
info.totalScore[1] = info.totalScore[i] info.totalScore[1] = info.totalScore[j]
info.totalScore[i] = fristInfo info.totalScore[j] = fristInfo
end end
end end
end end
for j = 1, tonumber(info.round) do
local rdata = info[string.format("round_%d", j)]
rdata = json.decode(rdata)
local fristInfo = rdata[1]
rdata[1] = rdata[s_index]
rdata[s_index] = fristInfo
info[string.format("round_%d", j)] = rdata
end
if info.round ~= "1" or totalScore ~= 0 then if info.round ~= "1" or totalScore ~= 0 then
table.insert(tempTableChild, info) table.insert(tempTableChild, info)
tempTableChild.totalScore = tempTableChild.totalScore + totalScore tempTableChild.totalScore = tempTableChild.totalScore + totalScore

View File

@ -17,10 +17,10 @@ function M:init(url)
self._listView_main = self._view:GetChild('list') self._listView_main = self._view:GetChild('list')
self._listView_main.itemRenderer = function(index, obj) self._listView_main.itemRenderer = function(index, obj)
local info = self._data_services[index + 1] local info = self._data_services[index + 1]
obj.text = info.wx obj.text = info.service_link
obj:GetChild('text_title').text = string.format("%s", info.title) obj:GetChild('text_title').text = string.format("%s", info.service_name)
obj:GetChild('btn_copy').onClick:Set(function() obj:GetChild('btn_copy').onClick:Set(function()
GameApplication.Instance:CopyToClipboard(info.wx) --湘北 GameApplication.Instance:CopyToClipboard(info.service_link) --湘北
ViewUtil.ErrorTip(-1, "复制成功") ViewUtil.ErrorTip(-1, "复制成功")
end) end)
end end
@ -29,8 +29,21 @@ function M:init(url)
end end
function M:GetService() function M:GetService()
self._data_services = { { title = "游戏客服", wx = "youxikefuweixing" }, { title = "黎川代理", wx = "lichuandaili" } } ViewUtil:ShowModalWait2(0.1)
local lobbyCtr = ControllerManager.GetController(LoddyController)
lobbyCtr:GetServiceInfo({}, function(res)
if res.ReturnCode ~= 0 then
ViewUtil.CloseModalWait2()
ViewUtil.ErrorTip(res.ReturnCode, "客服信息正在更新")
return
else
pt("GetService", res)
self._data_services = res.Data.services
self._listView_main.numItems = #self._data_services self._listView_main.numItems = #self._data_services
ViewUtil.CloseModalWait2()
self:Show()
end
end)
end end
return M return M

View File

@ -167,7 +167,7 @@ function M:InitView(url)
local btn_customerService = self._view:GetChild("btn_customerService") local btn_customerService = self._view:GetChild("btn_customerService")
btn_customerService.onClick:Add(function() btn_customerService.onClick:Add(function()
local lobbyService = LobbyService.new() local lobbyService = LobbyService.new()
lobbyService:Show() -- lobbyService:Show()
end) end)
local btn_invite = self._view:GetChild("btn_invite") local btn_invite = self._view:GetChild("btn_invite")

View File

@ -196,6 +196,12 @@ function M:LoadConfigToDetailOnlyPlay(data, hpdata)
returnString = string.format("%s倍", hpData.times / 1000) returnString = string.format("%s倍", hpData.times / 1000)
end end
returnString = string.format("%s人数%s人", returnString, configData.maxPlayers)
if hpData then
returnString = string.format("%s %s", returnString, hpData.maxRound)
end
if configData.zimo then if configData.zimo then
returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸") returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸")
end end
@ -253,6 +259,10 @@ function M:LoadConfigToDetail(data, hpdata)
end end
returnString = string.format("%s人数%s人", returnString, configData.maxPlayers) returnString = string.format("%s人数%s人", returnString, configData.maxPlayers)
if hpData then
returnString = string.format("%s %s", returnString, hpData.maxRound)
end
if configData.zimo then if configData.zimo then
returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸") returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸")
end end

View File

@ -192,6 +192,12 @@ function M:LoadConfigToDetailOnlyPlay(data, hpdata)
returnString = string.format("%s倍", hpData.times / 1000) returnString = string.format("%s倍", hpData.times / 1000)
end end
returnString = string.format("%s人数%s人", returnString, configData.maxPlayers)
if hpData then
returnString = string.format("%s %s", returnString, hpData.maxRound)
end
if configData.zimo then if configData.zimo then
returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸") returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸")
end end
@ -248,6 +254,10 @@ function M:LoadConfigToDetail(data, hpdata)
end end
returnString = string.format("%s人数%s人", returnString, configData.maxPlayers) returnString = string.format("%s人数%s人", returnString, configData.maxPlayers)
if hpData then
returnString = string.format("%s %s", returnString, hpData.maxRound)
end
if configData.zimo then if configData.zimo then
returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸") returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸")
end end

View File

@ -177,6 +177,12 @@ function M:LoadConfigToDetailOnlyPlay(data, hpdata)
returnString = string.format("%s倍", hpData.times / 1000) returnString = string.format("%s倍", hpData.times / 1000)
end end
returnString = string.format("%s人数%s人", returnString, configData.maxPlayers)
if hpData then
returnString = string.format("%s %s", returnString, hpData.maxRound)
end
if configData.zimo then if configData.zimo then
returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮 可自摸" or "必须自摸") returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮 可自摸" or "必须自摸")
end end
@ -215,6 +221,10 @@ function M:LoadConfigToDetail(data, hpdata)
returnString = string.format("%s人数%s人", returnString, configData.maxPlayers) returnString = string.format("%s人数%s人", returnString, configData.maxPlayers)
if hpData then
returnString = string.format("%s %s", returnString, hpData.maxRound)
end
if configData.zimo then if configData.zimo then
returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮 可自摸" or "必须自摸") returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮 可自摸" or "必须自摸")
end end

View File

@ -205,6 +205,12 @@ function M:LoadConfigToDetailOnlyPlay(data, hpdata)
returnString = string.format("%s倍", hpData.times / 1000) returnString = string.format("%s倍", hpData.times / 1000)
end end
returnString = string.format("%s人数%s人", returnString, configData.maxPlayers)
if hpData then
returnString = string.format("%s %s", returnString, hpData.maxRound)
end
if configData.zimo then if configData.zimo then
returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸") returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸")
end end
@ -262,6 +268,9 @@ function M:LoadConfigToDetail(data, hpdata)
returnString = string.format("%s人数%s人", returnString, configData.maxPlayers) returnString = string.format("%s人数%s人", returnString, configData.maxPlayers)
if hpData then
returnString = string.format("%s %s", returnString, hpData.maxRound)
end
if configData.zimo then if configData.zimo then
returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸") returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸")
end end

View File

@ -308,6 +308,10 @@ function M:LoadConfigToDetail(data, hpdata)
end end
returnString = string.format("%s人数%s人", returnString, configData.maxPlayers) returnString = string.format("%s人数%s人", returnString, configData.maxPlayers)
if hpData then
returnString = string.format("%s %s", returnString, hpData.maxRound)
end
if configData.leaf then if configData.leaf then
returnString = string.format("%s,%s", returnString, configData.leaf == 1 and "15张手牌" or "16张手牌") returnString = string.format("%s,%s", returnString, configData.leaf == 1 and "15张手牌" or "16张手牌")
end end

View File

@ -17,7 +17,8 @@ local RunFast_Record_Event = {
Evt_Pass = 'pass', Evt_Pass = 'pass',
Evt_NewRound = 'newindex', Evt_NewRound = 'newindex',
Evt_result = 'result', Evt_result = 'result',
Evt_Result = 'Result' Evt_Result = 'Result',
Evt_Opt = 'prompt'
} }
local default_bg = 1 local default_bg = 1
@ -81,6 +82,8 @@ function M:InitView(url)
else else
self._view:GetChild('roominfo_panel1'):GetChild('tex_beishu').text = '' self._view:GetChild('roominfo_panel1'):GetChild('tex_beishu').text = ''
end end
self._ctr_inClear = self._view:GetController('Inclear')
self._cardCheck = RunFast_CardCheck:InitFlag() self._cardCheck = RunFast_CardCheck:InitFlag()
self._gamectr._cardCheck = self._cardCheck self._gamectr._cardCheck = self._cardCheck
@ -91,6 +94,7 @@ function M:InitView(url)
self._cmdmap[RunFast_Record_Event.Evt_Pass] = self.CmdPass self._cmdmap[RunFast_Record_Event.Evt_Pass] = self.CmdPass
self._cmdmap[RunFast_Record_Event.Evt_NewRound] = self.CmdNewRound self._cmdmap[RunFast_Record_Event.Evt_NewRound] = self.CmdNewRound
self._cmdmap[RunFast_Record_Event.Evt_result] = self.Cmdresult self._cmdmap[RunFast_Record_Event.Evt_result] = self.Cmdresult
self._cmdmap[RunFast_Record_Event.Evt_Opt] = self.CmdOpt
end end
function M:NewPlayerPokerInfoView(view, index) function M:NewPlayerPokerInfoView(view, index)
@ -156,6 +160,12 @@ function M:ShowStep(index)
p.out_card_list = step.player_card_data[i].out_card_list p.out_card_list = step.player_card_data[i].out_card_list
p.hand_left_count = #p.hand_list p.hand_left_count = #p.hand_list
if step.cmd == RunFast_Record_Event.Evt_Opt and step.seat == p.seat then
info._view:GetController('out_card_option2').selectedIndex = 1
else
info._view:GetController('out_card_option2').selectedIndex = 0
end
if p.seat ~= self._room.self_player.seat then if p.seat ~= self._room.self_player.seat then
info:UpdateHandPoker(p.hand_list, false, true) info:UpdateHandPoker(p.hand_list, false, true)
else else
@ -195,17 +205,94 @@ function M:ShowStep(index)
end end
end end
if step.cmd == RunFast_Record_Event.Evt_result then if step.cmd == RunFast_Record_Event.Evt_result then
local result = step.result local data = step.data
local over = 0
for i = 1, #result do local info = data.win.info
local card_info = self._player_card_info[self:GetPos(result[i].seat)] local win_seat = data.win.winseat
local remaincards = {}
if result[i].entrust ~= nil and result[i].entrust == true then -- local energyTab = arg[5]
local head_info = self._player_info[self:GetPos(result[i].seat)] local otherpoker_list = self._view:GetChild("otherpoker_list")
head_info:MarkTuoguan() local card_info = self._player_card_info[self:GetPos(self._room.self_player.seat)]
if self.dismissWin ~= nil then
self.dismissWin:Destroy()
end end
-- head_info:UpdateScore(result[i].score) self.dismissWin = nil
card_info:PlayScore(result[i].score, false, step.win_seat == result[i].seat) if self.MypokerList ~= nil then
-- body
card_info:Clear()
card_info:InitPoker(self.MypokerList, false)
self.MypokerList = nil
end
if otherpoker_list ~= nil then
-- body
otherpoker_list:RemoveChildrenToPool()
otherpoker_list.visible = true
end
if self.destory_win ~= nil then
coroutine.stop(self.destory_win)
end
self.destory_win = nil
self.destory_win = coroutine.start(function()
if win_seat == self._room.self_player.seat then
ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/end_music.mp3")
else
ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/lose_music.mp3")
end
coroutine.stop(self._leftClock_continue)
for i = 1, #self._player_card_info do
local card_info = self._player_card_info[i]
card_info._ctr_time_clock.selectedIndex = 0
self._left_time = 0
end
for i = 1, #info do
local player = info[i]
local p = self._room:GetPlayerBySeat(player.seat)
local head_info = self._player_info[self:GetPos(player.seat)]
head_info:SetBaoDan(false)
head_info._view:GetChild('text_jifen').text = player.score
head_info:PlayScore(player.score, win_seat == player.seat)
end
coroutine.wait(2)
self.result_view = RunFast_ResultView.new(self, info, self._room.room_id, over, win_seat, 0,
remaincards)
self.result_view:SetDestroryCallback(function()
for i = 1, #self._player_card_info do
local card_info = self._player_card_info[i]
card_info.ctr_outpoker.selectedIndex = 0
if card_info._ctr_resultOut then
card_info._ctr_resultOut.selectedIndex = 0
end
end
end)
self.result_view:Show()
self.result_view._root_view:RemoveFromParent()
self._view:AddChildAt(self.result_view._root_view,
self._view:GetChildIndex(self._view:GetChild('mask_tips')) - 1)
if self.WinItem_view ~= nil then
self.WinItem_view:Dispose()
self.WinItem_view = nil
end
if self.rank_view ~= nil then
self.rank_view:Dispose()
self.rank_view = nil
end
if self._room.self_player.entrust == true then
local btn_confirm = self.result_view._view:GetChild("btn_confirm")
btn_confirm.onClick:Call()
end
ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/end_music.mp3")
end)
if over == 1 then
-- body
self:UnmarkSelfTuoguan()
ControllerManager.ChangeController(LoddyController)
end end
end end
if step.cmd == RunFast_Record_Event.Evt_Result then if step.cmd == RunFast_Record_Event.Evt_Result then
@ -278,8 +365,7 @@ end
function M:Cmdresult(cmd, index) function M:Cmdresult(cmd, index)
local data = self:CopyLastStep(index) local data = self:CopyLastStep(index)
data.cmd = cmd.cmd data.cmd = cmd.cmd
data.result = cmd.data.result data.data = cmd.data
data.win_seat = cmd.seat
end end
function M:CmdResult(cmd, index) function M:CmdResult(cmd, index)
@ -292,6 +378,12 @@ function M:CmdResult(cmd, index)
end end
end end
function M:CmdOpt(cmd, index)
local data = self:CopyLastStep(index)
data.cmd = cmd.cmd
data.seat = cmd.seat
end
function M:CopyLastStep(index) function M:CopyLastStep(index)
local step = {} local step = {}
local last_step = self._step[index] local last_step = self._step[index]

View File

@ -56,11 +56,10 @@ function M:init(url, data, roomid, over, win_seat, dissolve, remaincards)
self._view:GetChild('btn_nextRound').onClick:Set(function() self._view:GetChild('btn_nextRound').onClick:Set(function()
if over == 0 then if over == 0 then
self:Destroy()
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
_gamectr:ConformToNextGame() _gamectr:ConformToNextGame()
self._root_runFast:ClearOk()
self._root_runFast._ctr_inClear.selectedIndex = 0 self._root_runFast._ctr_inClear.selectedIndex = 0
self:Destroy()
else else
self._view:GetController('over').selectedIndex = 1 self._view:GetController('over').selectedIndex = 1
end end
@ -68,10 +67,10 @@ function M:init(url, data, roomid, over, win_seat, dissolve, remaincards)
self.ClearReady = function() self.ClearReady = function()
if over == 0 then if over == 0 then
self:Destroy()
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
_gamectr:ConformToNextGame() _gamectr:ConformToNextGame()
self._root_runFast:ClearOk() self._root_runFast:ClearOk()
self:Destroy()
else else
self._view:GetController('over').selectedIndex = 1 self._view:GetController('over').selectedIndex = 1
end end

View File

@ -6,6 +6,7 @@
<controller name="piao" pages="0,,1,,2,,3," selected="0"/> <controller name="piao" pages="0,,1,,2,,3," selected="0"/>
<controller name="piao_value" pages="0,0,1,1,2,2,3,3,4,5,5,8" selected="0"/> <controller name="piao_value" pages="0,0,1,1,2,2,3,3,4,5,5,8" selected="0"/>
<controller name="time_clock" pages="0,,1," selected="0"/> <controller name="time_clock" pages="0,,1," selected="0"/>
<controller name="out_card_option2" pages="0,,1," selected="1"/>
<displayList> <displayList>
<component id="n47_g618" name="hand_poker_c" src="prgz89" fileName="component/poker/hand_poker_con.xml" xy="-218,-1283" size="2565,190" visible="false"> <component id="n47_g618" name="hand_poker_c" src="prgz89" fileName="component/poker/hand_poker_con.xml" xy="-218,-1283" size="2565,190" visible="false">
<relation target="" sidePair="bottom-bottom,width-width"/> <relation target="" sidePair="bottom-bottom,width-width"/>
@ -23,7 +24,7 @@
<component id="n50_g618" name="btn_tips" src="m9jaha" fileName="component/Btn_Yellow.xml" xy="-733,398" group="n51_g618" scale="1.1,1.1"> <component id="n50_g618" name="btn_tips" src="m9jaha" fileName="component/Btn_Yellow.xml" xy="-733,398" group="n51_g618" scale="1.1,1.1">
<Button icon="ui://9n9stu2else5chd"/> <Button icon="ui://9n9stu2else5chd"/>
</component> </component>
<group id="n51_g618" name="btn" xy="-1173,395" size="1125,131" visible="false" advanced="true"> <group id="n51_g618" name="btn_old" xy="-1173,395" size="1125,131" visible="false" advanced="true">
<gearDisplay controller="out_card_option" pages="1,2"/> <gearDisplay controller="out_card_option" pages="1,2"/>
<relation target="" sidePair="bottom-top,left-right"/> <relation target="" sidePair="bottom-top,left-right"/>
</group> </group>
@ -116,6 +117,15 @@
<component id="n77_n9qr" name="Comp_Clock" src="ckvbcis" fileName="Main_New/Component/Comp_Clock.xml" xy="536,-205" size="174,143"> <component id="n77_n9qr" name="Comp_Clock" src="ckvbcis" fileName="Main_New/Component/Comp_Clock.xml" xy="536,-205" size="174,143">
<gearDisplay controller="time_clock" pages="1"/> <gearDisplay controller="time_clock" pages="1"/>
</component> </component>
<component id="n78_g6m8" name="Btn_SendCard_back" src="ckvbcix" fileName="Main_New/Component/Btn_SendCard.xml" xy="1170,-197" size="384,125" group="n80_g6m8">
<Button sound=""/>
</component>
<component id="n79_g6m8" name="Btn_Tip_back" src="ckvbciy" fileName="Main_New/Component/Btn_Tip.xml" xy="740,-201" size="384,125" group="n80_g6m8">
<Button sound=""/>
</component>
<group id="n80_g6m8" name="btn_back" xy="740,-201" size="814,129" advanced="true">
<gearDisplay controller="out_card_option2" pages="1"/>
</group>
</displayList> </displayList>
<transition name="score"> <transition name="score">
<item time="0" type="Alpha" target="n57_pgkj" tween="true" startValue="0" endValue="1" duration="18"/> <item time="0" type="Alpha" target="n57_pgkj" tween="true" startValue="0" endValue="1" duration="18"/>

View File

@ -2,8 +2,9 @@
<component size="1760,157" opaque="false" initName="player_card_info"> <component size="1760,157" opaque="false" initName="player_card_info">
<controller name="output" homePageType="specific" homePage="0" pages="0,,1,,2," selected="0"/> <controller name="output" homePageType="specific" homePage="0" pages="0,,1,,2," selected="0"/>
<controller name="one_card" pages="0,,1," selected="0"/> <controller name="one_card" pages="0,,1," selected="0"/>
<controller name="resultOut" homePageType="specific" homePage="0" pages="0,,1," selected="1"/> <controller name="resultOut" homePageType="specific" homePage="0" pages="0,,1," selected="0"/>
<controller name="time_clock" pages="0,,1," selected="0"/> <controller name="time_clock" pages="0,,1," selected="0"/>
<controller name="out_card_option2" pages="0,,1," selected="1"/>
<displayList> <displayList>
<list id="n53_q9cc" name="hand_card_list" xy="-697,-634" size="445,78" visible="false" layout="row" selectionMode="none" overflow="scroll" lineGap="-15" colGap="-25" defaultItem="ui://9n9stu2eprgz8e" align="right"/> <list id="n53_q9cc" name="hand_card_list" xy="-697,-634" size="445,78" visible="false" layout="row" selectionMode="none" overflow="scroll" lineGap="-15" colGap="-25" defaultItem="ui://9n9stu2eprgz8e" align="right"/>
<component id="n59_8yp0" name="out_card_com" src="prgz89" fileName="component/poker/hand_poker_con.xml" xy="-640,-632" size="390,179" visible="false"/> <component id="n59_8yp0" name="out_card_com" src="prgz89" fileName="component/poker/hand_poker_con.xml" xy="-640,-632" size="390,179" visible="false"/>
@ -59,7 +60,7 @@
<component id="n64_n9qr" name="Comp_Clock" src="ckvbcis" fileName="Main_New/Component/Comp_Clock.xml" xy="1612,-10" size="174,143"> <component id="n64_n9qr" name="Comp_Clock" src="ckvbcis" fileName="Main_New/Component/Comp_Clock.xml" xy="1612,-10" size="174,143">
<gearDisplay controller="time_clock" pages="1"/> <gearDisplay controller="time_clock" pages="1"/>
</component> </component>
<list id="n65_ukp7" name="list_backHand" xy="1866,653" size="1080,195" scale="0.657,1" rotation="-90" touchable="false" layout="row" overflow="scroll" colGap="-120" defaultItem="ui://9n9stu2eckvbcjn" autoClearItems="true"> <list id="n65_ukp7" name="list_backHand" xy="1866,653" size="1080,195" scale="0.657,1" rotation="-90" touchable="false" layout="row" overflow="scroll" colGap="-120" defaultItem="ui://9n9stu2eckvbcjn" align="center" autoClearItems="true">
<item/> <item/>
<item/> <item/>
<item/> <item/>
@ -77,6 +78,15 @@
<item/> <item/>
<item/> <item/>
</list> </list>
<component id="n66_g6m8" name="Btn_SendCard_back" src="ckvbcix" fileName="Main_New/Component/Btn_SendCard.xml" xy="1725,273" size="200,100" group="n68_g6m8" rotation="-90">
<Button sound=""/>
</component>
<component id="n67_g6m8" name="Btn_Tip_back" src="ckvbciy" fileName="Main_New/Component/Btn_Tip.xml" xy="1725,491" size="200,100" group="n68_g6m8" rotation="-90">
<Button sound=""/>
</component>
<group id="n68_g6m8" name="btn_back" xy="1725,273" size="200,318" advanced="true">
<gearDisplay controller="out_card_option2" pages="1"/>
</group>
</displayList> </displayList>
<transition name="score"> <transition name="score">
<item time="0" type="Alpha" target="n55_pgkj" tween="true" startValue="0" endValue="1" duration="18"/> <item time="0" type="Alpha" target="n55_pgkj" tween="true" startValue="0" endValue="1" duration="18"/>

View File

@ -2,8 +2,9 @@
<component size="1760,157" opaque="false" initName="player_card_info"> <component size="1760,157" opaque="false" initName="player_card_info">
<controller name="output" homePageType="specific" homePage="0" pages="0,,1,,2," selected="0"/> <controller name="output" homePageType="specific" homePage="0" pages="0,,1,,2," selected="0"/>
<controller name="one_card" pages="0,,1," selected="0"/> <controller name="one_card" pages="0,,1," selected="0"/>
<controller name="resultOut" homePageType="specific" homePage="0" pages="0,,1," selected="1"/> <controller name="resultOut" homePageType="specific" homePage="0" pages="0,,1," selected="0"/>
<controller name="time_clock" pages="0,,1," selected="0"/> <controller name="time_clock" pages="0,,1," selected="0"/>
<controller name="out_card_option2" pages="0,,1," selected="0"/>
<displayList> <displayList>
<list id="n53_q9cc" name="hand_card_list" xy="-697,-634" size="445,78" visible="false" layout="row" selectionMode="none" overflow="scroll" lineGap="-15" colGap="-25" defaultItem="ui://9n9stu2eprgz8e" align="right"/> <list id="n53_q9cc" name="hand_card_list" xy="-697,-634" size="445,78" visible="false" layout="row" selectionMode="none" overflow="scroll" lineGap="-15" colGap="-25" defaultItem="ui://9n9stu2eprgz8e" align="right"/>
<component id="n59_8yp0" name="out_card_com" src="prgz89" fileName="component/poker/hand_poker_con.xml" xy="-640,-632" size="390,179" visible="false"/> <component id="n59_8yp0" name="out_card_com" src="prgz89" fileName="component/poker/hand_poker_con.xml" xy="-640,-632" size="390,179" visible="false"/>
@ -59,7 +60,7 @@
<component id="n64_n9qr" name="Comp_Clock" src="ckvbcis" fileName="Main_New/Component/Comp_Clock.xml" xy="-138,-6" size="174,143"> <component id="n64_n9qr" name="Comp_Clock" src="ckvbcis" fileName="Main_New/Component/Comp_Clock.xml" xy="-138,-6" size="174,143">
<gearDisplay controller="time_clock" pages="1"/> <gearDisplay controller="time_clock" pages="1"/>
</component> </component>
<list id="n65_if10" name="list_backHand" xy="-80,-56" size="1080,195" scale="0.657,1" rotation="90" touchable="false" layout="row" overflow="scroll" colGap="-120" defaultItem="ui://9n9stu2eckvbcjn" autoClearItems="true"> <list id="n65_if10" name="list_backHand" xy="-80,-56" size="1080,195" scale="0.657,1" rotation="90" touchable="false" layout="row" overflow="scroll" colGap="-120" defaultItem="ui://9n9stu2eckvbcjn" align="center" autoClearItems="true">
<item/> <item/>
<item/> <item/>
<item/> <item/>
@ -76,6 +77,15 @@
<item/> <item/>
<item/> <item/>
</list> </list>
<component id="n66_g6m8" name="Btn_SendCard_back" src="ckvbcix" fileName="Main_New/Component/Btn_SendCard.xml" xy="56,296" size="200,100" group="n68_g6m8" rotation="90">
<Button sound=""/>
</component>
<component id="n67_g6m8" name="Btn_Tip_back" src="ckvbciy" fileName="Main_New/Component/Btn_Tip.xml" xy="56,74" size="200,100" group="n68_g6m8" rotation="90">
<Button sound=""/>
</component>
<group id="n68_g6m8" name="btn_back" xy="56,74" size="200,322" advanced="true">
<gearDisplay controller="out_card_option2" pages="1"/>
</group>
</displayList> </displayList>
<transition name="score"> <transition name="score">
<item time="0" type="Alpha" target="n55_pgkj" tween="true" startValue="0" endValue="1" duration="18"/> <item time="0" type="Alpha" target="n55_pgkj" tween="true" startValue="0" endValue="1" duration="18"/>

View File

@ -5,11 +5,16 @@
<image id="n31_op0e" name="n31" src="op0e7i4w" fileName="loggin_bg.png" xy="0,0"> <image id="n31_op0e" name="n31" src="op0e7i4w" fileName="loggin_bg.png" xy="0,0">
<relation target="" sidePair="width-width,height-height"/> <relation target="" sidePair="width-width,height-height"/>
</image> </image>
<text id="n2" name="tex_info" xy="813,897" size="906,79" group="n8_rtsl" font="ui://27vd145bh35o7il7" fontSize="60" color="#ffffff" align="center" autoSize="none" text="检查更新"/> <text id="n2" name="tex_info" xy="1057,897" size="417,79" group="n8_rtsl" font="ui://27vd145bh35o7il7" fontSize="60" color="#ffffff" align="center" text="检查更新啦啦啦">
<relation target="" sidePair="center-center,top-top%"/>
</text>
<component id="n20_nld2" name="pb_progress" src="pcy012" fileName="commpoent/Slider1.xml" xy="356,811" group="n8_rtsl"> <component id="n20_nld2" name="pb_progress" src="pcy012" fileName="commpoent/Slider1.xml" xy="356,811" group="n8_rtsl">
<relation target="" sidePair="width-width%,height-height%,center-center%"/> <relation target="" sidePair="width-width%,height-height%,center-center%"/>
<Slider value="100" max="100"/> <Slider value="100" max="100"/>
</component> </component>
<text id="n33_g6m8" name="tex_info_check" xy="1476,879" size="10,79" group="n8_rtsl" font="ui://27vd145bh35o7il7" fontSize="60" color="#ffffff" align="center" singleLine="true" text="">
<relation target="n2" sidePair="left-right,bottom-bottom"/>
</text>
<group id="n8_rtsl" name="n8" xy="356,811" size="1818,165" advanced="true"> <group id="n8_rtsl" name="n8" xy="356,811" size="1818,165" advanced="true">
<gearDisplay controller="state" pages="0"/> <gearDisplay controller="state" pages="0"/>
<relation target="" sidePair="bottom-bottom,center-center"/> <relation target="" sidePair="bottom-bottom,center-center"/>
@ -27,4 +32,13 @@
<relation target="" sidePair="width-width%,height-height%,center-center,top-top%"/> <relation target="" sidePair="width-width%,height-height%,center-center,top-top%"/>
</image> </image>
</displayList> </displayList>
<transition name="check" frameRate="30">
<item time="0" type="Text" target="n33_g6m8" value=""/>
<item time="3" type="Text" target="n33_g6m8" value="."/>
<item time="6" type="Text" target="n33_g6m8" value=".."/>
<item time="9" type="Text" target="n33_g6m8" value="..."/>
<item time="12" type="Text" target="n33_g6m8" value="...."/>
<item time="15" type="Text" target="n33_g6m8" value="....."/>
<item time="18" type="Text" target="n33_g6m8" value="......"/>
</transition>
</component> </component>

View File

@ -5,6 +5,7 @@ using System.IO;
using taurus.client; using taurus.client;
using taurus.unity; using taurus.unity;
using UnityEngine; using UnityEngine;
using UnityEngine.Networking;
public class Version public class Version
{ {
@ -321,6 +322,95 @@ public class Hotupdate {
Progress = 1; Progress = 1;
} }
public void LoadAssetSize()
{
GameApplication.Instance.StartCoroutine(__LoadAssetSize());
}
IEnumerator __LoadAssetSize()
{
Size = 0;
bool _decompression = true;
string dir = ResourcesManager.PACK_PATH + _base_path;
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
string rv = dir + "version.txt";
Version local_version1 = GetLocalVersion(_base_path);
if (local_version1 != null)
{
_local_version = local_version1;
_decompression = _local_version.ContainAll(_server_version);
}
//如果没有发现本地文件解压APP包
if ((_with_pack & LOCAL_PACK) != 0 && _decompression)
{
var path = Application.streamingAssetsPath + string.Format("/{0}/{1}asset_pack{2}.bytes", ResourcesManager.OS_Dir, _base_path, _server_version.ToString());
#if !UNITY_EDITOR && UNITY_ANDROID
var www = new WWW(path);
yield return www;
var data = www.bytes;
www.Dispose();
www = null;
#else
var data = File.ReadAllBytes(path);
#endif
var zip_path = ResourcesManager.PACK_PATH + "asset_pack.bytes";
File.WriteAllBytes(zip_path, data);
data = null;
System.GC.Collect();
var finsh = false;
var tem_state = 0;
VerCheck.Instance.StartCoroutine(__UnPack(_server_version, (state) =>
{
tem_state = state;
finsh = state == 0;
}, 0.3f));
while (!finsh)
{
if (tem_state > 10)
{
if (__ShowTip("解压资源包时出问题,请重新下载客户端!", () =>
{
__DeleteOldPack();
Application.Quit();
}))
{
__DeleteOldPack();
Application.Quit();
}
yield break;
}
yield return null;
}
local_version1 = _local_version;
_stage = 0.3f;
}
if ((_with_pack & SERVER_PACK) != 0)
{
var update_pack2 = local_version1 == null || local_version1.ContainAll(_server_version);
if (update_pack2)
{
var down = false;
var _ratio = 1 - _stage;
VerCheck.Instance.StartCoroutine(GetAssetSize((size) =>
{
Size = size;
down = true;
}, _server_version));
while (!down)
{
yield return null;
}
}
}
Done = true;
Progress = 1;
}
IEnumerator __UnPack(Version version,System.Action<int> onback, float ratio) IEnumerator __UnPack(Version version,System.Action<int> onback, float ratio)
{ {
@ -424,6 +514,60 @@ public class Hotupdate {
} }
} }
IEnumerator GetAssetSize(System.Action<long> downcall, Version version)
{
var pack_path = string.Format("{0}asset_pack{1}.bytes", _base_path, version.ToString());
string osPath = ResourcesManager.OS_Dir;
#if UNITY_ANDROID && !UNITY_EDITOR
if (GameApplication.Instance.isAndroid64bit == false)
{
//if (isBuild32lua)
//{
// osPath=osPath+"32";
//}
osPath=osPath+"32";
}
#endif
var url = "";
if (VerCheck.Instance.isGFF == false && VerCheck.Instance.isDXYGFF == false)
url = string.Format("{0}/{1}/{2}", Hotupdate.PackUrl, osPath, pack_path);
else
url = string.Format("{0}/{1}/{2}", "http://" + VerCheck.Instance.conn.ip + ":" + VerCheck.Instance.conn.port + "/NewFKN", osPath, pack_path);
url = string.Format("{0}/{1}/{2}", Hotupdate.PackUrl, osPath, pack_path);
if (Application.platform == RuntimePlatform.WindowsEditor)
Debug.Log("check_url:" + url);
using (UnityWebRequest head = UnityWebRequest.Head(url))
{
yield return head.SendWebRequest();
#if UNITY_2020_2_OR_NEWER
if (head.result == UnityWebRequest.Result.Success)
#else
if (!head.isNetworkError && !head.isHttpError)
#endif
{
string len = head.GetResponseHeader("Content-Length");
if (!string.IsNullOrEmpty(len) && long.TryParse(len, out long size))
{
if (downcall != null) downcall(size);
yield return null;
}
else
{
Debug.LogWarning($"无法获取文件大小: {url}");
yield return 0L;
}
}
else
{
Debug.LogError($"获取文件大小失败: {head.error}");
yield return 0L;
}
}
}
bool __ShowTip(string text,System.Action callback) bool __ShowTip(string text,System.Action callback)
{ {
if (this._tip_callback != null) if (this._tip_callback != null)
@ -456,4 +600,9 @@ public class Hotupdate {
{ {
get;set; get;set;
} }
public float Size
{
get; set;
}
} }

View File

@ -180,13 +180,13 @@ public class VerCheck : MonoBehaviour
while (request1!=null && request1.isDone==false) while (request1!=null && request1.isDone==false)
{ {
//Debug.LogError("wwwwwwwwwwwwwwwwwww11111111111111111111111"); //Debug.LogError("wwwwwwwwwwwwwwwwwww11111111111111111111111");
if(process<request1.progress) if (process < request1.progress)
{ {
timeOut = Time.time; timeOut = Time.time;
process = request1.progress; process = request1.progress;
} }
if(Time.time-timeOut>downTimeOut) if (Time.time-timeOut>downTimeOut)
{ {
ShowTip("资源配置下载失败,请检查您的网络设置!", () => ShowTip("资源配置下载失败,请检查您的网络设置!", () =>
@ -282,6 +282,8 @@ public class VerCheck : MonoBehaviour
IEnumerator CheckAssetConfig(Version server_version) IEnumerator CheckAssetConfig(Version server_version)
{ {
GObject v_tex_info = _version_view.GetChild("tex_info"); GObject v_tex_info = _version_view.GetChild("tex_info");
GObject v_tex_info_check = _version_view.GetChild("tex_info_check");
Transition t_check = _version_view.GetTransition("check");
Version local_version = Hotupdate.GetLocalVersion(string.Empty); Version local_version = Hotupdate.GetLocalVersion(string.Empty);
ArrayList asset_config_list = null; ArrayList asset_config_list = null;
string asset_config_text = null; string asset_config_text = null;
@ -337,27 +339,64 @@ public class VerCheck : MonoBehaviour
yield break; yield break;
} }
// //
v_tex_info.text = "正在检查资源。。。"; v_tex_info.text = "正在检查资源";
GSlider _pd = _version_view.GetChild("pb_progress").asSlider; GSlider _pd = _version_view.GetChild("pb_progress").asSlider;
_pd.value = 0.0; _pd.value = 0.0;
//开始检查所有资源
bool size_check = false;
long total_size = 0;
StartCoroutine(VersionUpdateCheckSize2(asset_config_list, (all_size, finish) =>
{
total_size = all_size;
size_check = finish;
}));
t_check.Play(-1, 0, () => { });
while (!size_check)
{
yield return null;
}
t_check.Stop();
v_tex_info_check.text = string.Empty;
Debug.Log($"总大小:{(total_size / 1024f / 1024f):F2} MB");
bool ver_check = false; bool ver_check = false;
StartCoroutine(VersionUpdateCheck(asset_config_list, (progress, finish) => StartCoroutine(VersionUpdateCheck(asset_config_list, (progress, finish) =>
{ {
_pd.value = progress * 100f; if (ver_check)
{
_pd.value = 100f;
ver_check = finish; ver_check = finish;
}, v_tex_info)); }
else
{
v_tex_info.text = $"正在下载资源({(progress / 1024f / 1024f):F2} MB/{(total_size / 1024f / 1024f):F2} MB";
_pd.value = progress / total_size * 100f;
ver_check = finish;
}
}));
while (!ver_check) while (!ver_check)
{ {
yield return null; yield return null;
} }
bool unZip_check = false;
v_tex_info.text = "正在解压文件(该过程不消耗流量)";
_pd.value = 100f;
StartCoroutine(VersionUpdateUnZip(asset_config_list, (finish) =>
{
unZip_check = finish;
}));
t_check.Play(-1, 0, () => { });
while (!unZip_check)
{
yield return null;
}
t_check.Stop();
v_tex_info_check.text = string.Empty;
string arv = string.Format("{0}asset_config{1}.json", ResourcesManager.PACK_PATH, server_version.ToString()); string arv = string.Format("{0}asset_config{1}.json", ResourcesManager.PACK_PATH, server_version.ToString());
File.WriteAllText(arv, asset_config_text, System.Text.Encoding.UTF8); File.WriteAllText(arv, asset_config_text, System.Text.Encoding.UTF8);
string rv = ResourcesManager.PACK_PATH + "version.txt"; string rv = ResourcesManager.PACK_PATH + "version.txt";
File.WriteAllText(rv, server_version.ToString(), System.Text.Encoding.UTF8); File.WriteAllText(rv, server_version.ToString(), System.Text.Encoding.UTF8);
} }
else else
{ {
@ -418,7 +457,7 @@ public class VerCheck : MonoBehaviour
} }
GameApplication.AppVersion.FillData(server_version); GameApplication.AppVersion.FillData(server_version);
v_tex_info.text = "正在加载资源请稍后。。"; //v_tex_info.text = "正在加载资源请稍后。。";
//ResourcesManager.Init(); //ResourcesManager.Init();
yield return null; yield return null;
_version_view.Dispose(); _version_view.Dispose();
@ -431,35 +470,20 @@ public class VerCheck : MonoBehaviour
/// <param name="asset_config_list"></param> /// <param name="asset_config_list"></param>
/// <param name="onback"></param> /// <param name="onback"></param>
/// <param name="tip"></param> /// <param name="tip"></param>
/// <param name="total_size"></param>
/// <returns></returns> /// <returns></returns>
IEnumerator VersionUpdateCheck(ArrayList asset_config_list, System.Action<float, bool> onback, FairyGUI.GObject tip) IEnumerator VersionUpdateCheck(ArrayList asset_config_list, System.Action<float, bool> onback)
{ {
Version local_version = Version.DEFUALT; Version local_version = Version.DEFUALT;
float download_size = 0;
for(int i=0;i< asset_config_list.Count; ++i) for(int i=0;i< asset_config_list.Count; ++i)
{ {
var tem = asset_config_list[i] as Hashtable; var tem = asset_config_list[i] as Hashtable;
//if (GameApplication.HideSdk)
//{
// if (!tem.ContainsKey("check")) continue;
// if (!(bool)tem["check"]) continue;
//}
string b_path = "base/" + tem["name"].ToString(); string b_path = "base/" + tem["name"].ToString();
Hotupdate version_update = new Hotupdate(b_path + "/", local_version, new Version((string)tem["ver"])); Hotupdate version_update = new Hotupdate(b_path + "/", local_version, new Version((string)tem["ver"]));
version_update.AssetName = b_path; version_update.AssetName = b_path;
version_update.HideDetail = true; version_update.HideDetail = true;
#if UNITY_ANDROID && !UNITY_EDITOR
//if (GameApplication.Instance.isAndroid64bit==false)
//{
// if (tem["name"].ToString()=="base_script")
// {
// version_update.isBuild32lua = true;
// }
//}
#endif
version_update.SetTipCallback((text,callback)=> version_update.SetTipCallback((text,callback)=>
{ {
@ -468,15 +492,126 @@ public class VerCheck : MonoBehaviour
version_update.LoadAsset(); version_update.LoadAsset();
while (!version_update.Done) while (!version_update.Done)
{ {
onback(version_update.Progress, false); onback(download_size + version_update.Progress* (float)tem["size"], false);
tip.text = version_update.TextTip;
yield return null; yield return null;
} }
download_size += (float)tem["size"];
ResourcesManager.ReadAssetConfig(b_path); ResourcesManager.ReadAssetConfig(b_path);
} }
onback(1, true); onback(1, true);
} }
/// <summary>
/// 检查基本更新包大小
/// </summary>
/// <param name="asset_config_list"></param>
/// <param name="onback"></param>
/// <param name="tip"></param>
/// <returns></returns>
IEnumerator VersionUpdateCheckSize(ArrayList asset_config_list, System.Action<long, bool> onback)
{
Version local_version_one = Version.DEFUALT;
long totalSize = 0;
for (int i = 0; i < asset_config_list.Count; ++i)
{
var tem_one = asset_config_list[i] as Hashtable;
string b_path_one = "base/" + tem_one["name"].ToString();
local_version_one = Hotupdate.GetLocalVersion(b_path_one);
var update_pack2 = local_version_one == null || local_version_one.ContainAll(new Version((string)tem_one["ver"]));
string osPath = ResourcesManager.OS_Dir;
if (update_pack2)
{
var pack_path = string.Format("{0}/asset_pack{1}.bytes", b_path_one, (string)tem_one["ver"]);
var url = "";
if (VerCheck.Instance.isGFF == false && VerCheck.Instance.isDXYGFF == false)
url = string.Format("{0}/{1}/{2}", Hotupdate.PackUrl, osPath, pack_path);
else
url = string.Format("{0}/{1}/{2}", "http://" + VerCheck.Instance.conn.ip + ":" + VerCheck.Instance.conn.port + "/NewFKN", osPath, pack_path);
url = string.Format("{0}/{1}/{2}", Hotupdate.PackUrl, osPath, pack_path);
if (Application.platform == RuntimePlatform.WindowsEditor)
Debug.Log("check_url:" + url);
using (UnityWebRequest head = UnityWebRequest.Head(url))
{
yield return head.SendWebRequest();
#if UNITY_2020_2_OR_NEWER
if (head.result == UnityWebRequest.Result.Success)
#else
if (!head.isNetworkError && !head.isHttpError)
#endif
{
string len = head.GetResponseHeader("Content-Length");
if (!string.IsNullOrEmpty(len) && long.TryParse(len, out long size))
{
totalSize += size;
tem_one["size"] = size;
yield return null;
}
else
{
Debug.LogWarning($"无法获取文件大小: {url}");
yield return 0L;
}
}
else
{
Debug.LogError($"获取文件大小失败: {head.error}");
yield return 0L;
}
}
}
}
onback(totalSize, true);
}
IEnumerator VersionUpdateCheckSize2(ArrayList asset_config_list, System.Action<long, bool> onback)
{
Version local_version = Version.DEFUALT;
long totalSize = 0;
for (int i = 0; i < asset_config_list.Count; ++i)
{
var tem = asset_config_list[i] as Hashtable;
string b_path = "base/" + tem["name"].ToString();
Hotupdate version_update = new Hotupdate(b_path + "/", local_version, new Version((string)tem["ver"]));
version_update.AssetName = b_path;
version_update.HideDetail = true;
version_update.SetTipCallback((text, callback) =>
{
ShowTip(text, callback);
});
version_update.LoadAssetSize();
while (!version_update.Done)
{
yield return null;
}
tem["size"] = version_update.Size;
totalSize += (long)version_update.Size;
ResourcesManager.ReadAssetConfig(b_path);
}
onback(totalSize, true);
}
/// <summary>
/// 解压下载的资源文件
/// </summary>
/// <param name="asset_config_list"></param>
/// <param name="onback"></param>
/// <returns></returns>
IEnumerator VersionUpdateUnZip(ArrayList asset_config_list, System.Action<bool> onback)
{
for (int i = 0; i < asset_config_list.Count; ++i)
{
var tem = asset_config_list[i] as Hashtable;
string b_path = "base/" + tem["name"].ToString();
ResourcesManager.ReadAssetConfig(b_path);
yield return null;
}
onback(true);
}
#if UNITY_ANDROID #if UNITY_ANDROID
IEnumerator DownApp(string appurl,string version) IEnumerator DownApp(string appurl,string version)
{ {

View File

@ -9,6 +9,7 @@ public class HotupdateWrap
L.BeginClass(typeof(Hotupdate), typeof(System.Object)); L.BeginClass(typeof(Hotupdate), typeof(System.Object));
L.RegFunction("GetLocalVersion", GetLocalVersion); L.RegFunction("GetLocalVersion", GetLocalVersion);
L.RegFunction("LoadAsset", LoadAsset); L.RegFunction("LoadAsset", LoadAsset);
L.RegFunction("LoadAssetSize", LoadAssetSize);
L.RegFunction("SetTipCallback", SetTipCallback); L.RegFunction("SetTipCallback", SetTipCallback);
L.RegFunction("New", _CreateHotupdate); L.RegFunction("New", _CreateHotupdate);
L.RegFunction("__tostring", ToLua.op_ToString); L.RegFunction("__tostring", ToLua.op_ToString);
@ -18,6 +19,7 @@ public class HotupdateWrap
L.RegVar("HideDetail", get_HideDetail, set_HideDetail); L.RegVar("HideDetail", get_HideDetail, set_HideDetail);
L.RegVar("Progress", get_Progress, set_Progress); L.RegVar("Progress", get_Progress, set_Progress);
L.RegVar("Done", get_Done, set_Done); L.RegVar("Done", get_Done, set_Done);
L.RegVar("Size", get_Size, set_Size);
L.EndClass(); L.EndClass();
} }
@ -90,6 +92,22 @@ public class HotupdateWrap
} }
} }
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int LoadAssetSize(IntPtr L)
{
try
{
ToLua.CheckArgsCount(L, 1);
Hotupdate obj = (Hotupdate)ToLua.CheckObject<Hotupdate>(L, 1);
obj.LoadAssetSize();
return 0;
}
catch (Exception e)
{
return LuaDLL.toluaL_exception(L, e);
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int SetTipCallback(IntPtr L) static int SetTipCallback(IntPtr L)
{ {
@ -221,6 +239,25 @@ public class HotupdateWrap
} }
} }
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int get_Size(IntPtr L)
{
object o = null;
try
{
o = ToLua.ToObject(L, 1);
Hotupdate obj = (Hotupdate)o;
float ret = obj.Size;
LuaDLL.lua_pushnumber(L, ret);
return 1;
}
catch(Exception e)
{
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Size on a nil value");
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int set_isBuild32lua(IntPtr L) static int set_isBuild32lua(IntPtr L)
{ {
@ -334,5 +371,24 @@ public class HotupdateWrap
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Done on a nil value"); return LuaDLL.toluaL_exception(L, e, o, "attempt to index Done on a nil value");
} }
} }
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int set_Size(IntPtr L)
{
object o = null;
try
{
o = ToLua.ToObject(L, 1);
Hotupdate obj = (Hotupdate)o;
float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
obj.Size = arg0;
return 0;
}
catch(Exception e)
{
return LuaDLL.toluaL_exception(L, e, o, "attempt to index Size on a nil value");
}
}
} }