-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1439884
commit c52ec15
Showing
8 changed files
with
255 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
UI Enhancement | ||
====== | ||
|
||
Mod for Planetary Annihilation to enhance the UI. Currently it does the following: | ||
* Auto-expand [SINGLE PLAYER] and [MULTIPLAYER] buttons in the main menu. | ||
* Show rank in main menu after badge. | ||
* Focus the cursor on the password field in the main menu. | ||
* Remember filter settings in the server browser. | ||
* Adds Titan filter if you enable PA: Titans. | ||
* Increase the time-out in the loading of replays from 10 seconds to 1 minute to fix unloadable replays. | ||
* Focus the cursor on the lobby ID field in the replay browser. | ||
* Allow for >Enter< after manually entering a lobby ID to load it. | ||
* After playing a ranked match show your new rank in the game over screen. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"author": "DeathByDenim", | ||
"build": "94684", | ||
"category": [ | ||
"ui" | ||
], | ||
"context": "client", | ||
"date": "2017/05/24", | ||
"description": "Enhances the user interface with little tweaks.", | ||
"description_nl": "Verbetert de UI met kleine aanpassingen.", | ||
"description_de": "Verbessert kleine Sachen in der UI.", | ||
"description_fr": "Petites améliorations pour l'interface utilisateur", | ||
"display_name": "UI Enhancements", | ||
"display_name_de": "UI Verbesserungen", | ||
"display_name_nl": "UI verbeteringen", | ||
"display_name_fr": "Améliorations pour l'IU", | ||
"enabled": true, | ||
"forum": "https://forums.uberent.com/threads/rel-ui-enhancements-76766.67546/", | ||
"icon": "https://raw.githubusercontent.com/DeathByDenim/uienhancements/master/ui_enhancements.png", | ||
"id": "com.pa.DeathByDenim.ui_enhancements", | ||
"identifier": "com.pa.DeathByDenim.ui_enhancements", | ||
"priority": 100, | ||
"scenes": { | ||
"start": [ | ||
"coui://ui/mods/com.pa.DeathByDenim.ui_enhancements/start.js" | ||
], | ||
"replay_browser": [ | ||
"coui://ui/mods/com.pa.DeathByDenim.ui_enhancements/replay_browser.js" | ||
], | ||
"server_browser": [ | ||
"coui://ui/mods/com.pa.DeathByDenim.ui_enhancements/server_browser.js" | ||
], | ||
"game_over": [ | ||
"coui://ui/mods/com.pa.DeathByDenim.ui_enhancements/game_over.js" | ||
], | ||
"replay_loading": [ | ||
"coui://ui/mods/com.pa.DeathByDenim.ui_enhancements/replay_loading.js" | ||
] | ||
}, | ||
"signature": "not yet implemented", | ||
"version": "1.2", | ||
"content_id": "com.pa.DeathByDenim.ui_enhancements", | ||
"store_id": "com.pahub.content.plugin.store.mod.client" | ||
} |
27 changes: 27 additions & 0 deletions
27
uienhancements-1.1/ui/mods/com.pa.DeathByDenim.ui_enhancements/game_over.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(function() { | ||
|
||
// Show your new rank in the game over screen. | ||
model.uienhancements_leaderBoardPosition = ko.observable(' (#??)'); | ||
model.getLeaderBoardPosition = function () { | ||
model.uienhancements_leaderBoardPosition(' (#??)'); | ||
|
||
engine.asyncCall('ubernet.getPlayerRating', MatchmakingUtility.getMatchmakingType()).done(function (data) { | ||
data = JSON.parse(data) | ||
if(data.LeaderboardPosition <= 0) | ||
model.uienhancements_leaderBoardPosition(''); | ||
else | ||
model.uienhancements_leaderBoardPosition(' (#' + data.LeaderboardPosition + ')'); | ||
}); | ||
}; | ||
|
||
var old_handlers_rating_updated = handlers.rating_updated; | ||
handlers.rating_updated = function(payload) { | ||
model.getLeaderBoardPosition(); | ||
old_handlers_rating_updated(payload); | ||
} | ||
|
||
model.leagueText = ko.computed(function () { | ||
return MatchmakingUtility.getTitle(model.league()) + model.uienhancements_leaderBoardPosition(); | ||
}); | ||
|
||
})(); |
20 changes: 20 additions & 0 deletions
20
uienhancements-1.1/ui/mods/com.pa.DeathByDenim.ui_enhancements/replay_browser.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
(function() { | ||
|
||
// Allows <Enter> after entering replay id to view replay. | ||
model.uienhancement_findenter = function(data, event) { | ||
if(event.keyCode === 13) { | ||
model.viewSelectedReplay(); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
var olddatabind = $('#search-filter').attr('data-bind'); | ||
$('#search-filter').attr('data-bind', olddatabind + ', event: { keypress: uienhancement_findenter }'); | ||
|
||
|
||
// Focus cursor on text field. | ||
setTimeout(function() {$('#search-filter')[0].focus();}, 1000); | ||
|
||
|
||
})(); |
5 changes: 5 additions & 0 deletions
5
uienhancements-1.1/ui/mods/com.pa.DeathByDenim.ui_enhancements/replay_loading.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(function() { | ||
|
||
self.heartbeatInterval = setInterval(self.heartbeat, 60000); | ||
|
||
})(); |
89 changes: 89 additions & 0 deletions
89
uienhancements-1.1/ui/mods/com.pa.DeathByDenim.ui_enhancements/server_browser.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
(function() { | ||
|
||
if(api.content.usingTitans()) | ||
{ | ||
// Add Product filter | ||
model.productFilter = ko.observable('any'); | ||
$('.section_controls').append( | ||
' <div class="form-group">\n' + | ||
' <label for="product">\n' + | ||
' <loc>Product</loc>\n' + | ||
' </label>\n' + | ||
' <select class="selectpicker form-control" id="Select2" name="product" data-bind="selectPicker: productFilter">\n' + | ||
'\n' + | ||
' <option value="any">Any</option>\n' + | ||
'\n' + | ||
' <option value="classic">Classic</option>\n' + | ||
'\n' + | ||
' <option value="titans">Titans</option>\n' + | ||
' </select>\n' + | ||
' </div>\n' | ||
); | ||
|
||
// Insert the new filter in the filtering algorithm. The only way | ||
// this can be done without completely rewriting the filter | ||
// function, is to just filter the source. | ||
model.allGames = ko.computed(function () { | ||
var gamelist = model.gameList().concat(model.lanGameList(),model.customGameList()); | ||
if(model.productFilter() === 'classic') | ||
{ | ||
_.remove(gamelist, function (game) { | ||
return game.titans; | ||
}); | ||
} | ||
else if(model.productFilter() === 'titans') | ||
{ | ||
_.remove(gamelist, function (game) { | ||
return !game.titans; | ||
}); | ||
} | ||
|
||
return gamelist; | ||
}); | ||
} | ||
|
||
|
||
// Restore filter settings. | ||
if(!_.isUndefined(localStorage.uienhancements_serverbrowsersettings)) | ||
{ | ||
var filtersettings = decode(localStorage.uienhancements_serverbrowsersettings); | ||
console.log(filtersettings); | ||
model.gameStateFilter(filtersettings['gameStateFilter']); | ||
model.gameStatusFilter(filtersettings['gameStatusFilter']); | ||
model.gameModeFilter(filtersettings['gameModeFilter']); | ||
|
||
model.planetCountMinFilter(filtersettings['planetCountMinFilter']); | ||
model.planetCountMaxFilter(filtersettings['planetCountMaxFilter']); | ||
model.playerCountMinFilter(filtersettings['playerCountMinFilter']); | ||
model.playerCountMaxFilter(filtersettings['playerCountMaxFilter']); | ||
model.regionFilter(filtersettings['regionFilter']); | ||
model.gameTagFilter(filtersettings['gameTagFilter']); | ||
model.lockedFilter(filtersettings['lockedFilter']); | ||
if(api.content.usingTitans()) | ||
model.productFilter(filtersettings['product']); | ||
} | ||
|
||
|
||
// Remember filter settings. | ||
$(window).unload(function() { | ||
console.log("Saving settings"); | ||
var filtersettings = { | ||
'gameStateFilter': model.gameStateFilter(), | ||
'gameStatusFilter': model.gameStatusFilter(), | ||
'gameModeFilter': model.gameModeFilter(), | ||
|
||
'planetCountMinFilter': model.planetCountMinFilter(), | ||
'planetCountMaxFilter': model.planetCountMaxFilter(), | ||
'playerCountMinFilter': model.playerCountMinFilter(), | ||
'playerCountMaxFilter': model.playerCountMaxFilter(), | ||
'regionFilter': model.regionFilter(), | ||
'gameTagFilter': model.gameTagFilter(), | ||
'lockedFilter': model.lockedFilter() | ||
}; | ||
if(api.content.usingTitans()) | ||
filtersettings['product'] = model.productFilter(); | ||
|
||
localStorage.uienhancements_serverbrowsersettings = encode(filtersettings); | ||
}); | ||
|
||
})(); |
57 changes: 57 additions & 0 deletions
57
uienhancements-1.1/ui/mods/com.pa.DeathByDenim.ui_enhancements/start.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
(function() { | ||
|
||
// Automatically open single and multiplayer menu on mouse over | ||
model.enableSinglePlayerMenu = function () { | ||
if (!model.allowNewOrJoinGame()) | ||
return; | ||
model.showSinglePlayerMenu(true); | ||
model.showMultiplayerMenu(false); | ||
}; | ||
model.enableMultiplayerMenu = function () { | ||
if (!model.allowNewOrJoinGame()) | ||
return; | ||
model.showMultiplayerMenu(true); | ||
model.showSinglePlayerMenu(false); | ||
}; | ||
model.disableSubmenus = function () { | ||
model.showMultiplayerMenu(false); | ||
model.showSinglePlayerMenu(false); | ||
}; | ||
|
||
$('.nav_item').each( | ||
function(arg) { | ||
var olddatabind = $(this).attr('data-bind'); | ||
|
||
var newdatabind = olddatabind.replace('click: toggleSinglePlayerMenu', 'event: { mouseover: enableSinglePlayerMenu }'); | ||
if(newdatabind === olddatabind) { | ||
newdatabind = olddatabind.replace('click: toggleMultiplayerMenu', 'event: { mouseover: enableMultiplayerMenu }'); | ||
if(newdatabind === olddatabind) { | ||
if($(this).parent().hasClass('nav_sub_item')) | ||
return; | ||
|
||
newdatabind = 'event: { mouseover: disableSubmenus }, ' + newdatabind; | ||
|
||
} | ||
} | ||
|
||
$(this).attr('data-bind', newdatabind) | ||
} | ||
); | ||
|
||
|
||
// Show current rank after badge. | ||
model.uienhancements_currentrank = ko.computed(function() { | ||
if(model.playerRatingInfo().LeaderboardPosition <= 0) | ||
return ''; | ||
else | ||
return '#' + model.playerRatingInfo().LeaderboardPosition; | ||
}); | ||
|
||
$('#ladder_badge').append('<div style="position: relative; width: 0; height: 0"><span data-bind="text: uienhancements_currentrank" style="position: absolute; top: .2em; left: 0em;"></span></div>') | ||
|
||
|
||
// Focus cursor on password field. | ||
setTimeout(function() {$('input.input_text')[1].focus();}, 1000); | ||
|
||
|
||
})(); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.