Added First Login help + Glow

This commit is contained in:
MasterGordon 2018-07-19 15:47:16 +02:00
parent 425932ca60
commit ca8f9bb9ad
9 changed files with 527 additions and 498 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
php/mysqldata.php
/nbproject/private/

View File

@ -20,16 +20,16 @@
<body id="body">
<div id="login">
<img class="logo" draggable="false" src="images/logo.svg"><br><br>
<p>Username:</p><input class="form" id="login_username"></input><br><br>
<p>Password:</p><input class="form" id="login_password" type="password"></input><br><br>
<p>Username:</p><input class="form" id="login_username"><br><br>
<p>Password:</p><input class="form" id="login_password" type="password"><br><br>
<button class="form" id="login_button">Login</button>
<p class="change">Register?</p>
</div>
<div id="register">
<img class="logo" draggable="false" src="images/logo.svg"><br><br>
<p>Username:</p><input class="form" id="register_username"></input><br><br>
<p>Password:</p><input class="form" id="register_password1" type="password"></input><br><br>
<p>Repeat Password:</p><input class="form" id="register_password2" type="password"></input><br><br>
<p>Username:</p><input class="form" id="register_username"><br><br>
<p>Password:</p><input class="form" id="register_password1" type="password"><br><br>
<p>Repeat Password:</p><input class="form" id="register_password2" type="password"><br><br>
<button class="form" id="register_button">Register</button>
<p class="change">Login?</p>
</div>

View File

@ -34,18 +34,23 @@ var playername = "Player"
var lastsave = 0
var saving = false
$(document).ready(function() {
$("#forcesave").click(function() {
$(document).ready(function () {
$("#forcesave").click(function () {
save()
})
$("#logout").click(function() {
$.get("php/logout.php", function(data) {
$("#logout").click(function () {
$.get("php/logout.php", function (data) {
window.location.replace("index.html")
})
})
$.get("php/playerdata.php", function(data) {
$.get("php/playerdata.php", function (data) {
try {
if (JSON.parse(data).status == "nologin")
window.location.replace("index.html")
} catch (err) {
mode = "help"
$('#help').fadeIn(200)
}
})
loadGameData()
loadItems()
@ -60,7 +65,7 @@ $(document).ready(function() {
var game = 0
$(window).on("beforeunload", function() {
$(window).on("beforeunload", function () {
//save()
})
@ -112,7 +117,7 @@ function save() {
gamedata: JSON.stringify(game),
"gametime": gametime
},
success: function(result) {
success: function (result) {
console.log(result)
if (JSON.parse(result).status == "succes") {
lastsave = new Date().getTime()
@ -128,7 +133,7 @@ function loadGameData() {
factorys.push(new Factory())
inventory = new FactoryInventory()
//game = Cookies.get("game")
$.get("php/playerdata.php", function(data) {
$.get("php/playerdata.php", function (data) {
if (JSON.parse(data).money != undefined) {
game = JSON.parse(data)
} else {
@ -398,11 +403,11 @@ function prepairRender() {
}
console.log(tilesLoaded + "/" + tileClasses.length + " Tiles Loaded!")
console.log("Loading Oretiers")
for(var i = 1;i<9;i++){
$('#oretiers').append("<h1>"+lang.depth+" "+i+":</h1>");
for(var j=0;j<minerals.nameFromId.length;j++){
if(minerals[minerals.nameFromId[j]].depth==i){
$('#oretiers').append("<h2>"+lang.minerals[j]+"</h2>");
for (var i = 1; i < 9; i++) {
$('#oretiers').append("<h1>" + lang.depth + " " + i + ":</h1>");
for (var j = 0; j < minerals.nameFromId.length; j++) {
if (minerals[minerals.nameFromId[j]].depth == i) {
$('#oretiers').append("<h2>" + lang.minerals[j] + "</h2>");
}
}
@ -418,7 +423,7 @@ function prepairRender() {
for (var i = 0; i < items.length; i++) {
var tag = '<img id="itemSel_' + i + '" draggable="false" class="buildtile itemhover" src="images/items/' + items[i].name + '.png">'
$('#selectItem').append(tag)
$('#itemSel_' + i).click(function() {
$('#itemSel_' + i).click(function () {
var id = $(this).attr("id");
id = parseInt(id.substr(8))
selectedItemId = id
@ -436,7 +441,7 @@ function prepairRender() {
$('#itemBig_' + i)[0].height = 72
}
$('.itemhover').hover(
function() {
function () {
//ENTER
var id = $(this).attr("id");
if (id != undefined)
@ -445,20 +450,21 @@ function prepairRender() {
if ($(this).attr("id").startsWith("itemBig_"))
if (id < itemId.length) {
id = itemId[id]
} else return
} else
return
hoverTooltip = true
$('#tooltip').text(lang.items[id] + " (" + formatCount(items[id].value) + " " + lang.money + ")")
$('#tooltip').show()
tooltip = true
}
},
function() {
function () {
//LEAVE
hoverTooltip = false
}
);
$('canvas').click(
function() {
function () {
var id = $(this).attr("id");
if (id != undefined)
if (id.startsWith("itemBig_")) {
@ -504,6 +510,10 @@ function drawInfoBar() {
selectedX = 3
} else if (mode == "selectFactory") {
selectedX = 8
}else if (mode == "help") {
selectedX = 5
}else if (mode == "oretiers") {
selectedX = 6
}
if (selectedX != -1) {

View File

@ -1,32 +1,32 @@
"bauxite"
"beryllium"
"lead"
"chrome"
"diamonds"
"iron"
"naturalgas"
"oil"
"gold"
"kaolin"
"cobalt"
"coal"
"copper"
"lithium"
"magnesium"
"manganese"
"molybdenum"
"nickel"
"phosphate"
"platinum"
"potash"
"rubies"
"silver"
"soda"
"tantalum"
"titanium"
"uranium"
"vanadium"
"tungsten"
"zinc"
"tin"
"salt"
["bauxite",
"beryllium",
"lead",
"chrome",
"diamonds",
"iron",
"naturalgas",
"oil",
"gold",
"kaolin",
"cobalt",
"coal",
"copper",
"lithium",
"magnesium",
"manganese",
"molybdenum",
"nickel",
"phosphate",
"platinum",
"potash",
"rubies",
"silver",
"soda",
"tantalum",
"titanium",
"uranium",
"vanadium",
"tungsten",
"zinc",
"tin",
"salt"]

View File

@ -980,7 +980,7 @@ class TeleporterInput extends Tile {
this.frequency = 0
this.cost = [{
"id": 0,
"count": 50
"count": 50000
}]
this.texture = {
"0": ["teleporter00", "teleporter01", "teleporter02", "teleporter03", "teleporter04", "teleporter06", "teleporter07", "teleporter08", "teleporter09"],
@ -1028,10 +1028,10 @@ class TeleporterOutput extends Tile {
this.frequency = 0
this.cost = [{
"id": 0,
"count": 50
"count": 100000
}]
this.texture = {
"0": ["teleporterout01", "teleporterout02", "teleporterout03", "teleporterout04", "teleporterout05", "teleporterout06", "teleporterout07", "teleporterout08", "teleporterout09"],
"0": ["teleporterout09", "teleporterout01", "teleporterout02", "teleporterout03", "teleporterout04", "teleporterout05", "teleporterout06", "teleporterout07", "teleporterout08"],
"1": []
}
this.options = [{

View File

@ -104,15 +104,15 @@
}
},
"teleporterinput": {
"name": "teleporterinput",
"description": "Puts a selected Item to the left and all other straight.",
"name": "Teleporter (input)",
"description": "Teleports items to a Teleporter (output) with the same frequency.",
"options": {
"frequency": "Frequency"
}
},
"teleporteroutput": {
"name": "teleporteroutput",
"description": "Puts a selected Item to the left and all other straight.",
"name": "Teleporter (output)",
"description": "Recieves items from a Teleporter (input) with the same frequency.",
"options": {
"frequency": "Frequency"
}

View File

@ -0,0 +1,3 @@
file.reference.factory-Factory=.
files.encoding=UTF-8
site.root.folder=${file.reference.factory-Factory}

9
nbproject/project.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.clientproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/clientside-project/1">
<name>Factory</name>
</data>
</configuration>
</project>

6
php/database.php Normal file
View File

@ -0,0 +1,6 @@
CREATE TABLE `users` (
`username` text NOT NULL,
`password` text NOT NULL,
`gamedata` mediumtext,
`gametime` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;