refactor words and language
parent
da3879474d
commit
459c3f1783
@ -1,14 +1,15 @@
|
|||||||
MAJOR SHTUFF
|
MAJOR SHTUFF
|
||||||
|
|
||||||
1. Sandbox with all parameters exposed // exposed... but time to make the UI!
|
1. Create Sandbox
|
||||||
2. Repeated game with all parameters exposed
|
2. Re-create Repeated Game w/ params exposed
|
||||||
3. Splash, with params for cool outro
|
3. Re-create Splash, with cool outro
|
||||||
4. Integrate *everything*. // slides, outro
|
4. Integrate & Write EVERYTHING
|
||||||
5. Credits and rewards
|
5. Final round of playtesting
|
||||||
|
6. Credits, Footnotes, Rewards
|
||||||
|
7. Polish the whole dang thing
|
||||||
|
|
||||||
MINOR SHTUFF
|
MINOR SHTUFF
|
||||||
|
|
||||||
- Word box class less annoying
|
- Word box class less annoying
|
||||||
- Refactoring, ugh
|
- Refactoring, ugh
|
||||||
- Logic: Prober, Pavlov, TF2T, Random? // done
|
- Draw: Pavlov, TF2T, Random
|
||||||
- Slides in different files
|
|
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
@ -0,0 +1,42 @@
|
|||||||
|
function TextBox(config){
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
self.id = config.id;
|
||||||
|
|
||||||
|
// Create DOM
|
||||||
|
self.dom = document.createElement("div");
|
||||||
|
self.dom.className = "object";
|
||||||
|
self.dom.classList.add("fader");
|
||||||
|
self.dom.classList.add("textbox");
|
||||||
|
|
||||||
|
// All the text boxes, yo
|
||||||
|
self.boxes = config.boxes;
|
||||||
|
|
||||||
|
// Create each textbox...
|
||||||
|
for(var i=0; i<self.boxes.length; i++){
|
||||||
|
|
||||||
|
// DOM
|
||||||
|
var textbox = document.createElement("div");
|
||||||
|
self.dom.appendChild(textbox);
|
||||||
|
|
||||||
|
// Customize
|
||||||
|
var box = self.boxes[i];
|
||||||
|
textbox.style.left = box.x+"px";
|
||||||
|
textbox.style.top = box.y+"px";
|
||||||
|
textbox.style.width = box.width+"px";
|
||||||
|
textbox.style.height = box.height+"px";
|
||||||
|
textbox.innerHTML = Words.get(box.text_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add...
|
||||||
|
self.add = function(INSTANT){
|
||||||
|
return _addFade(self, INSTANT);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Remove...
|
||||||
|
self.remove = function(INSTANT){
|
||||||
|
return _removeFade(self, INSTANT);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -1,30 +0,0 @@
|
|||||||
function WordBox(config){
|
|
||||||
|
|
||||||
var self = this;
|
|
||||||
self.id = config.id;
|
|
||||||
|
|
||||||
// Create DOM
|
|
||||||
var words = document.createElement("div");
|
|
||||||
words.className = "object";
|
|
||||||
words.classList.add("fader");
|
|
||||||
words.classList.add("wordbox");
|
|
||||||
self.dom = words;
|
|
||||||
|
|
||||||
// Customize DOM
|
|
||||||
words.style.left = config.x+"px";
|
|
||||||
words.style.top = config.y+"px";
|
|
||||||
words.style.width = config.width+"px";
|
|
||||||
words.style.height = config.height+"px";
|
|
||||||
words.innerHTML = config.text;
|
|
||||||
|
|
||||||
// Add...
|
|
||||||
self.add = function(INSTANT){
|
|
||||||
return _addFade(self, INSTANT);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Remove...
|
|
||||||
self.remove = function(INSTANT){
|
|
||||||
return _removeFade(self, INSTANT);
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,56 @@
|
|||||||
|
/**********************
|
||||||
|
|
||||||
|
Convert a word.html to a JSON containing innerHTMLs
|
||||||
|
|
||||||
|
**********************/
|
||||||
|
|
||||||
|
window.Words = {};
|
||||||
|
Words.text = null;
|
||||||
|
|
||||||
|
Words.get = function(id){
|
||||||
|
return Words.text[id];
|
||||||
|
};
|
||||||
|
|
||||||
|
Words.convert = function(filepath){
|
||||||
|
|
||||||
|
// Promise
|
||||||
|
var deferred = Q.defer();
|
||||||
|
|
||||||
|
// Get dat stuff
|
||||||
|
var request = pegasus(filepath);
|
||||||
|
request.then(
|
||||||
|
|
||||||
|
// success handler
|
||||||
|
function(data, xhr) {
|
||||||
|
|
||||||
|
// Convert HTML...
|
||||||
|
var words = document.createElement("div");
|
||||||
|
words.innerHTML = xhr.response;
|
||||||
|
var paragraphs = words.querySelectorAll("p");
|
||||||
|
|
||||||
|
// ...to a JSON
|
||||||
|
Words.text = {}; // new one!
|
||||||
|
for(var i=0;i<paragraphs.length;i++){
|
||||||
|
var p = paragraphs[i];
|
||||||
|
var id = p.id;
|
||||||
|
var html = p.innerHTML;
|
||||||
|
Words.text[id] = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fulfil promise!
|
||||||
|
deferred.resolve(Words.text);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// error handler (optional)
|
||||||
|
function(data, xhr) {
|
||||||
|
alert("AHHHHHHHHHHHH, PROBLEM LOADING WORDS");
|
||||||
|
console.error(data, xhr.status)
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
// Return Promise
|
||||||
|
return deferred.promise;
|
||||||
|
|
||||||
|
};
|
@ -0,0 +1,2 @@
|
|||||||
|
//0.3.5
|
||||||
|
function pegasus(a,b,c){return c=new XMLHttpRequest,c.open("GET",a),a=[],pegasus.timeout&&(c.timeout=pegasus.timeout),c.ontimeout=function(a){b=a},c.onreadystatechange=c.then=function(d,e,f,g){if(d&&d.call&&(a=[,d,e]),b&&a[2]&&a[2](b,c),4==c.readyState&&(f=a[0|c.status/200])){try{g=JSON.parse(c.responseText)}catch(a){g=null}f(g,c)}},c.send(),c}
|
@ -0,0 +1,39 @@
|
|||||||
|
SLIDES.push({
|
||||||
|
|
||||||
|
id: "sim",
|
||||||
|
add:[
|
||||||
|
|
||||||
|
// The tournament simulation
|
||||||
|
{id:"tournament", type:"Tournament", x:0, y:20},
|
||||||
|
|
||||||
|
// All the words!
|
||||||
|
{
|
||||||
|
id:"textbox", type:"TextBox",
|
||||||
|
boxes:[
|
||||||
|
{ x:500, y:0, width:460, height:50, text_id:"sandbox_1" },
|
||||||
|
{ x:500, y:370, width:460, height:200, text_id:"sandbox_2" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
{
|
||||||
|
id:"_b1", type:"Button", x:500, y:150, width:140,
|
||||||
|
text_id: "label_play_tournament",
|
||||||
|
message: "tournament/play"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"_b2", type:"Button", x:500, y:220, width:140,
|
||||||
|
text_id: "label_eliminate_bottom_5",
|
||||||
|
message: "tournament/eliminate",
|
||||||
|
active:false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"_b3", type:"Button", x:500, y:290, width:140,
|
||||||
|
text_id: "label_reproduce_top_5",
|
||||||
|
message: "tournament/reproduce",
|
||||||
|
active:false
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in New Issue