-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathonegame.cpp
84 lines (75 loc) · 1.75 KB
/
onegame.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include "onegame.h"
#include "ui_onegame.h"
onegame::onegame(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::onegame)
{
ui->setupUi(this);
ui->noticetext->hide();
}
onegame::~onegame()
{
delete ui;
}
void onegame::paintEvent(QPaintEvent *event){
QPixmap pixmap = QPixmap(":/image/background.png").scaled(this->size());
QPalette palette;
palette.setBrush(backgroundRole(), QBrush(pixmap));
setPalette(palette);
}
void onegame::on_pushButton_2_clicked(){
QFont font;
font.setPointSize(12);//字体大小
ui->myscore->setFont(font);
ui->opscore->setFont(font);
if(isopcheat){
ui->myscore->setText("-1");
ui->opscore->setText("+3");
}
else{
ui->myscore->setText("+2");
ui->opscore->setText("+2");
}
}
void onegame::on_pushButton_clicked()
{
QFont font;
font.setPointSize(12);//字体大小
ui->myscore->setFont(font);
ui->opscore->setFont(font);
if(isopcheat){
ui->myscore->setText("0");
ui->opscore->setText("0");
}
else{
ui->myscore->setText("+3");
ui->opscore->setText("-1");
}
}
void onegame::on_retry_clicked()
{
QFont font;
font.setPointSize(18);//字体大小
ui->label_2->setFont(font);
QPalette pe;
pe.setColor(QPalette::WindowText,Qt::red);
ui->label_2->setPalette(pe);
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
int x=qrand()%100;
if(x%2==0){
isopcheat = false;
ui->label_2->setText("合作(投币)");
}else{
isopcheat = true;
ui->label_2->setText("欺骗(不投币)");
}
}
void onegame::on_notice_clicked()
{
ui->noticetext->show();
}
void onegame::on_pushButton_3_clicked()
{
repg->show();
this->hide();
}