protected override SharpUIBase BuildMainPanel() { _healthBar = new SharpUIProgressBar("UnitHealthBar", null, null); _healthBar.SetFixedSize(Size); _healthBar.BackgroundColor = new Color(0f, 0f, 0f, 0.5f); _healthBar.FillColor = Color.green; return(_healthBar); }
// -------------------------------------------------------------------------------------------- protected override SharpUIBase BuildMainPanel() { _background = new SharpUINonDrawingGraphic($"{_player.name}_Panel"); _background.RaycastTarget = false; _background.SetFixedSize(Size); _background.alignment = EAlignment.BottomLeft; _background.margin = new RectOffset(20, 0, 0, 20); _heroHealthBar = new SharpUIProgressBar("HeroHealthBar", null, null); _heroHealthBar.BackgroundColor = new Color(0f, 0f, 0f, 0.5f); _heroHealthBar.FillColor = Color.green; _heroHealthBar.Percent = 1f; _heroHealthBar.SetFixedSize(340, 40); _heroHealthBar.alignment = EAlignment.TopRight; _heroHealthBar.margin = new RectOffset(0, 0, 20, 0); _background.AddChild(_heroHealthBar); _headBackground = new SharpUIMask("HeadBackground", AppManager.AssetManager.Get <Sprite>(AssetPaths.Sprites.CircleWhite2048)); _headBackground.ShowMaskGraphic = true; _headBackground.SetFixedSize((int)Size.y, (int)Size.y); _background.AddChild(_headBackground); _headSprite = new SharpUIImage("HeadSprite", AppManager.AssetManager.Get <Sprite>(_player.PlayerData.headSpritePath)); _headSprite.SetFillSize(); _headBackground.AddChild(_headSprite); _sourceLabel = new SharpUITextMeshPro("SourceLabel", _player.Source.ToString()); _sourceLabel.SetFixedSize(50, 50); _sourceLabel.Font = AppManager.AssetManager.Get <TMPro.TMP_FontAsset>(AssetPaths.Fonts.GravityBoldItalic); _sourceLabel.AutoSizeFont(); _sourceLabel.alignment = EAlignment.BottomLeft; _sourceLabel.TextAlignment = TMPro.TextAlignmentOptions.Center; _background.AddChild(_sourceLabel); _energyMeter = new UIEnergyMeter($"{_player.name}_energy_meter"); _energyMeter.SetEnergy(_player.Energy, _player.EnergyCap); _energyMeter.alignment = EAlignment.TopLeft; _energyMeter.margin = new RectOffset((int)Size.y + 10, 0, 70, 0); _background.AddChild(_energyMeter); return(_background); }