init
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace VOID.UserInterface.LoadingScreen
|
||||
{
|
||||
public class LoadingScreenUI : MonoBehaviour
|
||||
{
|
||||
public static LoadingScreenUI current { get; private set; }
|
||||
|
||||
// Visual Elements
|
||||
private VisualElement _rootElement;
|
||||
private VisualElement _progressBarElement;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
current = this;
|
||||
|
||||
var uiDocument = gameObject.GetComponent<UIDocument>();
|
||||
var templateElement = uiDocument.rootVisualElement;
|
||||
|
||||
// Find all important elements
|
||||
_rootElement = templateElement.Q("root-loading-screen");
|
||||
_progressBarElement = templateElement.Q("progress-bar");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets progress which change length of loading bar.
|
||||
/// </summary>
|
||||
/// <param name="progress">Value between 0 and 1</param>
|
||||
public void SetProgress(float progress)
|
||||
{
|
||||
_progressBarElement.style.width = new StyleLength(Length.Percent(Mathf.Clamp01(progress) * 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75aa94a21bca4e5e9210744adc65e42e
|
||||
timeCreated: 1730405288
|
||||
@@ -0,0 +1,12 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
engine="UnityEngine.UIElements" editor="UnityEditor.UIElements"
|
||||
noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
|
||||
<Style src="project://database/Assets/92%20-%20UserInterface/Generic/LoadingScreen/LoadingScreenUIStyle.uss?fileID=7433441132597879392&guid=9240a2367eb294f40b1c96ee23ce4778&type=3#LoadingScreenUIStyle" />
|
||||
<ui:VisualElement name="root-loading-screen">
|
||||
<ui:VisualElement class="progress-bar_container">
|
||||
<ui:VisualElement class="progress-bar_background" />
|
||||
<ui:VisualElement name="progress-bar" />
|
||||
<ui:VisualElement class="progress-bar_foreground" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69a4662233636394ead4f09bb29bf308
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
@@ -0,0 +1,41 @@
|
||||
#root-loading-screen {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url('project://database/Assets/_ADDONS/MedievalKingdomUI/Artworks/Backgrounds/Mini_art_Forest.png?fileID=2800000&guid=e8ca01f249a245947adc9cf9e162609b&type=3#Mini_art_Forest');
|
||||
}
|
||||
|
||||
.progress-bar_container {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
margin-top: 0;
|
||||
margin-right: 0;
|
||||
margin-bottom: 20px;
|
||||
margin-left: 0;
|
||||
align-self: center;
|
||||
width: 1200px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.progress-bar_container > .progress-bar_background {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url('project://database/Assets/_ADDONS/MedievalKingdomUI/Artworks/Classic_Skin/UI_elements_C/Loading_line.png?fileID=2800000&guid=18657c642cc0a9546adc71c0efcdd571&type=3#Loading_line');
|
||||
-unity-background-image-tint-color: rgba(66, 66, 66, 0.78);
|
||||
}
|
||||
|
||||
.progress-bar_container > #progress-bar {
|
||||
width: 66%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
background-image: url('project://database/Assets/_ADDONS/MedievalKingdomUI/Artworks/Classic_Skin/UI_elements_C/Loading_line.png?fileID=2800000&guid=18657c642cc0a9546adc71c0efcdd571&type=3#Loading_line');
|
||||
-unity-background-scale-mode: scale-and-crop;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.progress-bar_container > .progress-bar_foreground {
|
||||
background-image: url('project://database/Assets/_ADDONS/MedievalKingdomUI/Artworks/Classic_Skin/UI_elements_C/Loading_frame.png?fileID=2800000&guid=92e8d9b13e8bb024faa683e554fc30b8&type=3#Loading_frame');
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9240a2367eb294f40b1c96ee23ce4778
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
||||
Reference in New Issue
Block a user