Skip to content

Commit 1457587

Browse files
author
Vulpisfoglia_BOT_rev20250407
committed
[CN UPDATE] Client:2.7.11 Data:26-03-13-06-11-47_14fb99
1 parent 12e0a02 commit 1457587

54 files changed

Lines changed: 268147 additions & 162805 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

zh_CN/gamedata/[uc]lua/hotfixes/DefinedFix.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ local list =
77
"HotFixes/AutoChessUtilHotfixer",
88
"HotFixes/AdvancedSelectorWithEnemyOptionsHotfixer",
99
"HotFixes/PCHotfixer",
10+
"HotFixes/PCKeyDefaultRestoreHotfixer",
1011
"HotFixes/AbilityEventCounterHotfixer",
1112
"HotFixes/WangVisualStoneCtrlAbilityHotfixer"
1213
};
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
2+
local PCKeyDefaultRestoreHotfixer = Class("PCKeyDefaultRestoreHotfixer", HotfixBase)
3+
4+
local eutil = CS.Torappu.Lua.Util
5+
local _KEY = "KEYBOARD_DEFAULT_RESTORE_HOTFIX_V1"
6+
7+
local function IsNilOrEmpty(value)
8+
return value == nil or value == ""
9+
end
10+
11+
local function HasDone()
12+
return CS.UnityEngine.PlayerPrefs.GetInt("KEYBOARD_DEFAULT_RESTORE_HOTFIX_V1", 0) == 1
13+
end
14+
15+
local function MarkDone()
16+
CS.UnityEngine.PlayerPrefs.SetInt("KEYBOARD_DEFAULT_RESTORE_HOTFIX_V1", 1)
17+
CS.UnityEngine.PlayerPrefs.Save()
18+
end
19+
20+
local function TryRestore(self)
21+
if self == nil or HasDone() then
22+
return
23+
end
24+
25+
local displayData = CS.Torappu.DisplayMetaDB.data
26+
local gameData = displayData and displayData.pcKeyData
27+
local keySettingData = gameData and gameData.keySettingData
28+
if keySettingData == nil then
29+
return
30+
end
31+
32+
for groupId, groupData in pairs(keySettingData) do
33+
local itemList = groupData and groupData.itemList
34+
if not IsNilOrEmpty(groupId) and itemList ~= nil then
35+
for i = 0, itemList.Count - 1 do
36+
local itemData = itemList[i]
37+
if itemData ~= nil and itemData.canBeSet then
38+
local funcId = itemData.funcId
39+
local defaultKeyId = itemData.defaultKeyId
40+
if not IsNilOrEmpty(funcId) and not IsNilOrEmpty(defaultKeyId) then
41+
local currKey = self:GetKeyItemByFuncId(groupId, funcId)
42+
if currKey == nil then
43+
local config = CS.Torappu.KeyBoardVirtualButtonConfig(groupId, funcId)
44+
local conflict = self:GetConflictFuncInSetting(config, defaultKeyId)
45+
if conflict == nil then
46+
self:SetFuncKey(groupId, funcId, defaultKeyId)
47+
end
48+
end
49+
end
50+
end
51+
end
52+
end
53+
end
54+
55+
MarkDone()
56+
end
57+
58+
function PCKeyDefaultRestoreHotfixer:OnInit()
59+
if CS.Torappu.DeviceInfoUtil:IsPCMode() then
60+
self:Fix_ex(CS.Torappu.KeyEntityGroupBase.TorappuKeyBoardLogic, "LoadData", function(self)
61+
local okLoad, errLoad = xpcall(function()
62+
self:LoadData()
63+
TryRestore(self)
64+
end, debug.traceback)
65+
if not okLoad then
66+
eutil.LogHotfixError("[PCKeyDefaultRestoreHotfixer][LoadData]" .. tostring(errLoad))
67+
return
68+
end
69+
end)
70+
end
71+
end
72+
73+
return PCKeyDefaultRestoreHotfixer

0 commit comments

Comments
 (0)