ref #30 game is worked!!!

This commit is contained in:
Andrei Yankovich 2021-05-27 16:10:31 +03:00
parent b7fbe6f9ca
commit 4bcf687bad
6 changed files with 15 additions and 107 deletions

View File

@ -29,4 +29,15 @@
<qresource prefix="/SnakeTr">
<file>languages/en.qm</file>
</qresource>
<qresource prefix="/images">
<file>res/up.svg</file>
<file>res/logo.png</file>
<file>res/icon.ico</file>
<file>res/defaultUser.png</file>
<file>res/defaultSnake.png</file>
<file>res/cogs-solid.svg</file>
<file>res/box-texture.png</file>
<file>res/asphalt.jpg</file>
<file>res/Settings-icon.png</file>
</qresource>
</RCC>

View File

@ -42,7 +42,7 @@ void ClientApp::initLang() {
bool ClientApp::init(QQmlApplicationEngine *engine) {
qputenv("QT_QUICK_CONTROLS_MATERIAL_THEME", initTheme());
qputenv("QT_QUICK_CONTROLS_STYLE", "material");
qmlRegisterAnonymousType<GuiObject>("GuiObject", 1);
qmlRegisterAnonymousType<Diff>("Diff", 1);

View File

@ -19,7 +19,7 @@ Item {
id: aboutLogo
fillMode: Image.PreserveAspectFit
source: "qrc:/logo/logo"
source: "qrc:/images/res/logo.png"
anchors.margins: 10
anchors.fill: parent

View File

@ -6,45 +6,17 @@ import QtQuick.Layouts 1.3
Item {
id: item1
property var model: null
readonly property int onlineStatus: (model)? model.onlineStatus: false
visible: true
z: 1
signal playGame();
onOnlineStatusChanged: {
if (onlineStatus && onlineStatus !== 5) {
loginPopUp._show();
} else {
loginPopUp.close();
}
}
LeftSideBar {
id: userViewSideBar
openWidth: 7 * metrix.pt;
openHeight: columnLayout.height
source: UserView {
anchors.fill: parent;
model: (item1.model)? item1.model.userViewModel: null
visible: userViewSideBar.openFinished
onTryConnect: {
if (item1.model)
item1.model.tryConnect();
}
}
}
GridLayout {
id: columnLayout
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: userViewSideBar.right
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 0
@ -146,47 +118,6 @@ Item {
}
PagePopUp {
id: loginPopUp
source: LoginView {
id: loginView
loginStatus: onlineStatus
onSigLogin: {
if (!model) {
return;
}
model.login(gmail, password);
}
onSigNewUser: {
if (!model) {
return;
}
model.registerNewUser(gmail, password);
}
onToOffline: {
if (!model) {
return;
}
model.playOffline();
}
}
visible: true;
modal: true;
autoClose: false
clickClose: false
width: 12 * metrix.controlPtMaterial
height: ((loginView.currentView)? 9 : 7) * metrix.controlPtMaterial;
}
}

View File

@ -93,7 +93,7 @@ Item {
Connections {
target: model;
onGameObjectsChanged: {
function onGameObjectsChanged(dif) {
if (!dif) {
console.log("dif not found");
return;

View File

@ -41,40 +41,6 @@ Item {
columns: 2
anchors.fill: parent
Label {
text: qsTr("Game Host")
Layout.fillWidth: true
}
TextField {
id: host;
text: (model)? model.host: "localhost"
Layout.fillHeight: false
Layout.fillWidth: true
horizontalAlignment: Text.AlignLeft
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
Label {
text: qsTr("Game Port")
Layout.fillWidth: true
}
SpinBox {
id: port;
Layout.fillWidth: true
to: 10000
from: 7000
antialiasing: false
scale: 1
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
value: (model)? model.port: 7777
}
Label {
text: qsTr("Use Them")
Layout.fillWidth: true