Merge pull request #1086 from poixen/sounds

updated sounds
This commit is contained in:
poixen 2015-05-22 11:19:50 +02:00
commit d1b243481b
7 changed files with 13 additions and 4 deletions

View file

@ -565,8 +565,7 @@ void MessageLogWidget::logSetCardCounter(Player *player, QString cardName, int c
void MessageLogWidget::logSetTapped(Player *player, CardItem *card, bool tapped)
{
if (tapped)
soundEngine->tap();
soundEngine->tap();
if (currentContext == MessageContext_MoveCard)
moveCardTapped.insert(card, tapped);
@ -804,7 +803,7 @@ void MessageLogWidget::logSetActivePhase(int phase)
case 1: phaseName = tr("upkeep step"); break;
case 2: phaseName = tr("draw step"); break;
case 3: phaseName = tr("first main phase"); break;
case 4: phaseName = tr("beginning of combat step"); break;
case 4: phaseName = tr("beginning of combat step"); soundEngine->startCombat(); break;
case 5: phaseName = tr("declare attackers step"); break;
case 6: phaseName = tr("declare blockers step"); break;
case 7: phaseName = tr("combat damage step"); break;

View file

@ -17,12 +17,13 @@ SoundEngine::SoundEngine(QObject *parent)
lastTapPlayed = QDateTime::currentDateTime();
lastEndStepPlayed = QDateTime::currentDateTime();
lastStartCombatPlayed = QDateTime::currentDateTime();
}
void SoundEngine::cacheData()
{
static const QStringList fileNames = QStringList()
<< "end_step" << "tap" << "player_joined";
<< "end_step" << "tap" << "player_joined" << "start_combat";
for (int i = 0; i < fileNames.size(); ++i) {
QFile file(settingsCache->getSoundPath() + "/" + fileNames[i] + ".raw");
if(!file.exists())
@ -92,3 +93,10 @@ void SoundEngine::playerJoined()
{
playSound("player_joined");
}
void SoundEngine::startCombat() {
if (lastStartCombatPlayed.secsTo(QDateTime::currentDateTime()) >= 1)
playSound("start_combat");
lastStartCombatPlayed = QDateTime::currentDateTime();
}

View file

@ -17,6 +17,7 @@ private:
QAudioOutput *audio;
QDateTime lastTapPlayed;
QDateTime lastEndStepPlayed;
QDateTime lastStartCombatPlayed;
private slots:
void cacheData();
void soundEnabledChanged();
@ -26,6 +27,7 @@ public slots:
void endStep();
void tap();
void playerJoined();
void startCombat();
};
extern SoundEngine *soundEngine;

Binary file not shown.

Binary file not shown.

BIN
sounds/start_combat.raw Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 160 KiB