mirror of
https://gitlab.com/Oreolek/salet.git
synced 2024-07-07 01:04:25 +03:00
Issue #11 - room illustration property
This commit is contained in:
parent
0ed470dae6
commit
15792d556c
|
@ -46,6 +46,7 @@ room "plaza",
|
||||||
|
|
||||||
room "shop",
|
room "shop",
|
||||||
title: "The Shop"
|
title: "The Shop"
|
||||||
|
#pic: "http://loremflickr.com/640/300/room,shop"
|
||||||
ways: ["plaza", "shop-inside", "lair"]
|
ways: ["plaza", "shop-inside", "lair"]
|
||||||
dsc: """
|
dsc: """
|
||||||
Being the only shop in town, this trendy establishment did not need a name.
|
Being the only shop in town, this trendy establishment did not need a name.
|
||||||
|
|
|
@ -60,6 +60,17 @@ update_ways = (ways, name) ->
|
||||||
for node in min_key
|
for node in min_key
|
||||||
addClass(document.getElementById("waylink-#{node}"), "destination")
|
addClass(document.getElementById("waylink-#{node}"), "destination")
|
||||||
|
|
||||||
|
picture_tag = (picture) ->
|
||||||
|
extension = picture.substr((~-picture.lastIndexOf(".") >>> 0) + 2)
|
||||||
|
if (extension == "webm")
|
||||||
|
return """
|
||||||
|
<video src="#{picture}" controls>
|
||||||
|
Your browser does not support the video tag for some reason.
|
||||||
|
You won't be able to view this video in this browser.
|
||||||
|
</video>
|
||||||
|
"""
|
||||||
|
return "<img class='img-responsive' src='#{picture}' alt='Room illustration'>"
|
||||||
|
|
||||||
class SaletRoom extends undum.Situation
|
class SaletRoom extends undum.Situation
|
||||||
constructor: (spec) ->
|
constructor: (spec) ->
|
||||||
undum.Situation.call(this, spec)
|
undum.Situation.call(this, spec)
|
||||||
|
@ -69,6 +80,11 @@ class SaletRoom extends undum.Situation
|
||||||
visited: 0
|
visited: 0
|
||||||
title: "Room"
|
title: "Room"
|
||||||
objects: {}
|
objects: {}
|
||||||
|
|
||||||
|
# room illustration image, VN-style. Can be a GIF or WEBM. Can be a function.
|
||||||
|
pic: false
|
||||||
|
|
||||||
|
dsc: false # room description
|
||||||
extendSection: false
|
extendSection: false
|
||||||
distance: Infinity # distance to the destination
|
distance: Infinity # distance to the destination
|
||||||
clear: true # clear the screen on entering the room?
|
clear: true # clear the screen on entering the room?
|
||||||
|
@ -148,6 +164,9 @@ class SaletRoom extends undum.Situation
|
||||||
update_ways(@ways, @name)
|
update_ways(@ways, @name)
|
||||||
retval = ""
|
retval = ""
|
||||||
|
|
||||||
|
if @pic
|
||||||
|
retval += '<div class="pic">'+picture_tag(@pic.fcall(this, character, system, f))+'</div>'
|
||||||
|
|
||||||
# Print the room description
|
# Print the room description
|
||||||
if @dsc
|
if @dsc
|
||||||
retval += markdown(@dsc.fcall(this, character, system, f))
|
retval += markdown(@dsc.fcall(this, character, system, f))
|
||||||
|
|
|
@ -95,6 +95,10 @@ body {
|
||||||
@media (min-width: breakpoint-min(sm)) {
|
@media (min-width: breakpoint-min(sm)) {
|
||||||
@include make-col-offset(1);
|
@include make-col-offset(1);
|
||||||
}
|
}
|
||||||
|
.pic {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
p {
|
p {
|
||||||
hyphens: auto;
|
hyphens: auto;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue