mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-05-10 00:19:45 +00:00
temp commit
This commit is contained in:
parent
6a4ea452d0
commit
a7955b68d6
@ -23,6 +23,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AvailableSnakes</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
@ -41,6 +48,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Inventory</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JungleLvl::Snake</name>
|
||||
<message>
|
||||
|
@ -23,6 +23,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AvailableSnakes</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
@ -41,6 +48,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Inventory</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JungleLvl::Snake</name>
|
||||
<message>
|
||||
|
@ -23,6 +23,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AvailableSnakes</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
@ -41,6 +48,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Inventory</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JungleLvl::Snake</name>
|
||||
<message>
|
||||
|
@ -23,6 +23,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AvailableSnakes</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
@ -41,6 +48,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Inventory</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JungleLvl::Snake</name>
|
||||
<message>
|
||||
|
@ -23,6 +23,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AvailableSnakes</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
@ -41,6 +48,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Inventory</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JungleLvl::Snake</name>
|
||||
<message>
|
||||
|
@ -23,6 +23,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AvailableSnakes</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
@ -41,6 +48,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Inventory</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JungleLvl::Snake</name>
|
||||
<message>
|
||||
|
@ -23,6 +23,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AvailableSnakes</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
@ -41,6 +48,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Inventory</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JungleLvl::Snake</name>
|
||||
<message>
|
||||
|
@ -23,6 +23,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AvailableSnakes</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
@ -41,6 +48,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Inventory</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JungleLvl::Snake</name>
|
||||
<message>
|
||||
|
@ -23,6 +23,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AvailableSnakes</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
@ -41,6 +48,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Inventory</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JungleLvl::Snake</name>
|
||||
<message>
|
||||
|
@ -23,6 +23,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AvailableSnakes</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Crawl</name>
|
||||
<message>
|
||||
@ -41,6 +48,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Inventory</name>
|
||||
<message>
|
||||
<source>Buy</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>JungleLvl::Snake</name>
|
||||
<message>
|
||||
|
@ -26,5 +26,8 @@
|
||||
<file>CrawlModule/PreviewControl.qml</file>
|
||||
<file>CrawlModule/StoreView.qml</file>
|
||||
<file>CrawlModule/SelectLevelView.qml</file>
|
||||
<file>CrawlModule/SnakesView.qml</file>
|
||||
<file>CrawlModule/Inventory.qml</file>
|
||||
<file>CrawlModule/AvailableSnakes.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
31
src/Core/Crawl/igameworld.cpp
Normal file
31
src/Core/Crawl/igameworld.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
|
||||
#include "igameworld.h"
|
||||
|
||||
#include <eventserver.h>
|
||||
|
||||
namespace CRAWL {
|
||||
|
||||
IGameWorld::IGameWorld() {
|
||||
_eventServer = new EventServer(this);
|
||||
|
||||
connect(_eventServer, &EventServer::sigIntersect, this, &IWorld::onIntersects);
|
||||
connect(this, &IWorld::sigOBjctsListChanged, _eventServer, &EventServer::handleAvailableObjectChanges);
|
||||
|
||||
}
|
||||
|
||||
IGameWorld::~IGameWorld() {
|
||||
delete _eventServer;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
36
src/Core/Crawl/igameworld.h
Normal file
36
src/Core/Crawl/igameworld.h
Normal file
@ -0,0 +1,36 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#ifndef IGAMEWORLD_H
|
||||
#define IGAMEWORLD_H
|
||||
|
||||
|
||||
#include "iworld.h"
|
||||
|
||||
#include <gamesession.h>
|
||||
|
||||
|
||||
namespace CRAWL {
|
||||
|
||||
/**
|
||||
* @brief The IGameWorld class Is world interface for view items on the game session.
|
||||
*/
|
||||
class IGameWorld : public IWorld
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
IGameWorld();
|
||||
~IGameWorld();
|
||||
|
||||
private:
|
||||
GameSession _currentSession;
|
||||
EventServer * _eventServer = nullptr;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif // IGAMEWORLD_H
|
@ -10,6 +10,7 @@
|
||||
#include "snake.h"
|
||||
#include "store.h"
|
||||
#include "availablesnakesmodel.h"
|
||||
#include "inventorymodel.h"
|
||||
|
||||
namespace CRAWL {
|
||||
|
||||
@ -115,7 +116,7 @@ IControl *IPreviewScaneWorld::initUserInterface() const {
|
||||
}
|
||||
|
||||
QObject *IPreviewScaneWorld::getAvailableItemsModel() const {
|
||||
return m_availableItemsModel;
|
||||
return _availableItemsModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -104,7 +104,6 @@ protected:
|
||||
* @see IPreviewScaneWorld::availableSnakesModelChanged
|
||||
* @see IPreviewScaneWorld::getAvailableSnakesModel
|
||||
* @see IPreviewScaneWorld::availableSnakesModel
|
||||
|
||||
*/
|
||||
void setAvailableSnakesModel(AvailableSnakesModel *newAvailableSnakesModel);
|
||||
|
||||
|
@ -32,11 +32,6 @@ IWorld::IWorld() {
|
||||
qRegisterMetaType<WorldRule::const_iterator>("WorldRule::const_iterator");
|
||||
connect(this, &IWorld::sigWorldChanged, this, &IWorld::worldChanged, Qt::QueuedConnection);
|
||||
|
||||
_eventServer = new EventServer(this);
|
||||
|
||||
connect(_eventServer, &EventServer::sigIntersect, this, &IWorld::onIntersects);
|
||||
connect(this, &IWorld::sigOBjctsListChanged, _eventServer, &EventServer::handleAvailableObjectChanges);
|
||||
|
||||
}
|
||||
|
||||
IWorld::~IWorld() {
|
||||
@ -46,7 +41,6 @@ IWorld::~IWorld() {
|
||||
|
||||
clear();
|
||||
|
||||
delete _eventServer;
|
||||
}
|
||||
|
||||
QString IWorld::itemTextType() const {
|
||||
|
@ -542,8 +542,6 @@ private:
|
||||
|
||||
QFuture<void> _renderLoopFuture;
|
||||
|
||||
EventServer * _eventServer = nullptr;
|
||||
|
||||
QHash<int, IWorldItem*> _items;
|
||||
QMultiHash<QString, int> _itemsGroup;
|
||||
QMultiHash<QString, int> _lastItemsGroup;
|
||||
|
63
src/Core/CrawlModule/AvailableSnakes.qml
Normal file
63
src/Core/CrawlModule/AvailableSnakes.qml
Normal file
@ -0,0 +1,63 @@
|
||||
import QtQuick
|
||||
import ViewSolutionsModule
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
|
||||
Page {
|
||||
id: root
|
||||
property var model: null;
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
ListView {
|
||||
id: listView
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
model: root.model
|
||||
delegate: delegateRow
|
||||
clip: true
|
||||
|
||||
Component {
|
||||
id: delegateRow
|
||||
|
||||
RowLayout {
|
||||
width: listView.width
|
||||
height: 100
|
||||
Image {
|
||||
id: img
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
source: itemImage
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: height * 2
|
||||
}
|
||||
|
||||
Label {
|
||||
text: itemName
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
Label {
|
||||
text: itemDescription
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: buyStatus
|
||||
tristate: false
|
||||
checkState: (itemWasBuy)? Qt.Checked: Qt.Unchecked
|
||||
enabled: false
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Buy");
|
||||
visible: !itemWasBuy
|
||||
|
||||
onClicked: () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
62
src/Core/CrawlModule/Inventory.qml
Normal file
62
src/Core/CrawlModule/Inventory.qml
Normal file
@ -0,0 +1,62 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls.Material
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
Page {
|
||||
id: root
|
||||
property var model: null;
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
ListView {
|
||||
id: listView
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
model: root.model
|
||||
delegate: delegateRow
|
||||
clip: true
|
||||
|
||||
Component {
|
||||
id: delegateRow
|
||||
|
||||
RowLayout {
|
||||
width: listView.width
|
||||
height: 100
|
||||
Image {
|
||||
id: img
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
source: itemImage
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: height * 2
|
||||
}
|
||||
|
||||
Label {
|
||||
text: itemName
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
Label {
|
||||
text: itemDescription
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: buyStatus
|
||||
tristate: false
|
||||
checkState: (itemWasBuy)? Qt.Checked: Qt.Unchecked
|
||||
enabled: false
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Buy");
|
||||
visible: !itemWasBuy
|
||||
|
||||
onClicked: () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -12,6 +12,8 @@ import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
AbstractMenuView {
|
||||
id: root
|
||||
property var model: null
|
||||
columns: 4
|
||||
rows: 2
|
||||
|
||||
@ -61,6 +63,28 @@ AbstractMenuView {
|
||||
}
|
||||
}
|
||||
|
||||
AvailableSnakes {
|
||||
|
||||
Layout.columnSpan: 4
|
||||
Layout.rowSpan: 1
|
||||
Layout.preferredHeight: root.height * 0.1
|
||||
|
||||
model: (root.model)? root.model.availableSnakesModel: null
|
||||
}
|
||||
|
||||
Inventory {
|
||||
|
||||
Layout.preferredHeight: root.height * 0.2
|
||||
|
||||
Layout.columnSpan: 4
|
||||
Layout.rowSpan: 1
|
||||
model: (root.model)? root.model.availableItemsModel: null
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Start")
|
||||
onClicked: {
|
||||
|
5
src/Core/CrawlModule/SnakesView.qml
Normal file
5
src/Core/CrawlModule/SnakesView.qml
Normal file
@ -0,0 +1,5 @@
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
|
||||
}
|
31
src/Core/private/gamesession.cpp
Normal file
31
src/Core/private/gamesession.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#include "gamesession.h"
|
||||
namespace CRAWL {
|
||||
|
||||
GameSession::GameSession() {
|
||||
|
||||
}
|
||||
|
||||
int GameSession::xp() const {
|
||||
return _xp;
|
||||
}
|
||||
|
||||
void GameSession::setXp(int newXp) {
|
||||
_xp = newXp;
|
||||
}
|
||||
|
||||
int GameSession::money() const {
|
||||
return _money;
|
||||
}
|
||||
|
||||
void GameSession::setMoney(int newMoney) {
|
||||
_money = newMoney;
|
||||
}
|
||||
|
||||
}
|
52
src/Core/private/gamesession.h
Normal file
52
src/Core/private/gamesession.h
Normal file
@ -0,0 +1,52 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
|
||||
#ifndef GAMESESSION_H
|
||||
#define GAMESESSION_H
|
||||
|
||||
namespace CRAWL {
|
||||
|
||||
/**
|
||||
* @brief The GameSession class contains all temp information that changed during game session.
|
||||
*/
|
||||
class GameSession
|
||||
{
|
||||
public:
|
||||
GameSession();
|
||||
|
||||
/**
|
||||
* @brief xp This is game session experience of the current user.
|
||||
* @return current value of the experiance
|
||||
*/
|
||||
int xp() const;
|
||||
|
||||
/**
|
||||
* @brief setXp This method sets new vaue of the xperiance
|
||||
* @param newXp This is new value of the experiance durring game session.
|
||||
*/
|
||||
void setXp(int newXp);
|
||||
|
||||
/**
|
||||
* @brief money This method return received during game session money
|
||||
* @return received during game session money
|
||||
*/
|
||||
int money() const;
|
||||
|
||||
/**
|
||||
* @brief setMoney This method sets new value of money
|
||||
* @param newMoney This is new value of money
|
||||
*/
|
||||
void setMoney(int newMoney);
|
||||
|
||||
private:
|
||||
int _xp = 0;
|
||||
int _money = 0;
|
||||
|
||||
};
|
||||
}
|
||||
#endif // GAMESESSION_H
|
Loading…
x
Reference in New Issue
Block a user