Skip to content

Commit

Permalink
enhancement: expose MediumHealthRatio property for main colour json f…
Browse files Browse the repository at this point in the history
…iles
  • Loading branch information
Notexe committed Feb 27, 2024
1 parent 45a569d commit 0875941
Show file tree
Hide file tree
Showing 23 changed files with 44 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#D40000",
"MediumHealthColour": "#D40000",
"FullHealthColour": "#D40000",
"InfectedColour": "#E7C216"
"InfectedColour": "#E7C216",
"MediumHealthRatio": 0.5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#D40000",
"MediumHealthColour": "#D40000",
"FullHealthColour": "#D40000",
"InfectedColour": "#A0B000"
"InfectedColour": "#A0B000",
"MediumHealthRatio": 0.5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#D40000",
"MediumHealthColour": "#E7C216",
"FullHealthColour": "#00AB08",
"InfectedColour": "#E7C216"
"InfectedColour": "#E7C216",
"MediumHealthRatio": 0.5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#D40000",
"MediumHealthColour": "#E7C216",
"FullHealthColour": "#00AB08",
"InfectedColour": "#A0B000"
"InfectedColour": "#A0B000",
"MediumHealthRatio": 0.5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#900D12",
"MediumHealthColour": "#D40000",
"FullHealthColour": "#FA000E",
"InfectedColour": "#F8C600"
"InfectedColour": "#F8C600",
"MediumHealthRatio": 0.5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#FA000E",
"MediumHealthColour": "#D40000",
"FullHealthColour": "#900D12",
"InfectedColour": "#F8C600"
"InfectedColour": "#F8C600",
"MediumHealthRatio": 0.5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#FA0000",
"MediumHealthColour": "#FFFF00",
"FullHealthColour": "#00BA00",
"InfectedColour": "#FFFF00"
"InfectedColour": "#FFFF00",
"MediumHealthRatio": 0.5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#900D12",
"MediumHealthColour": "#F8EE2F",
"FullHealthColour": "#01900F",
"InfectedColour": "#F8EE2F"
"InfectedColour": "#F8EE2F",
"MediumHealthRatio": 0.5
}
}
3 changes: 2 additions & 1 deletion colour_schemes/main/h2016_goty/chunk0/00E4170B1BDDBEFA.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#900D12",
"MediumHealthColour": "#FFFFFF",
"FullHealthColour": "#FFFFFF",
"InfectedColour": "#F8EE2F"
"InfectedColour": "#F8EE2F",
"MediumHealthRatio": 0.2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#900D12",
"MediumHealthColour": "#FFFFFF",
"FullHealthColour": "#FFFFFF",
"InfectedColour": "#A0B000"
"InfectedColour": "#A0B000",
"MediumHealthRatio": 0.5
}
}
3 changes: 2 additions & 1 deletion colour_schemes/main/h2016_red/chunk0/00E4170B1BDDBEFA.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#900D12",
"MediumHealthColour": "#900D12",
"FullHealthColour": "#900D12",
"InfectedColour": "#F8EE2F"
"InfectedColour": "#F8EE2F",
"MediumHealthRatio": 0.5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#900D12",
"MediumHealthColour": "#900D12",
"FullHealthColour": "#900D12",
"InfectedColour": "#A0B000"
"InfectedColour": "#A0B000",
"MediumHealthRatio": 0.5
}
}
3 changes: 2 additions & 1 deletion colour_schemes/main/h2016_sick/chunk0/00E4170B1BDDBEFA.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#900D12",
"MediumHealthColour": "#F8EE2F",
"FullHealthColour": "#01900F",
"InfectedColour": "#A0B000"
"InfectedColour": "#A0B000",
"MediumHealthRatio": 0.5
}
}
3 changes: 2 additions & 1 deletion colour_schemes/main/hwoa_dark/chunk0/00E4170B1BDDBEFA.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#900D12",
"MediumHealthColour": "#F8C600",
"FullHealthColour": "#007000",
"InfectedColour": "#F8C600"
"InfectedColour": "#F8C600",
"MediumHealthRatio": 0.5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#900D12",
"MediumHealthColour": "#F8C600",
"FullHealthColour": "#007000",
"InfectedColour": "#A0B000"
"InfectedColour": "#A0B000",
"MediumHealthRatio": 0.5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#FA000E",
"MediumHealthColour": "#FFC900",
"FullHealthColour": "#3AFA4A",
"InfectedColour": "#F8C600"
"InfectedColour": "#F8C600",
"MediumHealthRatio": 0.5
}
}
3 changes: 2 additions & 1 deletion colour_schemes/main/hwoa_sick/chunk0/00E4170B1BDDBEFA.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#FA000E",
"MediumHealthColour": "#F8C900",
"FullHealthColour": "#3AFA4A",
"InfectedColour": "#A0B000"
"InfectedColour": "#A0B000",
"MediumHealthRatio": 0.5
}
}
3 changes: 2 additions & 1 deletion colour_schemes/main/rgb/chunk0/00E4170B1BDDBEFA.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#0000FF",
"MediumHealthColour": "#00FF00",
"FullHealthColour": "#FF0000",
"InfectedColour": "#FFFF00"
"InfectedColour": "#FFFF00",
"MediumHealthRatio": 0.5
}
}
3 changes: 2 additions & 1 deletion colour_schemes/main/rgb_gbr/chunk0/00E4170B1BDDBEFA.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"LowHealthColour": "#FA000E",
"MediumHealthColour": "#2117E7",
"FullHealthColour": "#41FF4D",
"InfectedColour": "#FFC900"
"InfectedColour": "#FFC900",
"MediumHealthRatio": 0.5
}
}
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.
12 changes: 6 additions & 6 deletions source/src/healthbar/HealthBar.as
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class HealthBar extends BaseControl {
private var m_mediumHealthColour:uint;
private var m_fullHealthColour:uint;
private var m_infectedColour:uint;
private var m_mediumHealthRatio:Number;

private var checkCallEntityTimer:Timer;

Expand Down Expand Up @@ -69,6 +70,7 @@ public class HealthBar extends BaseControl {
MediumHealthColour = object.MainColours.MediumHealthColour;
FullHealthColour = object.MainColours.FullHealthColour;
InfectedColour = object.MainColours.InfectedColour;
m_mediumHealthRatio = object.MainColours.MediumHealthRatio;
UpdateHealthBarColour();
mainColoursObjectDebug = object.MainColours;
}
Expand Down Expand Up @@ -106,7 +108,7 @@ public class HealthBar extends BaseControl {
UpdateHealthBarColour();
}

public function UpdateHealthBarColour():void {
private function UpdateHealthBarColour():void {
if (m_isInfected) {
m_infectedColourTransform.color = m_infectedColour;
m_healthBarView.HealthBarInner.transform.colorTransform = m_infectedColourTransform;
Expand All @@ -116,17 +118,15 @@ public class HealthBar extends BaseControl {
var m_maxHealth:Number = 100;
var healthRatio:Number = m_currentHealth / m_maxHealth;

var mediumHealthRatio:Number = 0.5;

var low:uint, medium:uint, full:uint;

if (healthRatio <= mediumHealthRatio) {
var lowToMiddleRatio:Number = healthRatio / mediumHealthRatio;
if (healthRatio <= m_mediumHealthRatio) {
var lowToMiddleRatio:Number = healthRatio / m_mediumHealthRatio;
low = interpolate((m_lowHealthColour >> 16) & 0xFF, (m_mediumHealthColour >> 16) & 0xFF, lowToMiddleRatio);
full = interpolate((m_lowHealthColour >> 8) & 0xFF, (m_mediumHealthColour >> 8) & 0xFF, lowToMiddleRatio);
medium = interpolate(m_lowHealthColour & 0xFF, m_mediumHealthColour & 0xFF, lowToMiddleRatio);
} else {
var middleToFullRatio:Number = (healthRatio - mediumHealthRatio) / (1 - mediumHealthRatio);
var middleToFullRatio:Number = (healthRatio - m_mediumHealthRatio) / (1 - m_mediumHealthRatio);
low = interpolate((m_mediumHealthColour >> 16) & 0xFF, (m_fullHealthColour >> 16) & 0xFF, middleToFullRatio);
full = interpolate((m_mediumHealthColour >> 8) & 0xFF, (m_fullHealthColour >> 8) & 0xFF, middleToFullRatio);
medium = interpolate(m_mediumHealthColour & 0xFF, m_fullHealthColour & 0xFF, middleToFullRatio);
Expand Down

0 comments on commit 0875941

Please sign in to comment.