File size: 1,522 Bytes
24b81cb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
class DisplayElementBase extends MessageReceiverBase
{
int m_Value;
int m_ValueLast = -99999;
int m_Key = 0;
int m_Type = 0;
int m_Range = 0;
int m_Colors[7];
string m_Labels[7];
int m_Pos = 1;
int NUM_OF_BITS;
bool m_IsClientOnly = false;
PlayerBase m_Player;
PluginPlayerStatus m_ModulePlayerStatus;
void DisplayElementBase(PlayerBase player)
{
m_System = "VirtualHud";
m_ModulePlayerStatus = PluginPlayerStatus.Cast(GetPlugin(PluginPlayerStatus));
m_Player = player;
//SetMaxValue();
}
//for elements which get their value client side and can be updated much more quickly
bool IsClientOnly()
{
return m_IsClientOnly;
}
bool IsValueChanged()
{
return !(m_Value == m_ValueLast);
}
void UpdateHUD()
{
m_ValueLast = m_Value;
}
int GetNumberOfBits()
{
return NUM_OF_BITS;
}
void SetValue(int value, int range = 0)
{
m_Value = value;
if (range != 0 )
{
m_Range = range;
}
}
int GetValue()
{
return m_Value;
}
int BitToDec(int mask, int index, int length)
{
int value = mask & (GetCompareMask() << index);
value = value >> index;
return value;
}
int GetCompareMask()
{
int mask = Math.Pow(2, GetNumberOfBits() ) - 1;
return mask;
}
int GetType()
{
return m_Type;
}
int TranslateLevelToStatus(int level)
{
if( level == DSLevels.WARNING )
return 2;
if( level == DSLevels.CRITICAL )
return 3;
if( level == DSLevels.BLINKING )
return 4;
if( level == DSLevels.EXTRA )
return 5;
return 1;
}
} |