diff --git a/src/app/assets/custom.css b/src/app/assets/custom.css index 5de92a57..72208721 100644 --- a/src/app/assets/custom.css +++ b/src/app/assets/custom.css @@ -2,6 +2,7 @@ html, body { overflow:hidden; background-color: #424242; + font-size: 14px !important; } #app { @@ -9,7 +10,7 @@ color: white; opacity: 0; } - + #app.show { opacity:1; } @@ -18,23 +19,17 @@ color: black; } - * { + * {# -webkit-user-select: none; /* Chrome all / Safari all */ user-select: none; } - .md-input-focused > .filterlabel { - opacity: 0; - } - - i.controlbtn { - + .filtericon { + color: #677e89; + font-size: 25px !important; } - - .slimscroll-l { - height: 570px; - } - + + .customAboutContainer img { border-radius: 100%; width: 120px; @@ -97,14 +92,9 @@ .btn-sort:hover { background-color: rgba(158, 158, 158, 0.4); } - - md-bottom-sheet { - color: black; - } - + md-bottom-sheet .md-subheader .md-subheader-inner { - padding: 0 !important; - color: black; + padding: 0 !important; } .gameholder { @@ -173,12 +163,17 @@ } md-bottom-sheet.md-grid md-list-item .md-grid-item-content { - width: 70px !important; + width: 70px !important; } + md-bottom-sheet.md-grid md-list-item { + padding: 5px; + } + .md-tab { max-width: 100% !important; } + md-bottom-sheet md-list-item:hover { background-color: transparent; } @@ -213,7 +208,6 @@ transform: scale(0); opacity:0; } - .repeat-animation.ng-enter, .repeat-animation.ng-leave, diff --git a/src/app/controllers/appController.js b/src/app/controllers/appController.js index e19d25ba..cef6db49 100644 --- a/src/app/controllers/appController.js +++ b/src/app/controllers/appController.js @@ -2,6 +2,13 @@ app.controller('appController', ['$scope', '$mdDialog', '$mdToast', '$mdBottomSheet', '$mdSidenav', 'modlistService', '$http', 'iwadService', 'nwService', appController]); function appController($scope, $mdDialog, $mdToast, $mdBottomSheet, $mdSidenav, modlistService, $http, iwadService, nwService) { + var $PARENT = $scope; + var TOASTDELAY = 1500; + + $mdToast.show( + $mdToast.simple() + .content('Checking for Updates...').position('bottom').hideDelay(TOASTDELAY) + ); $http.get('https://raw.githubusercontent.com/FreaKzero/ssgl-doom-launcher/master/package.json'). then(function(response) { @@ -12,7 +19,7 @@ $scope.downloadversion = response.data.version; $scope.download = function(url) { - var release = 'https://github.com/FreaKzero/ssgl-doom-launcher/releases/tag/v'+response.data.version; + var release = 'https://github.com/FreaKzero/ssgl-doom-launcher/releases/tag/v' + response.data.version; nwService.getShell().openExternal(release); }; @@ -31,10 +38,6 @@ console.log('ERROR: ' + response); }); - - var $PARENT = $scope; - var TOASTDELAY = 1500; - if ($scope.config.freshinstall === true) { SettingsDialog(null); } @@ -76,7 +79,6 @@ }); function AboutDialogController($scope, $mdBottomSheet) { - console.log($PARENT.APPVERSION) $scope.version = $PARENT.APPVERSION; $scope.openURL = function(url) { nwService.getShell().openExternal(url); @@ -97,6 +99,8 @@ }); function GameSelectionController($scope, $mdBottomSheet, iwadService) { + $scope.useoblige = false; + iwadService.getIWADS($PARENT.config.iwadpath).then(function(iwads) { $scope.iwads = iwads; }); @@ -111,11 +115,14 @@ $scope.engine = 'gzDoom'; } - $scope.startGame = function($index, engine) { - var iwad = $scope.iwads[$index].file; - - $PARENT.$broadcast('STARTGZDOOM', iwad, false, engine); - $mdBottomSheet.hide(); + $scope.startGame = function($index, engine, $event) { + if ($scope.useoblige === false) { + var iwad = $scope.iwads[$index].file; + $PARENT.$broadcast('STARTGZDOOM', iwad, false, engine); + $mdBottomSheet.hide(); + } else { + $scope.startGameOblige($event, $index, engine); + } }; $scope.startGameOblige = function(ev, $index, engine) { @@ -152,7 +159,7 @@ }; $scope.continue = function() { - $PARENT.$broadcast('STARTGZDOOM', iwad, $PARENT.config.oblige.mappath, engine); + $PARENT.$broadcast('STARTGZDOOM', iwad, $PARENT.config.oblige.mappath, engine, $mdDialog); }; $scope.cancel = function() { diff --git a/src/app/controllers/modController.js b/src/app/controllers/modController.js index d3367313..65b3ef5b 100644 --- a/src/app/controllers/modController.js +++ b/src/app/controllers/modController.js @@ -1,9 +1,9 @@ (function() { var execFile = require('child_process').execFile; - app.controller('modController', ['$scope', 'modService', 'modlistService', '$mdDialog', 'nwService','modselectedService', modController]); + app.controller('modController', ['$scope', 'modService', 'modlistService', '$mdDialog', 'nwService','modselectedService', '$mdToast', modController]); - function modController($scope, modService, modlistService, $mdDialog, nwService, modselectedService) { + function modController($scope, modService, modlistService, $mdDialog, nwService, modselectedService, $mdToast) { var self = this; var $parent = $scope; @@ -79,7 +79,20 @@ $scope.checkdoubles = function() {}; $scope.submitForm = function() { - modlistService.saveSelected($scope.listname, $parent.selected); + modlistService.saveSelected($scope.listname, $parent.selected).then(function(listname) { + $mdToast.show( + $mdToast.simple() + .content('Saved List to '+listname).position('bottom').hideDelay(1500) + ); + }, function(error) { + $mdToast.show( + $mdToast.simple() + .content(error.message).position('bottom').hideDelay(1500) + ); + }); + + + $parent.usedList = $scope.listname; $mdDialog.cancel(); }; @@ -110,7 +123,7 @@ }); } }; - + $scope.$on('STARTOBLIGE', function(ev, iwad, config, engine, log) { $mdDialog.show({ templateUrl: 'app/templates/ObligeLoading.html', @@ -145,11 +158,15 @@ }); }); - $scope.$on('STARTGZDOOM', function(ev, iwad, map, engine) { + $scope.$on('STARTGZDOOM', function(ev, iwad, map, engine, dialog) { if (typeof map === 'undefined') { map = false; } + if (typeof dialog === 'undefined') { + dialog = false; + } + var child; var SAVEDIR; var useEngine = ""; @@ -175,6 +192,17 @@ SAVEDIR = $scope.config.savepaths.zandronum + 'default'; } break; + + case "zdoom": + useEngine = $scope.config.engines.zdoom; + + if ($scope.usedList !== false) { + SAVEDIR = $scope.config.savepaths.zdoom + $scope.usedList; + } else { + SAVEDIR = $scope.config.savepaths.zdoom + 'default'; + } + + break; } var params = ['-iwad', $scope.config.iwadpath + iwad, '-savedir', SAVEDIR]; @@ -186,9 +214,13 @@ wads.push(map); } + if (dialog !== false) { + dialog.hide(); + } + params = params.concat(['-file'], wads); - console.log(params); child = execFile(useEngine, params, + function(error, stdout, stderr) { if (error) { console.log(error.stack); diff --git a/src/app/controllers/modlistController.js b/src/app/controllers/modlistController.js index d8909088..dd145701 100644 --- a/src/app/controllers/modlistController.js +++ b/src/app/controllers/modlistController.js @@ -1,7 +1,7 @@ (function() { - app.controller('modlistController', ['$scope', 'modlistService', '$rootScope', '$mdDialog', modlistController]); + app.controller('modlistController', ['$scope', 'modlistService', '$rootScope', '$mdDialog', '$mdToast', modlistController]); - function modlistController($scope, modlistService, $rootScope, $mdDialog) { + function modlistController($scope, modlistService, $rootScope, $mdDialog, $mdToast) { modlistService.getLists().then(function(list) { $scope.modlist = list; @@ -37,11 +37,21 @@ }; $scope.submitForm = function(valid) { - - if (valid && $scope.double.length === 0) { item.name = $scope.listname; - modlistService.rename(item); + + modlistService.rename(item).then(function(renamed) { + $mdToast.show( + $mdToast.simple() + .content('List renamed to ' + renamed).position('bottom').hideDelay(1500) + ); + }, function(error) { + $mdToast.show( + $mdToast.simple() + .content(error.message).position('bottom').hideDelay(1500) + ); + }); + $mdDialog.cancel(); } }; @@ -61,7 +71,19 @@ .targetEvent(ev); $mdDialog.show(confirm).then(function() { - modlistService.remove($scope.modlist[$index]); + + modlistService.remove($scope.modlist[$index]).then(function(listname) { + $mdToast.show( + $mdToast.simple() + .content('List ' + listname + ' removed').position('bottom').hideDelay(1500) + ); + }, function(error) { + $mdToast.show( + $mdToast.simple() + .content(error.message).position('bottom').hideDelay(1500) + ); + }); + $scope.modlist.splice($index, 1); }, function() { $mdDialog.cancel(); diff --git a/src/app/directives/directory-chooser.js b/src/app/directives/directory-chooser.js index 37428c04..74c78b46 100644 --- a/src/app/directives/directory-chooser.js +++ b/src/app/directives/directory-chooser.js @@ -1,5 +1,5 @@ (function() { - app.directive('dirChoose', function() { + app.directive('dirChoose', ['nwService', function(nwService) { return { restrict: 'AE', replace: 'true', @@ -13,7 +13,12 @@ template: '
', link: function($scope, elem, att, ngModel) { - $scope.wdir = $scope.ngModel; + if (typeof $scope.ngModel !== 'undefined' && $scope.ngModel !== '') { + $scope.wdir = $scope.ngModel; + } else { + $scope.wdir = nwService.execpath; + } + $scope.label = att.label; var z = elem[0].querySelector('.fileDialog'); @@ -27,7 +32,6 @@ $scope.$apply(function() { $scope.ngModel = newPath; }); - } }, false); @@ -37,5 +41,5 @@ }; } }; - }); + }]); })(); diff --git a/src/app/directives/file-chooser.js b/src/app/directives/file-chooser.js index ee30281d..7af4bda3 100644 --- a/src/app/directives/file-chooser.js +++ b/src/app/directives/file-chooser.js @@ -1,5 +1,5 @@ (function() { - app.directive('fileChoose', function() { + app.directive('fileChoose', ['nwService', function(nwService) { return { restrict: 'AE', replace: 'true', @@ -17,7 +17,7 @@ if (typeof $scope.ngModel !== 'undefined' && $scope.ngModel !== '') { $scope.wdir = $scope.ngModel.substring(0, $scope.ngModel.lastIndexOf('\\')); } else { - $scope.wdir = ''; + $scope.wdir = nwService.execpath; } $scope.label = att.label; @@ -44,5 +44,5 @@ }; } }; - }); + }]); })(); \ No newline at end of file diff --git a/src/app/main.js b/src/app/main.js index ebf625e3..215e0e33 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -1,6 +1,17 @@ -var app = angular.module('ssgl', ['ngMaterial']); +var app = angular.module('ssgl', ['ngMaterial', 'ui.router']); (function() { + + app.config(function($stateProvider, $urlRouterProvider) { + + $urlRouterProvider.otherwise('home'); + + $stateProvider.state('home', { + url: '/', + templateUrl: 'app/templates/MainMods.html' + }); + }); + app.config(function($mdThemingProvider) { $mdThemingProvider.theme('default') .primaryPalette('blue-grey', { @@ -22,11 +33,13 @@ var app = angular.module('ssgl', ['ngMaterial']); $rootScope.config = { engines: { + zdoom: "", gzdoom: "", zandronum: "", }, savepaths: { + zdoom: "", gzdoom: "", zandronum: "" }, @@ -41,7 +54,8 @@ var app = angular.module('ssgl', ['ngMaterial']); active: { gzdoom: false, zandronum: false, - oblige: false + oblige: false, + zdoom: false }, iwadpath: "", diff --git a/src/app/services/modlistService.js b/src/app/services/modlistService.js index 90986039..6fe529b9 100644 --- a/src/app/services/modlistService.js +++ b/src/app/services/modlistService.js @@ -6,22 +6,24 @@ var listDir = '\\lists\\'; service.rename = function(item) { + var oldPath = item.path; var newPath = nwService.getDirname(item.path) + '\\' + item.name + '.json'; - nwService.rename(item.path, newPath); + + item.path = nwService.getDirname(item.path) + '\\' + item.name + '.json'; + return nwService.rename(oldPath, newPath); }; service.remove = function(item) { - nwService.remove(item.path); + return nwService.remove(item.path); }; service.saveSelected = function(name, list) { - nwService.writeJSON(list, listDir + name + '.json', true); - - // todo: need ? setTimeout(function() { $rootScope.$broadcast('MODIFIEDLISTS'); }, 1500); + + return nwService.writeJSON(list, listDir + name + '.json', true); }; service.getLists = function() { @@ -32,7 +34,7 @@ return { name: item.replace(/^.*[\\\/]/, '').slice(0, -5), path: nwService.getAbsolute(listDir + item), - wads: nwService.readSyncJSON(listDir+item, true) + wads: nwService.readSyncJSON(listDir + item, true) }; }); diff --git a/src/app/services/nwService.js b/src/app/services/nwService.js index 9e0700f2..b6936620 100644 --- a/src/app/services/nwService.js +++ b/src/app/services/nwService.js @@ -2,9 +2,10 @@ var PATH = require('path'), FS = require('fs'), GUI = require('nw.gui'), - execFile = require('child_process').execFile; - recursive = require('recursive-readdir'); - + execFile = require('child_process').execFile, + recursive = require('recursive-readdir'), + request = require('request'); + app.factory('nwService', ['$q', nwService]); function nwService($q) { @@ -23,8 +24,21 @@ return path; } + service.requestDoomWorld = function(search) { + request({ + uri: 'http://www.doomworld.com/idgames/api/api.php?callback=&action=search&out=json&query='+search+'&sort=date&type=filename', + method: 'GET', + timeout: 10000, + followRedirect: true, + maxRedirects: 10 + }, function(error, response, body) { + console.log(body); + }); + + }; + service.recursiveDir = function(path, callback) { - var def = $q.defer(); + var def = $q.defer(); recursive(path, function(err, files) { if (err) { def.reject(err); @@ -49,13 +63,28 @@ }; service.rename = function(oldpath, newpath) { + var def = $q.defer(); FS.rename(oldpath, newpath, function(err) { - if (err) console.log('ERROR: ' + err); + if (err) { + def.reject(err); + } else { + def.resolve(newpath.replace(/^.*[\\\/]/, '')); + } }); + return def.promise; }; service.remove = function(path) { - FS.unlinkSync(path); + var def = $q.defer(); + + FS.unlink(path, function(err) { + if (err) { + def.reject(err); + } else { + def.resolve(path.replace(/^.*[\\\/]/, '')); + } + }); + return def.promise; }; service.getDir = function(path, relative) { @@ -120,7 +149,7 @@ }); return def.promise; - } + }; service.writeJSON = function(givenObject, path, relative) { var def = $q.defer(); @@ -130,7 +159,7 @@ if (err) { def.reject(err); } else { - def.resolve(); + def.resolve(path.replace(/^.*[\\\/]/, '')); } }); diff --git a/src/app/templates/GameSelection.html b/src/app/templates/GameSelection.html index 047d787d..9869f378 100644 --- a/src/app/templates/GameSelection.html +++ b/src/app/templates/GameSelection.html @@ -3,13 +3,21 @@ - + + + +
+ +

Build and Play (Oblige)

+
+
+
- +
@@ -18,19 +26,8 @@
{{iwad.name}}
- - - -
-
- -
- -
{{iwad.name}} (Oblige)
-
- - + +
+ - - \ No newline at end of file diff --git a/src/app/templates/MainMods.html b/src/app/templates/MainMods.html new file mode 100644 index 00000000..2ddabfde --- /dev/null +++ b/src/app/templates/MainMods.html @@ -0,0 +1,69 @@ +
+
+ + +
+ + + + + + +
+
+ + + + + + +
+

{{ mod.name }}

+

{{ mod.dir }}

+
+ +
+
+ +
+ + +

Sorry, No Mods Found

+
+ +
+
+
+ + +
+ +

{{usedList || 'Untitled'}}

+ + Save + + New +
+
+ + + + +
+

{{ mod.name }}

+

{{ mod.dir }}

+
+
+

+

+
+ +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/app/templates/SelectConfig.html b/src/app/templates/SelectConfig.html index 0ce2791e..21b22dfe 100644 --- a/src/app/templates/SelectConfig.html +++ b/src/app/templates/SelectConfig.html @@ -1,4 +1,4 @@ - +

Select Oblige Config

diff --git a/src/app/templates/Settings.html b/src/app/templates/Settings.html index cb20eef4..69e7d148 100644 --- a/src/app/templates/Settings.html +++ b/src/app/templates/Settings.html @@ -11,22 +11,31 @@

Settings

- -

Activate GZDoom

+ +

GZDoom

- -

Activate Zandronum

+ +

Zandronum

- -

Activate Oblige

-
+ +

zDoom

+
+ +
+ +

Oblige

+
+
+ + +
@@ -42,7 +51,12 @@

Settings

- + +
+ + +
+
diff --git a/src/index.html b/src/index.html index b848fc33..3a442961 100644 --- a/src/index.html +++ b/src/index.html @@ -74,81 +74,15 @@

Saved Lists

-
-
- - -
- - - - - - -
-
- - - - - - -
-

{{ mod.name }}

-

{{ mod.dir }}

-
- -
-
- -
- - -

Sorry, No Mods Found

-
- -
-
-
- - -
- -

{{usedList || 'Untitled'}}

- - Save - - New -
-
- - - - -
-

{{ mod.name }}

-

{{ mod.dir }}

-
-
-

-

-
- -
-
-
-
-
- - - - + +
+