mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-22 00:27:58 +02:00
rework battle mode button
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 873 B |
Binary file not shown.
|
Before Width: | Height: | Size: 863 B |
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"basepath" : "lobby/",
|
||||
"images" :
|
||||
[
|
||||
{ "frame" : 0, "file" : "battle-normal.png"},
|
||||
{ "frame" : 1, "file" : "battle-pressed.png"}
|
||||
]
|
||||
}
|
||||
@@ -140,7 +140,8 @@
|
||||
"vcmi.lobby.deleteFile" : "Do you want to delete following file?",
|
||||
"vcmi.lobby.deleteFolder" : "Do you want to delete following folder?",
|
||||
"vcmi.lobby.deleteMode" : "Switch to delete mode and back",
|
||||
"vcmi.lobby.battleOnlyMode" : "Battle Only Mode",
|
||||
"vcmi.lobby.battleOnlyMode" : "Battle Mode",
|
||||
"vcmi.lobby.battleOnlyMode.help" : "Play a simple battle without adventure map",
|
||||
"vcmi.lobby.battleOnlyModeSubTitle" : "Select heroes, army, skills, artifact and battleground for simple battle without adventure map",
|
||||
"vcmi.lobby.battleOnlyModeBattlefield" : "Battlefield",
|
||||
"vcmi.lobby.battleOnlyModeBattlefieldSelect" : "Select Battlefield",
|
||||
|
||||
@@ -139,7 +139,8 @@
|
||||
"vcmi.lobby.deleteFile" : "Möchtet Ihr folgende Datei löschen?",
|
||||
"vcmi.lobby.deleteFolder" : "Möchtet Ihr folgenden Ordner löschen?",
|
||||
"vcmi.lobby.deleteMode" : "In den Löschmodus wechseln und zurück",
|
||||
"vcmi.lobby.battleOnlyMode" : "Nur Kämpfen Modus",
|
||||
"vcmi.lobby.battleOnlyMode" : "Kampfmodus",
|
||||
"vcmi.lobby.battleOnlyMode.help" : "Spiele einen einfachen Kampf ohne Abenteuerkarte",
|
||||
"vcmi.lobby.battleOnlyModeSubTitle" : "Wähle Helden, Armeen, Skills, Artefakte und ein Schlachtfeld für einen Kampf ohne Abenteuerkarte",
|
||||
"vcmi.lobby.battleOnlyModeBattlefield" : "Schlachtfeld",
|
||||
"vcmi.lobby.battleOnlyModeBattlefieldSelect" : "Schlachtfeld auswählen",
|
||||
|
||||
@@ -58,7 +58,11 @@ CLobbyScreen::CLobbyScreen(ESelectionScreen screenType, bool hideScreen)
|
||||
buttonOptions = std::make_shared<CButton>(Point(411, 510), AnimationPath::builtin("GSPBUTT.DEF"), LIBRARY->generaltexth->zelp[46], std::bind(&CLobbyScreen::toggleTab, this, tabOpt), EShortcut::LOBBY_ADDITIONAL_OPTIONS);
|
||||
if(settings["general"]["enableUiEnhancements"].Bool())
|
||||
{
|
||||
buttonTurnOptions = std::make_shared<CButton>(Point(619, 105), AnimationPath::builtin("GSPBUT2.DEF"), LIBRARY->generaltexth->zelp[46], std::bind(&CLobbyScreen::toggleTab, this, tabTurnOptions), EShortcut::LOBBY_TURN_OPTIONS);
|
||||
if(screenType == ESelectionScreen::newGame)
|
||||
buttonBattleMode = std::make_shared<CButton>(Point(619, 105), AnimationPath::builtin("GSPButton2Arrow"), CButton::tooltip("", LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyMode.help")), [this](){
|
||||
updateAfterStateChange(); // creates tabBattleOnlyMode -> cannot created by init of object because GAME->server().isGuest() isn't valid at that point
|
||||
toggleTab(tabBattleOnlyMode);
|
||||
}, EShortcut::LOBBY_BATTLE_MODE);
|
||||
buttonExtraOptions = std::make_shared<CButton>(Point(619, 510), AnimationPath::builtin("GSPBUT2.DEF"), LIBRARY->generaltexth->zelp[46], std::bind(&CLobbyScreen::toggleTab, this, tabExtraOptions), EShortcut::LOBBY_EXTRA_OPTIONS);
|
||||
}
|
||||
};
|
||||
@@ -225,8 +229,8 @@ void CLobbyScreen::toggleMode(bool host)
|
||||
buttonSelect->setTextOverlay(" " + LIBRARY->generaltexth->allTexts[500], FONT_SMALL, buttonColor);
|
||||
buttonOptions->setTextOverlay(LIBRARY->generaltexth->allTexts[501], FONT_SMALL, buttonColor);
|
||||
|
||||
if (buttonTurnOptions)
|
||||
buttonTurnOptions->setTextOverlay(LIBRARY->generaltexth->translate("vcmi.optionsTab.turnOptions.hover"), FONT_SMALL, buttonColor);
|
||||
if (buttonBattleMode)
|
||||
buttonBattleMode->setTextOverlay(LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyMode"), FONT_SMALL, buttonColor);
|
||||
|
||||
if (buttonExtraOptions)
|
||||
buttonExtraOptions->setTextOverlay(LIBRARY->generaltexth->translate("vcmi.optionsTab.extraOptions.hover"), FONT_SMALL, buttonColor);
|
||||
@@ -239,8 +243,8 @@ void CLobbyScreen::toggleMode(bool host)
|
||||
buttonSelect->block(!host);
|
||||
buttonOptions->block(!host);
|
||||
|
||||
if (buttonTurnOptions)
|
||||
buttonTurnOptions->block(!host);
|
||||
if (buttonBattleMode)
|
||||
buttonBattleMode->block(!host);
|
||||
|
||||
if (buttonExtraOptions)
|
||||
buttonExtraOptions->block(!host);
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
std::shared_ptr<CButton> buttonSelect;
|
||||
std::shared_ptr<CButton> buttonRMG;
|
||||
std::shared_ptr<CButton> buttonOptions;
|
||||
std::shared_ptr<CButton> buttonTurnOptions;
|
||||
std::shared_ptr<CButton> buttonBattleMode;
|
||||
std::shared_ptr<CButton> buttonExtraOptions;
|
||||
std::shared_ptr<CButton> buttonStart;
|
||||
std::shared_ptr<CButton> buttonBack;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "StdInc.h"
|
||||
#include "OptionsTabBase.h"
|
||||
#include "CSelectionBase.h"
|
||||
#include "TurnOptionsTab.h"
|
||||
#include "CLobbyScreen.h"
|
||||
|
||||
#include "../widgets/ComboBox.h"
|
||||
#include "../widgets/CTextInput.h"
|
||||
@@ -79,6 +81,12 @@ OptionsTabBase::OptionsTabBase(const JsonPath & configPath)
|
||||
GAME->server().setSimturnsInfo(getSimturnsPresets().at(index));
|
||||
};
|
||||
|
||||
addCallback("tabTurnOptions", [&](int)
|
||||
{
|
||||
auto lobby = (static_cast<CLobbyScreen *>(parent));
|
||||
lobby->toggleTab(lobby->tabTurnOptions);
|
||||
});
|
||||
|
||||
addCallback("setTimerPreset", setTimerPresetCallback);
|
||||
addCallback("setSimturnPreset", setSimturnsPresetCallback);
|
||||
|
||||
@@ -428,6 +436,11 @@ void OptionsTabBase::recreate(bool campaign)
|
||||
buttonUnlimitedReplay->block(GAME->server().isGuest());
|
||||
}
|
||||
|
||||
if(auto buttonTurnOptions = widget<CToggleButton>("buttonTurnOptions"))
|
||||
{
|
||||
buttonTurnOptions->block(GAME->server().isGuest());
|
||||
}
|
||||
|
||||
if(auto textureCampaignOverdraw = widget<CFilledTexture>("textureCampaignOverdraw"))
|
||||
textureCampaignOverdraw->setEnabled(campaign);
|
||||
}
|
||||
|
||||
@@ -242,14 +242,6 @@ SelectionTab::SelectionTab(ESelectionScreen Type)
|
||||
sortByDate->setOverlay(std::make_shared<CPicture>(ImagePath::builtin("lobby/selectionTabSortDate")));
|
||||
buttonsSortBy.push_back(sortByDate);
|
||||
|
||||
if(tabType == ESelectionScreen::newGame)
|
||||
{
|
||||
buttonBattleOnlyMode = std::make_shared<CButton>(Point(23, 18), AnimationPath::builtin("lobby/battleButton"), CButton::tooltip("", LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyMode")), [this](){
|
||||
auto lobby = static_cast<CLobbyScreen *>(parent);
|
||||
lobby->toggleTab(lobby->tabBattleOnlyMode);
|
||||
}, EShortcut::LOBBY_BATTLE_MODE);
|
||||
}
|
||||
|
||||
if(tabType == ESelectionScreen::loadGame || tabType == ESelectionScreen::newGame)
|
||||
{
|
||||
buttonDeleteMode = std::make_shared<CButton>(Point(367, 18), AnimationPath::builtin("lobby/deleteButton"), CButton::tooltip("", LIBRARY->generaltexth->translate("vcmi.lobby.deleteMode")), [this, tabTitle, tabTitleDelete](){
|
||||
@@ -324,8 +316,6 @@ void SelectionTab::toggleMode()
|
||||
{
|
||||
if(slider)
|
||||
slider->block(true);
|
||||
if(buttonBattleOnlyMode)
|
||||
buttonBattleOnlyMode->block(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -128,8 +128,6 @@ private:
|
||||
std::shared_ptr<CButton> buttonDeleteMode;
|
||||
bool deleteMode;
|
||||
|
||||
std::shared_ptr<CButton> buttonBattleOnlyMode;
|
||||
|
||||
bool enableUiEnhancements;
|
||||
std::shared_ptr<CButton> buttonCampaignSet;
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ void AssetGenerator::initialize()
|
||||
animationFiles[AnimationPath::builtin("SPRITES/adventureLayersButton")] = createAdventureMapButton(ImagePath::builtin("adventureLayers.png"), true);
|
||||
|
||||
animationFiles[AnimationPath::builtin("SPRITES/GSPButtonClear")] = createGSPButtonClear();
|
||||
animationFiles[AnimationPath::builtin("SPRITES/GSPButton2Arrow")] = createGSPButton2Arrow();
|
||||
|
||||
for (PlayerColor color(-1); color < PlayerColor::PLAYER_LIMIT; ++color)
|
||||
{
|
||||
@@ -1009,6 +1010,30 @@ AssetGenerator::AnimationLayoutMap AssetGenerator::createGSPButtonClear()
|
||||
return layout;
|
||||
}
|
||||
|
||||
AssetGenerator::AnimationLayoutMap AssetGenerator::createGSPButton2Arrow()
|
||||
{
|
||||
auto baseImg = ENGINE->renderHandler().loadAnimation(AnimationPath::builtin("GSPBUT2"), EImageBlitMode::OPAQUE);
|
||||
auto overlayImg = ENGINE->renderHandler().loadAnimation(AnimationPath::builtin("GSPBUTT"), EImageBlitMode::OPAQUE);
|
||||
|
||||
AnimationLayoutMap layout;
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
ImagePath spriteName = ImagePath::builtin("GSPButton2Arrow" + std::to_string(i) + ".png");
|
||||
|
||||
imageFiles[spriteName] = [baseImg, overlayImg, i](){
|
||||
auto newImg = ENGINE->renderHandler().createImage(baseImg->getImage(i)->dimensions(), CanvasScalingPolicy::IGNORE);
|
||||
auto canvas = newImg->getCanvas();
|
||||
canvas.draw(baseImg->getImage(i), Point(0, 0));
|
||||
canvas.draw(overlayImg->getImage(i), Point(0, 0), Rect(0, 0, 20, 20));
|
||||
return newImg;
|
||||
};
|
||||
|
||||
layout[0].push_back(ImageLocator(spriteName, EImageBlitMode::SIMPLE));
|
||||
}
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
AssetGenerator::CanvasPtr AssetGenerator::createGateListColored(PlayerColor color, PlayerColor backColor) const
|
||||
{
|
||||
auto locator = ImageLocator(ImagePath::builtin("TpGate"), EImageBlitMode::COLORKEY);
|
||||
|
||||
@@ -67,6 +67,7 @@ private:
|
||||
CanvasPtr createCreatureInfoPanelElement(CreatureInfoPanelElement element) const;
|
||||
CanvasPtr createQuestWindow() const;
|
||||
AnimationLayoutMap createGSPButtonClear();
|
||||
AnimationLayoutMap createGSPButton2Arrow();
|
||||
CanvasPtr createGateListColored(PlayerColor color, PlayerColor backColor) const;
|
||||
CanvasPtr createHeroSlotsColored(PlayerColor backColor) const;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"name": "ExtraOptionsButtons",
|
||||
"type" : "verticalLayout",
|
||||
"customType" : "toggleButton",
|
||||
"position": {"x": 70, "y": 100},
|
||||
"position": {"x": 70, "y": 130},
|
||||
"items":
|
||||
[
|
||||
{
|
||||
@@ -62,7 +62,7 @@
|
||||
"name": "ExtraOptionsLabels",
|
||||
"type" : "verticalLayout",
|
||||
"customType" : "label",
|
||||
"position": {"x": 110, "y": 103},
|
||||
"position": {"x": 110, "y": 133},
|
||||
"items":
|
||||
[
|
||||
{
|
||||
@@ -80,6 +80,29 @@
|
||||
"text": "vcmi.optionsTab.unlimitedReplay.hover"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "buttonTurnOptions",
|
||||
"type" : "button",
|
||||
"position" : {
|
||||
"x" : 70,
|
||||
"y" : 100
|
||||
},
|
||||
"image" : "GSPButtonClear",
|
||||
"items" : [
|
||||
{
|
||||
"type" : "label",
|
||||
"position" : {
|
||||
"x" : 0,
|
||||
"y" : 0
|
||||
},
|
||||
"text" : "vcmi.optionsTab.turnOptions.hover",
|
||||
"font" : "small",
|
||||
"color" : "yellow"
|
||||
}
|
||||
],
|
||||
"help": "vcmi.optionsTab.turnOptions",
|
||||
"callback" : "tabTurnOptions"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user