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,70 @@
using System;
using System.Collections.Generic;
using Sirenix.Utilities;
using UnityEngine;
using UnityEngine.UIElements;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Player;
using VOID.UserInterface.Game.Party;
namespace VOID.UserInterface.Generic.Lobby
{
public class LobbyGameStarterUI : MonoBehaviour
{
public static LobbyGameStarterUI current { get; private set; }
// Visual Elements
private VisualElement _rootElement;
private VisualElement _offsetElement;
private VisualElement _unitsElement;
private Dictionary<UnitObject, UnitPortraitUI> _unitPortraits = new();
private void Awake()
{
current = this;
var uiDocument = gameObject.GetComponent<UIDocument>();
var templateElement = uiDocument.rootVisualElement;
_rootElement = templateElement.Q("root-lobby-game-starter");
_rootElement.dataSource = this;
_offsetElement = templateElement.Q("offset");
_unitsElement = templateElement.Q("units");
// Remove all placeholders
_unitsElement.Clear();
// Main party UI hidden because no unit selected - hide offset
_offsetElement.style.display = DisplayStyle.None;
}
private void Start()
{
PlayerController.current.OnMainUnitChange += OnMainUnitChange;
}
public void AddUnit(UnitObject unit, Action<UnitObject> onSelect)
{
var unitPortrait = new UnitPortraitUI();
unitPortrait.InitNew(_unitsElement);
unitPortrait.SetUnit(unit);
unitPortrait.OnClick += onSelect;
_unitPortraits.Add(unit, unitPortrait);
}
private void OnMainUnitChange(UnitObject unit)
{
// Show all available units to select
_unitPortraits.Values.ForEach(unitPortrait => unitPortrait.templateElement.style.display = DisplayStyle.Flex);
// Hide main unit portrait, it will be displayed in party ui
if (_unitPortraits.TryGetValue(unit, out var mainUnitPortrait))
mainUnitPortrait.templateElement.style.display = DisplayStyle.None;
// Party UI should have main unit set - show offset to prevent overlapping
_offsetElement.style.display = DisplayStyle.Flex;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 616c49714fe2443b8c8956111a85883f
timeCreated: 1748182783
@@ -0,0 +1,13 @@
<ui:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:Template name="UnitPortrait" src="project://database/Assets/92%20-%20UserInterface/Generic/Game/Utility/UnitPortrait.uxml?fileID=9197481963319205126&amp;guid=2b588e131b790bd408086718bd2f82cd&amp;type=3#UnitPortrait" />
<Style src="project://database/Assets/92%20-%20UserInterface/Generic/Game/Utility/UnitPortraitOuter.uss?fileID=7433441132597879392&amp;guid=a9fd7af89854ed243b3383ce693bc254&amp;type=3#UnitPortraitOuter" />
<Style src="project://database/Assets/92%20-%20UserInterface/Generic/Lobby/LobbyGameStarterUIStyle.uxml.uss?fileID=7433441132597879392&amp;guid=13e395373e2f07648ad6e2004958d3fa&amp;type=3#LobbyGameStarterUIStyle.uxml" />
<ui:VisualElement name="root-lobby-game-starter" picking-mode="Ignore" style="flex-grow: 1;">
<ui:VisualElement name="offset" picking-mode="Ignore" class="unit-portrait-big" />
<ui:VisualElement name="units" picking-mode="Ignore" style="flex-grow: 1;">
<ui:Instance template="UnitPortrait" class="unit-portrait-small" />
<ui:Instance template="UnitPortrait" class="unit-portrait-small" />
<ui:Instance template="UnitPortrait" class="unit-portrait-small" />
</ui:VisualElement>
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b671d3d3a49a49944b62b2b58047e4aa
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
@@ -0,0 +1,3 @@
:root {
align-items: flex-start;
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 13e395373e2f07648ad6e2004958d3fa
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0