DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ValueToBar()

static string ValueToBar ( float value,
string bar = "[----------]",
string mark = "x" )
staticprotected

Produces ACII "progress bar" based on an 0..1 'value' input.

См. определение в файле MiscGameplayFunctions.c строка 247

248 {
249 int length = bar.Length() - 2;
250 float index = Math.Lerp(0,length, value);
251 index = Math.Round(index);
252 index = Math.Clamp(index,0,length);
253
254 return InsertAtPos(bar,mark,index);
255 }
static string InsertAtPos(string base, string insert, int pos)
Insert 'insert' behind index 'pos' of the 'base' string.
Определения MiscGameplayFunctions.c:258
Определения EnMath.c:7
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Round(float f)
Returns mathematical round of value.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
proto native int Length()
Returns length of string.

Перекрестные ссылки Math::Clamp(), InsertAtPos(), string::Length(), Math::Lerp() и Math::Round().