Add map zones
This commit is contained in:
parent
cde50d8467
commit
4e5444f97d
49
public_html/js/MapPlaces.js
Normal file
49
public_html/js/MapPlaces.js
Normal file
@ -0,0 +1,49 @@
|
||||
function MapPlaces() {
|
||||
this.zones = {};
|
||||
this.currentZone = "";
|
||||
|
||||
this.names = {};
|
||||
this.names["admin_house"] = "Админ. корпус";
|
||||
this.names["badminton"] = "Бадминтон";
|
||||
this.names["beach"] = "Пляж";
|
||||
this.names["boat_station"] = "Лодочная станция";
|
||||
this.names["camp_entrance"] = "Ворота в лагерь";
|
||||
this.names["clubs"] = "Клубы";
|
||||
this.names["dining_hall"] = "Столовая";
|
||||
this.names["dv_us_house"] = "Домик Ульяны и Алисы";
|
||||
this.names["estrade"] = "Сцена";
|
||||
this.names["forest"] = "Лес";
|
||||
this.names["island_nearest"] = 'Остров "Ближний"';
|
||||
this.names["library"] = "Библиотека";
|
||||
this.names["me_mt_house"] = "Домик вожатой";
|
||||
this.names["medic_house"] = "Медпункт";
|
||||
this.names["monument"] = "Памятник";
|
||||
this.names["music_club"] = "Музыкальный клуб";
|
||||
this.names["old_house"] = "Старый корпус";
|
||||
this.names["old_road"] = "Дорога к старому лагерю";
|
||||
this.names["sl_mz_house"] = "Домик Слави и Жени";
|
||||
this.names["sport_area"] = "Спортплощадка";
|
||||
this.names["square"] = "Площадь";
|
||||
this.names["store_house"] = "Склад";
|
||||
this.names["sy_sh_house"] = "Домик Электроника и Шурика";
|
||||
this.names["un_mi_house"] = "Домик Лены и Мику";
|
||||
this.names["valleyball"] = "Волейбол";
|
||||
this.names["wash_house"] = "Душевая";
|
||||
}
|
||||
|
||||
MapPlaces.prototype.disableAllZones = function () {
|
||||
this.zones = {};
|
||||
this.currentZone = "";
|
||||
};
|
||||
|
||||
MapPlaces.prototype.disableCurrentZone = function () {
|
||||
delete this.zones[this.currentZone];
|
||||
};
|
||||
|
||||
MapPlaces.prototype.resetZone = function (zone) {
|
||||
delete this.zones[zone];
|
||||
};
|
||||
|
||||
MapPlaces.prototype.setZone = function (name, label) {
|
||||
this.zones[name] = label;
|
||||
};
|
@ -19,6 +19,8 @@ function Views(parser) {
|
||||
this.characters.makeNamesUnknown();
|
||||
this.characters.makeNamesKnown();
|
||||
|
||||
this.places = new MapPlaces();
|
||||
|
||||
this.useSpriteTransitions = true;
|
||||
this.spriteInContainer = {};
|
||||
|
||||
@ -282,18 +284,48 @@ Views.prototype.meet = function (whoid, name) {
|
||||
};
|
||||
|
||||
Views.prototype.disableAllZones = function () {
|
||||
this.places.disableAllZones();
|
||||
};
|
||||
|
||||
Views.prototype.disableCurrentZone = function () {
|
||||
this.places.disableCurrentZone();
|
||||
};
|
||||
|
||||
Views.prototype.resetZone = function (zone) {
|
||||
this.places.resetZone(zone);
|
||||
};
|
||||
|
||||
Views.prototype.setZone = function (name, label) {
|
||||
this.places.setZone(name, label);
|
||||
};
|
||||
|
||||
Views.prototype.showMap = function () {
|
||||
$('#menuTitle').text('Карта');
|
||||
|
||||
var zoneKeys = new Array();
|
||||
var zoneNames = new Array();
|
||||
for (var key in this.places.zones) {
|
||||
zoneKeys.push(key);
|
||||
zoneNames.push( (key in this.places.names) ? this.places.names[key] : key );
|
||||
}
|
||||
|
||||
$('#menuChoose').empty();
|
||||
for(var i = 0; i < zoneKeys.length; i++) {
|
||||
var li = $('<li>', {text: zoneNames[i]});
|
||||
li.click(this.createMapPlaceClickFunction(i, zoneKeys, this.places.zones));
|
||||
li.appendTo($('#menuChoose'));
|
||||
}
|
||||
$('#menu').show();
|
||||
};
|
||||
|
||||
Views.prototype.createMapPlaceClickFunction = function (index, zoneKeys, zones) {
|
||||
var views = this;
|
||||
return function () {
|
||||
$('#menu').hide();
|
||||
var currentZone = zoneKeys[index];
|
||||
views.parser.jumpLabel(zones[currentZone]);
|
||||
views.parser.next();
|
||||
};
|
||||
};
|
||||
|
||||
Views.prototype.menu = function (menu) {
|
||||
|
Loading…
Reference in New Issue
Block a user