Skip to content

Commit

Permalink
fix: fix health bar colours not loading when loading a save game
Browse files Browse the repository at this point in the history
  • Loading branch information
Notexe committed Feb 24, 2024
1 parent ca68e71 commit 9676a0b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
13 changes: 13 additions & 0 deletions content/chunk0/gameessentialbase.entity.patch.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,19 @@
"events": { "Data": { "SecondaryColours": ["cafef77f80f5f691"] } }
}
]
},
{
"AddEntity": [
"cafe80cf93bca7cf",
{
"parent": "cafeba446945a84b",
"name": "GameEventListener",
"factory": "[modules:/zgameeventlistenerentity.class].pc_entitytype",
"blueprint": "[modules:/zgameeventlistenerentity.class].pc_entityblueprint",
"properties": { "m_eEvent": { "type": "EGameEventType", "value": "GET_SavegameRestored" } },
"events": { "EventOccurred": { "GetData": ["cafea8f9b3707ba1", "cafe6e40d206cd7a"] } }
}
]
}
],
"patchVersion": 6
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.
14 changes: 7 additions & 7 deletions source/src/healthbar/HealthBar.as
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class HealthBar extends BaseControl {

private var m_healthBarView:HealthBarView = new HealthBarView();
private var m_debugTextView:DebugTextView = new DebugTextView();
private var m_healthBarColourTransform:ColorTransform = new ColorTransform();
private var m_infectedColourTransform:ColorTransform = new ColorTransform();
private var m_currentHealth:Number;
private var m_isInfected:Boolean = false;
private var m_lowHealthColour:uint;
Expand Down Expand Up @@ -104,11 +106,10 @@ public class HealthBar extends BaseControl {
UpdateHealthBarColour();
}

private function UpdateHealthBarColour():void {
public function UpdateHealthBarColour():void {
if (m_isInfected) {
var yellow:ColorTransform = new ColorTransform();
yellow.color = m_infectedColour;
m_healthBarView.HealthBarInner.transform.colorTransform = yellow;
m_infectedColourTransform.color = m_infectedColour;
m_healthBarView.HealthBarInner.transform.colorTransform = m_infectedColourTransform;
return;
}

Expand All @@ -131,9 +132,8 @@ public class HealthBar extends BaseControl {
medium = interpolate(m_mediumHealthColour & 0xFF, m_fullHealthColour & 0xFF, middleToFullRatio);
}

var colorTransform:ColorTransform = new ColorTransform();
colorTransform.color = (low << 16) | (full << 8) | medium;
m_healthBarView.HealthBarInner.transform.colorTransform = colorTransform;
m_healthBarColourTransform.color = (low << 16) | (full << 8) | medium;
m_healthBarView.HealthBarInner.transform.colorTransform = m_healthBarColourTransform;
}

private function interpolate(start:uint, end:uint, ratio:Number):uint {
Expand Down

0 comments on commit 9676a0b

Please sign in to comment.