Skip to content

Commit

Permalink
[CN UPDATE] Client:2.3.61 Data:24-08-30-10-37-03-474f83
Browse files Browse the repository at this point in the history
  • Loading branch information
MuelsyseBot_v1 committed Sep 2, 2024
1 parent 855b4b9 commit 9a47cf1
Show file tree
Hide file tree
Showing 99 changed files with 170,036 additions and 50,236 deletions.
2 changes: 1 addition & 1 deletion zh_CN/gamedata/[uc]lua/GlobalConfig.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GlobalConfig =
{
CUR_FUNC_VER = "V053",
CUR_FUNC_VER = "V054",
}


Expand Down
10 changes: 6 additions & 4 deletions zh_CN/gamedata/[uc]lua/base/network/UISender.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local rapidjson = require("rapidjson")
UISender = ModelMgr.DefineModel("UISender")

local ConcurrentType = CS.Torappu.UI.UISender.ConcurrentType
local CSLuaSender = CS.Torappu.Lua.LuaSender



Expand All @@ -23,12 +24,12 @@ local function _GenDefaultOptions()
end

function UISender:OnInit()
CS.Torappu.Lua.LuaSender.LuaOnlyBindCallback(self)
CSLuaSender.LuaOnlyBindCallback(self)
self.m_callbacks = {}
end

function UISender:OnDispose()
CS.Torappu.Lua.LuaSender.LuaOnlyBindCallback(nil)
CSLuaSender.LuaOnlyBindCallback(nil)
self.m_callbacks = nil
end

Expand All @@ -47,7 +48,7 @@ function UISender:SendGet(url, param, config)
useMask = config.useMask
end

local requestId = CS.Torappu.Lua.LuaSender.SendGet(url, param, useMask)
local requestId = CSLuaSender.SendGet(url, param, useMask)

local callback = {}
if config ~= nil then
Expand Down Expand Up @@ -75,6 +76,7 @@ end
function UISender:SendRequest(serviceCode, body, config)
local options = _GenDefaultOptions()

CSLuaSender.AchieveServiceMeta(serviceCode, body)
options.serviceCode = serviceCode
options.body = rapidjson.encode(body)
if config ~= nil then
Expand All @@ -90,7 +92,7 @@ function UISender:SendRequest(serviceCode, body, config)
options.overrideUrl = config.url
end

local requestId = CS.Torappu.Lua.LuaSender.SendRequest(options)
local requestId = CSLuaSender.SendRequest(options)

local callback = {}
if config ~= nil then
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@







local CollectionTaskListAdapter = Class("CollectionTaskListAdapter", UIRecycleAdapterBase);
local CollectionTimedTaskItem = require("Feature/Activity/Collection/CollectionTimedTaskItem");

function CollectionTaskListAdapter:ViewConstructor(objPool)
local missionItem = self:CreateWidgetByPrefab(CollectionTimedTaskItem, self._itemPrefab, self._container);
self:AddObj(missionItem, missionItem:RootGameObject());
return missionItem:RootGameObject();
end

function CollectionTaskListAdapter:OnRender(transform, index)
if #self.missionList <= 0 then
return;
end

local luaIndex = index + 1;
local missionData = self.missionList[luaIndex];
local item = self:GetWidget(transform.gameObject);
item:Refresh(missionData, self.actCfg);
end


function CollectionTaskListAdapter:GetTotalCount()
if self.missionList == nil then
return 0;
end
return #self.missionList;
end

return CollectionTaskListAdapter;
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@





local CollectionTaskListAdapter = require("Feature/Activity/Collection/CollectionTaskListAdapter")
CollectionTaskListDlg = DlgMgr.DefineDialog("CollectionTaskListDlg", "Activity/Collection/task_list_dlg");

function CollectionTaskListDlg:OnInit()
self.m_limitItems = {}
self.m_dailyItem = self:CreateWidgetByGO(CollectionDailyTaskItem, self._dailyItem);

self.m_listAdapter = self:CreateCustomComponent(CollectionTaskListAdapter, self._listAdapter, self);
self.m_listAdapter.missionList = {};
end

function CollectionTaskListDlg:OnClose()
Expand Down Expand Up @@ -44,43 +45,34 @@ function CollectionTaskListDlg:Refresh(activityId, close)
local missionData = CollectionActModel.me:FindMission(missionId);

if missionData then
local item = null;
if idx < #self.m_limitItems then
item = self.m_limitItems[idx+1];
else
item = self:CreateWidgetByPrefab(CollectionTimedTaskItem, self._limitItemPrefab);
table.insert(self.m_limitItems, item);
end

item:Refresh(missionData, actcfg);
table.insert(list, item);
table.insert(list, missionData);
end

end

local playerMissions = CS.Torappu.PlayerData.instance.data.mission.missions;
local suc, typeMissions = playerMissions:TryGetValue(CS.Torappu.MissionPlayerDataGroup.MissionTypeString.ACTIVITY);
if not suc then
return;
end

table.sort(list, function(a, b)
if a:Finished() == b:Finished() then
return a:SortId() < b:SortId();
end
return b:Finished();
end);

local co = coroutine.create(function()
for _, item in ipairs(list) do
item:CreateRewardIcon(actcfg);
item:RootGameObject().transform:SetParent(self._limitContainer, false);
coroutine.yield();
local comp = function(a, b)
local a_finish = self:_CheckMissionFinished(typeMissions, a.id);
local b_finish = self:_CheckMissionFinished(typeMissions, b.id);

if a_finish == b_finish then
return a.sortId < b.sortId;
end
end);
self:Frame(#list, self._RunCoroutine, co);
return b_finish;
end;

table.sort(list, comp);
self.m_listAdapter.missionList = list;
self.m_listAdapter.actCfg = actcfg;
self.m_listAdapter:NotifyDataSourceChanged();

self:_SynTime();
end

function CollectionTaskListDlg:_RunCoroutine(co)
coroutine.resume(co);
end

function CollectionTaskListDlg:_SynTime()

local time = CS.Torappu.DateTimeUtil.currentTime:AddHours(-1 * CS.Torappu.SharedConsts.GAME_DAY_DIVISION_HOUR);
Expand All @@ -91,3 +83,11 @@ function CollectionTaskListDlg:_SynTime()
local timeRemain = endTime - CS.Torappu.DateTimeUtil.currentTime;
self._limitTaskTimeLabel.text = CS.Torappu.Lua.Util.Format(CS.Torappu.StringRes.SHOP_REMAIN_COUNT, CS.Torappu.FormatUtil.FormatTimeDelta(timeRemain));
end




function CollectionTaskListDlg:_CheckMissionFinished(playerMissionDict, missionId)
local suc, state = playerMissionDict:TryGetValue(missionId);
return suc and state.state == CS.Torappu.MissionHoldingState.FINISHED;
end
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local ColorRes = CS.Torappu.ColorRes;



CollectionTimedTaskItem = Class("CollectionTimedTaskItem", UIWidget);
local CollectionTimedTaskItem = Class("CollectionTimedTaskItem", UIWidget);



Expand Down Expand Up @@ -123,4 +123,6 @@ end

function CollectionTimedTaskItem:SortId()
return self.m_sortId;
end
end

return CollectionTimedTaskItem;
6 changes: 2 additions & 4 deletions zh_CN/gamedata/[uc]lua/hotfixes/DefinedFix.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ local list =
{

"HotFixes/TestStubHotfixer",
"HotFixes/RemovableSharedRandomTileGlobalBuffHotfixer",
"HotFixes/NameCardEditHotfixer",
"HotFixes/CameraControllerHotfixer",
"HotFixes/SandboxBattleDataControllerHotfixer"
"HotFixes/SandboxBattleDataControllerHotfixer",
"HotFixes/SandboxCatchedAnimalManagerHotfixer"
};

return list;
Original file line number Diff line number Diff line change
@@ -1,114 +1,50 @@




local SandboxCatchedAnimalManagerHotfixer = Class("SandboxCatchedAnimalManagerHotfixer", HotfixBase)
local lua_hashSet = CS.System.Collections.Generic.HashSet(CS.System.Int32)
local lua_dict_StrInt = CS.System.Collections.Generic.Dictionary(CS.System.String, CS.System.Int32)

local function _Fix_OnFenceFinishInNormal(self, character)
self.m_roomTilesCache:Clear()
self.m_roomDiff:Clear()
for row = 0, self.m_mapHeight - 1 do
for col = 0, self.m_mapWidth - 1 do
if self:_IsFenceTile(row, col) then
self.m_roomTilesCache[self:_CatchedAnimalRoomId(row, col)] = self.m_catchedAnimalFlagMap:GetValue(row, col)
end
end
end

local tile = character.rootTile;
self.m_catchedAnimalFlagMap:SetValue(CS.XLua.Cast.Int32(0), tile.row, tile.col)
self:_RefreshCatchAnimalMap()
self:_RefreshCatchAnimalMapStatus()
self:_RefreshTrapFenceAnimatorSurround(tile.row, tile.col)

if self.output.catchedAnimals == nil or self.output.catchedAnimals.Count == 0 then
return
end
local FENCE_AREA_FLAG = -1;

local function DoResetFromCacheFix(self)
for row = 0, self.m_mapHeight - 1 do
for col = 0, self.m_mapWidth - 1 do
local tileId = self:_CatchedAnimalRoomId(row, col)
if self.m_roomTilesCache:ContainsKey(tileId) and self:_IsFenceTile(row, col) then
local oldRoomId = self.m_roomTilesCache[tileId]
local newRoomId = self.m_catchedAnimalFlagMap:GetValue(row, col)
if self.m_roomDiff:ContainsKey(oldRoomId) then
self.m_roomDiff[oldRoomId]:Add(newRoomId);
else
local roomDiff = lua_hashSet()
roomDiff:Add(newRoomId)
self.m_roomDiff:Add(oldRoomId, roomDiff)
local tile = CS.Torappu.Battle.Map.instance:GetTile(row, col)
if tile ~= nil then
local character = tile:GetCharacter()
if character ~= nil and character.rootTile ~= nil and character.rootTile == tile then
local flagValue
if self:_IsFenceTileId(character.id) then
flagValue = FENCE_AREA_FLAG;
else
flagValue = 0;
end
self.m_catchedAnimalFlagMap:SetValue(CS.XLua.Cast.Int32(flagValue), row, col);
end
end
end
end

self.m_catchedAnimalCache:Clear();
for k, v in pairs(self.output.catchedAnimals) do
self.m_catchedAnimalCache:Add(k, v)
for i = self.m_catchedAnimals.Count - 1, 0, -1 do
local enemy = self.m_catchedAnimals:Get(i).Key
enemy:FinishWithNoReason()
end
self.output.catchedAnimals:Clear();
self.m_animalCountInRoom:Clear()

for animalCacheKey, _animalCacheValue in pairs(self.m_catchedAnimalCache) do
local animalCacheValue = {}
for k, v in pairs(_animalCacheValue) do
animalCacheValue[k] = v
end

if self.m_roomDiff:ContainsKey(animalCacheKey) then
local newRoomIds = self.m_roomDiff[animalCacheKey]
for k, v in pairs(newRoomIds) do
local newRoomId = v
local roomAnimalCountTmp = {}
for animalCacheValue_k, animalCacheValue_v in pairs(animalCacheValue) do
roomAnimalCountTmp[animalCacheValue_k] = animalCacheValue_v
end

for roomAnimalCountTmp_k, roomAnimalCountTmp_v in pairs(roomAnimalCountTmp) do
if roomAnimalCountTmp_v > 0 then
local addCount = self:_RegisterAnimalInRoom(newRoomId, roomAnimalCountTmp_v)
if addCount <= 0 then
break
end

if self.output.catchedAnimals:ContainsKey(newRoomId) then
if self.output.catchedAnimals[newRoomId]:ContainsKey(roomAnimalCountTmp_k) then
local newCount = self.output.catchedAnimals[newRoomId][roomAnimalCountTmp_k] + addCount
self.output.catchedAnimals[newRoomId][roomAnimalCountTmp_k] = newCount
else
self.output.catchedAnimals[newRoomId]:Add(roomAnimalCountTmp_k, addCount)
end
else
local catchAnimalNew = lua_dict_StrInt()
catchAnimalNew:Add(roomAnimalCountTmp_k, addCount)
self.output.catchedAnimals:Add(newRoomId, catchAnimalNew)
end

local restCount = roomAnimalCountTmp_v - addCount;
animalCacheValue[roomAnimalCountTmp_k] = restCount
if restCount > 0 then
break
end
end
end
end
end
self.m_catchedAnimals:Clear()
self.m_catchedAnimalFenceId:Clear()
self:_ParseCatchedAnimals(self.m_catchedAnimalCache)
for key, value in pairs(self.m_catchedAnimalCardCount) do
self:_ForceChargeCatchedAnimalCard(key, value);
end
end

function SandboxCatchedAnimalManagerHotfixer:OnInit()
xlua.private_accessible(CS.Torappu.Battle.Sandbox.SandboxCatchedAnimalManager)
self:Fix_ex(CS.Torappu.Battle.Sandbox.SandboxCatchedAnimalManager, "_OnFenceFinishInNormal", function(self, character)
local ok, ret = xpcall(_Fix_OnFenceFinishInNormal, debug.traceback, self, character)
xlua.private_accessible(CS.Torappu.Battle.Character)
self:Fix_ex(CS.Torappu.Battle.Sandbox.SandboxCatchedAnimalManager, "DoResetFromCache", function(self)
local ok, errorInfo = xpcall(DoResetFromCacheFix, debug.traceback, self)
if not ok then
LogError("[Hotfix] failed to _Fix_OnFenceFinishInNormal : " .. ret)
return self:_OnFenceFinishInNormal(character)
else
return ret
LogError("[SandboxCatchedAnimalManagerHotfixer] fix" .. errorInfo)
end
end)
end

function SandboxCatchedAnimalManagerHotfixer:OnDispose()
end

return SandboxCatchedAnimalManagerHotfixer
Loading

0 comments on commit 9a47cf1

Please sign in to comment.