parent
25f892be5d
commit
456759c6e4
4 changed files with 38 additions and 1 deletions
@ -0,0 +1,22 @@ |
||||
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); |
||||
} |
||||
} |
@ -0,0 +1,3 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 5dbef9373027473e89dc9baa2b24b443 |
||||
timeCreated: 1681209417 |
@ -1,5 +1,4 @@ |
||||
.player_panel { |
||||
width: 100%; |
||||
height: 15%; |
||||
position: absolute; |
||||
} |
||||
|
Loading…
Reference in new issue