Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Quitch committed Jul 24, 2022
2 parents e5f87c5 + b5bf4cb commit 9891ff2
Show file tree
Hide file tree
Showing 20 changed files with 240 additions and 126 deletions.
25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"parserOptions": {
"ecmaFeatures": {
"impliedStrict": true
}
},
"env": {
"browser": true,
"jquery": true,
"amd": true,
"es6": true // PA uses Chrome 40 which supports a subset of ES6
},
"extends": ["eslint:recommended", "plugin:lodash/v3", "prettier"],
"globals": {
"model": "readonly",
"ko": "readonly",
"loadHtml": "readonly"
},
"plugins": ["lodash"],
"rules": {
"lodash/prefer-lodash-method": 0,
"no-inner-declarations": 0,
"curly": [2, "all"]
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

.vscode/settings.json
Empty file added .prettierrc.json
Empty file.
6 changes: 6 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["stylelint-config-standard", "stylelint-config-prettier"],
"rules": {
"selector-class-pattern": "^([a-z][a-z0-9]*)((_|-)[a-z0-9]+)*$"
}
}
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# CHANGELOG

## v1.2.0 - 2022-07-24

- Expands the spectator panel by default

## v1.1 - 2019-01-12

- Added ALL2 tab with army metal count
- Set ALL tab to be the default
- Added ALL2 tab with army metal count
- Set ALL tab to be the default

## v1.0 - 2018-10-01

- Added ALL tab to spectator panel
- Added ALL tab to spectator panel
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# All-In-One Spectator Tab

![alt text](https://i.imgur.com/k5fM6FD.png "All In One Spectator Tab")
![An example of the mod in use](https://i.imgur.com/k5fM6FD.png "All In One Spectator Tab")

Adds a two tabs to the spectator player panel: ALL and ALL2.
Adds two tabs to the spectator player panel: ALL and ALL2.

ALL displays the following:

- Metal income
- Energy income
- Efficiency
- Army count
- Fabber count
- Factory count
- Metal income
- Energy income
- Efficiency
- Army count
- Fabber count
- Factory count

ALL2 displays army metal in place of army count. Army metal counts all units and structures owned by a player, not just offensive units.

Expand All @@ -31,12 +31,12 @@ Because I wanted to avoid having the ALL tab be any wider than the other tabs. I

**Why does your mod wrap the text when the numbers get big?**

I've tried to ensure this is very unlikely to happen, but because the columns are narrower it *could* happen. Things will get more cramped though. You can switch to the other tabs still if things get ugly.
I've tried to ensure this is very unlikely to happen, but because the columns are narrower it _could_ happen. Things will get more cramped though. You can switch to the other tabs still if things get ugly.

**Do you support translations?**

No. When you include translations in a Planetary Annihilation client mod, it breaks all other translations in the game. Until this is fixed this mod can't ship with translations.

## Thanks

- mikeyh, who once again covered for my total inability to inject Javascript and HTML
- mikeyh, who once again covered for my total inability to inject Javascript and HTML
10 changes: 5 additions & 5 deletions modinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
"display_name": "All-In-One Spectator Tab",
"description": "Adds a tab called ALL to the spectator panel, which contains both economy and army information.",
"author": "Quitch",
"version": "1.1",
"build": "112595",
"date": "2019/01/12",
"version": "1.2.0",
"build": "115872",
"date": "2022/07/24",
"signature": " ",
"forum": "https://steamcommunity.com/app/386070/discussions/0/1694914736008697542/",
"icon": "https://i.imgur.com/oF09PFr.jpg",
"category": ["ui", "classic", "titans"],
"priority": 100,
"scenes": {
"live_game_players": [
"coui://ui/mods/com.quitch.qallinonetab/live_game_players.css",
"coui://ui/mods/com.quitch.qallinonetab/live_game_players.js"
"coui://ui/mods/com.quitch.qallinonetab/all_tabs.css",
"coui://ui/mods/com.quitch.qallinonetab/all_tabs.js"
]
},
"github": "https://github.com/Quitch/All-In-One-Spectator-Tab"
Expand Down
3 changes: 3 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sonar.projectKey=Quitch_All-In-One-Spectator-Tab
sonar.organization=quitch
sonar.projectVersion=1.2.0
6 changes: 6 additions & 0 deletions ui/mods/com.quitch.qallinonetab/all2_buttons.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div
class="div_spectator_panel_button"
data-bind="click: function () { spectatorPanelMode('all2') }, css: { div_spectator_panel_button_active: showAllData2 } "
>
<loc>ALL2</loc>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
<th class="div_spectator_headers div_army_factory_value_header_quitch">
<loc>Fac</loc>
</th>
<!-- /ko -->
<!-- /ko -->
44 changes: 44 additions & 0 deletions ui/mods/com.quitch.qallinonetab/all2_values.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!-- ko if: $parent.showAllData2 -->
<td
class="div_metal_header_quitch div_spectator_player_info"
style="padding-top: 5px;"
>
<span
data-bind="text: metalProductionStr, css: $parent.metalTextColorCSS($index())"
></span>
</td>
<td
class="div_energy_header_quitch div_spectator_player_info"
style="padding-top: 5px;"
>
<span
data-bind="text: energyProductionStr, css: $parent.energyTextColorCSS($index())"
></span>
</td>
<td
class="div_build_efficiency_header_quitch div_spectator_player_info"
style="padding-top: 5px;"
>
<span
data-bind="text: buildEfficiencyStr, css: $parent.efficiencyTextColorCSS($index())"
></span>
</td>
<td
class="div_army_metal_value_header_quitch div_spectator_player_info"
style="padding-top: 5px;"
>
<span data-bind="text: armyMetal"></span>
</td>
<td
class="div_army_fabber_value_header_quitch div_spectator_player_info"
style="padding-top: 5px;"
>
<span data-bind="text: fabberCount"></span>
</td>
<td
class="div_army_factory_value_header_quitch div_spectator_player_info"
style="padding-top: 5px;"
>
<span data-bind="text: factoryCount"></span>
</td>
<!-- /ko -->
6 changes: 6 additions & 0 deletions ui/mods/com.quitch.qallinonetab/all_buttons.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div
class="div_spectator_panel_button"
data-bind="click: function () { spectatorPanelMode('all') }, css: { div_spectator_panel_button_active: showAllData } "
>
<loc>ALL</loc>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
<th class="div_spectator_headers div_army_factory_value_header_quitch">
<loc>Fac</loc>
</th>
<!-- /ko -->
<!-- /ko -->
34 changes: 34 additions & 0 deletions ui/mods/com.quitch.qallinonetab/all_tabs.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.div_metal_header_quitch {
min-width: 80px;
text-align: right;
}

.div_energy_header_quitch {
min-width: 105px;
text-align: right;
}

.div_build_efficiency_header_quitch {
min-width: 50px;
text-align: right;
}

.div_army_mobile_value_header_quitch {
min-width: 55px;
text-align: right;
}

.div_army_metal_value_header_quitch {
min-width: 55px;
text-align: right;
}

.div_army_fabber_value_header_quitch {
min-width: 35px;
text-align: right;
}

.div_army_factory_value_header_quitch {
min-width: 35px;
text-align: right;
}
46 changes: 46 additions & 0 deletions ui/mods/com.quitch.qallinonetab/all_tabs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
var allInOneSpectatorTabLoaded;

if (!allInOneSpectatorTabLoaded) {
allInOneSpectatorTabLoaded = true;

function allInOneSpectatorTab() {
try {
$("div.div_spectator_panel_buttons").append(
loadHtml("coui://ui/mods/com.quitch.qallinonetab/all_buttons.html")
);

$("table.tbl_spectator_stats tr:first").append(
loadHtml("coui://ui/mods/com.quitch.qallinonetab/all_headers.html")
);

$("table.tbl_spectator_stats tr:last").append(
loadHtml("coui://ui/mods/com.quitch.qallinonetab/all_values.html")
);
$("div.div_spectator_panel_buttons").append(
loadHtml("coui://ui/mods/com.quitch.qallinonetab/all2_buttons.html")
);

$("table.tbl_spectator_stats tr:first").append(
loadHtml("coui://ui/mods/com.quitch.qallinonetab/all2_headers.html")
);

$("table.tbl_spectator_stats tr:last").append(
loadHtml("coui://ui/mods/com.quitch.qallinonetab/all2_values.html")
);

model.showAllData = ko.computed(function () {
return model.spectatorPanelMode() === "all";
});
model.showAllData2 = ko.computed(function () {
return model.spectatorPanelMode() === "all2";
});

model.spectatorPanelMode("all");
model.pinSpectatorPanel(true);
} catch (e) {
console.error(e);
console.error(JSON.stringify(e));
}
}
allInOneSpectatorTab();
}
44 changes: 44 additions & 0 deletions ui/mods/com.quitch.qallinonetab/all_values.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!-- ko if: $parent.showAllData -->
<td
class="div_metal_header_quitch div_spectator_player_info"
style="padding-top: 5px;"
>
<span
data-bind="text: metalProductionStr, css: $parent.metalTextColorCSS($index())"
></span>
</td>
<td
class="div_energy_header_quitch div_spectator_player_info"
style="padding-top: 5px;"
>
<span
data-bind="text: energyProductionStr, css: $parent.energyTextColorCSS($index())"
></span>
</td>
<td
class="div_build_efficiency_header_quitch div_spectator_player_info"
style="padding-top: 5px;"
>
<span
data-bind="text: buildEfficiencyStr, css: $parent.efficiencyTextColorCSS($index())"
></span>
</td>
<td
class="div_army_mobile_value_header_quitch div_spectator_player_info"
style="padding-top: 5px;"
>
<span data-bind="text: mobileCount"></span>
</td>
<td
class="div_army_fabber_value_header_quitch div_spectator_player_info"
style="padding-top: 5px;"
>
<span data-bind="text: fabberCount"></span>
</td>
<td
class="div_army_factory_value_header_quitch div_spectator_player_info"
style="padding-top: 5px;"
>
<span data-bind="text: factoryCount"></span>
</td>
<!-- /ko -->
34 changes: 0 additions & 34 deletions ui/mods/com.quitch.qallinonetab/live_game_players.css

This file was deleted.

32 changes: 0 additions & 32 deletions ui/mods/com.quitch.qallinonetab/live_game_players.js

This file was deleted.

Loading

0 comments on commit 9891ff2

Please sign in to comment.