aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarvin Borner2020-04-06 15:13:13 +0200
committerMarvin Borner2020-04-06 15:13:13 +0200
commitd1a16995f263b4985668a26da311fda77d5a92ab (patch)
tree3788ed4f1fbc0c99bc0546a8d6069d24f9b87ea5
parentbf800f3b9a78140d6ee5c031389af67f67d52d8f (diff)
More stats in leaderboard, basic cheat detection1.1
-rw-r--r--qml/harbour-binaryfun.qml2
-rw-r--r--qml/pages/Game.qml2
-rw-r--r--qml/pages/LeaderBoard.qml49
-rw-r--r--rpm/harbour-binaryfun.spec2
-rw-r--r--rpm/harbour-binaryfun.yaml2
-rw-r--r--translations/harbour-binaryfun-de.ts36
-rw-r--r--translations/harbour-binaryfun.ts30
7 files changed, 92 insertions, 31 deletions
diff --git a/qml/harbour-binaryfun.qml b/qml/harbour-binaryfun.qml
index 9378223..599a3ea 100644
--- a/qml/harbour-binaryfun.qml
+++ b/qml/harbour-binaryfun.qml
@@ -6,5 +6,5 @@ ApplicationWindow
{
initialPage: Component { Menu { } }
cover: Qt.resolvedUrl("cover/CoverPage.qml")
- allowedOrientations: defaultAllowedOrientations
+ allowedOrientations: Orientation.Portrait
}
diff --git a/qml/pages/Game.qml b/qml/pages/Game.qml
index c99c8a3..cc13b84 100644
--- a/qml/pages/Game.qml
+++ b/qml/pages/Game.qml
@@ -132,7 +132,7 @@ Page {
Button {
id: new_game
- text: qsTr("Play again!")
+ text: qsTr("Play again")
visible: false
anchors.horizontalCenter: parent.horizontalCenter
onClicked: pageStack.replace(Qt.resolvedUrl("Game.qml"), {bits: root.bits})
diff --git a/qml/pages/LeaderBoard.qml b/qml/pages/LeaderBoard.qml
index f80c969..75f8c64 100644
--- a/qml/pages/LeaderBoard.qml
+++ b/qml/pages/LeaderBoard.qml
@@ -15,9 +15,9 @@ Page {
}
TextField {
- placeholderText: "Enter username (default: anon)"
+ placeholderText: qsTr("Enter username (default: anon)")
text: username.value
- label: "Username"
+ label: qsTr("Username")
width: page.width
EnterKey.enabled: text.length > 0 && text.length <= 16
EnterKey.iconSource: "image://theme/icon-m-enter-close"
@@ -29,20 +29,22 @@ Page {
ComboBox {
id: selector
- label: "Difficulty"
+ label: qsTr("Difficulty")
function select(diff) {
var xhr = new XMLHttpRequest()
xhr.open("GET",
"https://marvinborner.de/lead/binaryfun1/list?sort=time&order=asc&count=1000&filter=difficulty,"+diff,
- false)
- xhr.send()
- if (xhr.status !== 0) {
- list.model = JSON.parse(xhr.responseText);
- internet.visible = false;
- } else {
- internet.visible = true;
+ true)
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === 4 && xhr.status === 200) {
+ list.model = JSON.parse(xhr.responseText);
+ internet.visible = false;
+ } else {
+ internet.visible = true;
+ }
}
+ xhr.send()
}
menu: ContextMenu {
@@ -79,7 +81,7 @@ Page {
Label {
id: internet
- text: qsTr("No internet connection!")
+ text: qsTr("Please try again later.")
visible: false
}
@@ -90,7 +92,8 @@ Page {
height: page.height - y
model: []
delegate: ListItem {
- contentHeight: Theme.itemSizeMedium
+ id: score
+ contentHeight: Theme.itemSizeLarge
Label {
id: name
@@ -98,9 +101,27 @@ Page {
}
Label {
+ id: level
anchors.top: name.bottom
- text: ((modelData.end_time[1] - modelData.start_time[1]) / 1000) + "s - Help: " + modelData.cheats
- font.pixelSize: Theme.fontSizeSmall
+ text: {
+ var numbers = modelData.level.split(",").slice(
+ modelData.difficulty).filter(function (_, i) {
+ return i % (modelData.difficulty + 1) === 0.
+ }).slice(1);
+ if (numbers.length !== modelData.difficulty && modelData.difficulty !== 10) {
+ console.log("Tempered: " + numbers.length + " " + modelData.difficulty);
+ score.visible = false;
+ }
+
+ return qsTr("Numbers: ") + numbers.join(", ");
+ }
+ font.pixelSize: Theme.fontSizeExtraSmall
+ }
+
+ Label {
+ anchors.top: level.bottom
+ text: ((modelData.end_time[1] - modelData.start_time[1]) / 1000) + qsTr("s - Help: ") + modelData.cheats
+ font.pixelSize: Theme.fontSizeExtraSmall
}
}
}
diff --git a/rpm/harbour-binaryfun.spec b/rpm/harbour-binaryfun.spec
index 4ad17dc..ab41aaa 100644
--- a/rpm/harbour-binaryfun.spec
+++ b/rpm/harbour-binaryfun.spec
@@ -13,7 +13,7 @@ Name: harbour-binaryfun
%{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: An awesome binary game
-Version: 1.0
+Version: 1.1
Release: 1
Group: Qt/Qt
License: MIT
diff --git a/rpm/harbour-binaryfun.yaml b/rpm/harbour-binaryfun.yaml
index 1d45899..0b8357c 100644
--- a/rpm/harbour-binaryfun.yaml
+++ b/rpm/harbour-binaryfun.yaml
@@ -1,6 +1,6 @@
Name: harbour-binaryfun
Summary: An awesome binary game
-Version: 1.0
+Version: 1.1
Release: 1
# The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
diff --git a/translations/harbour-binaryfun-de.ts b/translations/harbour-binaryfun-de.ts
index efb8610..8c0aa0d 100644
--- a/translations/harbour-binaryfun-de.ts
+++ b/translations/harbour-binaryfun-de.ts
@@ -15,10 +15,6 @@
<translation>Binär-Spaß</translation>
</message>
<message>
- <source>Play again!</source>
- <translation>Nochmal!</translation>
- </message>
- <message>
<source>Not bad!</source>
<translation>Nicht schlecht!</translation>
</message>
@@ -26,6 +22,10 @@
<source>Leaderboard</source>
<translation>Bestenliste</translation>
</message>
+ <message>
+ <source>Play again</source>
+ <translation>Nochmal spielen</translation>
+ </message>
</context>
<context>
<name>LeaderBoard</name>
@@ -34,6 +34,10 @@
<translation>Bestenliste</translation>
</message>
<message>
+ <source>Please select</source>
+ <translation>Bitte auswählen</translation>
+ </message>
+ <message>
<source>Very easy (2 Bit)</source>
<translation>Sehr einfach (2 Bit)</translation>
</message>
@@ -54,12 +58,28 @@
<translation>Krass (10 Bit)</translation>
</message>
<message>
- <source>Please select</source>
- <translation>Bitte auswählen</translation>
+ <source>Enter username (default: anon)</source>
+ <translation>Nutzername eingeben (Standard: anon)</translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation>Nutzername</translation>
+ </message>
+ <message>
+ <source>Difficulty</source>
+ <translation>Schwierigkeit</translation>
+ </message>
+ <message>
+ <source>Numbers: </source>
+ <translation>Zahlen: </translation>
+ </message>
+ <message>
+ <source>s - Help: </source>
+ <translation>s - Hilfe:</translation>
</message>
<message>
- <source>No internet connection!</source>
- <translation>Keine Internetverbindung!</translation>
+ <source>Please try again later.</source>
+ <translation>Bitte probiere es später nochmal.</translation>
</message>
</context>
<context>
diff --git a/translations/harbour-binaryfun.ts b/translations/harbour-binaryfun.ts
index 3902a1f..2d4e464 100644
--- a/translations/harbour-binaryfun.ts
+++ b/translations/harbour-binaryfun.ts
@@ -15,15 +15,15 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>Play again!</source>
+ <source>Not bad!</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Not bad!</source>
+ <source>Leaderboard</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Leaderboard</source>
+ <source>Play again</source>
<translation type="unfinished"></translation>
</message>
</context>
@@ -34,6 +34,10 @@
<translation type="unfinished"></translation>
</message>
<message>
+ <source>Please select</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<source>Very easy (2 Bit)</source>
<translation type="unfinished"></translation>
</message>
@@ -54,11 +58,27 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>Please select</source>
+ <source>Enter username (default: anon)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Difficulty</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Numbers: </source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>s - Help: </source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>No internet connection!</source>
+ <source>Please try again later.</source>
<translation type="unfinished"></translation>
</message>
</context>