next steps implementing cardschance
This commit is contained in:
@@ -90,3 +90,9 @@ void Tools::getRandNumber(int start, int end, int howMany, int* randArray, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double* Tools::calcCardsChance()
|
||||||
|
{
|
||||||
|
double array[10] = { 30.12, 11.11, 100.00, 0.00, 0.00, 99.22, 78.56, 34.22, 67.22, 21.00 };
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
class Tools{
|
class Tools{
|
||||||
public:
|
public:
|
||||||
static void getRandNumber(int, int, int, int*, bool);
|
static void getRandNumber(int, int, int, int*, bool);
|
||||||
|
static double* calcCardsChance();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2571,7 +2571,7 @@
|
|||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex" >
|
<property name="currentIndex" >
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_Log" >
|
<widget class="QWidget" name="tab_Log" >
|
||||||
<attribute name="title" >
|
<attribute name="title" >
|
||||||
@@ -2664,7 +2664,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="MyChanceLable" name="label" >
|
<widget class="MyChanceLabel" name="label_chance" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@@ -3144,9 +3144,9 @@
|
|||||||
<header>myavatarlabel.h</header>
|
<header>myavatarlabel.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>MyChanceLable</class>
|
<class>MyChanceLabel</class>
|
||||||
<extends>QLabel</extends>
|
<extends>QLabel</extends>
|
||||||
<header>mychancelable.h</header>
|
<header>mychancelabel.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|||||||
@@ -591,6 +591,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
connect(this, SIGNAL(signalStartVoteOnKick(int, int)), this, SLOT(startVoteOnKick(int, int)));
|
connect(this, SIGNAL(signalStartVoteOnKick(int, int)), this, SLOT(startVoteOnKick(int, int)));
|
||||||
connect(this, SIGNAL(signalEndVoteOnKick()), this, SLOT(endVoteOnKick()));
|
connect(this, SIGNAL(signalEndVoteOnKick()), this, SLOT(endVoteOnKick()));
|
||||||
|
|
||||||
|
refreshCardsChance();
|
||||||
}
|
}
|
||||||
|
|
||||||
gameTableImpl::~gameTableImpl() {
|
gameTableImpl::~gameTableImpl() {
|
||||||
@@ -3124,3 +3125,8 @@ void gameTableImpl::refreshVotesMonitor()
|
|||||||
label_votesMonitor->setText(tr("Player <b>%1</b> has %2 votes against him.").arg(QString::fromUtf8(info.playerName.c_str())));
|
label_votesMonitor->setText(tr("Player <b>%1</b> has %2 votes against him.").arg(QString::fromUtf8(info.playerName.c_str())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gameTableImpl::refreshCardsChance()
|
||||||
|
{
|
||||||
|
label_chance->refreshChance(Tools::calcCardsChance());
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -230,6 +230,8 @@ public slots:
|
|||||||
void postRiverRunAnimation5();
|
void postRiverRunAnimation5();
|
||||||
void postRiverRunAnimation6();
|
void postRiverRunAnimation6();
|
||||||
|
|
||||||
|
void refreshCardsChance();
|
||||||
|
|
||||||
void blinkingStartButtonAnimationAction();
|
void blinkingStartButtonAnimationAction();
|
||||||
|
|
||||||
void flipHolecardsAllIn();
|
void flipHolecardsAllIn();
|
||||||
|
|||||||
@@ -22,3 +22,101 @@ MyChanceLabel::MyChanceLabel(QWidget* parent)
|
|||||||
MyChanceLabel::~MyChanceLabel()
|
MyChanceLabel::~MyChanceLabel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyChanceLabel::refreshChance(double *chance)
|
||||||
|
{
|
||||||
|
RFChance = chance[9];
|
||||||
|
SFChance = chance[8];
|
||||||
|
FOAKChance = chance[7];
|
||||||
|
FHChance = chance[6];
|
||||||
|
FLChance = chance[5];
|
||||||
|
STRChance = chance[4];
|
||||||
|
TOAKChance = chance[3];
|
||||||
|
TPChance = chance[2];
|
||||||
|
OPChance = chance[1];
|
||||||
|
HCChance = chance[0];
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyChanceLabel::paintEvent(QPaintEvent * event) {
|
||||||
|
|
||||||
|
QPainter painter(this);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
QString font1String = "font-family: \"Arial\";";
|
||||||
|
#else
|
||||||
|
#ifdef __APPLE__
|
||||||
|
QString font1String = "font-family: \"Lucida Grande\";";
|
||||||
|
#else
|
||||||
|
QString font1String = "font-family: \"Nimbus Sans L\";";
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
QFont font;
|
||||||
|
font.setFamily(font1String);
|
||||||
|
font.setPixelSize(10);
|
||||||
|
painter.setFont(font);
|
||||||
|
|
||||||
|
//Draw Texts
|
||||||
|
if(RFChance == 0.00) { painter.setPen(QColor(85,99,47)); }
|
||||||
|
else { painter.setPen(QColor(156,213,0)); }
|
||||||
|
painter.drawText(QRectF(QPointF(2,0), QPointF(76,13)),Qt::AlignRight,"Royal Flush");
|
||||||
|
painter.drawText(QRectF(QPointF(196,0), QPointF(236,13)),Qt::AlignRight,QString("%1%").arg(RFChance, 0, 'f', 2));
|
||||||
|
if(SFChance == 0.00) { painter.setPen(QColor(85,99,47)); }
|
||||||
|
else { painter.setPen(QColor(156,213,0)); }
|
||||||
|
painter.drawText(QRectF(QPointF(2,13), QPointF(76,26)),Qt::AlignRight,"Straight Flush");
|
||||||
|
painter.drawText(QRectF(QPointF(196,13), QPointF(236,26)),Qt::AlignRight,QString("%1%").arg(SFChance, 0, 'f', 2));
|
||||||
|
if(FOAKChance == 0.00) { painter.setPen(QColor(85,99,47)); }
|
||||||
|
else { painter.setPen(QColor(156,213,0)); }
|
||||||
|
painter.drawText(QRectF(QPointF(2,26), QPointF(76,39)),Qt::AlignRight,"Four of a Kind");
|
||||||
|
painter.drawText(QRectF(QPointF(196,26), QPointF(236,39)),Qt::AlignRight,QString("%1%").arg(FOAKChance, 0, 'f', 2));
|
||||||
|
if(FHChance == 0.00) { painter.setPen(QColor(85,99,47)); }
|
||||||
|
else { painter.setPen(QColor(156,213,0)); }
|
||||||
|
painter.drawText(QRectF(QPointF(2,39), QPointF(76,52)),Qt::AlignRight,"Full House");
|
||||||
|
painter.drawText(QRectF(QPointF(196,39), QPointF(236,52)),Qt::AlignRight,QString("%1%").arg(FHChance, 0, 'f', 2));
|
||||||
|
if(FLChance == 0.00) { painter.setPen(QColor(85,99,47)); }
|
||||||
|
else { painter.setPen(QColor(156,213,0)); }
|
||||||
|
painter.drawText(QRectF(QPointF(2,52), QPointF(76,65)),Qt::AlignRight,"Flush");
|
||||||
|
painter.drawText(QRectF(QPointF(196,52), QPointF(236,65)),Qt::AlignRight,QString("%1%").arg(FLChance, 0, 'f', 2));
|
||||||
|
if(STRChance == 0.00) { painter.setPen(QColor(85,99,47)); }
|
||||||
|
else { painter.setPen(QColor(156,213,0)); }
|
||||||
|
painter.drawText(QRectF(QPointF(2,65), QPointF(76,78)),Qt::AlignRight,"Straight");
|
||||||
|
painter.drawText(QRectF(QPointF(196,65), QPointF(236,78)),Qt::AlignRight,QString("%1%").arg(STRChance, 0, 'f', 2));
|
||||||
|
if(TOAKChance == 0.00) { painter.setPen(QColor(85,99,47)); }
|
||||||
|
else { painter.setPen(QColor(156,213,0)); }
|
||||||
|
painter.drawText(QRectF(QPointF(2,78), QPointF(76,91)),Qt::AlignRight,"Three of a Kind");
|
||||||
|
painter.drawText(QRectF(QPointF(196,78), QPointF(236,91)),Qt::AlignRight,QString("%1%").arg(TOAKChance, 0, 'f', 2));
|
||||||
|
if(TPChance == 0.00) { painter.setPen(QColor(85,99,47)); }
|
||||||
|
else { painter.setPen(QColor(156,213,0)); }
|
||||||
|
painter.drawText(QRectF(QPointF(2,91), QPointF(76,104)),Qt::AlignRight,"Two Pairs");
|
||||||
|
painter.drawText(QRectF(QPointF(196,91), QPointF(236,104)),Qt::AlignRight,QString("%1%").arg(TPChance, 0, 'f', 2));
|
||||||
|
if(OPChance == 0.00) { painter.setPen(QColor(85,99,47)); }
|
||||||
|
else { painter.setPen(QColor(156,213,0)); }
|
||||||
|
painter.drawText(QRectF(QPointF(2,104), QPointF(76,117)),Qt::AlignRight,"One Pair");
|
||||||
|
painter.drawText(QRectF(QPointF(196,104), QPointF(236,117)),Qt::AlignRight,QString("%1%").arg(OPChance, 0, 'f', 2));
|
||||||
|
if(HCChance == 0.00) { painter.setPen(QColor(85,99,47)); }
|
||||||
|
else { painter.setPen(QColor(156,213,0)); }
|
||||||
|
painter.drawText(QRectF(QPointF(2,117), QPointF(76,130)),Qt::AlignRight,"Highest Card");
|
||||||
|
painter.drawText(QRectF(QPointF(196,117), QPointF(236,130)),Qt::AlignRight,QString("%1%").arg(HCChance, 0, 'f', 2));
|
||||||
|
|
||||||
|
//Draw gfx
|
||||||
|
painter.setPen(QColor(0,0,0));
|
||||||
|
|
||||||
|
QLinearGradient linearGrad(QPointF(80,3), QPointF(180,10));
|
||||||
|
linearGrad.setColorAt(0, Qt::blue);
|
||||||
|
linearGrad.setColorAt(0.5, Qt::yellow);
|
||||||
|
linearGrad.setColorAt(1, Qt::red);
|
||||||
|
painter.setBrush(linearGrad);
|
||||||
|
|
||||||
|
if(RFChance != 0.00) painter.drawRect(80,3,(107*RFChance)/100,7);
|
||||||
|
if(SFChance != 0.00) painter.drawRect(80,16,(107*SFChance)/100,7);
|
||||||
|
if(FOAKChance != 0.00) painter.drawRect(80,29,(107*FOAKChance)/100,7);
|
||||||
|
if(FHChance != 0.00) painter.drawRect(80,42,(107*FHChance)/100,7);
|
||||||
|
if(FLChance != 0.00) painter.drawRect(80,55,(107*FLChance)/100,7);
|
||||||
|
if(STRChance != 0.00) painter.drawRect(80,68,(107*STRChance)/100,7);
|
||||||
|
if(TOAKChance != 0.00) painter.drawRect(80,81,(107*TOAKChance)/100,7);
|
||||||
|
if(TPChance != 0.00) painter.drawRect(80,94,(107*TPChance)/100,7);
|
||||||
|
if(OPChance != 0.00) painter.drawRect(80,107,(107*OPChance)/100,7);
|
||||||
|
if(HCChance != 0.00) painter.drawRect(80,120,(107*HCChance)/100,7);
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,12 +28,22 @@ public:
|
|||||||
~MyChanceLabel();
|
~MyChanceLabel();
|
||||||
|
|
||||||
void setMyW ( gameTableImpl* theValue ) { myW = theValue; }
|
void setMyW ( gameTableImpl* theValue ) { myW = theValue; }
|
||||||
|
void paintEvent(QPaintEvent * event);
|
||||||
|
void refreshChance(double*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
gameTableImpl *myW;
|
gameTableImpl *myW;
|
||||||
|
double RFChance;
|
||||||
|
double SFChance;
|
||||||
|
double FOAKChance;
|
||||||
|
double FHChance;
|
||||||
|
double FLChance;
|
||||||
|
double STRChance;
|
||||||
|
double TOAKChance;
|
||||||
|
double TPChance;
|
||||||
|
double OPChance;
|
||||||
|
double HCChance;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user