Skip to content

Commit

Permalink
feat(developers): expose width and height property
Browse files Browse the repository at this point in the history
  • Loading branch information
Notexe committed Feb 22, 2024
1 parent 1c8238a commit a454dd0
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions content/chunk0/gameessentialbase.entity.patch.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"value": { "resource": "[assembly:/ui/controls/HealthBar.swf].pc_swf", "flag": "5F" }
},
"m_sClassName": { "type": "ZString", "value": "healthbar.HealthBar" },
"m_vPositionOffset": { "type": "SVector3", "value": { "x": 14, "y": 829, "z": 0 } },
"m_vPositionOffset": { "type": "SVector3", "value": { "x": 15, "y": 829, "z": 0 } },
"m_eAlignmentType": {
"type": "ZUIControlLayoutLegacyAspect.EAlignmentType",
"value": "E_ALIGNMENT_TYPE_BottomLeft"
Expand All @@ -95,7 +95,9 @@
"LowHealthColour": { "type": "ZString", "value": "#FA0000" },
"MediumHealthColour": { "type": "ZString", "value": "#FFFF00" },
"FullHealthColour": { "type": "ZString", "value": "#00BA00" },
"InfectedColour": { "type": "ZString", "value": "#FFFF00" }
"InfectedColour": { "type": "ZString", "value": "#FFFF00" },
"Height": { "type": "float32", "value": 1 },
"Width": { "type": "float32", "value": 1 }
}
}
]
Expand Down
Binary file modified content/chunk0/scaleform/001D0947392E2DD6.GFXF
Binary file not shown.
Binary file modified content/chunk0/scaleform/003F45DD25EEE393.UICB
Binary file not shown.
Binary file modified source/bin/HealthBar.swf
Binary file not shown.
Binary file modified source/lib/HealthBar.swc
Binary file not shown.
11 changes: 11 additions & 0 deletions source/src/healthbar/HealthBar.as
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import scaleform.gfx.Extensions;
public class HealthBar extends BaseControl {

private var m_healthBarView:HealthBarView = new HealthBarView();
private var m_debugTextView:DebugTextView = new DebugTextView();
private var m_currentHealth:Number;
private var m_isInfected:Boolean = false;
private var m_lowHealthColour:uint;
Expand All @@ -19,8 +20,10 @@ public class HealthBar extends BaseControl {
private var m_DebugMode:Boolean;

public function HealthBar() {
m_debugTextView.DebugText.visible = false;
Extensions.setEdgeAAMode(m_healthBarView, Extensions.EDGEAA_OFF)
addChild(m_healthBarView);
addChild(m_debugTextView);
}

public function SetHealth(health:Number):void {
Expand Down Expand Up @@ -161,6 +164,14 @@ public class HealthBar extends BaseControl {
}
}

public function set Height(number:Number):void {
m_healthBarView.scaleY = number;
}

public function set Width(number:Number):void {
m_healthBarView.scaleX = number;
}

private function UpdateDebugText(e:Event):void {
var debugInfo:String = "";
debugInfo += "Current Health: " + Math.round(m_currentHealth) + "\n";
Expand Down

0 comments on commit a454dd0

Please sign in to comment.