From 3dd178833871117774360a62e130620d67b5b5e2 Mon Sep 17 00:00:00 2001 From: Oleg Petruny Date: Sat, 4 Jan 2025 13:35:00 +0100 Subject: [PATCH] Main, Options, Audio, Game menu and settings --- .../Config/DefaultGameUserSettings.ini | 5 + .../Blueprints/BP_CustomGameInstance.uasset | 4 +- .../Blueprints/Characters/BP_Player.uasset | 4 +- .../FunctionLibraries/BPFL_BPCast.uasset | 3 + .../Lost_Edge/Content/Levels/Test/L_Test.umap | 4 +- .../MainMenu/E_MainMenuButtonNames.uasset | 3 - .../E_MainMenuOptionsButtonName.uasset | 3 + .../E_MainMenuOptionsButtonNames.uasset | 3 - .../MainMenu/E_MainMenuPages.uasset | 3 - .../MainMenu/E_MainMenu_Button.uasset | 3 + .../MainMenu/E_MainMenu_Page.uasset | 3 + .../Pages/UI_MainMenu_Page_Credits.uasset | 3 + .../Pages/UI_MainMenu_Page_Home.uasset | 3 + .../Pages/UI_MainMenu_Page_Options.uasset | 3 + .../UI_MainMenu_Page_Options_Audio.uasset | 3 + .../UI_MainMenu_Page_Options_Game.uasset | 3 + .../UI_MainMenu_Page_Options_Graphics.uasset | 3 + .../MainMenu/ST_MainMenuCommonText.uasset | 3 - .../MainMenu/ST_MainMenu_CommonText.uasset | 3 + .../UI/Blueprints/MainMenu/UI_MainMenu.uasset | 4 +- .../MainMenu/UI_MainMenuOptions.uasset | 3 - .../MainMenu/UI_MainMenuOptionsAudio.uasset | 3 - .../UI_MainMenuOptionsControls.uasset | 4 +- .../MainMenu/UI_MainMenuOptionsGame.uasset | 3 - .../Classes/UICC_MainMenu_Page.uasset | 3 + .../UICC_MainMenu_PageButtonParticle.uasset | 4 +- .../Components/ST_CommonComboxValues.uasset | 3 + .../Content/UI/Components/UIC_ComboBox.uasset | 3 + .../UIC_MainMenu_OptionsButton.uasset | 4 +- .../UIC_MainMenu_OptionsComboBox.uasset | 4 +- .../UIC_MainMenu_OptionsComboBox_Bool.uasset | 3 + .../UIC_MainMenu_OptionsSlider.uasset | 4 +- .../UIC_MainMenu_OptionsSwitchButton.uasset | 3 - .../Components/UIC_MainMenu_PageButton.uasset | 4 +- .../UI/Components/UIC_MainMenu_Title.uasset | 4 +- .../Content/UI/Components/UIC_Slider.uasset | 4 +- .../Lost_Edge/Private/CommonFunctions.cpp | 10 ++ .../Lost_Edge/Private/CommonFunctions.h | 3 + .../Lost_Edge/Private/CustomGameInstance.cpp | 25 ++++ .../Lost_Edge/Private/CustomGameInstance.h | 10 +- .../Lost_Edge/Private/CustomGameSettings.cpp | 110 +++++++++++++++++- .../Lost_Edge/Private/CustomGameSettings.h | 83 +++++++++++-- .../Private/CustomPlayerController.cpp | 44 ++++--- .../Private/CustomPlayerController.h | 7 +- .../Source/Lost_Edge/Private/PlayerBase.cpp | 14 ++- .../Source/Lost_Edge/Private/PlayerBase.h | 1 - .../Private/Widgets/ComboBoxText.cpp | 20 ++++ .../Lost_Edge/Private/Widgets/ComboBoxText.h | 23 ++++ .../Private/Widgets/MainMenu/MainMenuWidget.h | 17 +-- 49 files changed, 390 insertions(+), 99 deletions(-) create mode 100644 UnrealProject/Lost_Edge/Content/Blueprints/FunctionLibraries/BPFL_BPCast.uasset delete mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuButtonNames.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuOptionsButtonName.uasset delete mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuOptionsButtonNames.uasset delete mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuPages.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenu_Button.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenu_Page.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Credits.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Home.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Audio.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Game.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Graphics.uasset delete mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/ST_MainMenuCommonText.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/ST_MainMenu_CommonText.uasset delete mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptions.uasset delete mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsAudio.uasset delete mode 100644 UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsGame.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MainMenu_Page.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Components/ST_CommonComboxValues.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Components/UIC_ComboBox.uasset create mode 100644 UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsComboBox_Bool.uasset delete mode 100644 UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsSwitchButton.uasset create mode 100644 UnrealProject/Lost_Edge/Source/Lost_Edge/Private/Widgets/ComboBoxText.cpp create mode 100644 UnrealProject/Lost_Edge/Source/Lost_Edge/Private/Widgets/ComboBoxText.h diff --git a/UnrealProject/Lost_Edge/Config/DefaultGameUserSettings.ini b/UnrealProject/Lost_Edge/Config/DefaultGameUserSettings.ini index 6c87b93..d9bc256 100644 --- a/UnrealProject/Lost_Edge/Config/DefaultGameUserSettings.ini +++ b/UnrealProject/Lost_Edge/Config/DefaultGameUserSettings.ini @@ -3,6 +3,11 @@ bUseMotionBlur=False bShowFps=False bMouseInverted=False fMouseSensetivity=1.000000 +fMasterVolume=0.500000 +fMusicVolume=1.000000 +fEffectsVolume=1.000000 +fVoicesVolume=1.000000 +fMenuVolume=1.000000 bUseVSync=False bUseDynamicResolution=False ResolutionSizeX=1920 diff --git a/UnrealProject/Lost_Edge/Content/Blueprints/BP_CustomGameInstance.uasset b/UnrealProject/Lost_Edge/Content/Blueprints/BP_CustomGameInstance.uasset index da2e0e6..9833752 100644 --- a/UnrealProject/Lost_Edge/Content/Blueprints/BP_CustomGameInstance.uasset +++ b/UnrealProject/Lost_Edge/Content/Blueprints/BP_CustomGameInstance.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:617aa7adcc34b939014b4d3e4e3442dacde726db2198f9943f13a9606a5dd12d -size 6156 +oid sha256:9c9c93e846c0b9f7c8ef0d79047da3cda2eb17550062c0bea1fcfa64a4688ecc +size 54469 diff --git a/UnrealProject/Lost_Edge/Content/Blueprints/Characters/BP_Player.uasset b/UnrealProject/Lost_Edge/Content/Blueprints/Characters/BP_Player.uasset index 1745f1d..941b408 100644 --- a/UnrealProject/Lost_Edge/Content/Blueprints/Characters/BP_Player.uasset +++ b/UnrealProject/Lost_Edge/Content/Blueprints/Characters/BP_Player.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:65401d20c2bdd7a90f808492cb9fc7ffae46c67dc88e6eb46716c7a8dd1966da -size 491639 +oid sha256:58d6cbf633283a9746aaee650d1b09949761b2dc40b9e1c3fb5f1be043737f71 +size 493547 diff --git a/UnrealProject/Lost_Edge/Content/Blueprints/FunctionLibraries/BPFL_BPCast.uasset b/UnrealProject/Lost_Edge/Content/Blueprints/FunctionLibraries/BPFL_BPCast.uasset new file mode 100644 index 0000000..ed5419e --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/Blueprints/FunctionLibraries/BPFL_BPCast.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a91bc779986e469ebc95b0ff0a4375de966693318524c836388d40013b383627 +size 19136 diff --git a/UnrealProject/Lost_Edge/Content/Levels/Test/L_Test.umap b/UnrealProject/Lost_Edge/Content/Levels/Test/L_Test.umap index f37d0f1..c72b361 100644 --- a/UnrealProject/Lost_Edge/Content/Levels/Test/L_Test.umap +++ b/UnrealProject/Lost_Edge/Content/Levels/Test/L_Test.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:654c333de2b64ac0da0ff144917ff839fbf97858a564007816c2aec6cc5e678a -size 2266458 +oid sha256:e88d30729b1a3db9085efe74430a979ec8fa4eec486f2df5c102f09e6252b14f +size 2267466 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuButtonNames.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuButtonNames.uasset deleted file mode 100644 index 5fc0b85..0000000 --- a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuButtonNames.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:116dc3eda9899a70ce02396ea2b15067238e5cf710ecec9d6738151c50a1f6dd -size 4059 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuOptionsButtonName.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuOptionsButtonName.uasset new file mode 100644 index 0000000..c36d271 --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuOptionsButtonName.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:804ce49b67d36ed546a85af9413fd7a243ca8953562359a9ad1b4f00b156a5c9 +size 2910 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuOptionsButtonNames.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuOptionsButtonNames.uasset deleted file mode 100644 index 7d292ee..0000000 --- a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuOptionsButtonNames.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0a1615c364bee71f147d2da29d321b73083e982347c676f9ae75bbf9a2253190 -size 2951 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuPages.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuPages.uasset deleted file mode 100644 index a6b8f22..0000000 --- a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenuPages.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0632b9cfa1742906e319ba7cc1a013be2ced858bc9c89820a3a182a95a8c8a12 -size 3349 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenu_Button.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenu_Button.uasset new file mode 100644 index 0000000..321b75b --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenu_Button.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e7ac2ae1d68094b707a2347df39144c696e7e52f79db6a61d801a7f22c36778 +size 3816 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenu_Page.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenu_Page.uasset new file mode 100644 index 0000000..8b8969f --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/E_MainMenu_Page.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:324785424810ad0ba200ab0aa14fe095ba00b8c5bfd1b367304b1a52ced73748 +size 2976 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Credits.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Credits.uasset new file mode 100644 index 0000000..07c4166 --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Credits.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c54961497232b5b3bc1bc712b62c546377d267f9016cc2debca089a980fd308 +size 119987 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Home.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Home.uasset new file mode 100644 index 0000000..5091ff3 --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Home.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae76723653c9615604da1d4c6f0658f74c6a66f29a48e3ddbd09640b38ec372d +size 133071 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options.uasset new file mode 100644 index 0000000..86c3975 --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79c137948d7e5184ca1230c9c461c6e23bf225ee44d657003d938b23d62ff3da +size 68002 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Audio.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Audio.uasset new file mode 100644 index 0000000..e85345d --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Audio.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:245a41b788f5cf2c392401225e701bee6ec493a9b5275686bb876dce3f4efbe6 +size 179621 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Game.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Game.uasset new file mode 100644 index 0000000..8689e74 --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Game.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7801f52458c5b085992c1ac5e956b72285699cec7ee4af24104d6397c48295bc +size 96533 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Graphics.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Graphics.uasset new file mode 100644 index 0000000..ecbf921 --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/Pages/UI_MainMenu_Page_Options_Graphics.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9aeaebec4e95c2f53bf51442efb796560e0fe8d65f5887d36591de7b0f682e21 +size 170790 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/ST_MainMenuCommonText.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/ST_MainMenuCommonText.uasset deleted file mode 100644 index b6f68eb..0000000 --- a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/ST_MainMenuCommonText.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6b94aa433be1147267908989331dff3f6af447d372cf8a82f2b25e81e3326598 -size 1878 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/ST_MainMenu_CommonText.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/ST_MainMenu_CommonText.uasset new file mode 100644 index 0000000..be5c588 --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/ST_MainMenu_CommonText.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:646e788c2134f1742ac16b56e16254aa23ee16703e46a10d8d6b27e091aecfb4 +size 2581 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenu.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenu.uasset index 5bba889..7570a4d 100644 --- a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenu.uasset +++ b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenu.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8e834d1b704d2cf4587441001e9f1022d12dcc607e19141e7abed76e2e47adf -size 192994 +oid sha256:bee71e7ac3864119d6e7043a968424188b5c1a4160dd933b3ac76a67ffa2626e +size 198290 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptions.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptions.uasset deleted file mode 100644 index 3510003..0000000 --- a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptions.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:647b375075ad14af64932e5ef664da6e22b0a375c7867811f5f1c436f24808cc -size 62215 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsAudio.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsAudio.uasset deleted file mode 100644 index d7f116d..0000000 --- a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsAudio.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9e247836e085546324e4f68c3a5070b4d37992b60082ef5a525160e79ca9ea5f -size 95551 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsControls.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsControls.uasset index 828f58f..fea9005 100644 --- a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsControls.uasset +++ b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsControls.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a1c5e7352b100ccabe043eee5ffd02b83fd1b2d5109144c28c687609841291b0 -size 130173 +oid sha256:c1b79c1fd758a592357c72366d989ba0185792c811f75601dee9a09784f57613 +size 129437 diff --git a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsGame.uasset b/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsGame.uasset deleted file mode 100644 index 60b0c2c..0000000 --- a/UnrealProject/Lost_Edge/Content/UI/Blueprints/MainMenu/UI_MainMenuOptionsGame.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:26321fde0b37a5dc8b876f8caee0d4c02eef2cb23264915a9aa181a53c133a93 -size 89011 diff --git a/UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MainMenu_Page.uasset b/UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MainMenu_Page.uasset new file mode 100644 index 0000000..de68f7c --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MainMenu_Page.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c3a942954cbba0c1406e32321f3f3f23985fcd9dd60e5cf02706d1c80cea900 +size 13492 diff --git a/UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MainMenu_PageButtonParticle.uasset b/UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MainMenu_PageButtonParticle.uasset index 175d3e9..113718e 100644 --- a/UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MainMenu_PageButtonParticle.uasset +++ b/UnrealProject/Lost_Edge/Content/UI/Components/Classes/UICC_MainMenu_PageButtonParticle.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd2cb854bac32344c95a52bb2dbd96d1d71fb6c413c16b6e7bbeb3356bc813df -size 6659 +oid sha256:0d6dd492548c424e42aa44c6c37a2dfdd8492116cdafca0fce1b7ffd4250dac2 +size 6704 diff --git a/UnrealProject/Lost_Edge/Content/UI/Components/ST_CommonComboxValues.uasset b/UnrealProject/Lost_Edge/Content/UI/Components/ST_CommonComboxValues.uasset new file mode 100644 index 0000000..dd8f8bb --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Components/ST_CommonComboxValues.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8693419363541fe78fdeb7af030428b90dce009da71fbd2d2168af808a5c259 +size 1809 diff --git a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_ComboBox.uasset b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_ComboBox.uasset new file mode 100644 index 0000000..bd8c7d1 --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_ComboBox.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:070138fc6cfd92dd686cf311d8895f074c53de94a648cdcb33e0c5956caba9c3 +size 121172 diff --git a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsButton.uasset b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsButton.uasset index 44cd3ff..312746e 100644 --- a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsButton.uasset +++ b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsButton.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d8eb2ca474902a3180db5dafe6dc2ac2d9972a83384bb6a3a05c2ba51d58005e -size 341174 +oid sha256:ecd4075b374af4aebe1e63429ac0ce65b8882945c006f59f5f58d1d1af47510a +size 341123 diff --git a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsComboBox.uasset b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsComboBox.uasset index ea80e93..944688d 100644 --- a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsComboBox.uasset +++ b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsComboBox.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aa41827ace0e485a32ad9ba233912f258ee5cfd0990ccdd117eaa007cb8379ae -size 39310 +oid sha256:c5aa1d53af63777f21fa4a01b11a049be775c448f17cd7db25fb52036f239c55 +size 61481 diff --git a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsComboBox_Bool.uasset b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsComboBox_Bool.uasset new file mode 100644 index 0000000..f51d24d --- /dev/null +++ b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsComboBox_Bool.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71ae04b2ecc2b47966a4cd26a9052ac6c8646c1e171ae69b60df05257677078d +size 69115 diff --git a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsSlider.uasset b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsSlider.uasset index 89dcec6..2c62b55 100644 --- a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsSlider.uasset +++ b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsSlider.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b22ad29cebdf628e50306fa7ec0eadfd98d8f817bd02cee0f1e7c0186070ee49 -size 55275 +oid sha256:51e0896d4bca4e3ccd43d1ec3fabe18ce55c452d07b21ffbfb335a72e9ffec18 +size 77285 diff --git a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsSwitchButton.uasset b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsSwitchButton.uasset deleted file mode 100644 index 1fb0cc3..0000000 --- a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_OptionsSwitchButton.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ccdc4694adbbda575bd02ebfdc77f17e4020fce859243133ad4e999dacb14ff2 -size 39415 diff --git a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_PageButton.uasset b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_PageButton.uasset index 56e6256..c72bcc6 100644 --- a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_PageButton.uasset +++ b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_PageButton.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ec23b255a074720b88a6fde5b0a4fca89ea04488704494abefe09cd88f11241c -size 358593 +oid sha256:cf8fa9cdd55f24d905fa07e6ee18107c23442d41c8498cb9fad5b6015bbd7d3a +size 370639 diff --git a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_Title.uasset b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_Title.uasset index a73c9d5..8488cfc 100644 --- a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_Title.uasset +++ b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_MainMenu_Title.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1643864c41e24f3b31d7cc2e7ae81d5a81662e040da7ed680094fc3035edcb02 -size 447458 +oid sha256:14ae36bb0e852e06a55126d54cbe6f2e77b66a48461c1789b9c232281919ced7 +size 453511 diff --git a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_Slider.uasset b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_Slider.uasset index eae415d..358e39e 100644 --- a/UnrealProject/Lost_Edge/Content/UI/Components/UIC_Slider.uasset +++ b/UnrealProject/Lost_Edge/Content/UI/Components/UIC_Slider.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e9b29efef1b67fb199f51f19c9f9e44d47079aa0342840d5dc902ff7a944d70b -size 86429 +oid sha256:1c871982aeb84a78a991eb8a18cd1232624cfa452894ecfcb14cb4fd09c935b4 +size 146802 diff --git a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CommonFunctions.cpp b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CommonFunctions.cpp index c45eec7..78f528f 100644 --- a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CommonFunctions.cpp +++ b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CommonFunctions.cpp @@ -29,6 +29,16 @@ FText UCommonFunctions::GetKeyDisplayName(FKey key) return key.GetDisplayName(false); } +int32 UCommonFunctions::StringIndexInTextArray(const TArray& array, const FString& value) +{ + FString v = value.ToLower(); + for(int32 i = 0; i < array.Num(); ++i) + if(FTextInspector::GetSourceString(array[i])->ToLower().Equals(v)) + return i; + + return -1; +} + void UCommonFunctions::DestroyActorRecursively(AActor* actor) { TArray childs; diff --git a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CommonFunctions.h b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CommonFunctions.h index 56d9dae..7e40538 100644 --- a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CommonFunctions.h +++ b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CommonFunctions.h @@ -25,6 +25,9 @@ public: UFUNCTION(BlueprintPure) static FText GetKeyDisplayName(struct FKey key); + UFUNCTION(BlueprintPure) + static int32 StringIndexInTextArray(const TArray& array, const FString& value); + /** Recursively destroy actor and all its childs (the default Destroy doesn't have consistent behavior) */ UFUNCTION(BlueprintCallable, Category = Actor) static void DestroyActorRecursively(class AActor* actor); diff --git a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameInstance.cpp b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameInstance.cpp index b606fb4..60769f0 100644 --- a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameInstance.cpp +++ b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameInstance.cpp @@ -6,6 +6,7 @@ #include "Kismet/KismetSystemLibrary.h" #include "ContentLoader.h" +#include "CustomGameSettings.h" #include "Levels/LevelBase.h" #include "PlayerBase.h" #include "SaveData.h" @@ -23,7 +24,15 @@ void UCustomGameInstance::Init() UGameInstance::Init(); instance = this; + contentLoader = NewObject(this); + for(auto& _class : globalInstancesClasses) + { + UObject* gi = NewObject(_class); + gi->AddToRoot(); + globalInstances.Add(_class.Get(), gi); + } + globalInstancesClasses.Empty(); if(auto save = UGameplayStatics::LoadGameFromSlot(saveName, saveIndex)) saveData = Cast(save); @@ -31,6 +40,14 @@ void UCustomGameInstance::Init() saveData = Cast(UGameplayStatics::CreateSaveGameObject(USaveData::StaticClass())); } +void UCustomGameInstance::Shutdown() +{ + if(auto settings = UCustomGameSettings::Get()) + settings->SaveSettings(); + + Super::Shutdown(); +} + UCustomGameInstance* UCustomGameInstance::Get() { return instance; @@ -44,6 +61,14 @@ UContentLoader* UCustomGameInstance::GetContentLoader() return nullptr; } +UObject* UCustomGameInstance::GetGlobalInstance(UClass* _class) +{ + if(auto GI = Get()) + return *(GI->globalInstances.Find(_class)); + + return nullptr; +} + bool UCustomGameInstance::IsGameSaved() { if(auto GI = Get()) diff --git a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameInstance.h b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameInstance.h index 1d3b441..d2cd197 100644 --- a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameInstance.h +++ b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameInstance.h @@ -20,19 +20,24 @@ class UCustomGameInstance : public UGameInstance public: /** Instantiates content loader, dummy save data and applies settings */ virtual void Init() override; + /** Saves settings */ + virtual void Shutdown() override; UFUNCTION(BlueprintPure, meta = (DisplayName = "Get Custom Game Instance")) static UCustomGameInstance* Get(); UFUNCTION(BlueprintPure) static class UContentLoader* GetContentLoader(); + UFUNCTION(BlueprintPure) + static UObject* GetGlobalInstance(UClass* _class); + /** Return true is save data are present and valid */ UFUNCTION(BlueprintPure) static bool IsGameSaved(); - UFUNCTION(BlueprintCallable, Category = Save) void SaveGame(FName checkpointName); UFUNCTION(BlueprintCallable, Category = Save) void LoadGame(); + UFUNCTION(BlueprintCallable) void ExitGame(); @@ -48,4 +53,7 @@ protected: UPROPERTY() class UContentLoader* contentLoader; + UPROPERTY(EditDefaultsOnly) + TSet> globalInstancesClasses; + TMap globalInstances; }; diff --git a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameSettings.cpp b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameSettings.cpp index 2c17640..b095e21 100644 --- a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameSettings.cpp +++ b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameSettings.cpp @@ -4,12 +4,35 @@ #include "Kismet/GameplayStatics.h" +namespace +{ + /** Game */ + constexpr float fDefaultMouseSensetivity = 0.5f; + constexpr bool bDefaultMouseInverted = false; + + /** Audio */ + constexpr float fDefaultMasterVolume = 0.4f; + constexpr float fDefaultMusicVolume = 1.0f; + constexpr float fDefaultEffectsVolume = 1.0f; + constexpr float fDefaultVoicesVolume = 1.0f; + constexpr float fDefaultMenuVolume = 1.0f; +} + UCustomGameSettings::UCustomGameSettings(const FObjectInitializer& ObjectInitializer) :Super(ObjectInitializer) { bUseMotionBlur = false; bShowFps = false; - bMouseInverted = false; - fMouseSensetivity = 1.0f; + + /** Game */ + fMouseSensetivity = GetDefaultMouseSensetivity(); + bMouseInverted = GetDefaultMouseInverted(); + + /** Audio */ + fMasterVolume = GetDefaultMasterVolume(); + fMusicVolume = GetDefaultMusicVolume(); + fEffectsVolume = GetDefaultEffectsVolume(); + fVoicesVolume = GetDefaultVoicesVolume(); + fMenuVolume = GetDefaultMenuVolume(); } UCustomGameSettings* UCustomGameSettings::Get() @@ -17,12 +40,89 @@ UCustomGameSettings* UCustomGameSettings::Get() return Cast(UGameUserSettings::GetGameUserSettings()); } + + +/** Game */ +float UCustomGameSettings::GetDefaultMouseSensetivity() const +{ + return fDefaultMouseSensetivity; +} +float UCustomGameSettings::GetMouseSensetivity() const +{ + return fMouseSensetivity; +} void UCustomGameSettings::SetMouseSensetivity(float value) { fMouseSensetivity = FMath::Clamp(value, 0.1f, 2.0f); } -float UCustomGameSettings::GetMouseSensetivity() const +bool UCustomGameSettings::GetDefaultMouseInverted() const { - return fMouseSensetivity; -} \ No newline at end of file + return bDefaultMouseInverted; +} + + + +/** Audio */ +float UCustomGameSettings::GetDefaultMasterVolume() const +{ + return fDefaultMasterVolume; +} +float UCustomGameSettings::GetDefaultMusicVolume() const +{ + return fDefaultMusicVolume; +} +float UCustomGameSettings::GetDefaultEffectsVolume() const +{ + return fDefaultEffectsVolume; +} +float UCustomGameSettings::GetDefaultVoicesVolume() const +{ + return fDefaultVoicesVolume; +} +float UCustomGameSettings::GetDefaultMenuVolume() const +{ + return fDefaultMenuVolume; +} + +float UCustomGameSettings::GetMasterVolume() const +{ + return fMasterVolume; +} +float UCustomGameSettings::GetMusicVolume() const +{ + return fMusicVolume; +} +float UCustomGameSettings::GetEffectsVolume() const +{ + return fEffectsVolume; +} +float UCustomGameSettings::GetVoicesVolume() const +{ + return fVoicesVolume; +} +float UCustomGameSettings::GetMenuVolume() const +{ + return fMenuVolume; +} + +void UCustomGameSettings::SetMasterVolume(float value) +{ + fMasterVolume = FMath::Clamp(value, 0.0f, 1.0f); +} +void UCustomGameSettings::SetMusicVolume(float value) +{ + fMusicVolume = FMath::Clamp(value, 0.0f, 1.0f); +} +void UCustomGameSettings::SetEffectsVolume(float value) +{ + fEffectsVolume = FMath::Clamp(value, 0.0f, 1.0f); +} +void UCustomGameSettings::SetVoicesVolume(float value) +{ + fVoicesVolume = FMath::Clamp(value, 0.0f, 1.0f); +} +void UCustomGameSettings::SetMenuVolume(float value) +{ + fMenuVolume = FMath::Clamp(value, 0.0f, 1.0f); +} diff --git a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameSettings.h b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameSettings.h index fbc5795..094d031 100644 --- a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameSettings.h +++ b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomGameSettings.h @@ -10,28 +10,19 @@ * Manages custom game settings. * Mouse sensetivity and inversion, motion blur usage, fps show. */ -UCLASS(Config = Game, defaultconfig) +UCLASS(defaultconfig) class UCustomGameSettings : public UGameUserSettings { - GENERATED_UCLASS_BODY() + GENERATED_BODY() public: // Is auto defined by UE but implementation is in cpp - //UCustomGameSettings(const FObjectInitializer& ObjectInitializer); + UCustomGameSettings(const FObjectInitializer& ObjectInitializer); UFUNCTION(BlueprintPure, Category = Settings, meta = (DisplayName = "Get Custom Game Settings")) static UCustomGameSettings* Get(); - /** - * Sets mouse sensetivity multiplier - * @param value [0.1 - 2.0] - */ - UFUNCTION(BlueprintCallable, Category = Settings) - void SetMouseSensetivity(float value); - /** Returns mouse sensetivity multiplier in [0.1 - 2.0] */ - UFUNCTION(BlueprintCallable, Category = Settings) - float GetMouseSensetivity() const; UPROPERTY(Config, BlueprintReadWrite) bool bUseMotionBlur; @@ -39,11 +30,79 @@ public: UPROPERTY(Config, BlueprintReadWrite) bool bShowFps; + + + /** Game */ + UFUNCTION(BlueprintPure, Category = Settings) + float GetDefaultMouseSensetivity() const; + /** Returns mouse sensetivity multiplier in [0.1 - 2.0] */ + UFUNCTION(BlueprintPure, Category = Settings) + float GetMouseSensetivity() const; + /** + * Sets mouse sensetivity multiplier + * @param value [0.1 - 2.0] + */ + UFUNCTION(BlueprintCallable, Category = Settings) + void SetMouseSensetivity(float value); + + UFUNCTION(BlueprintPure, Category = Settings) + bool GetDefaultMouseInverted() const; UPROPERTY(Config, BlueprintReadWrite) bool bMouseInverted; + + + /** + * Audio + * All values are clamped in [0.0 - 1.0] + */ + UFUNCTION(BlueprintPure, Category = Settings) + float GetDefaultMasterVolume() const; // UFUNCTION doesn't support constexpr functions + UFUNCTION(BlueprintPure, Category = Settings) + float GetDefaultMusicVolume() const; // UFUNCTION doesn't support constexpr functions + UFUNCTION(BlueprintPure, Category = Settings) + float GetDefaultEffectsVolume() const; // UFUNCTION doesn't support constexpr functions + UFUNCTION(BlueprintPure, Category = Settings) + float GetDefaultVoicesVolume() const; // UFUNCTION doesn't support constexpr functions + UFUNCTION(BlueprintPure, Category = Settings) + float GetDefaultMenuVolume() const; // UFUNCTION doesn't support constexpr functions + + UFUNCTION(BlueprintPure, Category = Settings) + float GetMasterVolume() const; + UFUNCTION(BlueprintPure, Category = Settings) + float GetMusicVolume() const; + UFUNCTION(BlueprintPure, Category = Settings) + float GetEffectsVolume() const; + UFUNCTION(BlueprintPure, Category = Settings) + float GetVoicesVolume() const; + UFUNCTION(BlueprintPure, Category = Settings) + float GetMenuVolume() const; + + UFUNCTION(BlueprintCallable, Category = Settings) + void SetMasterVolume(float value); + UFUNCTION(BlueprintCallable, Category = Settings) + void SetMusicVolume(float value); + UFUNCTION(BlueprintCallable, Category = Settings) + void SetEffectsVolume(float value); + UFUNCTION(BlueprintCallable, Category = Settings) + void SetVoicesVolume(float value); + UFUNCTION(BlueprintCallable, Category = Settings) + void SetMenuVolume(float value); + protected: UPROPERTY(Config) float fMouseSensetivity; + /** Audio */ + UPROPERTY(Config) + float fMasterVolume; + UPROPERTY(Config) + float fMusicVolume; + UPROPERTY(Config) + float fEffectsVolume; + UPROPERTY(Config) + float fVoicesVolume; + UPROPERTY(Config) + float fMenuVolume; + }; diff --git a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomPlayerController.cpp b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomPlayerController.cpp index 386d1c6..cc00e34 100644 --- a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomPlayerController.cpp +++ b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomPlayerController.cpp @@ -33,6 +33,13 @@ void ACustomPlayerController::AppendInputContext(TSoftObjectPtrAddMappingContext(context.LoadSynchronous(), 0); } +void ACustomPlayerController::ApplyMouseSettings() +{ + if(auto settings = UCustomGameSettings::Get()) + for(auto& context : contexts) + ApplyMouseSettings(context, settings); +} + void ACustomPlayerController::BeginPlay() { Super::BeginPlay(); @@ -71,15 +78,19 @@ void ACustomPlayerController::EndPlay(const EEndPlayReason::Type EndPlayReason) Super::EndPlay(EndPlayReason); } -void ACustomPlayerController::ApplyMouseSettings(TSoftObjectPtr& context) +void ACustomPlayerController::ApplyMouseSettings(TSoftObjectPtr& context, UCustomGameSettings* settings) { - auto gameSettings = UCustomGameSettings::Get(); - if(!gameSettings) - return; + if(!settings) + { + settings = UCustomGameSettings::Get(); + if(!settings) + return; + } if(!context.LoadSynchronous()) return; + bool contextChanged = false; for(auto& mapping : context.LoadSynchronous()->GetMappings()) { if(mapping.Key != EKeys::Mouse2D) @@ -87,20 +98,27 @@ void ACustomPlayerController::ApplyMouseSettings(TSoftObjectPtrbMouseInverted) + if(auto negate_modifier = Cast(modifier)) { - if(auto negate_modifier = Cast(modifier)) - { - negate_modifier->bY = !negate_modifier->bY; - continue; - } + negate_modifier->bY = !settings->bMouseInverted; + contextChanged = true; + } + else if(auto scalar_modifier = Cast(modifier)) + { + scalar_modifier->Scalar = FVector{ settings->GetMouseSensetivity() }; + contextChanged = true; } - if(auto scalar_modifier = Cast(modifier)) - scalar_modifier->Scalar = FVector{ gameSettings->GetMouseSensetivity() * 0.5 }; } } - UEnhancedInputLibrary::RequestRebuildControlMappingsUsingContext(context.LoadSynchronous()); + if(contextChanged) + { + if(subsystem) + { + FModifyContextOptions options; + subsystem->RequestRebuildControlMappings(options, EInputMappingRebuildType::RebuildWithFlush); + } + } } void ACustomPlayerController::OnAnyKeyPressed(FKey key) diff --git a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomPlayerController.h b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomPlayerController.h index 191f83c..15efc94 100644 --- a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomPlayerController.h +++ b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/CustomPlayerController.h @@ -30,6 +30,10 @@ public: UFUNCTION(BlueprintCallable) static void AppendInputContext(TSoftObjectPtr context); + /** Applies mouse settings to all loaded contexts */ + UFUNCTION(BlueprintCallable) + static void ApplyMouseSettings(); + FPlayerAnyKeyPressedDelegate onAnyKeyPressed; FPlayerAnyKeyReleasedDelegate onAnyKeyReleased; @@ -38,7 +42,8 @@ protected: virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; private: - static void ApplyMouseSettings(TSoftObjectPtr& context); + /** Applies mouse settings to the specific context */ + static void ApplyMouseSettings(TSoftObjectPtr& context, class UCustomGameSettings* settings = nullptr); void OnAnyKeyPressed(FKey key); void OnAnyKeyReleased(FKey key); diff --git a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/PlayerBase.cpp b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/PlayerBase.cpp index 853d6ba..e841f08 100644 --- a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/PlayerBase.cpp +++ b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/PlayerBase.cpp @@ -371,16 +371,22 @@ void APlayerBase::ShowMenu() if(GetWorld()->IsPaused()) { WM->HideMainMenu(); - playerController->SetShowMouseCursor(false); - playerController->SetInputMode(FInputModeGameOnly{}); + if(auto PC = ACustomPlayerController::Get()) + { + PC->SetShowMouseCursor(false); + PC->SetInputMode(FInputModeGameOnly{}); + } UnlockPlayer(FPlayerLock::All()); UGameplayStatics::SetGamePaused(GetWorld(), false); } else { WM->ShowMainMenu(); - playerController->SetShowMouseCursor(true); - playerController->SetInputMode(FInputModeGameAndUI{}); + if(auto PC = ACustomPlayerController::Get()) + { + PC->SetShowMouseCursor(true); + PC->SetInputMode(FInputModeGameAndUI{}); + } LockPlayer(FPlayerLock::All()); UGameplayStatics::SetGamePaused(GetWorld(), true); } diff --git a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/PlayerBase.h b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/PlayerBase.h index 7d3c691..63aa4da 100644 --- a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/PlayerBase.h +++ b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/PlayerBase.h @@ -113,7 +113,6 @@ protected: UFUNCTION(BlueprintCallable, Category = Character) void ShowMenu(); - class APlayerController* playerController; UPROPERTY(EditAnywhere) float moveSpeed = 200; UPROPERTY(EditAnywhere) diff --git a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/Widgets/ComboBoxText.cpp b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/Widgets/ComboBoxText.cpp new file mode 100644 index 0000000..dbd1fc0 --- /dev/null +++ b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/Widgets/ComboBoxText.cpp @@ -0,0 +1,20 @@ +// Oleg Petruny proprietary. + +#include "ComboBoxText.h" + +void UComboBoxText::PostInitProperties() +{ + Super::PostInitProperties(); + + SetOptions(_DefaultOptions); + _DefaultOptions.Empty(); +} + +void UComboBoxText::SetOptions(const TArray& options) +{ + ClearSelection(); + Options.Empty(); + for(auto& o : options) + Options.Add(MakeShareable(new FString(o.ToString()))); + RefreshOptions(); +} diff --git a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/Widgets/ComboBoxText.h b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/Widgets/ComboBoxText.h new file mode 100644 index 0000000..82321b7 --- /dev/null +++ b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/Widgets/ComboBoxText.h @@ -0,0 +1,23 @@ +// Oleg Petruny proprietary. + +#pragma once + +#include "Components/ComboBoxString.h" + +#include "ComboBoxText.generated.h" + +UCLASS(Blueprintable, meta = (DisplayName = "ComboBox (Text)"), MinimalAPI) +class UComboBoxText : public UComboBoxString +{ + GENERATED_BODY() + +public: + virtual void PostInitProperties() override; + + UFUNCTION(BlueprintCallable) + void SetOptions(const TArray& options); + +protected: + UPROPERTY(EditAnywhere, Category = ComboBoxTextDefault) + TArray _DefaultOptions; +}; diff --git a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/Widgets/MainMenu/MainMenuWidget.h b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/Widgets/MainMenu/MainMenuWidget.h index 2c97df6..550bc7b 100644 --- a/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/Widgets/MainMenu/MainMenuWidget.h +++ b/UnrealProject/Lost_Edge/Source/Lost_Edge/Private/Widgets/MainMenu/MainMenuWidget.h @@ -30,20 +30,9 @@ public: UPROPERTY(BlueprintAssignable) FMainMenuClosedDelegate OnMainMenuClosedDelegate; - UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) - class UMainMenuButtonWidget* ButtonContinue; - UPROPERTY(meta = (BindWidget)) - class UMainMenuButtonWidget* ButtonOptions; - UPROPERTY(meta = (BindWidget)) - class UMainMenuButtonWidget* ButtonCredits; - UPROPERTY(meta = (BindWidget)) - class UMainMenuButtonWidget* ButtonExit; - - UPROPERTY(Transient, meta = (BindWidgetAnim)) - class UWidgetAnimation* showFullAnimation; - UPROPERTY(Transient, meta = (BindWidgetAnim)) - class UWidgetAnimation* showFastAnimation; - UPROPERTY(Transient, meta = (BindWidgetAnim)) + UPROPERTY(BlueprintReadOnly, Transient, meta = (BindWidgetAnim)) + class UWidgetAnimation* extendAnimation; + UPROPERTY(BlueprintReadOnly, Transient, meta = (BindWidgetAnim)) class UWidgetAnimation* closeAnimation; protected: