Data classes

This commit is contained in:
danbulant 2019-12-30 20:38:27 +01:00
parent c0d7f3cabf
commit 4488d1421b
11 changed files with 149 additions and 11 deletions

View file

@ -0,0 +1,9 @@
class Achievment {
time = new Date;
name = "";
game = 0;
image = "";
text = "";
}
module.exports = Achievment;

View file

@ -0,0 +1,6 @@
class Action {
button = null;
text = "";
}
module.exports = Action;

View file

@ -0,0 +1,7 @@
class Button {
icon = "";
player = -1;
type = "";
}
module.exports = Button;

6
html/views/data/card.js Normal file
View file

@ -0,0 +1,6 @@
class Card {
name = "";
image = "";
action = "";
onclick(){}
}

View file

@ -0,0 +1,7 @@
const User = require("./user");
class CurrentUser extends User {
}
module.exports = CurrentUser;

13
html/views/data/game.js Normal file
View file

@ -0,0 +1,13 @@
class Game {
name = "";
image = "";
run(){
console.log("Game running");
this.exit();
}
exit(){
global.menu.show();
}
}
module.exports = Game;

20
html/views/data/user.js Normal file
View file

@ -0,0 +1,20 @@
const Card = require("./card");
class User {
name = [];
username = "";
friends = [];
avatar = "";
achievments = {};
getCard(){
var card = new Card;
card.name = this.name;
card.image = this.avatar;
card.action = "Select";
return card;
}
}
module.exports = User;

View file

@ -4,25 +4,24 @@
<meta charset="utf-8">
<title>Console hub</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"><!-- include material icons -->
<link rel="stylesheet" href="styles.min.css"><!-- include custom stylesheet -->
<link rel="stylesheet" href="../../dist/css/styles.min.css"><!-- include custom stylesheet -->
</head>
<body>
<div id="view">
</div>
<div class='box'>
<div class='wave -one'></div>
<div class='wave -two'></div>
<div class='wave -three'></div>
</div>
<script>
if (typeof module === 'object') {window.module = module; module = undefined;}
</script>
<script src="jquery.min.js"></script>
<script src="../dep/jquery.min.js"></script>
<script>if (window.module) module = window.module;</script>
<script src="gamepad.js"></script>
<script src="functions.js"></script>
<script src="script.js"></script>
<script src="onlineChecker.js"></script>
<script src="filesystem.js"></script>
<script src="node.js"></script>
<script src="keyboard.js"></script>
<script src="main.js"></script>
</body>
</html>

6
html/views/main.js Normal file
View file

@ -0,0 +1,6 @@
const gamepadConnected = require("./menu/connected");
console.log("Console-hub alpha");
gamepadConnected();

View file

@ -0,0 +1,14 @@
const utils = require("../../utils");
const gui = require("./gui");
function gamepadConnected(){
console.log("Gamepad connected");
var view = document.getElementById("view");
utils.removeChildNodes(view);
gui.showTitle("Your profile");
gui.showDescription("Select or login with your Pushr account to continue");
}
module.exports = gamepadConnected;

51
html/views/menu/gui.js Normal file
View file

@ -0,0 +1,51 @@
function showTitle(title){
var view = document.getElementById("view");
var t = document.createElement("h1");
t.classList.add("title--main")
t.innerText = title;
view.appendChild(t);
}
function showDescription(desc) {
var view = document.getElementById("view");
var t = document.createElement("h2");
t.classList.add("title--description")
t.innerText = desc;
view.appendChild(t);
}
global.cards = [];
global.currentCard = -1;
function getCard(card){
var t = document.createElement("div");
var title = document.createElement("span");
title.innerText = card.name;
var image = document.createElement("img");
image.src = card.image;
global.cards[global.cards.length] = card;
t.appendChild(title);
t.appendChild(image);
return t;
}
function renderCardList(cards){
var view = document.getElementById("view");
}
function showAction(action, side){
}
module.exports = {
showTitle,
showDescription,
getCard,
renderCardList,
showAction
}