66 ImGuiWindowFlags flags = ImGuiWindowFlags_NoCollapse |
67 ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar;
68 const float content_width = 200.f;
69 ImGui::SetNextWindowContentWidth(content_width);
70 ImGui::SetNextWindowPos(ImVec2(
71 ImGui::GetIO().DisplaySize.x - (content_width + (2*ImGui::GetStyle().WindowPadding.x) + theme.
screen_edge_padding.x),
74 int y = 20 + (ImGui::GetTextLineHeightWithSpacing() * m_users.size());
81 ImGui::SetNextWindowSize(ImVec2((content_width + (2*ImGui::GetStyle().WindowPadding.x)),
y));
83 ImGui::Begin(
"Peers",
nullptr, flags);
90 Ogre::TexturePtr flag_tex;
91 Ogre::TexturePtr auth_tex;
92 Ogre::TexturePtr down_tex;
93 Ogre::TexturePtr up_tex;
96 if (user.uniqueid != local_user.
uniqueid &&
101 case 0: down_tex = m_icon_arrow_down_red;
break;
102 case 1: down_tex = m_icon_arrow_down;
break;
103 case 2: down_tex = m_icon_arrow_down_grey;
break;
110 case 0: up_tex = m_icon_arrow_up_red;
break;
111 case 1: up_tex = m_icon_arrow_up;
break;
112 case 2: up_tex = m_icon_arrow_up_grey;
break;
117 hovered |= this->DrawIcon(down_tex, ImVec2(8.f, ImGui::GetTextLineHeight()));
118 hovered |= this->DrawIcon(up_tex, ImVec2(8.f, ImGui::GetTextLineHeight()));
122 else if (user.authstatus &
RoRnet::AUTH_MOD ) { auth_tex = m_icon_flag_blue; }
125 hovered |= this->DrawIcon(auth_tex, ImVec2(14.f, ImGui::GetTextLineHeight()));
128 StringVector parts = StringUtil::split(user.language,
"_");
129 if (parts.size() == 2)
131 StringUtil::toLowerCase(parts[1]);
132 flag_tex =
FetchIcon((parts[1] +
".png").c_str());
133 hovered |= this->DrawIcon(flag_tex, ImVec2(16.f, ImGui::GetTextLineHeight()));
137 ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetStyle().ItemSpacing.x);
139 ImGui::TextColored(ImVec4(col.r, col.g, col.b, col.a),
"%s", user.username);
140 hovered |= ImGui::IsItemHovered();
145 ImGui::BeginTooltip();
149 ImGui::TextDisabled(
"%s: ",
_LC(
"MultiplayerClientList",
"user name"));
151 ImGui::TextColored(ImVec4(col.r, col.g, col.b, col.a),
"%s", user.username);
154 ImGui::TextDisabled(
"%s: ",
_LC(
"MultiplayerClientList",
"user uid"));
156 ImGui::Text(
"%d", user.uniqueid);
158 ImGui::TextDisabled(
"%s",
_LC(
"MultiplayerClientList",
"user language: "));
160 ImGui::Text(
"%s", parts[0].c_str());
162 ImGui::TextDisabled(
"%s",
_LC(
"MultiplayerClientList",
"user country: "));
164 ImGui::Text(
"%s", parts[1].c_str());
168 ImGui::Image(
reinterpret_cast<ImTextureID
>(flag_tex->getHandle()),
169 ImVec2(flag_tex->getWidth(), flag_tex->getHeight()));
173 ImGui::TextDisabled(
"%s",
_LC(
"MultiplayerClientList",
"user authentication level"));
176 ImGui::Image(
reinterpret_cast<ImTextureID
>(auth_tex->getHandle()),
177 ImVec2(auth_tex->getWidth(), auth_tex->getHeight()));
181 ImGui::Text(
"%s",
App::GetNetwork()->UserAuthToStringLong(user).c_str());
184 if (user.uniqueid != local_user.
uniqueid &&
188 ImGui::TextDisabled(
"%s",
_LC(
"MultiplayerClientList",
"truck loading state"));
191 ImGui::Image(
reinterpret_cast<ImTextureID
>(down_tex->getHandle()),
192 ImVec2(down_tex->getWidth(), down_tex->getHeight()));
197 case 0: ImGui::Text(
"%s",
_LC(
"MultiplayerClientList",
"Truck loading errors"));
break;
198 case 1: ImGui::Text(
"%s",
_LC(
"MultiplayerClientList",
"Truck loaded correctly, no errors"));
break;
199 case 2: ImGui::Text(
"%s",
_LC(
"MultiplayerClientList",
"no truck loaded"));
break;
203 ImGui::TextDisabled(
"%s",
_LC(
"MultiplayerClientList",
"remote truck loading state"));
206 ImGui::Image(
reinterpret_cast<ImTextureID
>(up_tex->getHandle()),
207 ImVec2(up_tex->getWidth(), up_tex->getHeight()));
212 case 0: ImGui::Text(
"%s",
_LC(
"MultiplayerClientList",
"Remote Truck loading errors"));
break;
213 case 1: ImGui::Text(
"%s",
_LC(
"MultiplayerClientList",
"Remote Truck loaded correctly, no errors"));
break;
214 case 2: ImGui::Text(
"%s",
_LC(
"MultiplayerClientList",
"No Trucks loaded"));
break;
226 ImGui::Image(
reinterpret_cast<ImTextureID
>(m_icon_warn_triangle->getHandle()),
227 ImVec2(m_icon_warn_triangle->getWidth(), m_icon_warn_triangle->getHeight()));
229 ImGui::TextColored(
App::GetGuiManager()->GetTheme().error_text_color,
"%s",
_LC(
"MultiplayerClientList",
"Slow Network Download"));
233 ImGui::PopStyleColor(1);
234 #endif // USE_SOCKETW
239 ImVec2 orig_pos = ImGui::GetCursorPos();
240 bool hovered =
false;
246 ImGui::Image(
reinterpret_cast<ImTextureID
>(tex->getHandle()), ImVec2(16, 16));
247 hovered = ImGui::IsItemHovered();
249 ImGui::SetCursorPosX(orig_pos.x + reference_box.x + ImGui::GetStyle().ItemSpacing.x);
250 ImGui::SetCursorPosY(orig_pos.y);
256 m_icon_arrow_down =
FetchIcon(
"arrow_down.png");
257 m_icon_arrow_down_grey =
FetchIcon(
"arrow_down_grey.png");
258 m_icon_arrow_down_red =
FetchIcon(
"arrow_down_red.png");
259 m_icon_arrow_up =
FetchIcon(
"arrow_up.png");
260 m_icon_arrow_up_grey =
FetchIcon(
"arrow_up_grey.png");
261 m_icon_arrow_up_red =
FetchIcon(
"arrow_up_red.png");
262 m_icon_flag_red =
FetchIcon(
"flag_red.png");
263 m_icon_flag_blue =
FetchIcon(
"flag_blue.png");
264 m_icon_flag_green =
FetchIcon(
"flag_green.png");
265 m_icon_warn_triangle =
FetchIcon(
"error.png");
267 m_icons_cached =
true;