Merge pull request #197 from mikeprimm/master

Add optional background color control per map, including day/night
This commit is contained in:
mikeprimm 2011-06-03 01:32:10 -07:00
commit c323ba5b11
4 changed files with 86 additions and 1 deletions

View File

@ -136,6 +136,12 @@ templates:
# night-and-day: true # night-and-day: true
# Option to turn on transparency support (off by default) - slows render # Option to turn on transparency support (off by default) - slows render
# transparency: true # transparency: true
# Background color for map during the day
# backgroundday: "#153E7E"
# Background color for map during the night
# backgroundnight: "#000000"
# Backgrounc color for map (independent of night/day)
# background: "#000000"
- class: org.dynmap.kzedmap.KzedMap - class: org.dynmap.kzedmap.KzedMap
renderers: renderers:
- class: org.dynmap.kzedmap.DefaultTileRenderer - class: org.dynmap.kzedmap.DefaultTileRenderer
@ -152,6 +158,12 @@ templates:
# night-and-day: true # night-and-day: true
# Option to turn off transparency support (on by default) - speeds render # Option to turn off transparency support (on by default) - speeds render
# transparency: false # transparency: false
# Background color for map during the day
# backgroundday: "#153E7E"
# Background color for map during the night
# backgroundnight: "#000000"
# Backgrounc color for map (independent of night/day)
# background: "#000000"
# Sets the icon to 'images/block_custom.png' # Sets the icon to 'images/block_custom.png'
# icon: custom # icon: custom
#- class: org.dynmap.kzedmap.HighlightTileRenderer #- class: org.dynmap.kzedmap.HighlightTileRenderer
@ -180,6 +192,8 @@ templates:
title: "Flat" title: "Flat"
prefix: flat prefix: flat
colorscheme: default colorscheme: default
# Map background color (day or night)
background: "#300806"
- class: org.dynmap.kzedmap.KzedMap - class: org.dynmap.kzedmap.KzedMap
renderers: renderers:
- class: org.dynmap.kzedmap.DefaultTileRenderer - class: org.dynmap.kzedmap.DefaultTileRenderer
@ -188,6 +202,40 @@ templates:
prefix: nt prefix: nt
maximumheight: 127 maximumheight: 127
colorscheme: default colorscheme: default
# Map background color (day or night)
background: "#300806"
# Skylands world template
skylands:
enabled: true
center:
x: 0
y: 64
z: 0
maps:
- class: org.dynmap.flat.FlatMap
name: flat
title: "Flat"
prefix: flat
colorscheme: default
# Background color for map during the day
backgroundday: "#153E7E"
# Background color for map during the night
backgroundnight: "#000000"
- class: org.dynmap.kzedmap.KzedMap
renderers:
- class: org.dynmap.kzedmap.DefaultTileRenderer
name: skylands
title: "Surface"
prefix: st
maximumheight: 127
colorscheme: default
# Background color for map during the day
backgroundday: "#153E7E"
# Background color for map during the night
backgroundnight: "#000000"
night-and-day: true
shadowstrength: 1.0
ambientlight: 4
# The maptypes Dynmap will use to render. # The maptypes Dynmap will use to render.
worlds: worlds:
@ -226,6 +274,12 @@ worlds:
# # night-and-day: true # # night-and-day: true
# # Option to turn on transparency support (off by default) - slows render # # Option to turn on transparency support (off by default) - slows render
# # transparency: true # # transparency: true
# # Background color for map during the day
# # backgroundday: "#153E7E"
# # Background color for map during the night
# # backgroundnight: "#000000"
# # Backgrounc color for map (independent of night/day)
# # background: "#000000"
# - class: org.dynmap.kzedmap.KzedMap # - class: org.dynmap.kzedmap.KzedMap
# renderers: # renderers:
# - class: org.dynmap.kzedmap.DefaultTileRenderer # - class: org.dynmap.kzedmap.DefaultTileRenderer
@ -242,6 +296,12 @@ worlds:
# # night-and-day: true # # night-and-day: true
# # Option to turn off transparency support (on by default) - speeds render # # Option to turn off transparency support (on by default) - speeds render
# # transparency: false # # transparency: false
# # Background color for map during the day
# # backgroundday: "#153E7E"
# # Background color for map during the night
# # backgroundnight: "#000000"
# # Backgrounc color for map (independent of night/day)
# # background: "#000000"
# # Sets the icon to 'images/block_custom.png' # # Sets the icon to 'images/block_custom.png'
# # icon: custom # # icon: custom
# #- class: org.dynmap.kzedmap.HighlightTileRenderer # #- class: org.dynmap.kzedmap.HighlightTileRenderer

View File

@ -418,7 +418,10 @@ public class FlatMap extends MapType {
s(o, "title", c.getString("title")); s(o, "title", c.getString("title"));
s(o, "icon", c.getString("icon")); s(o, "icon", c.getString("icon"));
s(o, "prefix", c.getString("prefix")); s(o, "prefix", c.getString("prefix"));
s(o, "background", c.getString("background"));
s(o, "nightandday", c.getBoolean("night-and-day",false)); s(o, "nightandday", c.getBoolean("night-and-day",false));
s(o, "backgroundday", c.getString("backgroundday"));
s(o, "backgroundnight", c.getString("backgroundnight"));
a(worldObject, "maps", o); a(worldObject, "maps", o);
} }
} }

View File

@ -518,7 +518,10 @@ public class DefaultTileRenderer implements MapTileRenderer {
s(o, "title", c.getString("title")); s(o, "title", c.getString("title"));
s(o, "icon", c.getString("icon")); s(o, "icon", c.getString("icon"));
s(o, "prefix", c.getString("prefix")); s(o, "prefix", c.getString("prefix"));
s(o, "background", c.getString("background"));
s(o, "nightandday", c.getBoolean("night-and-day", false)); s(o, "nightandday", c.getBoolean("night-and-day", false));
s(o, "backgroundday", c.getString("backgroundday"));
s(o, "backgroundnight", c.getString("backgroundnight"));
a(worldObject, "maps", o); a(worldObject, "maps", o);
} }
} }

View File

@ -358,6 +358,7 @@ DynMap.prototype = {
}, 1); }, 1);
$('.map', me.worldlist).removeClass('selected'); $('.map', me.worldlist).removeClass('selected');
$(map.element).addClass('selected'); $(map.element).addClass('selected');
me.updateBackground();
}, },
selectWorld: function(world, completed) { selectWorld: function(world, completed) {
var me = this; var me = this;
@ -440,6 +441,7 @@ DynMap.prototype = {
}); });
if(me.serverday != oldday) { if(me.serverday != oldday) {
me.updateBackground();
var mtid = me.map.mapTypeId; var mtid = me.map.mapTypeId;
if(me.map.mapTypes[mtid].nightandday) { if(me.map.mapTypes[mtid].nightandday) {
me.map.setMapTypeId('none'); me.map.setMapTypeId('none');
@ -573,7 +575,24 @@ DynMap.prototype = {
me.panTo(player.location); me.panTo(player.location);
} }
this.followingPlayer = player; this.followingPlayer = player;
} },
updateBackground: function() {
var me = this;
var col = "#000000";
if(me.serverday) {
if(me.maptype.backgroundday)
col = me.maptype.backgroundday;
else if(me.maptype.background)
col = me.maptype.background;
}
else {
if(me.maptype.backgroundnight)
col = me.maptype.backgroundnight;
else if(me.maptype.background)
col = me.maptype.background;
}
$('.map').css('background', col);
}
// TODO: Enable hash-links. // TODO: Enable hash-links.
/* updateLink: function() { /* updateLink: function() {
var me = this; var me = this;