Permalink
Browse files

Flux now actually showing proper list items + FINALLY SCROLL

  • Loading branch information...
RedDuckss committed Nov 3, 2017
1 parent ad46e3c commit 6e77059a8fba2950fd1cd862d896e8860f7b22b8
Showing with 80 additions and 86 deletions.
  1. +1 −0 .gitignore
  2. +33 −13 app.js
  3. +1 −2 app/Flux/css/main.css
  4. +10 −22 app/Flux/index.html
  5. +31 −49 app/Flux/js/main.js
  6. +4 −0 build.js
View
@@ -3,5 +3,6 @@ builds
certs
cdecrypt
*.log
*.txt
test.js
logo.psd
View
46 app.js
@@ -414,6 +414,11 @@ ipcMain.on('load_cemu_folder', () => {
var cemu_path = pickEmuFolder(),
cemu_object = {name: 'Default'};
if (!cemu_path) {
ApplicationWindow.webContents.send('cemu_folder_loaded');
return;
}
cemu_path = cemu_path.replace(/\\/g, '/');
cemu_object.cemu_path = cemu_path;
@@ -431,6 +436,10 @@ ipcMain.on('skip_cemu_folder', () => {
ipcMain.on('load_games_folder', () => {
var game_path = pickGameFolder();
if (!game_path) {
ApplicationWindow.webContents.send('games_folder_loaded');
return;
}
ApplicationWindow.webContents.send('game_folder_loading');
if (!settings_storage.get('game_paths').value().contains(game_path)) {
@@ -575,13 +584,15 @@ ipcMain.on('play_rom', (event, data) => {
game_path = game.path + '/code/' + game.rom;
}
game_storage.get('games').find(game).set('last_started', Date.now()).write();
exec('"' + instance.cemu_path + '" -g ' + '"' + game_path + '"', (error, stdout, stderr) => {
if (error) {
console.error(error);
return;
}
game_storage.get('games').find(game).set('plays', game.plays+=1).write();
game_storage.get('games').find(game).set('last_stopped', Date.now()).write();
});
});
@@ -1139,11 +1150,17 @@ function sendScreens() {
function init() {
verifyGames(() => {
async.each(settings_storage.get('game_paths').value(), (game_path, callback) => {
let load_games_queue = async.queue((game_path, callback) => {
console.log({
level: 'info',
message: game_path
})
loadGames(game_path, () => {
callback();
});
}, (error) => {
});
load_games_queue.drain = () => {
var games = game_storage.get('games').value();
ApplicationWindow.webContents.send('games_folder_list', settings_storage.get('game_paths').value());
if (!games || games.length <= 0) {
@@ -1155,10 +1172,12 @@ function init() {
getSuggested(most_played, (error, suggested) => {
if (error) throw error;
ApplicationWindow.webContents.send('emulator_list', settings_storage.get('cemu_paths').value());
ApplicationWindow.webContents.send('init_complete', {library: games, most_played: most_played, suggested: suggested});
ApplicationWindow.webContents.send('init_complete', {library: fs.readJSONSync(path.join(DATA_ROOT, 'cache/json/games.json')).games, most_played: most_played, suggested: suggested});
});
}
})
}
load_games_queue.push(settings_storage.get('game_paths').value());
});
}
@@ -1215,15 +1234,14 @@ function loadGames(dir, master_callback) {
if (error) throw error;
async.each(files, (file, callback) => {
let exists = game_storage.get('games').find({ path: dir + '/' + file }).value();
if (exists) {
return callback();
}
if (isGame(dir + '/' + file)) {
async.waterfall([
function(cb) {
var test = game_storage.get('games').find({ path: dir + '/' + file }).value(),
is_wud = false;
if (test) {
return cb(true);
}
let is_wud = false
console.log({
level: 'info',
message: 'Found new game ' + file
@@ -1542,6 +1560,8 @@ function loadGames(dir, master_callback) {
var game_data = {
is_favorite: false,
plays: 0,
last_started: Date.now(),
last_stopped: Date.now(),
is_wud: is_wud,
title_id: data.game_title_id,
product_code: data.game_product_code,
@@ -1604,7 +1624,7 @@ function loadGames(dir, master_callback) {
if (event.removedFiles || event.removedFolders) {
checkInvalidGames();
}
})*/
});*/
});
});
}
@@ -1641,7 +1661,7 @@ function pickGameFolder() {
});
if (!gameFolder) {
return pickGameFolder();
return false;
}
return gameFolder[0];
}
@@ -1656,7 +1676,7 @@ function pickEmuFolder() {
});
if (!emuFolder) {
return pickEmuFolder();
return false;
}
return emuFolder[0];
}
View
@@ -127,12 +127,12 @@ body, html {
background-position: center;
background-size: cover;
box-shadow: 0px 0px 8px -3px rgba(0,0,0,0.55);
cursor: pointer;
transition: width .25s;
overflow: hidden;
background-image: url('http://cemui.com/api/v2/image/grid/00050000-1010ED00');
}
.item:hover {
cursor: pointer;
width: 400px;
}
.item div {
@@ -143,7 +143,6 @@ body, html {
bottom: -100%;
width: 100%;
transition: bottom .35s;
cursor: auto;
}
.item div p {
padding: .75em 1em;
View
@@ -19,31 +19,19 @@ <h2 class="txt-s-24 txt-pad-lr txt-up txt-c-black" style="display: inline-block;
</div>
</div>
<h2 class="txt-up txt-c-purple txt-s-24 txt-pad-lr">Recently played</h2>
<div class="square-cont" id="recent">
<div id="draggable">
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
</div>
</div>
<div class="square-cont" id="recent"></div>
<h2 class="txt-up txt-c-purple txt-s-24 txt-pad-lr">Library</h2>
<div class="square-cont" id="library">
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
<div class="item img-cap-white"><div><p>A random game <span>More</span></p></div></div>
</div>
<div class="square-cont" id="library"></div>
</div>
<template id="TEMPLATE_GAME_ITEM">
<div class="item img-cap-white">
<div>
<p>A random game <span>More</span></p>
</div>
</div>
</template>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="slick/slick.min.js"></script>
View
@@ -113,65 +113,47 @@ ipcRenderer.on('game_folder_loading', function(event, data) {
ipcRenderer.on('init_complete', function(event, data) {
console.log('init main.js flux');
ipcRenderer.send('theme_finished_loading');
//$('#library').slick();
ipcRenderer.send('theme_finished_loading');
setTimeout(function () {
var games = data.library;
games_lib.innerHTML = '';
for (var i=0,length = games.length ;i<length;i++) {
var game = games[i],
wrapper = document.createElement('div'),
box = document.createElement('div');
let game = games[i],
item = document.getElementById("TEMPLATE_GAME_ITEM").content.firstElementChild.cloneNode(true);
wrapper.setAttribute('data-modal-id', game.title_id);
wrapper.className = 'grid-item';
preload(game.grid);
item.style.backgroundImage = 'url("' + game.grid + '")';
item.querySelector('p').innerHTML = game.name + ' <span>' + game.region + '</span>';
addEvent(item, 'click', () => {
// modal shit here
alert('Open modal');
});
preload(game.boxart);
box.style.backgroundImage = 'url("' + game.grid + '")';
box.classList = 'game';
box.onclick = function() {
clicks++;
if (clicks === 1) {
clicktimer = setTimeout(function() {
clicks = 0;
closeExpandModal(document.getElementById(this.parentElement.getAttribute('data-modal-id')).children[0].children[1]);
openModal(this.parentElement.getAttribute('data-modal-id'));
}.bind(this), 400);
} else if (clicks === 2) {
clearTimeout(clicktimer);
clicks = 0;
ipcRenderer.send('play_rom', this.parentElement.getAttribute('data-modal-id'));
}
}
games_lib.appendChild(item);
}
wrapper.appendChild(box);
let recent_sorted = games.sort((a, b) => {
return b.last_stopped - a.last_stopped;
});
//games_lib.appendChild(wrapper);
}
recents_lib.innerHTML = '';
for (var i=0,length = recent_sorted.length ;i<length;i++) {
let game = recent_sorted[i],
item = document.getElementById("TEMPLATE_GAME_ITEM").content.firstElementChild.cloneNode(true);
//addToGrid(data.suggested,'suggest_grid');
//addToGrid(data.most_played,'most_grid');
preload(game.grid);
item.style.backgroundImage = 'url("' + game.grid + '")';
item.querySelector('p').innerHTML = game.name + ' <span>' + game.region + '</span>';
var count = games.length;
count = 16 - count;
for (var i=0;i<count;i++) {
var item = document.createElement('div');
item.classList = "grid-item filler-grid-item";
item.innerHTML = "<div class='game'></div>"
games_lib.appendChild(item);
}
/*
document.getElementById('main').style.display = 'grid';
openModal('modal1');
setTimeout(function () {
closeModal();
},1000);
*/
// This was 2000, but the timeout above was removed so i added the 1000 here
addEvent(item, 'click', () => {
// modal shit here
alert('Open modal');
});
//createCemuDropdowns();
},0);
recents_lib.appendChild(item);
}
}, 0);
});
ipcRenderer.send('init');
View
@@ -29,6 +29,10 @@ builder.build({
"!build.js",
"!smm.js",
"!test.js",
"!cemui.info.log",
"!cemui.error.log",
"!cemui.log",
"!log.txt",
],
}
}).then(() => {

0 comments on commit 6e77059

Please sign in to comment.