MultiplayerDemo
import Felgo 3.0
import QtQuick 2.0
import "../common"
SceneBase {
id: menuScene
signal menuButtonPressed(string button)
Rectangle {
anchors.fill: gameWindowAnchorItem
color: "white"
}
Text {
id: logo
anchors.horizontalCenter: gameWindowAnchorItem.horizontalCenter
horizontalAlignment: Text.AlignHCenter
y: 50
font.pixelSize: 20
color: "#f05352"
text: "Felgo Multiplayer Demo"
}
Text {
anchors.top: logo.bottom
anchors.topMargin: 10
anchors.horizontalCenter: gameWindowAnchorItem.horizontalCenter
horizontalAlignment: Text.AlignHCenter
y: 10
font.pixelSize: 16
color: "black"
text: "Player: " + gameNetwork.user.name
}
Column {
anchors.centerIn: gameWindowAnchorItem
anchors.verticalCenterOffset: 20
spacing: 10
MenuButton {
text: "Quick Game"
action: "quick"
}
MenuButton {
text: "Matchmaking"
}
MenuButton {
text: "Simulate Score +1"
action: "increase_score"
}
}
Row{
spacing: 10
anchors.horizontalCenter: gameWindowAnchorItem.horizontalCenter
anchors.bottom: gameWindowAnchorItem.bottom
anchors.bottomMargin: 30
MenuButton {
text: "Invites"
anchors.horizontalCenter: undefined
}
MenuButton {
id: inboxButton
text: "Inbox"
anchors.horizontalCenter: undefined
}
MenuButton {
text: "Friends"
anchors.horizontalCenter: undefined
}
MenuButton {
text: "Game Network"
action: "gn"
anchors.horizontalCenter: undefined
}
}
Connections{
target: gameNetwork
onInboxEntriesChanged:{
var conv=gameNetwork.inboxEntries;
var count=0;
for(var i=0;i<conv.length;i++){
count += conv[i].unread_count;
}
inboxButton.notification = count
}
}
onVisibleChanged: {
if(visible){
gameNetwork.api.inbox()