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 php/mysqldata.php
/nbproject/private/

View File

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

View File

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

View File

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

View File

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

View File

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