This commit is contained in:
2026-07-09 21:33:33 +02:00
commit 84a2a365f3
2364 changed files with 950134 additions and 0 deletions
@@ -0,0 +1,39 @@
using System;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UIElements;
using VOID.ScriptableObjects.Player;
namespace VOID.UserInterface.Game.LevelUp
{
public class LevelUpOptionUI : MonoBehaviour
{
public event Action OnSelect;
public static LevelUpOptionUI InitNew(GameObject gameObject, VisualElement parentWrapperElement, LevelUpOption option)
{
// New instance to manage this option
var instance = gameObject.AddComponent<LevelUpOptionUI>();
// Get all needed visual elements
var templateElement = GameUI.current.levelUpOptionTemplate.CloneTree().contentContainer;
templateElement.Q<Button>("root-level-up-option").clicked += () => instance.OnSelect?.Invoke();
templateElement.Q<Label>("title").text = option.displayName;
templateElement.Q("image").style.backgroundImage = option.displayIcon;
templateElement.Q<Label>("description").text = new StringBuilder()
.AppendJoin("\n", option.effects.Select(effect => effect.GetSimpleDescription()))
.AppendLine(option.displayDescription)
.ToString();
// Put this option into LevelUpUI
parentWrapperElement.Add(templateElement);
// Bind UI to this script + make it pickable
templateElement.dataSource = instance;
templateElement.pickingMode = PickingMode.Position;
return instance;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8b0abe7e999848df8ab7eeefa2a8b3df
timeCreated: 1729088250
@@ -0,0 +1,10 @@
<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/Game/LevelUp/LevelUpOptionUIStyle.uss?fileID=7433441132597879392&amp;guid=f8e50bdc9f94ea34a86065518df01235&amp;type=3#LevelUpOptionUIStyle" />
<ui:Button name="root-level-up-option" style="width: 450px; height: 600px;">
<ui:Label text="{TITLE}" name="title" picking-mode="Ignore" />
<ui:VisualElement name="image" picking-mode="Ignore" />
<ui:Label text="{DESCRIPTION}" name="description" picking-mode="Ignore" />
</ui:Button>
</ui:UXML>
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: df731c68208fb8f49b616715fe5fc317
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
@@ -0,0 +1,40 @@
#root-level-up-option {
width: 100%;
height: 100%;
flex-direction: column;
background-color: rgba(130, 130, 130, 0.98);
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 2px;
border-left-width: 2px;
border-left-color: rgb(0, 0, 0);
border-right-color: rgb(0, 0, 0);
border-top-color: rgb(0, 0, 0);
border-bottom-color: rgb(0, 0, 0);
padding-top: 20px;
padding-right: 20px;
padding-bottom: 20px;
padding-left: 20px;
align-items: center;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
margin-left: 10px;
}
#root-level-up-option > #title {
-unity-text-align: upper-center;
font-size: 50px;
}
#root-level-up-option > #image {
height: 150px;
width: 150px;
background-image: url('project://database/Assets/_ADDONS/MedievalKingdomUI/Artworks/White_gold_Skin/UI_elements_W/icon_frame.png?fileID=2800000&guid=f272753cabc45b9419037998d01412e7&type=3#icon_frame');
}
#root-level-up-option > #description {
-unity-text-align: upper-left;
font-size: 20px;
width: 100%;
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f8e50bdc9f94ea34a86065518df01235
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using VOID.ScriptableObjects.Player;
namespace VOID.UserInterface.Game.LevelUp
{
public class LevelUpUI : MonoBehaviour
{
public static LevelUpUI current { get; private set; }
// Children - Options
private List<LevelUpOptionUI> _options = new();
// Visual Elements
private VisualElement _rootElement;
private VisualElement _optionListElement;
private Button _closeButton;
private void Awake()
{
current = this;
var uiDocument = gameObject.GetComponent<UIDocument>();
var templateElement = uiDocument.rootVisualElement;
_rootElement = templateElement.Q("root-level-up");
_closeButton = _rootElement.Q<Button>("close");
_optionListElement = _rootElement.Q("options");
_rootElement.dataSource = this;
_rootElement.pickingMode = PickingMode.Position;
_closeButton.clicked += Close;
Close();
}
public void Open(List<LevelUpOption> options, Action<LevelUpOption> onOptionSelect)
{
Close();
_rootElement.style.display = DisplayStyle.Flex;
foreach (var option in options)
{
var optionUI = LevelUpOptionUI.InitNew(gameObject, _optionListElement, option);
optionUI.OnSelect += Close;
optionUI.OnSelect += () => onOptionSelect.Invoke(option);
_options.Add(optionUI);
}
}
public void Close()
{
_rootElement.style.display = DisplayStyle.None;
_optionListElement.Clear();
_options.ForEach(Destroy);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 63f40eebe486cd64eb7a5a6bd5da7da4
timeCreated: 1697407029
@@ -0,0 +1,15 @@
<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">
<ui:Template name="LevelUpOptionUI" src="project://database/Assets/92%20-%20UserInterface/Generic/Game/LevelUp/LevelUpOptionUI.uxml?fileID=9197481963319205126&amp;guid=df731c68208fb8f49b616715fe5fc317&amp;type=3#LevelUpOptionUI" />
<Style src="project://database/Assets/92%20-%20UserInterface/Generic/Game/LevelUp/LevelUpUIStyle.uss?fileID=7433441132597879392&amp;guid=1ef38f048e44352458744eb7ba0ef450&amp;type=3#LevelUpUIStyle" />
<ui:VisualElement name="root-level-up">
<ui:Button name="close" text="X" />
<ui:VisualElement name="options">
<ui:Instance template="LevelUpOptionUI" />
<ui:Instance template="LevelUpOptionUI" />
<ui:Instance template="LevelUpOptionUI" />
<ui:Instance template="LevelUpOptionUI" />
</ui:VisualElement>
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: cea9f1cecad1e6e4fae469eb345a8c2f
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
@@ -0,0 +1,21 @@
#root-level-up {
width: 100%;
height: 100%;
flex-direction: row;
align-items: center;
background-color: rgba(255, 255, 255, 0.08);
}
#root-level-up > #close {
position: absolute;
top: 10px;
right: 10px;
width: 40px;
height: 40px;
}
#root-level-up > #options {
flex-direction: row;
justify-content: center;
width: 100%;
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1ef38f048e44352458744eb7ba0ef450
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0