Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Andreas Nedbal
FarmingGame-web
Commits
cad8e6ea
Commit
cad8e6ea
authored
May 17, 2014
by
Jyrki
🐾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slidrrerrs
parent
8449f222
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
13 deletions
+41
-13
coffee/main.coffee
coffee/main.coffee
+11
-0
index.html
index.html
+12
-12
js/main.js
js/main.js
+18
-1
No files found.
coffee/main.coffee
View file @
cad8e6ea
...
...
@@ -56,6 +56,9 @@ updateCounters = ->
$
(
'span#builds-fields'
).
html
window
.
gameVars
.
fields
.
count
$
(
'span#builds-cattle'
).
html
window
.
gameVars
.
cattleGrid
.
count
# market sliders
$
(
"span[name=market-
#{
x
}
-val]"
).
html
$
(
"input[name=market-slider][data-type=
#{
x
}
]"
).
val
()
for
x
in
[
'wheat'
,
'livestock'
,
'fields'
,
'cattle'
]
# statistics
$
(
'td#stats-wheat-produced'
).
html
window
.
gameVars
.
wheat
.
produced
$
(
'td#stats-wheat-consumed'
).
html
window
.
gameVars
.
wheat
.
consumed
...
...
@@ -199,3 +202,11 @@ fitim = window.setInterval fieldTimer, 100
whtim
=
window
.
setInterval
wheatTimer
,
100
$
(
document
).
ready
->
updateCounters
()
marketSliderChange
=
->
self
=
$
this
selector
=
"span[name=market-
#{
self
[
0
].
dataset
.
type
}
-val]"
$
(
selector
).
html
self
.
val
()
$
(
document
).
on
"change"
,
"input[name=market-slider]"
,
marketSliderChange
$
(
document
).
on
"mousemove"
,
"input[name=market-slider]"
,
marketSliderChange
index.html
View file @
cad8e6ea
...
...
@@ -118,13 +118,13 @@
<div
class=
"panel-body"
>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<button
class=
"btn btn-market btn-block btn-success"
>
Buy
{n}
Wheat
</button>
<button
class=
"btn btn-market btn-block btn-success"
>
Buy
<span
name=
"market-wheat-val"
>
{n}
</span>
Wheat
</button>
</div>
<div
class=
"col-md-6"
>
<button
class=
"btn btn-market btn-block btn-danger"
>
Sell
{n}
Wheat
</button>
<button
class=
"btn btn-market btn-block btn-danger"
>
Sell
<span
name=
"market-wheat-val"
>
{n}
</span>
Wheat
</button>
</div>
</div>
<input
type=
"range"
>
<input
type=
"range"
name=
"market-slider"
data-type=
"wheat"
>
</div>
</div>
<!-- Livestock Panel -->
...
...
@@ -135,13 +135,13 @@
<div
class=
"panel-body"
>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<button
class=
"btn btn-market btn-block btn-success"
>
Buy
{n}
Livestock
</button>
<button
class=
"btn btn-market btn-block btn-success"
>
Buy
<span
name=
"market-livestock-val"
>
{n}
</span>
Livestock
</button>
</div>
<div
class=
"col-md-6"
>
<button
class=
"btn btn-market btn-block btn-danger"
>
Sell
{n}
Livestock
</button>
<button
class=
"btn btn-market btn-block btn-danger"
>
Sell
<span
name=
"market-livestock-val"
>
{n}
</span>
Livestock
</button>
</div>
</div>
<input
type=
"range"
>
<input
type=
"range"
name=
"market-slider"
data-type=
"livestock"
>
</div>
</div>
<!-- Fields Panel -->
...
...
@@ -152,13 +152,13 @@
<div
class=
"panel-body"
>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<button
class=
"btn btn-market btn-block btn-success"
>
Buy
{n}
Fields
</button>
<button
class=
"btn btn-market btn-block btn-success"
>
Buy
<span
name=
"market-fields-val"
>
{n}
</span>
Fields
</button>
</div>
<div
class=
"col-md-6"
>
<button
class=
"btn btn-market btn-block btn-danger"
>
Sell
{n}
Fields
</button>
<button
class=
"btn btn-market btn-block btn-danger"
>
Sell
<span
name=
"market-fields-val"
>
{n}
</span>
Fields
</button>
</div>
</div>
<input
type=
"range"
>
<input
type=
"range"
name=
"market-slider"
data-type=
"fields"
>
</div>
</div>
<!-- Cattle Grids Panel -->
...
...
@@ -169,13 +169,13 @@
<div
class=
"panel-body"
>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<button
class=
"btn btn-market btn-block btn-success"
>
Buy
{n}
Cattle Grids
</button>
<button
class=
"btn btn-market btn-block btn-success"
>
Buy
<span
name=
"market-cattle-val"
>
{n}
</span>
Cattle Grids
</button>
</div>
<div
class=
"col-md-6"
>
<button
class=
"btn btn-market btn-block btn-danger"
>
Sell
{n}
Cattle Grids
</button>
<button
class=
"btn btn-market btn-block btn-danger"
>
Sell
<span
name=
"market-cattle-val"
>
{n}
</span>
Cattle Grids
</button>
</div>
</div>
<input
type=
"range"
>
<input
type=
"range"
name=
"market-slider"
data-type=
"cattle"
>
</div>
</div>
</div>
...
...
js/main.js
View file @
cad8e6ea
// Generated by CoffeeScript 1.7.1
(
function
()
{
var
eventTimer
,
evtim
,
fieldTimer
,
fitim
,
initItem
,
updateCounters
,
warTimer
,
wheatTimer
,
whtim
;
var
eventTimer
,
evtim
,
fieldTimer
,
fitim
,
initItem
,
marketSliderChange
,
updateCounters
,
warTimer
,
wheatTimer
,
whtim
;
initItem
=
function
(
defaultCount
,
consumable
)
{
var
retobj
;
...
...
@@ -44,6 +44,7 @@
};
updateCounters
=
function
()
{
var
x
,
_i
,
_len
,
_ref
;
$
(
'
span#valuables-gold
'
).
html
(
window
.
gameVars
.
gold
);
$
(
'
span#goods-wheat
'
).
html
(
window
.
gameVars
.
wheat
.
count
);
$
(
'
span#goods-livestock
'
).
html
(
window
.
gameVars
.
liveStock
.
count
);
...
...
@@ -53,6 +54,11 @@
$
(
'
span#people-all
'
).
html
(
window
.
gameVars
.
people
.
home
+
window
.
gameVars
.
people
.
war
+
window
.
gameVars
.
people
.
shelter
);
$
(
'
span#builds-fields
'
).
html
(
window
.
gameVars
.
fields
.
count
);
$
(
'
span#builds-cattle
'
).
html
(
window
.
gameVars
.
cattleGrid
.
count
);
_ref
=
[
'
wheat
'
,
'
livestock
'
,
'
fields
'
,
'
cattle
'
];
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
x
=
_ref
[
_i
];
$
(
"
span[name=market-
"
+
x
+
"
-val]
"
).
html
(
$
(
"
input[name=market-slider][data-type=
"
+
x
+
"
]
"
).
val
());
}
$
(
'
td#stats-wheat-produced
'
).
html
(
window
.
gameVars
.
wheat
.
produced
);
$
(
'
td#stats-wheat-consumed
'
).
html
(
window
.
gameVars
.
wheat
.
consumed
);
$
(
'
td#stats-wheat-bought
'
).
html
(
window
.
gameVars
.
wheat
.
bought
);
...
...
@@ -217,4 +223,15 @@
return
updateCounters
();
});
marketSliderChange
=
function
()
{
var
selector
,
self
;
self
=
$
(
this
);
selector
=
"
span[name=market-
"
+
self
[
0
].
dataset
.
type
+
"
-val]
"
;
return
$
(
selector
).
html
(
self
.
val
());
};
$
(
document
).
on
(
"
change
"
,
"
input[name=market-slider]
"
,
marketSliderChange
);
$
(
document
).
on
(
"
mousemove
"
,
"
input[name=market-slider]
"
,
marketSliderChange
);
}).
call
(
this
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment