feat: changed tower place popop

This commit is contained in:
2021-11-14 11:13:23 +01:00
parent 74ce17a007
commit 39a38c8deb

View File

@@ -15,20 +15,21 @@ TowerPlacePopup::TowerPlacePopup(client::Client* client) : GuiWidget(client) {
void TowerPlacePopup::render(){ void TowerPlacePopup::render(){
if (ImGui::BeginPopup("TowerPlace")) { if (ImGui::BeginPopup("TowerPlace")) {
ImGui::BeginChild("SubWindow", ImVec2(800, 270), false, ImGuiWindowFlags_HorizontalScrollbar);
for (int i = 0; i < (int)game::TowerType::TowerCount; i++) { for (int i = 0; i < (int)game::TowerType::TowerCount; i++) {
game::TowerType towerType = game::TowerType(i); if(i > 0) ImGui::SameLine();
const game::TowerInfo& towerInfo = game::getTowerInfo(towerType);
if (!towerInfo.isBigTower() || (towerInfo.isBigTower() && getClient()->getGame().getWorld().CanPlaceBigTower(m_ClickWorldPos, getClient()->getGame().getPlayer()->getID()))) { ImGui::BeginChild(std::to_string(i).c_str(), ImVec2(250, 250), true);
if (ImGui::Button(game::getTowerInfo(towerType).getName().c_str())) {
getClient()->placeTower(towerType, m_ClickWorldPos); ImGui::Text(game::getTowerInfo(game::TowerType(i)).getName().c_str());
ImGui::CloseCurrentPopup();
break; ImGui::SameLine();
} ImGui::SetCursorPosX(250 - 10 - ImGui::CalcTextSize("(?)").x);
if (ImGui::IsItemHovered()) { ImGui::TextDisabled("(?)");
ImGui::SetTooltip(game::getTowerInfo(towerType).getDescription().c_str(), "%s");
} ImGui::EndChild();
}
} }
ImGui::EndChild();
ImGui::EndPopup(); ImGui::EndPopup();
} }
} }