114 lines
2.9 KiB
JavaScript
114 lines
2.9 KiB
JavaScript
var baseResDir = 'file:///E:/everlastingsummer/';
|
|
//var baseResDir = '/resources/es/';
|
|
|
|
function FadeInfo() {
|
|
this.fadeIn = false;
|
|
this.fadeOut = false;
|
|
this.duration = 0;
|
|
}
|
|
|
|
|
|
function TextUtilsImpl() { }
|
|
|
|
TextUtilsImpl.prototype.isEmpty = function (text) {
|
|
if (text === undefined) return true;
|
|
return text.length === 0;
|
|
};
|
|
|
|
var TextUtils = new TextUtilsImpl();
|
|
|
|
|
|
String.prototype.equalsIgnoreCase = function(text) {
|
|
return this.toLowerCase() == text.toLowerCase();
|
|
};
|
|
|
|
String.prototype.equals = function(text) {
|
|
return this == text;
|
|
};
|
|
|
|
String.prototype.contains = function(text) {
|
|
return this.indexOf(text) >= 0;
|
|
};
|
|
|
|
String.prototype.replaceAll = function(search, replace) {
|
|
return this.split(search).join(replace);
|
|
};
|
|
|
|
String.prototype.startsWith = function(text) {
|
|
return this.indexOf(text) == 0;
|
|
};
|
|
|
|
String.prototype.replaceAll = function (find, replace) {
|
|
var str = this;
|
|
return str.replace(new RegExp(find, 'g'), replace);
|
|
};
|
|
|
|
|
|
function toColor(num) {
|
|
num >>>= 0;
|
|
var b = num & 0xFF,
|
|
g = (num & 0xFF00) >>> 8,
|
|
r = (num & 0xFF0000) >>> 16,
|
|
a = ( (num & 0xFF000000) >>> 24 ) / 255 ;
|
|
return "rgba(" + [r, g, b, a].join(",") + ")";
|
|
}
|
|
|
|
|
|
var PathResolver = new function () {
|
|
this.background = function (type, name) {
|
|
return baseResDir + type.toLowerCase() + "/" + name + ".jpg";
|
|
};
|
|
this.sprite = function (whoid, params) {
|
|
var path = baseResDir + "sprites/";
|
|
path += whoid.toLowerCase() + "/";
|
|
path += (TextUtils.isEmpty(params) ? "normal" : params);
|
|
path += ".png";
|
|
return path;
|
|
};
|
|
this.music = function (name) {
|
|
return baseResDir + "music/" + name + ".ogg";
|
|
};
|
|
this.ambience = function (name) {
|
|
var path = baseResDir + "ambience/";
|
|
if (name.startsWith("ambience_")) path += name.substring(9);
|
|
else path += name;
|
|
path += ".ogg";
|
|
return path;
|
|
};
|
|
this.sound = function (name) {
|
|
if (name.startsWith("ambience_")) {
|
|
return this.ambience(name);
|
|
}
|
|
var path = baseResDir + "sfx/";
|
|
if (name.startsWith("sfx_")) path += name.substring(4);
|
|
else path += name;
|
|
path += ".ogg";
|
|
return path;
|
|
};
|
|
};
|
|
|
|
function Menu(title) {
|
|
this.title = title;
|
|
this.items = new Array();
|
|
}
|
|
|
|
Menu.prototype.getTitle = function () { return this.title; };
|
|
|
|
Menu.prototype.getItems = function () { return this.items; };
|
|
|
|
Menu.prototype.addItem = function (name, position) {
|
|
this.items.push({name: name, position: position});
|
|
};
|
|
|
|
Menu.prototype.getPosition = function (itemIndex) {
|
|
return this.items[itemIndex].position;
|
|
};
|
|
|
|
function SaveInfo(time, position, variables, characterNames, backgroundType, backgroundName) {
|
|
this.time = time;
|
|
this.position = position;
|
|
this.variables = variables;
|
|
this.characterNames = characterNames;
|
|
this.backgroundType = backgroundType;
|
|
this.backgroundName = backgroundName;
|
|
} |