diff --git a/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/CustomLoadingScreenBackground.c b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/CustomLoadingScreenBackground.c new file mode 100644 index 0000000..caa174e --- /dev/null +++ b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/CustomLoadingScreenBackground.c @@ -0,0 +1,16 @@ +/** + * ExpansionRespawnHandlerModule.c + * + * DayZ Expansion Mod + * www.dayzexpansion.com + * © 2022 DayZ Expansion Mod Team + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + * +*/ + +class CustomLoadingScreenBackground +{ + string ImagePath; +}; diff --git a/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/CustomLoadingScreenData.c b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/CustomLoadingScreenData.c new file mode 100644 index 0000000..5836f5f --- /dev/null +++ b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/CustomLoadingScreenData.c @@ -0,0 +1,29 @@ +/** + * ExpansionRespawnHandlerModule.c + * + * DayZ Expansion Mod + * www.dayzexpansion.com + * © 2022 DayZ Expansion Mod Team + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + * +*/ + +class CustomLoadingScreenData +{ + bool ShowLogo = true; + string LogoPath = "LoadingScreen/GUI/logo.edds"; + bool RandomizeBackgounds = true; + int LoadingBarColor = ARGB(255, 199, 38, 81); + bool UseCustomHints = true; + string HintIconPath = "LoadingScreen/GUI/icons/circle_info.edds"; + + ref array m_ExBackgrounds; + + void CustomLoadingScreenData() + { + m_ExBackgrounds = new array; + JsonFileLoader>.JsonLoadFile("LoadingScreen/Scripts/Data/LoadingImages.json", m_ExBackgrounds); + } +}; diff --git a/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoadingScreen.c b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoadingScreen.c index 4ef098d..b5db18b 100644 --- a/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoadingScreen.c +++ b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoadingScreen.c @@ -10,173 +10,6 @@ * */ -class CustomLoadingScreenBackground -{ - string ImagePath; -}; - -class CustomLoadingScreenData -{ - bool ShowLogo = true; - string LogoPath = "LoadingScreen/GUI/logo.edds"; - bool RandomizeBackgounds = true; - int LoadingBarColor = ARGB(255, 199, 38, 81); - bool UseCustomHints = true; - string HintIconPath = "LoadingScreen/GUI/icons/circle_info.edds"; - - ref array m_ExBackgrounds; - - void CustomLoadingScreenData() - { - m_ExBackgrounds = new array; - JsonFileLoader>.JsonLoadFile("LoadingScreen/Scripts/Data/LoadingImages.json", m_ExBackgrounds); - } -}; - -modded class UiHintPanel -{ - protected const string m_ExDataPath = "LoadingScreen/Scripts/Data/Hints.json"; //! Custom hints json path - protected ref CustomLoadingScreenData m_ExCustomLoadingScreenData; - - override protected void LoadContentList() - { - if (!m_ExCustomLoadingScreenData) - m_ExCustomLoadingScreenData = new CustomLoadingScreenData(); - - if (m_ExCustomLoadingScreenData && m_ExCustomLoadingScreenData.UseCustomHints) - { - JsonFileLoader>.JsonLoadFile(m_ExDataPath, m_ContentList); - } - else - { - JsonFileLoader>.JsonLoadFile(m_DataPath, m_ContentList); - } - } -}; - -modded class LoginScreenBase -{ - protected ImageWidget m_ExHintIcon; - protected int m_ExBackgroundIndex = 0; - - protected const float LOADING_SCREEN_CHANGE_TIME = 3.0; - protected float m_ExLoadingTime; - - protected ImageWidget m_ExBackground; - - protected ref CustomLoadingScreenData m_ExCustomLoadingScreenData; - protected ref array m_ShownBackgrounds; - - void LoginScreenBase() - { - m_ExCustomLoadingScreenData = new CustomLoadingScreenData(); - - if (!m_ExCustomLoadingScreenData) - return; - - if (m_ExCustomLoadingScreenData.RandomizeBackgounds) - m_ShownBackgrounds = new array; - } - - /*override Widget Init() - { - layoutRoot = super.Init(); - - m_ExBackground = ImageWidget.Cast(layoutRoot.FindAnyWidget("Background")); - - SetBackgroundImage(m_ExBackgroundIndex); - m_ExBackgroundIndex++; - - return layoutRoot; - }*/ - - override void Update(float timeslice) - { - super.Update(timeslice); - - m_ExLoadingTime += timeslice; - if (m_ExLoadingTime >= LOADING_SCREEN_CHANGE_TIME) - { - if (!m_ExCustomLoadingScreenData.RandomizeBackgounds) - { - SetBackgroundImage(m_ExBackgroundIndex); - m_ExBackgroundIndex++; - if (m_ExBackgroundIndex > (m_ExCustomLoadingScreenData.m_ExBackgrounds.Count() - 1)) - m_ExBackgroundIndex = 0; - } - else - { - if (m_ShownBackgrounds.Count() < m_ExCustomLoadingScreenData.m_ExBackgrounds.Count()) - { - m_ExBackgroundIndex = GetRandomBackroundIndex(); - SetBackgroundImage(m_ExBackgroundIndex); - m_ShownBackgrounds.Insert(m_ExBackgroundIndex); - } - else - { - m_ShownBackgrounds.Clear(); - } - - } - - m_ExLoadingTime = 0; - } - } - - protected int GetRandomBackroundIndex() - { - int index = Math.RandomIntInclusive(0, (m_ExCustomLoadingScreenData.m_ExBackgrounds.Count() - 1)); - int searchCount; - while ((m_ShownBackgrounds.Find(index) > -1) && (searchCount < m_ShownBackgrounds.Count())) - { - index = Math.RandomIntInclusive(0, (m_ExCustomLoadingScreenData.m_ExBackgrounds.Count() - 1)); - } - - return index; - } - - protected void SetBackgroundImage(int index) - { - CustomLoadingScreenBackground background = m_ExCustomLoadingScreenData.m_ExBackgrounds.Get(index); - if (background && background.ImagePath != string.Empty) - { - Print(ToString() + "::SetBackgroundImage - Background: " + background.ImagePath); - m_ExBackground.LoadImageFile(0, background.ImagePath, true); - m_ExBackground.SetImage(0); - } - } -}; - -modded class LoginQueueBase -{ - override Widget Init() - { - layoutRoot = super.Init(); - - m_ExBackground = ImageWidget.Cast(layoutRoot.FindAnyWidget("Background")); - - SetBackgroundImage(m_ExBackgroundIndex); - m_ExBackgroundIndex++; - - return layoutRoot; - } -}; - -modded class LoginTimeBase -{ - override Widget Init() - { - layoutRoot = super.Init(); - - m_ExBackground = ImageWidget.Cast(layoutRoot.FindAnyWidget("Background")); - - SetBackgroundImage(m_ExBackgroundIndex); - m_ExBackgroundIndex++; - - return layoutRoot; - } -}; - modded class LoadingScreen { protected Widget m_ExPanelWidget; @@ -354,4 +187,4 @@ modded class LoadingScreen Print(ToString() + "::SetBackgroundImage - End"); } -}; \ No newline at end of file +}; diff --git a/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoginQueueBase.c b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoginQueueBase.c new file mode 100644 index 0000000..f3bbd1e --- /dev/null +++ b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoginQueueBase.c @@ -0,0 +1,26 @@ +/** + * ExpansionRespawnHandlerModule.c + * + * DayZ Expansion Mod + * www.dayzexpansion.com + * © 2022 DayZ Expansion Mod Team + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + * +*/ + +modded class LoginQueueBase +{ + override Widget Init() + { + layoutRoot = super.Init(); + + m_ExBackground = ImageWidget.Cast(layoutRoot.FindAnyWidget("Background")); + + SetBackgroundImage(m_ExBackgroundIndex); + m_ExBackgroundIndex++; + + return layoutRoot; + } +}; diff --git a/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoginScreenBase.c b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoginScreenBase.c new file mode 100644 index 0000000..79ccc69 --- /dev/null +++ b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoginScreenBase.c @@ -0,0 +1,104 @@ +/** + * ExpansionRespawnHandlerModule.c + * + * DayZ Expansion Mod + * www.dayzexpansion.com + * © 2022 DayZ Expansion Mod Team + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + * +*/ + +modded class LoginScreenBase +{ + protected ImageWidget m_ExHintIcon; + protected int m_ExBackgroundIndex = 0; + + protected const float LOADING_SCREEN_CHANGE_TIME = 3.0; + protected float m_ExLoadingTime; + + protected ImageWidget m_ExBackground; + + protected ref CustomLoadingScreenData m_ExCustomLoadingScreenData; + protected ref array m_ShownBackgrounds; + + void LoginScreenBase() + { + m_ExCustomLoadingScreenData = new CustomLoadingScreenData(); + + if (!m_ExCustomLoadingScreenData) + return; + + if (m_ExCustomLoadingScreenData.RandomizeBackgounds) + m_ShownBackgrounds = new array; + } + + /*override Widget Init() + { + layoutRoot = super.Init(); + + m_ExBackground = ImageWidget.Cast(layoutRoot.FindAnyWidget("Background")); + + SetBackgroundImage(m_ExBackgroundIndex); + m_ExBackgroundIndex++; + + return layoutRoot; + }*/ + + override void Update(float timeslice) + { + super.Update(timeslice); + + m_ExLoadingTime += timeslice; + if (m_ExLoadingTime >= LOADING_SCREEN_CHANGE_TIME) + { + if (!m_ExCustomLoadingScreenData.RandomizeBackgounds) + { + SetBackgroundImage(m_ExBackgroundIndex); + m_ExBackgroundIndex++; + if (m_ExBackgroundIndex > (m_ExCustomLoadingScreenData.m_ExBackgrounds.Count() - 1)) + m_ExBackgroundIndex = 0; + } + else + { + if (m_ShownBackgrounds.Count() < m_ExCustomLoadingScreenData.m_ExBackgrounds.Count()) + { + m_ExBackgroundIndex = GetRandomBackroundIndex(); + SetBackgroundImage(m_ExBackgroundIndex); + m_ShownBackgrounds.Insert(m_ExBackgroundIndex); + } + else + { + m_ShownBackgrounds.Clear(); + } + + } + + m_ExLoadingTime = 0; + } + } + + protected int GetRandomBackroundIndex() + { + int index = Math.RandomIntInclusive(0, (m_ExCustomLoadingScreenData.m_ExBackgrounds.Count() - 1)); + int searchCount; + while ((m_ShownBackgrounds.Find(index) > -1) && (searchCount < m_ShownBackgrounds.Count())) + { + index = Math.RandomIntInclusive(0, (m_ExCustomLoadingScreenData.m_ExBackgrounds.Count() - 1)); + } + + return index; + } + + protected void SetBackgroundImage(int index) + { + CustomLoadingScreenBackground background = m_ExCustomLoadingScreenData.m_ExBackgrounds.Get(index); + if (background && background.ImagePath != string.Empty) + { + Print(ToString() + "::SetBackgroundImage - Background: " + background.ImagePath); + m_ExBackground.LoadImageFile(0, background.ImagePath, true); + m_ExBackground.SetImage(0); + } + } +}; diff --git a/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoginTimeBase.c b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoginTimeBase.c new file mode 100644 index 0000000..da87d2d --- /dev/null +++ b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoginTimeBase.c @@ -0,0 +1,26 @@ +/** + * ExpansionRespawnHandlerModule.c + * + * DayZ Expansion Mod + * www.dayzexpansion.com + * © 2022 DayZ Expansion Mod Team + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + * +*/ + +modded class LoginTimeBase +{ + override Widget Init() + { + layoutRoot = super.Init(); + + m_ExBackground = ImageWidget.Cast(layoutRoot.FindAnyWidget("Background")); + + SetBackgroundImage(m_ExBackgroundIndex); + m_ExBackgroundIndex++; + + return layoutRoot; + } +}; diff --git a/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/UiHintPanel.c b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/UiHintPanel.c new file mode 100644 index 0000000..7db8ffc --- /dev/null +++ b/LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/UiHintPanel.c @@ -0,0 +1,32 @@ +/** + * ExpansionRespawnHandlerModule.c + * + * DayZ Expansion Mod + * www.dayzexpansion.com + * © 2022 DayZ Expansion Mod Team + * + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + * +*/ + +modded class UiHintPanel +{ + protected const string m_ExDataPath = "LoadingScreen/Scripts/Data/Hints.json"; //! Custom hints json path + protected ref CustomLoadingScreenData m_ExCustomLoadingScreenData; + + override protected void LoadContentList() + { + if (!m_ExCustomLoadingScreenData) + m_ExCustomLoadingScreenData = new CustomLoadingScreenData(); + + if (m_ExCustomLoadingScreenData && m_ExCustomLoadingScreenData.UseCustomHints) + { + JsonFileLoader>.JsonLoadFile(m_ExDataPath, m_ContentList); + } + else + { + JsonFileLoader>.JsonLoadFile(m_DataPath, m_ContentList); + } + } +};