/******************************************
Дата 18.07.2024 11:47
Разработчик: BITHACK
Copyright (c) Ваша компания
Описание скрипта:....
*******************************************/
class OnScreenDmgMsgWnd extends UICommonAPI;
const MAX_DAMAGE_MESSAGE = 28;
var TextBoxHandle DamageText[MAX_DAMAGE_MESSAGE];
var int i;
var Color WhiteColor;
function OnLoad() {
RegisterEvent(EV_SystemMessage);
for (i = 0; i < MAX_DAMAGE_MESSAGE; i++) {
DamageText[i] = TextBoxHandle(GetHandle("OnScreenDmgMsgWnd.D-" $ i));
DamageText[i].SetText("");
}
}
function OnEvent(int Event_ID, string a_param) {
if (Event_ID == EV_SystemMessage) {
HandleSystemMessage(a_param);
}
}
function HandleSystemMessage(string a_Param) {
local int SystemMsgIndex;
ParseInt(a_Param, "Index", SystemMsgIndex);
switch (SystemMsgIndex) {
case 35:
case 1015:
DamageUI(WhiteColor, a_param);
break;
}
}
function DamageUI(Color DColor, string a_param) {
local String DamageToPlayer;
for (i = 0; i < MAX_DAMAGE_MESSAGE; i++) {
if (DamageText[i].GetText() == "" || DamageText[i].GetAlpha() <= 0) {
DamageText[i].SetText("");
DamageText[i].SetAlpha(255);
ParseString(a_Param, "Param1", DamageToPlayer);
DamageText[i].SetText(DamageToPlayer);
DamageText[i].SetAnchor("OnScreenDmgMsgWnd", "BottomCenter", "BottomCenter", -120 + Rand(150), Rand(100));
DamageText[i].ClearAnchor();
DamageText[i].Move(-100, -1500, 8f);
DamageText[i].SetTextColor(DColor);
DamageText[i].SetAlpha(0, 4f);
break;
}
}
}
defaultproperties {
WhiteColor=(B=255,G=255,R=255,A=255)
}