mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 01:15:33 +00:00
Don't play "Menu Click" sound for disabled (= cannot receive input) buttons, plus some redundancy fixes
This commit is contained in:
parent
0f5dc59176
commit
d7f69205f6
6 changed files with 14 additions and 32 deletions
|
@ -68,8 +68,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
|||
|
||||
|
||||
MyGUI::Button* button =
|
||||
mList->createWidget<MyGUI::Button>(
|
||||
(price>playerGold) ? "SandTextGreyedOut" : "SandTextButton",
|
||||
mList->createWidget<MyGUI::Button>("SandTextButton",
|
||||
0,
|
||||
currentY,
|
||||
0,
|
||||
|
|
|
@ -45,13 +45,14 @@ namespace MWGui
|
|||
|
||||
MyGUI::Button* toAdd =
|
||||
mSpellsView->createWidget<MyGUI::Button>(
|
||||
(price>playerGold) ? "SandTextGreyedOut" : "SandTextButton",
|
||||
"SandTextButton",
|
||||
0,
|
||||
mCurrentY,
|
||||
200,
|
||||
sLineHeight,
|
||||
MyGUI::Align::Default
|
||||
);
|
||||
toAdd->setEnabled(price<=playerGold);
|
||||
|
||||
mCurrentY += sLineHeight;
|
||||
|
||||
|
@ -118,19 +119,13 @@ namespace MWGui
|
|||
int price = *_sender->getUserData<int>();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
spells.add (mSpellsWidgetMap.find(_sender)->second);
|
||||
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);
|
||||
startSpellBuying(mPtr);
|
||||
|
||||
if (playerGold>=price)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
spells.add (mSpellsWidgetMap.find(_sender)->second);
|
||||
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);
|
||||
startSpellBuying(mPtr);
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0);
|
||||
}
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0);
|
||||
}
|
||||
|
||||
void SpellBuyingWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||
|
|
|
@ -83,11 +83,10 @@ namespace MWGui
|
|||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer
|
||||
(mPtr,pcStats.getSkill (bestSkills[i].first).getBase() * gmst.find("iTrainingMod")->getInt (),true);
|
||||
|
||||
std::string skin = (price > playerGold) ? "SandTextGreyedOut" : "SandTextButton";
|
||||
|
||||
MyGUI::Button* button = mTrainingOptions->createWidget<MyGUI::Button>(skin,
|
||||
MyGUI::Button* button = mTrainingOptions->createWidget<MyGUI::Button>("SandTextButton",
|
||||
MyGUI::IntCoord(5, 5+i*18, mTrainingOptions->getWidth()-10, 18), MyGUI::Align::Default);
|
||||
|
||||
button->setEnabled(price <= playerGold);
|
||||
button->setUserData(bestSkills[i].first);
|
||||
button->eventMouseButtonClick += MyGUI::newDelegate(this, &TrainingWindow::onTrainingSelected);
|
||||
|
||||
|
@ -116,7 +115,6 @@ namespace MWGui
|
|||
int skillId = *sender->getUserData<int>();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
|
||||
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
|
||||
const MWWorld::ESMStore &store =
|
||||
|
@ -125,9 +123,6 @@ namespace MWGui
|
|||
int price = pcStats.getSkill (skillId).getBase() * store.get<ESM::GameSetting>().find("iTrainingMod")->getInt ();
|
||||
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
|
||||
|
||||
if (playerGold<price)
|
||||
return;
|
||||
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(mPtr).getNpcStats (mPtr);
|
||||
if (npcStats.getSkill (skillId).getBase () <= pcStats.getSkill (skillId).getBase ())
|
||||
{
|
||||
|
|
|
@ -66,7 +66,8 @@ namespace MWGui
|
|||
|
||||
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
|
||||
|
||||
MyGUI::Button* toAdd = mDestinationsView->createWidget<MyGUI::Button>((price>playerGold) ? "SandTextGreyedOut" : "SandTextButton", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default);
|
||||
MyGUI::Button* toAdd = mDestinationsView->createWidget<MyGUI::Button>("SandTextButton", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default);
|
||||
toAdd->setEnabled(price<=playerGold);
|
||||
mCurrentY += sLineHeight;
|
||||
if(interior)
|
||||
toAdd->setUserString("interior","y");
|
||||
|
|
|
@ -555,7 +555,7 @@ namespace MWInput
|
|||
if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0)
|
||||
{
|
||||
MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false);
|
||||
if (b)
|
||||
if (b && b->getEnabled())
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f);
|
||||
}
|
||||
|
|
|
@ -17,14 +17,6 @@
|
|||
<BasisSkin type="SimpleText" offset="0 0 16 16" align="Stretch"/>
|
||||
</Skin>
|
||||
|
||||
<!-- HTML colour: #9A9074 -->
|
||||
<Skin name="SandTextGreyedOut" size="16 16">
|
||||
<Property key="FontName" value="Default"/>
|
||||
<Property key="TextAlign" value="Left Bottom"/>
|
||||
<Property key="TextColour" value="0.6 0.56 0.45"/>
|
||||
<BasisSkin type="SimpleText" offset="0 0 16 16" align="Stretch"/>
|
||||
</Skin>
|
||||
|
||||
<!-- HTML colour: #BF9959 -->
|
||||
<Skin name="SandText" size="16 16">
|
||||
<Property key="FontName" value="Default"/>
|
||||
|
|
Loading…
Reference in a new issue