Newer
Older
/********************************************************************************
This file contains the variables and functions that form the select screens of
the game. The parsing functions for the opponent.xml file.
********************************************************************************/
/**********************************************************************
***** Opponent & Group Specification *****
**********************************************************************/
/**************************************************
* Stores meta information about opponents.
**************************************************/
function createNewOpponent (folder, enabled, first, last, label, image, gender,
height, source, artist, writer, description,
ending, layers, release) {
var newOpponentObject = {folder:folder,
enabled:enabled,
first:first,
last:last,
label:label,
image:image,
gender:gender,
height:height,
source:source,
artist:artist,
writer:writer,
layers:layers,
release:parseInt(release)};
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
return newOpponentObject;
}
/**************************************************
* Stores meta information about groups.
**************************************************/
function createNewGroup (title, opponents) {
var newGroupObject = {title:title,
opponents:opponents};
return newGroupObject;
}
/**********************************************************************
***** Select Screen UI Elements *****
**********************************************************************/
/* main select screen */
$selectTable = $("#select-table");
$selectBubbles = [$("#select-bubble-1"),
$("#select-bubble-2"),
$("#select-bubble-3"),
$("#select-bubble-4")];
$selectDialogues = [$("#select-dialogue-1"),
$("#select-dialogue-2"),
$("#select-dialogue-3"),
$("#select-dialogue-4")];
$selectAdvanceButtons = [$("#select-advance-button-1"),
$("#select-advance-button-2"),
$("#select-advance-button-3"),
$("#select-advance-button-4")];
$selectImages = [$("#select-image-1"),
$("#select-image-2"),
$("#select-image-3"),
$("#select-image-4")];
$selectLabels = [$("#select-name-label-1"),
$("#select-name-label-2"),
$("#select-name-label-3"),
$("#select-name-label-4")];
$selectButtons = [$("#select-slot-button-1"),
$("#select-slot-button-2"),
$("#select-slot-button-3"),
$("#select-slot-button-4")];
$selectMainButton = $("#main-select-button");
$selectRandomButtons = [$("#select-random-button"), $("#select-random-female-button"), $("#select-random-male-button")];
$selectRemoveAllButton = $("#select-remove-all-button");
/* individual select screen */
$individualSelectTable = $("#individual-select-table");
$individualNameLabels = [$("#individual-name-label-1"), $("#individual-name-label-2"), $("#individual-name-label-3"), $("#individual-name-label-4")];
$individualPrefersLabels = [$("#individual-prefers-label-1"), $("#individual-prefers-label-2"), $("#individual-prefers-label-3"), $("#individual-prefers-label-4")];
$individualSexLabels = [$("#individual-sex-label-1"), $("#individual-sex-label-2"), $("#individual-sex-label-3"), $("#individual-sex-label-4")];
$individualHeightLabels = [$("#individual-height-label-1"), $("#individual-height-label-2"), $("#individual-height-label-3"), $("#individual-height-label-4")];
$individualSourceLabels = [$("#individual-source-label-1"), $("#individual-source-label-2"), $("#individual-source-label-3"), $("#individual-source-label-4")];
$individualWriterLabels = [$("#individual-writer-label-1"), $("#individual-writer-label-2"), $("#individual-writer-label-3"), $("#individual-writer-label-4")];
$individualArtistLabels = [$("#individual-artist-label-1"), $("#individual-artist-label-2"), $("#individual-artist-label-3"), $("#individual-artist-label-4")];
$individualDescriptionLabels = [$("#individual-description-label-1"), $("#individual-description-label-2"), $("#individual-description-label-3"), $("#individual-description-label-4")];
$individualBadges = [$("#individual-badge-1"), $("#individual-badge-2"), $("#individual-badge-3"), $("#individual-badge-4")];
$individualLayers = [$("#individual-layer-1"), $("#individual-layer-2"), $("#individual-layer-3"), $("#individual-layer-4")];
$individualImages = [$("#individual-image-1"), $("#individual-image-2"), $("#individual-image-3"), $("#individual-image-4")];
$individualButtons = [$("#individual-button-1"), $("#individual-button-2"), $("#individual-button-3"), $("#individual-button-4")];
$individualPageIndicator = $("#individual-page-indicator");
$individualMaxPageIndicator = $("#individual-max-page-indicator");
/* group select screen */
$groupSelectTable = $("#group-select-table");
$groupNameLabels = [$("#group-name-label-1"), $("#group-name-label-2"), $("#group-name-label-3"), $("#group-name-label-4")];
$groupPrefersLabels = [$("#group-prefers-label-1"), $("#group-prefers-label-2"), $("#group-prefers-label-3"), $("#group-prefers-label-4")];
$groupSexLabels = [$("#group-sex-label-1"), $("#group-sex-label-2"), $("#group-sex-label-3"), $("#group-sex-label-4")];
$groupHeightLabels = [$("#group-height-label-1"), $("#group-height-label-2"), $("#group-height-label-3"), $("#group-height-label-4")];
$groupSourceLabels = [$("#group-source-label-1"), $("#group-source-label-2"), $("#group-source-label-3"), $("#group-source-label-4")];
$groupWriterLabels = [$("#group-writer-label-1"), $("#group-writer-label-2"), $("#group-writer-label-3"), $("#group-writer-label-4")];
$groupArtistLabels = [$("#group-artist-label-1"), $("#group-artist-label-2"), $("#group-artist-label-3"), $("#group-artist-label-4")];
$groupDescriptionLabels = [$("#group-description-label-1"), $("#group-description-label-2"), $("#group-description-label-3"), $("#group-description-label-4")];
$groupBadges = [$("#group-badge-1"), $("#group-badge-2"), $("#group-badge-3"), $("#group-badge-4")];
$groupLayers = [$("#group-layer-1"), $("#group-layer-2"), $("#group-layer-3"), $("#group-layer-4")];
$groupImages = [$("#group-image-1"), $("#group-image-2"), $("#group-image-3"), $("#group-image-4")];
$groupNameLabel = $("#group-name-label");
$groupButton = $("#group-button");
$groupPageIndicator = $("#group-page-indicator");
$groupMaxPageIndicator = $("#group-max-page-indicator");
$searchName = $("#search-name");
$searchSource = $("#search-source");
$searchTag = $("#search-tag");
$searchGenderOptions = [$("#search-gender-1"), $("#search-gender-2"), $("#search-gender-3")];
$sortingOptionsItems = $(".sort-dropdown-options li");
/**********************************************************************
***** Select Screen Variables *****
**********************************************************************/
/* hidden variables */
var mainSelectHidden = false;
var singleSelectHidden = false;
var groupSelectHidden = false;
/* opponent listing file */
var listingFile = "opponents/listing.xml";
var metaFile = "meta.xml";
/* opponent information storage */
var loadedOpponents = [];
var selectableOpponents = [];
var hiddenOpponents = [];
var loadedGroups = [];
/* page variables */
var individualPage = 0;
var groupPage = 0;
var chosenGender = -1;
var sortingMode = "Featured";
var sortingOptionsMap = {
"Newest" : sortOpponentsByMultipleFields("-release"),
"Oldest" : sortOpponentsByMultipleFields("release"),
"Most Layers" : sortOpponentsByMultipleFields("-layers"),
"Fewest Layers" : sortOpponentsByMultipleFields("layers"),
};
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/* consistence variables */
var selectedSlot = 0;
var individualSlot = 0;
var shownIndividuals = [null, null, null, null];
var shownGroup = [null, null, null, null];
var randomLock = false;
/**********************************************************************
***** Start Up Functions *****
**********************************************************************/
/************************************************************
* Loads all of the content required to display the title
* screen.
************************************************************/
function loadSelectScreen () {
loadListingFile();
updateSelectionVisuals();
}
/************************************************************
* Loads and parses the main opponent listing file.
************************************************************/
function loadListingFile () {
/* clear the previous meta information */
loadedOpponents = [];
loadedGroups = [];
/* grab and parse the opponent listing file */
$.ajax({
type: "GET",
url: listingFile,
dataType: "text",
/* start by parsing and loading the individual listings */
var oppDefaultIndex = 0; // keep track of an opponent's default placement
$individualListings = $(xml).find('individuals');
$individualListings.find('opponent').each(function () {
var folder = $(this).text();
console.log("Reading \""+folder+"\" from listing file");
loadOpponentMeta(OPP + folder, oppDefaultIndex);
Loading
Loading full blame...