257 lines
9.2 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
require("Script.Global.DefaultSettings")
WidgetConfig = WidgetConfig or {}
-- UI 类型
WidgetConfig.EUIType = {
Default = 0,
AllWeapon = 1,
Main = 2,
FaceNotice = 3,
-- Tips1 = 4,
GameEnd = 5,
AllWeapon_Spectator = 9,
CustomSelectWeapon = 10,
2025-01-18 21:14:32 +08:00
--ShowCustomSelectWeaponBtn = 11,
2025-01-04 23:00:19 +08:00
GameRecord = 12,
ShowRankInheritance = 13,
RankingListBtn = 14,
ShowPK = 1001,
TipSlidingTackle = 1002,
SelectWeaponNew = 1003,
SecondaryConfirmation = 1004,
WeaponConfiguration = 1005,
2025-01-04 23:00:19 +08:00
}
if not UE_SERVER then
--- 直接加载
WidgetConfig.DirectLoad = {
[WidgetConfig.EUIType.AllWeapon] = true,
[WidgetConfig.EUIType.AllWeapon_Spectator] = true,
};
--- 观战配置
WidgetConfig.SpectorConfig = {
--[WidgetConfig.EUIType.AllWeapon] = false,
[WidgetConfig.EUIType.AllWeapon_Spectator] = true;
};
WidgetConfig.ShowMainBaseUI = {
NavigatorPanel = false, -- 导航面板
Image_0 = false, -- 导航指针
CanvasPanel_FreeCamera = true, -- 小眼睛
CanvasPanel_MiniMapAndSetting = true, -- 小地图
CanvasPanelSurviveKill = true, -- 剩余人数
Border_TopPlatformTipsColor = false, -- 顶部平台击杀提示
PlayerInfoSocket = true, -- 血条信息
SurviveInfoPanel = false, -- 存活人数
InvalidationBox_3 = true, -- 击杀/剩余, 背包,游戏Logo
ChatAndChatPanelCanvas = true, -- 聊天A
CanvasPanel_BackpackPanel = false, -- 背包
Backpack_Border = false, -- 背包
CanvasPanel_BackpackSlot = false, -- 背包
CanvasPanel_IDPanel = true, -- 玩家 ID左下角
};
WidgetConfig.BackpackUIs = {
CanvasPanel_BackpackPanel = 1, -- 背包
Backpack_Border = 1, -- 背包
CanvasPanel_BackpackSlot = 1, -- 背包
}
WidgetConfig.ShowShootingUI = {
NewbieGuideCanvas = true, -- SwimControl
Fade = true, -- SwimControl
SwitchWeaponSlot_Mode2 = true, -- 武器栏1
SwitchWeaponSlot_Mode2_C_0 = true, -- 武器栏2
CustomProne = true, -- 卧倒
CustomCrouch = true, -- 蹲下
CustomFireBtnL = true, -- 攻击左
CustomFireBtnR = true, -- 攻击右
CustomSprint = true, -- 疾跑
CustomReload = true, -- 换弹
Ingame_TeamPanel_BP = true, -- 队伍
};
--- 针对全局观战和好友观战玩家的显示
WidgetConfig.Spectator_MainUI = {
CanvasPanel_MiniMapAndSetting = false;
}
WidgetConfig.Ingame_TeamPanel = {
Canvas_Border_Team = true, -- 组队和队友信息
}
function WidgetConfig.ShowExpressionUI()
local QuickExpressionUIBPClass = UE.LoadClass("/Game/BluePrints/ControlInput/IngameUI/QuickExpressionUIBP.QuickExpressionUIBP_C")
if QuickExpressionUIBPClass then
UGCLogSystem.Log("[WidgetConfig.ShowExpressionUI] QuickExpressionUIBPClass is true")
local UI_QuickExpressionUIBP = UserWidget.NewWidgetObjectBP(LocalPlayerController, QuickExpressionUIBPClass)
-- MainControlBaseUI.CanvasPanel_Main:AddChild(UI_QuickExpressionUIBP)
UI_QuickExpressionUIBP:AddToViewport(10000);
UGCLogSystem.Log("[WidgetConfig.ShowExpressionUI]")
else
UGCLogSystem.Log("[WidgetConfig.ShowExpressionUI] QuickExpressionUIBPClass is nil")
end
end
-- 默认UI的隐藏
---@param InShow bool
function WidgetConfig.HideDefaultUI(InShow)
---@type MainControlPanelTochButton_C
local MainControlPanel = GameBusinessManager.GetWidgetFromName(ingame, "MainControlPanelTochButton_C");
if MainControlPanel ~= nil then
---@type MainControlBaseUI_C
local MainControlBaseUI = MainControlPanel.MainControlBaseUI;
local Show = not InShow;
if MainControlBaseUI then
for i, v in pairs(WidgetConfig.ShowMainBaseUI) do
local Item = MainControlBaseUI[i];
--- 如果是观战玩家,不显示小地图
if Item then
if WidgetConfig.BackpackUIs[i] ~= nil then
if not DefaultSettings.EnableTest then
local IsShow = v;
if LocalIsGlobalSpectator then
IsShow = WidgetConfig.Spectator_MainUI[i] or IsShow;
end
UITool.ShowUI(IsShow, Item);
end
else
local IsShow = v;
if LocalIsGlobalSpectator then
IsShow = WidgetConfig.Spectator_MainUI[i] or IsShow;
end
UITool.ShowUI(IsShow, Item);
end
end
end
end
local ShootingUIPanel = MainControlPanel.ShootingUIPanel;
for i, v in pairs(WidgetConfig.ShowShootingUI) do
local Item = ShootingUIPanel[i];
if Item then UITool.ShowUI(v, Item); end
end
else
UGCLogSystem.Log('[UIUtils.ShowDefaultHUD] 无法加载 MainControlPanel');
end
--- 显示表情UI
--WidgetConfig.ShowExpressionUI()
end
WidgetConfig.EUILayerGroup = {
Negative = -1,
Least = 0,
Bottom = 1,
Low = 2,
Low1 = 3,
Up = 10001,
MainUI = 10003,
Medium = 10010,
High = 10020,
Top = 10030,
Topper = 10040,
Toppest = 10080,
Notice = 10200,
Spector = 10100, -- 跟原生的观战界面是平级的
OverSpector = 10101,
HigherSpector = 10105;
};
WidgetConfig.AddedLayerConfig = {
[WidgetConfig.EUIType.GameEnd] = WidgetConfig.EUILayerGroup.OverSpector + 1;
}
---@return table<EUIType, HUDConfigItem> key: int32 value: HUDConfigStruct
WidgetConfig.HUDConfig = {
[WidgetConfig.EUIType.Main] = {
Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/WB_Main.WB_Main_C'),
-- 是否仅显示一次
bShowOnce = true,
Layer = WidgetConfig.EUILayerGroup.Low,
bAddToTouch = true;
},
[WidgetConfig.EUIType.GameEnd] = {
Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/GameEnd/WB_GameEnd.WB_GameEnd_C'),
-- 是否仅显示一次
bShowOnce = false,
Layer = WidgetConfig.EUILayerGroup.Up + 1,
},
[WidgetConfig.EUIType.AllWeapon] = {
Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/SelectWeapons/WB_SelectAllWeapon.WB_SelectAllWeapon_C'),
-- 是否仅显示一次
bShowOnce = true,
Layer = WidgetConfig.EUILayerGroup.MainUI,
},
[WidgetConfig.EUIType.AllWeapon_Spectator] = {
Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/SelectWeapons/WB_SpectatorSelectWeapon.WB_SpectatorSelectWeapon_C'),
-- 是否仅显示一次
bShowOnce = true,
Layer = WidgetConfig.EUILayerGroup.OverSpector,
},
[WidgetConfig.EUIType.CustomSelectWeapon] = {
Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/SelectWeapons/WB_CustomWeapon_New.WB_CustomWeapon_New_C'),
-- 是否仅显示一次
bShowOnce = false,
Layer = WidgetConfig.EUILayerGroup.Medium,
},
[WidgetConfig.EUIType.SelectWeaponNew] = {
2025-01-18 21:26:02 +08:00
Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/SelectWeapons/WB_WeaponSelect_New.WB_WeaponSelect_New_C'),
2025-01-04 23:00:19 +08:00
-- 是否仅显示一次
bShowOnce = false,
Layer = WidgetConfig.EUILayerGroup.MainUI,
},
[WidgetConfig.EUIType.SecondaryConfirmation] = {
Widget = UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/SecondaryConfirmation/WB_SecondaryConfirmation.WB_SecondaryConfirmation_C'),
Layer = WidgetConfig.EUILayerGroup.Notice,
ShowOnce = false,
},
[WidgetConfig.EUIType.GameRecord] = {
Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/GameRecord/WB_GameRecord.WB_GameRecord_C'),
-- 是否仅显示一次
bShowOnce = false,
Layer = WidgetConfig.EUILayerGroup.HigherSpector,
},
[WidgetConfig.EUIType.ShowRankInheritance] = {
Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/CompetitionSeason/WB_ShowRankInheritance.WB_ShowRankInheritance_C'),
-- 是否仅显示一次
bShowOnce = true,
Layer = WidgetConfig.EUILayerGroup.MainUI + 1,
},
[WidgetConfig.EUIType.ShowPK] = {
Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/CompetitionSeason/WB_ShowVSPlayerInfo.WB_ShowVSPlayerInfo_C'),
-- 是否仅显示一次
bShowOnce = true,
Layer = WidgetConfig.EUILayerGroup.High,
},
[WidgetConfig.EUIType.TipSlidingTackle] = {
Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/Tip/WB_TipSlidingTackle.WB_TipSlidingTackle_C'),
-- 是否仅显示一次
bShowOnce = true,
Layer = WidgetConfig.EUILayerGroup.High,
},
[WidgetConfig.EUIType.RankingListBtn] = {
Path = UGCGameSystem.GetUGCResourcesFullPath('ExtendResource/RankingList/OfficialPackage/Asset/RankingList/Blueprint/WBP_RankingListBtn.WBP_RankingListBtn_C'),
-- 是否仅显示一次
bShowOnce = false,
Layer = WidgetConfig.EUILayerGroup.High,
},
2025-01-15 03:21:37 +08:00
[WidgetConfig.EUIType.WeaponConfiguration] = {
Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/SelectWeapons/WeaponConfiguration/WB_WeaponConfiguration.WB_WeaponConfiguration_C'),
-- 是否仅显示一次
bShowOnce = false,
Layer = WidgetConfig.EUILayerGroup.High,
},
2025-01-04 23:00:19 +08:00
}
end
return WidgetConfig