mirror of
https://github.com/QuasarApp/Hanoi-Towers.git
synced 2025-05-14 10:29:34 +00:00
commit
c2eba614ff
@ -53,6 +53,9 @@ Item {
|
||||
|
||||
function load () {
|
||||
|
||||
showAdMobBanner()
|
||||
|
||||
|
||||
stateData.load();
|
||||
stateWidget.tumbler.spin.maximumValue = stateData.lvl;
|
||||
stateWidget.tumbler.spin.value = stateData.getMaxValueOfLoadedSaves();
|
||||
@ -181,6 +184,8 @@ Item {
|
||||
const action = function () {
|
||||
stateData.unlockNextLvl();
|
||||
start(stateData.lvl)
|
||||
showAdMobBanner()
|
||||
|
||||
}
|
||||
|
||||
popUp.action = action;
|
||||
@ -200,12 +205,12 @@ Item {
|
||||
|
||||
const action = function () {
|
||||
start(++stateWidget.tumbler.spin.value)
|
||||
showAdMobBanner()
|
||||
|
||||
}
|
||||
|
||||
popUp.action = action;
|
||||
}
|
||||
showAdMobBanner()
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,35 @@
|
||||
import QtQuick 2.15
|
||||
import QtAndroidTools 1.0
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
QtAndroidAdMobInterstitial {
|
||||
id: interstitial
|
||||
|
||||
unitId: "ca-app-pub-5799112356811682/5211864198"
|
||||
nonPersonalizedAds: false
|
||||
onLoaded: {
|
||||
show()
|
||||
|
||||
onClosed: {
|
||||
load()
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
load()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
load()
|
||||
}
|
||||
|
||||
onLoadError: {
|
||||
timer.start()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: timer
|
||||
interval: 1000
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
interstitial.load()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<manifest package="df.mobily.hanoi_towers" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.6.0.3" android:versionCode="25" android:installLocation="auto">
|
||||
<manifest package="df.mobily.hanoi_towers" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.6.1.0" android:versionCode="26" android:installLocation="auto">
|
||||
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
|
||||
Remove the comment if you do not require these default permissions. -->
|
||||
<!-- %%INSERT_PERMISSIONS -->
|
||||
|
@ -33,6 +33,7 @@
|
||||
#define FOG "fog"
|
||||
#define FOG_ANIMATION "fogAnimation"
|
||||
#define SHOW_CREDITS "showCredits"
|
||||
#define LAUNCH_COUNT "launchCount"
|
||||
|
||||
HanoiTowers::HanoiTowers(QQmlApplicationEngine *engine):
|
||||
QObject(),
|
||||
@ -123,6 +124,9 @@ void HanoiTowers::init() {
|
||||
_settingsData.fog = _settings->getValue(FOG, true).toBool();
|
||||
_settingsData.fogAnimation = _settings->getValue(FOG_ANIMATION, true).toBool();
|
||||
_settingsData.showCredits = _settings->getValue(SHOW_CREDITS, true).toBool();
|
||||
_settingsData._launchCount = _settings->getValue(LAUNCH_COUNT, 0).toUInt();
|
||||
|
||||
setLaunchCount(_settingsData._launchCount + 1);
|
||||
|
||||
}
|
||||
|
||||
@ -606,3 +610,17 @@ void HanoiTowers::setShowCredits(bool newShowCredits) {
|
||||
emit showCreditsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int HanoiTowers::launchCount() const {
|
||||
return _settingsData._launchCount;
|
||||
}
|
||||
|
||||
void HanoiTowers::setLaunchCount(unsigned int newLaunchCount) {
|
||||
if (_settingsData._launchCount == newLaunchCount)
|
||||
return;
|
||||
|
||||
_settingsData._launchCount = newLaunchCount;
|
||||
_settings->setValue(LAUNCH_COUNT, newLaunchCount);
|
||||
|
||||
emit launchCountChanged();
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ class HanoiTowers: public QObject
|
||||
Q_PROPERTY(bool fog READ fog WRITE setFog NOTIFY fogChanged)
|
||||
Q_PROPERTY(bool fogAnimation READ fogAnimation WRITE setFogAnimation NOTIFY fogAnimationChanged)
|
||||
Q_PROPERTY(bool showCredits READ showCredits WRITE setShowCredits NOTIFY showCreditsChanged)
|
||||
Q_PROPERTY(unsigned int launchCount READ launchCount WRITE setLaunchCount NOTIFY launchCountChanged)
|
||||
|
||||
Q_PROPERTY(GameState* gameState READ gameState WRITE setGameState NOTIFY profileChanged)
|
||||
Q_PROPERTY(QObject* client READ client)
|
||||
@ -117,6 +118,9 @@ public:
|
||||
bool showCredits() const;
|
||||
void setShowCredits(bool newShowCredits);
|
||||
|
||||
unsigned int launchCount() const;
|
||||
void setLaunchCount(unsigned int newLaunchCount);
|
||||
|
||||
public slots:
|
||||
|
||||
/**
|
||||
@ -202,6 +206,8 @@ signals:
|
||||
|
||||
void showCreditsChanged();
|
||||
|
||||
void launchCountChanged();
|
||||
|
||||
private slots:
|
||||
void handleChangeName(const QString&);
|
||||
void handleBestUserIdChanged(const QString&userId);
|
||||
|
@ -33,6 +33,17 @@
|
||||
* Copyright (C) 2019-2021 QuasarApp-Gruppe.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AdLoadScrean</name>
|
||||
<message>
|
||||
<source>Load ads</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sorry, but we need to show you an ad. We want to eat too 😇</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Config</name>
|
||||
<message>
|
||||
|
@ -34,6 +34,17 @@
|
||||
* Copyright (C) 2019-2021 QuasarApp group.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AdLoadScrean</name>
|
||||
<message>
|
||||
<source>Load ads</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sorry, but we need to show you an ad. We want to eat too 😇</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BackEnd</name>
|
||||
<message>
|
||||
|
@ -34,6 +34,17 @@
|
||||
* Copyright (C) 2019-2021 Grupo QuasarApp.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AdLoadScrean</name>
|
||||
<message>
|
||||
<source>Load ads</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sorry, but we need to show you an ad. We want to eat too 😇</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Config</name>
|
||||
<message>
|
||||
|
@ -34,6 +34,17 @@
|
||||
* Copyright (C) 2019-2021 Groupe QuasarApp.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AdLoadScrean</name>
|
||||
<message>
|
||||
<source>Load ads</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sorry, but we need to show you an ad. We want to eat too 😇</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Config</name>
|
||||
<message>
|
||||
|
@ -48,6 +48,17 @@
|
||||
* Copyright(C)2018-2019 Yankovich N. Andrei。 {3 ?} {2018-2019 ?}</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AdLoadScrean</name>
|
||||
<message>
|
||||
<source>Load ads</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sorry, but we need to show you an ad. We want to eat too 😇</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BackEnd</name>
|
||||
<message>
|
||||
|
@ -34,6 +34,17 @@
|
||||
* Prawa autorskie (C) 2019-2021 grupa QuasarApp.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AdLoadScrean</name>
|
||||
<message>
|
||||
<source>Load ads</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sorry, but we need to show you an ad. We want to eat too 😇</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Config</name>
|
||||
<message>
|
||||
|
@ -48,6 +48,17 @@
|
||||
* Copyright (C) 2018-2019 Янкович А. Н.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AdLoadScrean</name>
|
||||
<message>
|
||||
<source>Load ads</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sorry, but we need to show you an ad. We want to eat too 😇</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BackEnd</name>
|
||||
<message>
|
||||
|
@ -48,6 +48,17 @@
|
||||
* Telif Hakkı (C) 2018-2019 Yankovich N. Andrei.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AdLoadScrean</name>
|
||||
<message>
|
||||
<source>Load ads</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sorry, but we need to show you an ad. We want to eat too 😇</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BackEnd</name>
|
||||
<message>
|
||||
|
@ -50,6 +50,17 @@
|
||||
* Авторське право (C) 2018-2019 Янкович Н. Андрій.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AdLoadScrean</name>
|
||||
<message>
|
||||
<source>Load ads</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sorry, but we need to show you an ad. We want to eat too 😇</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BackEnd</name>
|
||||
<message>
|
||||
|
@ -34,6 +34,17 @@
|
||||
* 版权所有 (C) 2019-2021 QuasarApp group 。</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AdLoadScrean</name>
|
||||
<message>
|
||||
<source>Load ads</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sorry, but we need to show you an ad. We want to eat too 😇</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Config</name>
|
||||
<message>
|
||||
|
@ -32,14 +32,28 @@ ApplicationWindow {
|
||||
|
||||
function showAdMobBanner() {
|
||||
if (admodbanner) {
|
||||
admodbanner.load()
|
||||
admodbanner.show()
|
||||
}
|
||||
}
|
||||
|
||||
function hideLoad() {
|
||||
loadAdScrean.visible = false
|
||||
}
|
||||
|
||||
function hideerrLoad(errorID) {
|
||||
loadAdScrean.visible = false
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
const obj = createAdBobObjects("qrc:/admod/AdMobInterstitialAndroid.qml", this);
|
||||
if (obj) {
|
||||
admodbanner = obj;
|
||||
|
||||
loadAdScrean.visible = true;
|
||||
|
||||
admodbanner.loadError.connect(hideerrLoad)
|
||||
admodbanner.loaded.connect(hideLoad)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -172,4 +186,9 @@ ApplicationWindow {
|
||||
|
||||
Menu.PremiumLoader {
|
||||
}
|
||||
|
||||
Menu.AdLoadScrean {
|
||||
id: loadAdScrean
|
||||
visible: false
|
||||
}
|
||||
}
|
||||
|
69
HanoiTowers/client/menu/AdLoadScrean.qml
Normal file
69
HanoiTowers/client/menu/AdLoadScrean.qml
Normal file
@ -0,0 +1,69 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
Dialog {
|
||||
id: loadDialog
|
||||
x: (gameWindow.width / 2 - width / 2)
|
||||
y: (gameWindow.height / 2 - height / 2)
|
||||
|
||||
width: gameWindow.width * 0.5
|
||||
height: gameWindow.height * 0.5
|
||||
modal : true
|
||||
|
||||
background: Rectangle {
|
||||
id: background
|
||||
property int colorIndex: 0
|
||||
property var colors: ["#ffffff",
|
||||
"#00aaff",
|
||||
"#00ffaa",
|
||||
"#ffaa00"]
|
||||
color: colors[colorIndex % colors.length]
|
||||
|
||||
Behavior on color {
|
||||
|
||||
ColorAnimation {
|
||||
duration: timer.interval
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
timer.start()
|
||||
colorIndex ++
|
||||
|
||||
}
|
||||
Timer {
|
||||
id: timer
|
||||
interval: 5000
|
||||
repeat: true
|
||||
running: false
|
||||
onTriggered: {
|
||||
parent.colorIndex++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
BusyIndicator {
|
||||
Layout.fillWidth: true
|
||||
|
||||
running: true
|
||||
}
|
||||
|
||||
Label {
|
||||
id: textContainer
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: qsTr("Loading ...");
|
||||
font.bold: true
|
||||
font.pointSize: loadDialog.height * 0.06
|
||||
|
||||
verticalAlignment: Qt.AlignTop
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
|
||||
}
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
closePolicy: Popup.NoAutoClose
|
||||
}
|
@ -10,6 +10,11 @@ Item {
|
||||
return;
|
||||
|
||||
if (backEnd.isAdMod()) {
|
||||
|
||||
if (backEnd.launchCount < 6 || backEnd.launchCount % 2 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const component = Qt.createComponent("qrc:/menu/Premium.qml");
|
||||
popup = component.createObject(this);
|
||||
popup.open();
|
||||
|
@ -26,6 +26,7 @@
|
||||
<file>menu/Premium.qml</file>
|
||||
<file>menu/PremiumThanks.qml</file>
|
||||
<file>menu/PremiumLoader.qml</file>
|
||||
<file>menu/AdLoadScrean.qml</file>
|
||||
</qresource>
|
||||
<qresource prefix="/textures">
|
||||
<file>res/fogBack.png</file>
|
||||
|
@ -17,6 +17,7 @@ struct SettingsData
|
||||
bool fog = true;
|
||||
bool fogAnimation = true;
|
||||
bool showCredits = true;
|
||||
unsigned int _launchCount = 0;
|
||||
};
|
||||
|
||||
#endif // SETTINGSDATA_H
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit afb5e5a40501066673c480adeed3314fe2b6b197
|
||||
Subproject commit cfe0527c5961a7d17b74d02cee1359688ab376ee
|
@ -1 +1 @@
|
||||
Subproject commit d999706ca9fcfac6acf41a11b99d19632d78e516
|
||||
Subproject commit 0b7ded4df1e1fa0164e19dfa8bfa1dee0a8590ed
|
@ -1 +1 @@
|
||||
Subproject commit cdeab90d82ee95edbe86afa1da5ac6dd16cee7bb
|
||||
Subproject commit 6bb89017c8acae3a30574c9930b65bd5792cb3d0
|
Loading…
x
Reference in New Issue
Block a user