代码拉取完成,页面将自动刷新
同步操作将从 ibc-dabing/Landlords 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "animationwindow.h"
#include <QPainter>
#include <QTimer>
AnimationWindow::AnimationWindow(QWidget *parent) : QWidget(parent)
{
}
void AnimationWindow::showBetScore(int bet)
{
m_x = 0;
if(bet == 1)
{
m_image.load(":/images/score1.png");
}
else if(bet == 2)
{
m_image.load(":/images/score2.png");
}
else if(bet == 3)
{
m_image.load(":/images/score3.png");
}
update();
QTimer::singleShot(2000, this, &AnimationWindow::hide);
}
void AnimationWindow::showSequence(Type type)
{
m_x = 0;
QString name = type == Pair ? ":/images/liandui.png" : ":/images/shunzi.png";
m_image.load(name);
update();
QTimer::singleShot(2000, this, &AnimationWindow::hide);
}
void AnimationWindow::showJokerBomb()
{
m_index = 0;
m_x = 0;
QTimer* timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, [=](){
m_index++;
if(m_index > 8)
{
timer->stop();
timer->deleteLater();
m_index = 8;
hide();
}
QString name = QString(":/images/joker_bomb_%1.png").arg(m_index);
m_image.load(name);
update();
});
timer->start(60);
}
void AnimationWindow::showBomb()
{
m_index = 0;
m_x = 0;
QTimer* timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, [=](){
m_index++;
if(m_index > 12)
{
timer->stop();
timer->deleteLater();
m_index = 12;
hide();
}
QString name = QString(":/images/bomb_%1.png").arg(m_index);
m_image.load(name);
update();
});
timer->start(60);
}
void AnimationWindow::showPlane()
{
m_x = width();
m_image.load(":/images/plane_1.png");
setFixedHeight(m_image.height());
update();
int step = width() / 5;
QTimer* timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, [=]()
{
static int dist = 0;
static int timers = 0;
dist += 5;
if(dist >= step)
{
dist = 0;
timers++;
QString name = QString(":/images/plane_%1.png").arg(timers % 5 + 1);
m_image.load(name);
}
if(m_x <= -110)
{
timer->stop();
timer->deleteLater();
dist = timers = 0;
hide();
}
m_x -= 5;
update();
});
timer->start(15);
}
void AnimationWindow::paintEvent(QPaintEvent *ev)
{
Q_UNUSED(ev)
QPainter p(this);
p.drawPixmap(m_x, 0, m_image.width(), m_image.height(), m_image);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。