Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
};
Original file line number Diff line number Diff line change
@@ -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<ref CustomLoadingScreenBackground> m_ExBackgrounds;

void CustomLoadingScreenData()
{
m_ExBackgrounds = new array<ref CustomLoadingScreenBackground>;
JsonFileLoader<array<ref CustomLoadingScreenBackground>>.JsonLoadFile("LoadingScreen/Scripts/Data/LoadingImages.json", m_ExBackgrounds);
}
};
169 changes: 1 addition & 168 deletions LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoadingScreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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<ref CustomLoadingScreenBackground> m_ExBackgrounds;

void CustomLoadingScreenData()
{
m_ExBackgrounds = new array<ref CustomLoadingScreenBackground>;
JsonFileLoader<array<ref CustomLoadingScreenBackground>>.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<array<ref HintPage>>.JsonLoadFile(m_ExDataPath, m_ContentList);
}
else
{
JsonFileLoader<array<ref HintPage>>.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<int> m_ShownBackgrounds;

void LoginScreenBase()
{
m_ExCustomLoadingScreenData = new CustomLoadingScreenData();

if (!m_ExCustomLoadingScreenData)
return;

if (m_ExCustomLoadingScreenData.RandomizeBackgounds)
m_ShownBackgrounds = new array<int>;
}

/*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;
Expand Down Expand Up @@ -354,4 +187,4 @@ modded class LoadingScreen

Print(ToString() + "::SetBackgroundImage - End");
}
};
};
26 changes: 26 additions & 0 deletions LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoginQueueBase.c
Original file line number Diff line number Diff line change
@@ -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;
}
};
104 changes: 104 additions & 0 deletions LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoginScreenBase.c
Original file line number Diff line number Diff line change
@@ -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<int> m_ShownBackgrounds;

void LoginScreenBase()
{
m_ExCustomLoadingScreenData = new CustomLoadingScreenData();

if (!m_ExCustomLoadingScreenData)
return;

if (m_ExCustomLoadingScreenData.RandomizeBackgounds)
m_ShownBackgrounds = new array<int>;
}

/*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);
}
}
};
26 changes: 26 additions & 0 deletions LoadingScreen/Scripts/3_Game/LoadingScreen/GUI/LoginTimeBase.c
Original file line number Diff line number Diff line change
@@ -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;
}
};
Loading