You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
565 B
23 lines
565 B
1 year ago
|
using System;
|
||
|
using System.Linq;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UIElements;
|
||
|
|
||
|
public class GameUI : MonoBehaviour {
|
||
|
|
||
|
private UIDocument document;
|
||
|
private void OnEnable() {
|
||
|
document = GetComponent<UIDocument>();
|
||
|
PreparePlayerPanels();
|
||
|
}
|
||
|
|
||
|
void PreparePlayerPanels() {
|
||
|
var players = document.rootVisualElement.Children().Where(e => e.ClassListContains("player_panel"));
|
||
|
|
||
|
float heightPercentage = Dimensions.Singleton.panelHeightPercentage;
|
||
|
|
||
|
foreach (var playerPanel in players)
|
||
|
playerPanel.style.height = Length.Percent(heightPercentage);
|
||
|
}
|
||
|
}
|