4 const float FADE_TIMEOUT = 30;
5 const float FADE_OUT_DURATION = 3;
6 const float FADE_IN_DURATION = 0.5;
8 private const string RADIO_PREFIX =
"(" +
"#str_radio" +
") ";
9 private const string GAME_PREFIX =
"(" +
"#layout_chat_game" +
") ";
10 private const string ADMIN_PREFIX =
"(" +
"#STR_MP_MASTER" +
") ";
11 private const int DEFAULT_COLOUR =
ARGB(255, 255, 255, 255);
12 private const int GAME_TEXT_COLOUR =
ARGB(255, 255, 0, 0);
13 private const int ADMIN_TEXT_COLOUR =
ARGB(255, 255, 255, 0);
20 private ref WidgetFadeTimer m_FadeTimer;
21 private ref
Timer m_TimeoutTimer;
25 m_RootWidget =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/day_z_chat_item.layout", root_widget);
30 m_FadeTimer =
new WidgetFadeTimer;
43 m_NameWidget.SetText(
"");
44 m_TextWidget.SetText(
"");
46 SetColour(DEFAULT_COLOUR);
49 channel = params.param1;
76 if ( channel & CCSystem )
79 if (params.param2 !=
"")
81 m_NameWidget.SetText(GAME_PREFIX +
": " );
84 SetColorByParam(params.param4, GAME_TEXT_COLOUR);
86 else if ( channel & CCAdmin )
89 m_NameWidget.SetText(ADMIN_PREFIX +
": ");
90 SetColorByParam(params.param4, ADMIN_TEXT_COLOUR);
92 else if ( channel & CCTransmitter )
95 m_NameWidget.SetText(RADIO_PREFIX + params.param2 +
" : ");
97 else if ( channel == 0 || channel & CCDirect )
100 if (params.param2 !=
"")
102 m_NameWidget.SetText(params.param2 +
" : ");
107 m_TextWidget.SetText(params.param3);
113 private void SetColour(
int colour)
115 m_NameWidget.SetColor(colour);
116 m_TextWidget.SetColor(colour);
119 protected void SetColorByParam(
string pParamValue,
int pFallback)
121 if (pParamValue !=
"")
123 SetColour(ColorNameToColor(pParamValue));
127 SetColour(pFallback);
133 m_TimeoutTimer.Stop();
137 protected int ColorNameToColor(
string pColorName)
139 int color = 0xFFFFFFFF;
142 case "colorStatusChannel":
148 case "colorFriendly":
151 case "colorImportant":