diff --git a/SoloKing/Asset/UGCLayout_BP.uasset b/SoloKing/Asset/UGCLayout_BP.uasset index eeb109de..d3777670 100644 Binary files a/SoloKing/Asset/UGCLayout_BP.uasset and b/SoloKing/Asset/UGCLayout_BP.uasset differ diff --git a/SoloKing/Asset/UI/SelectWeapons/WeaponConfiguration/WB_WeaponConfiguration.uasset b/SoloKing/Asset/UI/SelectWeapons/WeaponConfiguration/WB_WeaponConfiguration.uasset index cbf61b5d..4c02709c 100644 Binary files a/SoloKing/Asset/UI/SelectWeapons/WeaponConfiguration/WB_WeaponConfiguration.uasset and b/SoloKing/Asset/UI/SelectWeapons/WeaponConfiguration/WB_WeaponConfiguration.uasset differ diff --git a/SoloKing/Asset/UI/Tool/WB_OpenOldWeaponParts.uasset b/SoloKing/Asset/UI/Tool/WB_OpenOldWeaponParts.uasset new file mode 100644 index 00000000..bc6b2993 Binary files /dev/null and b/SoloKing/Asset/UI/Tool/WB_OpenOldWeaponParts.uasset differ diff --git a/SoloKing/Asset/UI/WB_Main.uasset b/SoloKing/Asset/UI/WB_Main.uasset index ee73eca5..ebad11b9 100644 Binary files a/SoloKing/Asset/UI/WB_Main.uasset and b/SoloKing/Asset/UI/WB_Main.uasset differ diff --git a/SoloKing/DeleteFiles.txt b/SoloKing/DeleteFiles.txt index ff66f7b9..e69de29b 100644 --- a/SoloKing/DeleteFiles.txt +++ b/SoloKing/DeleteFiles.txt @@ -1,17 +0,0 @@ -SoloKing/Script/Global/Tool/StateMachine.lua -SoloKing/Script/Global/RepData.lua -SoloKing/Script/Global/Plugin/Plugins/MapTool.lua -SoloKing/Script/Global/Plugin/Plugins/BuffManager_PC.lua -SoloKing/Script/Global/Plugin/Plugins/MiniConfig.lua -SoloKing/Script/Global/Plugin/Plugins/ArchiveManager.lua -SoloKing/Script/Global/Plugin/Plugins/SkillConfig.lua -SoloKing/Script/Global/Plugin/Plugins/PoisonManager.lua -SoloKing/Script/Global/Plugin/Plugins/ServerTimeManager.lua -SoloKing/Script/Global/Plugin/Plugins/Skill/Skill_Base.lua -SoloKing/Script/Global/Plugin/Plugins/BuffConfig.lua -SoloKing/Script/Global/Plugin/Plugins/BuffManager.lua -SoloKing/Script/Global/Plugin/Plugins/Buff/Buff_Base.lua -SoloKing/Script/Global/Plugin/Plugins/SkillManager.lua -SoloKing/Script/Global/Plugin/PluginConfig.lua -SoloKing/Script/Global/Plugin/PluginManager.lua -SoloKing/Script/Global/Plugin/MiniManager.lua diff --git a/SoloKing/Script/Blueprint/UGCPlayerController.lua b/SoloKing/Script/Blueprint/UGCPlayerController.lua index 5a6992ed..22b4442a 100644 --- a/SoloKing/Script/Blueprint/UGCPlayerController.lua +++ b/SoloKing/Script/Blueprint/UGCPlayerController.lua @@ -194,6 +194,7 @@ function UGCPlayerController:GetEnableDamageText() if not table.isEmpty(Archive) and not table.isEmpty(Archive.Disables) and Archive.Disables.DamageText ~= nil then self.EnableDamageText = Archive.Disables.DamageText end + return self.EnableDamageText; end --- 处理切换观战对象 diff --git a/SoloKing/Script/Blueprint/UGCPlayerPawn.lua b/SoloKing/Script/Blueprint/UGCPlayerPawn.lua index b43628e3..6f77e698 100644 --- a/SoloKing/Script/Blueprint/UGCPlayerPawn.lua +++ b/SoloKing/Script/Blueprint/UGCPlayerPawn.lua @@ -9,32 +9,15 @@ function UGCPlayerPawn:ReceiveBeginPlay() self.bVaultIsOpen = DefaultSettings.OpenVault; self.DamageNotifyDelegate:Add(self.PlayerInjury, self) - - --- 仅客户端 - --self.OnCharacterShootDelegate:Add(function(Pawn, Weapon) - -- UGCLogSystem.Log("[UGCPlayerPawn:ReceiveBeginPlay] %s 开始射击", UE.GetName(Weapon)); - --end, self); - - --self.OnCharacterStartFireDelegate:Add(function(Pawn, Weapon) - -- UGCLogSystem.Log("[UGCPlayerPawn:ReceiveBeginPlay] Weapon = %s 开火", UE.GetName(Weapon)) - --end, self) end ---function UGCPlayerPawn:ReceiveTick(DeltaTime) --- self.SuperClass.ReceiveTick(self, DeltaTime); ---end - function UGCPlayerPawn:ReceiveEndPlay() if GlobalTickTool then GlobalTickTool:RemoveTickByOwner(self) end self.SuperClass.ReceiveEndPlay(self); end ---function UGCPlayerPawn:GetReplicatedProperties() --- return; ---end - function UGCPlayerPawn:GetAvailableServerRPCs() - return "UpdateWeaponParts" + return "UpdateWeaponParts", "ReplacePartId" end function UGCPlayerPawn:ReceivePossessed(NewController) @@ -227,14 +210,31 @@ UGCPlayerPawn.SlotWeapons = {}; ---@param Weapons table 插槽武器 function UGCPlayerPawn:UpdateSlotWeapons(Weapons) + self.SlotWeapons = TableHelper.DeepCopyTable(Weapons); for i = 0, ESurviveWeaponPropSlot.SWPS_Max do if self.SlotWeapons[i] then self:CheckHasSlotWeapon(i, self.SlotWeapons[i]); end end + self:AddAllTelescopes(); self:CheckSlotWeapons(); - +end + +function UGCPlayerPawn:AddAllTelescopes() + local AllDatas = UGCBackPackSystem.GetAllItemData(self) + local HadTeles = {}; + for i, v in pairs(AllDatas) do + if GetItemIdType(v.ItemID) == 203 then + HadTeles[v.ItemID] = v.Count; + end + end + -- 直接给他所有的配件 + for i, v in pairs(WeaponTypeParts[EWeaponPartType.Telescope]) do + if HadTeles[v] == nil then + ItemTool.AddItem(self, v, 1, false); + end + end end --- 通过插槽检查武器,需要先配置好之后再启动,该方法仅限两把武器,如果只有一把武器,SlotWeapons的第一个值必须为 SWPS_MainShootWeapon1 @@ -346,14 +346,14 @@ function UGCPlayerPawn:UpdateWeaponParts(WeaponID, WeaponParts) end end - UnrealNetwork.CallUnrealRPC(self:GetPlayerControllerSafety(), self, "RecvWeaponParts", WeaponID, WeaponParts); + UnrealNetwork.CallUnrealRPC(self:GetPlayerControllerSafety(), self, "RecvParts", WeaponID, WeaponParts); end -function UGCPlayerPawn:RecvWeaponParts(WeaponID, Parts) +function UGCPlayerPawn:RecvParts(WeaponID, Parts) if table.isEmpty(ArchiveTable[LocalPlayerKey]) then ArchiveTable[LocalPlayerKey] = {}; end if table.isEmpty(ArchiveTable[LocalPlayerKey].Weapons) then ArchiveTable[LocalPlayerKey].Weapons = {}; end ArchiveTable[LocalPlayerKey].Weapons[WeaponID] = Parts; - UGCLogSystem.LogTree(string.format("[UGCPlayerPawn:RecvWeaponParts] Parts ="), Parts) + UGCLogSystem.LogTree(string.format("[UGCPlayerPawn:RecvParts] Parts ="), Parts) UGCEventSystem.SendEvent(EventTypes.UpdateWeapons, WeaponID) end diff --git a/SoloKing/Script/Global/EventTypes.lua b/SoloKing/Script/Global/EventTypes.lua index 4d236ffa..3ee1accc 100644 --- a/SoloKing/Script/Global/EventTypes.lua +++ b/SoloKing/Script/Global/EventTypes.lua @@ -40,4 +40,6 @@ EventTypes = EventTypes or { AllSelectWeaponsAlready = CountTable(); -- 所有存档数据准备就绪 UpdateEnterWeapons = CountTable(); -- 所有存档数据准备就绪 UpdateWeapons = CountTable(); -- 所有存档数据准备就绪 + + OpenOldWeaponParts = CountTable(); -- 所有存档数据准备就绪 } diff --git a/SoloKing/Script/Global/Mini/MiniManager.lua b/SoloKing/Script/Global/Mini/MiniManager.lua index 8cc65e73..c25be25a 100644 --- a/SoloKing/Script/Global/Mini/MiniManager.lua +++ b/SoloKing/Script/Global/Mini/MiniManager.lua @@ -546,8 +546,10 @@ function MiniManager:OnMiniRoundFormalStart() end function MiniManager:OnMiniRoundEnd() - if self.CurrMiniMode.bGameEnd == false and self.CurrMiniMode.bRoundEnd == false then - table.func(self.CurrMiniMode, "OnTimeExhausted", self.State) + if self.State == MiniGameState.ROUND_GAMING then + if self.CurrMiniMode.bGameEnd == false and self.CurrMiniMode.bRoundEnd == false then + table.func(self.CurrMiniMode, "OnTimeExhausted", self.State) + end end -- 通知结束了 UGCLogSystem.Log("[MiniManager:OnMiniRoundEnd] 结束") @@ -627,36 +629,6 @@ function MiniManager:OnPawnInit(Pawn) end end ---- 修改伤害函数 ----@param DamagedActor UGCPlayerPawn_C ----@param Damage float ----@param DamageType EDamageType ----@param EventInstigator UGCPlayerController_C ---function MiniManager:OnPlayerDamage(DamagedActor, Damage, DamageType, EventInstigator) --- UGCLogSystem.Log("[MiniManager:OnPlayerDamage] DamagedActor = %s, Damage = %f", UE.GetName(DamagedActor), Damage); --- local CalDamage = table.func(self.CurrMiniMode, 'OnPlayerTakeDamage', DamagedActor, Damage, DamageType, EventInstigator) --- if CalDamage == nil then return Damage; end --- return CalDamage; ---end - ---- S & C 接受到伤害函数 ---function MiniManager:BPReceiveDamage(DamagedActor, Damage, DamageType, InstigatedBy, DamageCauser) --- if IsServer then --- table.func(self.CurrMiniMode, 'BPReceiveDamage', DamagedActor, Damage, DamageType, InstigatedBy, DamageCauser) --- end ---end - ---- 服务器/客户端收到伤害数据 ----@param DamagedPawn UGCPlayerPawn_C ----@param Damage float ----@param DamageType UDamageType ----@param InstigatedBy UGCPlayerController_C ----@param DamageCauser AActor ---function MiniManager:ReceiveDamage(DamagedPawn, Damage, DamageType, InstigatedBy, DamageCauser) --- UGCLogSystem.Log("[MiniManager:ReceiveDamage] 收到伤害") --- table.func(self.CurrMiniMode, "ReceiveDamage", DamagedPawn, Damage, DamageType, InstigatedBy, DamageCauser); ---end - --- 当玩家死亡 ---@param DeadPlayerKey PlayerKey ---@param KillerPlayerKey PlayerKey diff --git a/SoloKing/Script/Global/Mini/Script/Mini_Solo.lua b/SoloKing/Script/Global/Mini/Script/Mini_Solo.lua index 67ad34b6..4451041b 100644 --- a/SoloKing/Script/Global/Mini/Script/Mini_Solo.lua +++ b/SoloKing/Script/Global/Mini/Script/Mini_Solo.lua @@ -539,6 +539,7 @@ function Mini_Solo:CheckTimeExhausted_Health() end end local Count = table.getCount(Table); + if Count == 0 then return nil; end if Count == 1 then return Table[1].PlayerKey; end table.sort(Table, function(a, b) return a.Health > b.Health; @@ -1642,7 +1643,33 @@ function Mini_Solo:PlayerAddWeapon(PlayerKey, Weapon) -- 检查当前武器上是否有倍镜 for i, v in pairs(NeedAddTelescope) do - --Pawn:AddItem(i, ); + Pawn:AddItem(i, 1, false); + end + + -- 判断武器上原本是否有该配件 + if ArchiveTable[PlayerKey] and ArchiveTable[PlayerKey].Weapons[Weapon] then + if WeaponSuits[Weapon] then + if WeaponSuits[Weapon][EWeaponPartType.Telescope] then + local HaveParts = {}; + for i, PartID in pairs(WeaponSuits[Weapon][EWeaponPartType.Telescope]) do + HaveParts[PartID] = 1; + end + local Parts = ArchiveTable[PlayerKey].Weapons[Weapon]; + -- 判断是否有倍镜 + local HavePart = false; + for i, PartID in pairs(Parts) do + if HaveParts[PartID] then HavePart = true; end + end + + -- 移除 + if not HavePart then + local Weapons = ItemTool.GetWeaponsById(Pawn, Weapon) + for i, v in pairs(Weapons) do + UGCGunSystem.RemoveGunAttachmentBySocketType(v, ItemTool.GetWeaponAttachmentSocketType(EWeaponPartType.Telescope)); + end + end + end + end end -- 启动检测 @@ -1655,16 +1682,6 @@ function Mini_Solo:PlayerAddWeapon(PlayerKey, Weapon) end end ---- 服务器/客户端收到伤害数据 ----@param DamagedPawn UGCPlayerPawn_C ----@param Damage float ----@param DamageType UDamageType ----@param InstigatedBy UGCPlayerController_C ----@param DamageCauser AActor -function Mini_Solo:ReceiveDamage(DamagedPawn, Damage, DamageType, InstigatedBy, DamageCauser) - return Damage; -end - ---@param PlayerStartList table> ---@param Controller UGCPlayerController_C function Mini_Solo:SelectPlayerStart(PlayerStartList, Controller) diff --git a/SoloKing/Script/Global/Table/A_TableInclude.lua b/SoloKing/Script/Global/Table/A_TableInclude.lua index 713df6db..d97ad3b9 100644 --- a/SoloKing/Script/Global/Table/A_TableInclude.lua +++ b/SoloKing/Script/Global/Table/A_TableInclude.lua @@ -15,11 +15,9 @@ require(Prefix .. 'RankInformation' .. Post) function UnableTable() ObjectPath = nil; - WeaponTable = nil; EWeaponTypes = nil; EWeaponIdType = nil; WeaponTypeInfo = nil; - WeaponTable = nil; EnglishNamedWeapon = nil; ShootWeaponEnums = nil; EFillBulletType = nil; diff --git a/SoloKing/Script/Global/Tool/A_ToolInclude.lua b/SoloKing/Script/Global/Tool/A_ToolInclude.lua index 9b1c8682..9ebf1d3e 100644 --- a/SoloKing/Script/Global/Tool/A_ToolInclude.lua +++ b/SoloKing/Script/Global/Tool/A_ToolInclude.lua @@ -20,9 +20,6 @@ require(Prefix .. 'SoundSystem') require(Prefix .. 'GlobalInit') require(Prefix .. 'UGCEventSystem') require(Prefix .. 'GlobalTickTool') -require(Prefix .. 'GlobalBeginTool') -require(Prefix .. 'json') - require(Prefix .. 'UGCSystemLibrary') require(Prefix .. 'MyWeaponSystem') @@ -33,11 +30,11 @@ require(Prefix .. 'WidgetLibrary') if DefaultSettings.EnableTest then require(Prefix .. 'TestTool') - for i, v in pairs(TestTool) do - if type(v) == 'function' then - v(TestTool); - end - end + --for i, v in pairs(TestTool) do + -- if type(v) == 'function' then + -- v(TestTool); + -- end + --end end diff --git a/SoloKing/Script/Global/Tool/UETool.lua b/SoloKing/Script/Global/Tool/UETool.lua index 4f91944a..a8ae5ac7 100644 --- a/SoloKing/Script/Global/Tool/UETool.lua +++ b/SoloKing/Script/Global/Tool/UETool.lua @@ -117,21 +117,18 @@ function UE.InitArchiveData() return { TotalGameTimes = 0; -- 经典模式游玩次数,同步 GameTimes = 0, -- 游玩次数(包含所有模式)不同步 - Weapons = {}, -- 武器配件 不同步 + Weapons = {}, -- 武器配件 Score = DefaultSettings.RankScore, -- 默认 2000分 同步 WinTimes = 0, -- 一共获胜次数 不同步 GameWinTimes = 0, -- 经典模式获胜次数 同步 - Kill = 0, -- 总击杀数 同步 Dead = 0, -- 总死亡数 同步 - HideScore = 0, -- 隐藏分 同步 Disables = {}; -- 最后十局战绩 Last10Games = {}, -- 历史十局 同步 - CurSeason = 0; -- 默认赛季 不同步 --- 赛季信息 Seasons = {}; -- 历史赛季 同步 @@ -144,6 +141,8 @@ function UE.InitArchiveData() NoSelectMaps = {}; -- 没有选择的地图 EnterWeaponIndex = nil; -- 娱乐模式的之前选择的 Index EnterWeapons = {}; -- 娱乐模式保存的武器 + + bOldParts = nil, -- 是否默认开启之前的武器配件配置 }; end diff --git a/SoloKing/Script/UI/SelectWeapons/WeaponConfiguration/WB_WeaponConfiguration.lua b/SoloKing/Script/UI/SelectWeapons/WeaponConfiguration/WB_WeaponConfiguration.lua index d90bd470..7e925e3f 100644 --- a/SoloKing/Script/UI/SelectWeapons/WeaponConfiguration/WB_WeaponConfiguration.lua +++ b/SoloKing/Script/UI/SelectWeapons/WeaponConfiguration/WB_WeaponConfiguration.lua @@ -14,6 +14,7 @@ ---@field TextBlock_Parts UTextBlock ---@field TextBlock_WeaponName UTextBlock ---@field WB_DamageTextButton UWB_DamageTextButton_C +---@field WB_OpenOldWeaponParts UWB_OpenOldWeaponParts_C --Edit Below-- local WB_WeaponConfiguration = { bInitDoOnce = false; @@ -66,6 +67,8 @@ function WB_WeaponConfiguration:LuaInit() Item:SetSelectStyle(1) Item:BindSelectCallBack(self.ClickSelectPart, self) end + + self.WB_OpenOldWeaponParts:LuaInit(); end function WB_WeaponConfiguration:CloseSelf() diff --git a/SoloKing/Script/UI/Tool/WB_OpenOldWeaponParts.lua b/SoloKing/Script/UI/Tool/WB_OpenOldWeaponParts.lua new file mode 100644 index 00000000..66c8547c --- /dev/null +++ b/SoloKing/Script/UI/Tool/WB_OpenOldWeaponParts.lua @@ -0,0 +1,37 @@ +---@class WB_OpenOldWeaponParts_C:UUserWidget +---@field NewButton_Shovel UNewButton +---@field WidgetSwitcher_ChangeShovel UWidgetSwitcher +--Edit Below-- +---@type WB_OpenOldWeaponParts_C +local WB_OpenOldWeaponParts = { bInitDoOnce = false } + +function WB_OpenOldWeaponParts:Construct() + self:LuaInit(); +end + +function WB_OpenOldWeaponParts:LuaInit() + if self.bInitDoOnce then return ; end + self.bInitDoOnce = true; + + UITool.BindButtonClicked(self.NewButton_Shovel, self.OnClickButton, self) + + UGCEventSystem.AddListener(EventTypes.OpenOldWeaponParts, self.OnOpenOldWeaponParts, self) + if ArchiveTable[LocalPlayerKey] and ArchiveTable[LocalPlayerKey].bOldParts then + self:OnOpenOldWeaponParts(ArchiveTable[LocalPlayerKey].bOldParts); + end +end + +function WB_OpenOldWeaponParts:OnOpenOldWeaponParts(IsEnable) + self.bOldParts = IsEnable; + self.WidgetSwitcher_ChangeShovel:SetActiveWidgetIndex(IsEnable and 1 or 0); +end + +WB_OpenOldWeaponParts.bOldParts = false; + +function WB_OpenOldWeaponParts:OnClickButton() + UGCLogSystem.Log("[WB_DamageTextButton:OnClickButton] 点击") + self:OnOpenOldWeaponParts(not self.bOldParts); + UGCEventSystem.SendEvent(EventTypes.OpenOldWeaponParts, self.bOldParts); +end + +return WB_OpenOldWeaponParts \ No newline at end of file diff --git a/SoloKing/Script/UI/WB_Main.lua b/SoloKing/Script/UI/WB_Main.lua index b267dcdf..0f9cef0f 100644 --- a/SoloKing/Script/UI/WB_Main.lua +++ b/SoloKing/Script/UI/WB_Main.lua @@ -5,6 +5,7 @@ ---@field Button_Test_Custom UButton ---@field Button_TestSide UButton ---@field CanvasPanel_Test UCanvasPanel +---@field CustomizeCanvasPanel_BP_C_4 UCustomizeCanvasPanel_BP_C ---@field Overlay_EnemyHP UOverlay ---@field TextBlock_1 UTextBlock ---@field TextBlock_EnemyHP UTextBlock @@ -38,6 +39,8 @@ function WB_Main:LuaInit() UGCEventSystem.AddListener(EventTypes.MiniStateChange, self.OnMiniStateChange, self) UGCEventSystem.AddListener(EventTypes.ChangeSpector, self.OnChangeSpector, self) UGCEventSystem.AddListener(EventTypes.ShowRoundWin, self.ShowRoundWin, self) + UGCEventSystem.AddListener(EventTypes.OpenOldWeaponParts, self.OpenOldWeaponParts, self) + UGCEventSystem.AddListener(EventTypes.UpdateArchiveData, self.UpdateArchiveData, self) --- 死亡的时候显示 ID Panel UGCEventSystem.AddListener(EventTypes.PlayerRespawn, function(MainUI, PlayerKey) @@ -79,9 +82,11 @@ function WB_Main:LuaInit() self.WB_PID:LuaInit(); self.WB_Title1_2:LuaInit(); self.WB_Title2_2:LuaInit(); - --self.WB_SelectParts:LuaInit(); self.WB_ReselectWeaponBtn:LuaInit(); - --self.WB_SelectParts:SetType({ EWeaponPartType.Telescope, EWeaponPartType.Grip, EWeaponPartType.Muzzle, }); + + --- 有显示的操作 + self.WB_SelectParts:LuaInit(); + self.WB_SelectParts:SetType({ EWeaponPartType.Telescope, EWeaponPartType.Grip, EWeaponPartType.Muzzle, }); self:ShowCustomSelectWeaponBtn(false); @@ -112,6 +117,21 @@ function WB_Main:LuaInit() GameState:UIAlready(); end +function WB_Main:OpenOldWeaponParts(IsShow) + UGCLogSystem.Log("[WB_Main:OpenOldWeaponParts] 执行") + if IsShow then + self.CustomizeCanvasPanel_BP_C_4:SetVisibility(ESlateVisibility.SelfHitTestInvisible); + else + self.CustomizeCanvasPanel_BP_C_4:SetVisibility(ESlateVisibility.Collapsed); + end +end + +function WB_Main:UpdateArchiveData() + if ArchiveTable[LocalPlayerKey] then return; end + --- 默认选项 + self:OpenOldWeaponParts(ArchiveTable[LocalPlayerKey].bOldParts or false); +end + function WB_Main:OnShowPanel(...) self.WB_PID:SetIDs() end diff --git a/SoloKing/SoloKing.ugcproj b/SoloKing/SoloKing.ugcproj index 2aee0fab..1500421b 100644 --- a/SoloKing/SoloKing.ugcproj +++ b/SoloKing/SoloKing.ugcproj @@ -53,13 +53,13 @@ SwitchesInMaps=((Key="r.Mobile.EnableIBL",Value=0),(Key="s.StreamableDelegateLim PlayBindingArray=[] [JobOption] -LastJobId=-1 -LastWindowsJobId=-1 -LastAndroidJobId=-1 -LastIOSJobId=-1 -PakOnly=0 -LastSkipBake=False -LastTargetPlatform=LinuxServer +LastJobId=600044806 +LastWindowsJobId=600026723 +LastAndroidJobId=600026723 +LastIOSJobId=600026723 +PakOnly=1 +LastSkipBake=True +LastTargetPlatform=LinuxServer+WindowsNoEditor+Android_ETC2+IOS+OpenHarmony_ETC2 [UGCUploadOption] PlatformIndex=0