#I try to create a Simple score indicator
1 messages · Page 1 of 1 (latest)
class SCR_CTF_Widget: SCR_InfoDisplay
{
private TextWidget ScoreTextB;
private int score = 0;
override event void OnStartDraw(IEntity owner)
{
super.OnStartDraw(owner);
//Get widgets
if (!ScoreTextB) ScoreTextB = TextWidget.Cast(m_wRoot.FindAnyWidget("ScoreB"));
//set start values
ScoreTextB.SetText(score.ToString());
Print(" !!!!!!!!!!! OnStartDraw");
}
void AddPointToScoreB(IEntity owner)
{
score = score + 1;
if (ScoreTextR) {
Print("[AddPointToScoreB] --- WIDGET:: ");
ScoreTextB.SetText(score.ToString());
Print("[AddPointToScoreB] present ScoreTextB: " + ScoreTextB);
Print("Refresh UI with new value" + score);
UpdateValues(owner, 0.1);
}
else {
Print("[AddPointToScoreB] --- NO WIDGET:: ");
ScoreTextB = TextWidget.Cast(m_wRoot.FindAnyWidget("ScoreR"));
Print("[AddPointToScoreB] ScoreTextB: created: " + ScoreTextB);
ScoreTextR.SetText(score.ToString());
Print("Refresh UI with new value" + score);
UpdateValues(owner, 0.1);
}
}
}
check this example how its working:
https://github.com/HTomJMW/htCTI-Arma-Reforger/blob/Default/Scripts/Game/HUD/SCR_CTI_VehicleInfoHud.c
i used SCR_InfoDisplayExtended not base SCR_InfoDisplay