Page MenuHomeWildfire Games

Rewrite the civinfo page to use OOP principles
ClosedPublic

Authored by s0600204 on Jun 18 2020, 12:43 AM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP24289: Rewrite the civinfo page to use OOP principles
Trac Tickets
#5387
Summary

Continuation of the general effort to convert gui pages to use OOP principles.

There are two visual alterations:

  • Scrollbars have been enabled on the textboxes (only appearing when necessary).
  • The "Special Technologies"/"Special Structures" subsection has been split in two (separation of concerns).

Note: This revision is a step towards adapting the civinfo page to load information from entity/technology/aura data files - where relevant - instead of from the {civ}.json files. (This is why the civinfo codebase has been relocated into the gui/reference folder.)

Requires D2734

Test Plan
  • Apply revision;
  • Run 0A.D.;
  • Open civinfo page;
  • Confirm it runs correctly.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

s0600204 updated this revision to Diff 12703.Jul 16 2020, 5:29 AM

Rebase of work

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2657/display/redirect

Reasonable changes overall. I think this is a good example of code that would be improved by merging JS and XML together (D2805).

I have one remark on StructTreeButton which seems completely dispensable to me and weirdly located.

binaries/data/mods/public/gui/reference/common/Buttons/StructreeButton.js
27 ↗(On Diff #12703)

I don't really understand what this is doing in common/

Scrollbars have been enabled on the textboxes (only appearing when necessary).

Could you also allow them on the "History" text?

binaries/data/mods/public/gui/reference/civinfo/CivInfoPage.js
73 ↗(On Diff #12703)

(+.)

s0600204 updated this revision to Diff 12731.Jul 17 2020, 3:44 AM
s0600204 marked an inline comment as done.

Enable scrolling on the History textbox

binaries/data/mods/public/gui/reference/common/Buttons/StructreeButton.js
27 ↗(On Diff #12703)

For much the same reason that there's a CivInfoButton{.xml|.js} in the same location - so it may be used in other pages in future pages without inadvertently including the entire civinfo or structree codebases.

(In case you're wondering how likely that is - three/four years ago I was working on a gui page that, if I were to resurrect, would benefit from both buttons.)

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2673/display/redirect

I'm getting some errors:

ERROR: CCacheLoader failed to find archived or source file for: "gui/reference/civinfo/sprites.xml"
ERROR: CCacheLoader failed to find archived or source file for: "gui/reference/civinfo/setup.xml"
ERROR: Cannot find tooltip object named 'civInfoTooltip'
ERROR: Cannot find tooltip named 'civInfoTooltip'
ERROR: Cannot find tooltip named 'civInfoTooltip' or it is not a tooltip
binaries/data/mods/public/gui/reference/common/Buttons/StructreeButton.js
27 ↗(On Diff #12703)

My point is more that it doesn't actually seem to provide much functionality, and thus might be worth duplicating.

As a matter of fact, I'm not a fan of making buttons with specific behaviours classes of their own (so the same applies to CloseButton I guess). It might be worth putting the text in JSON files and then just defining a 'button' somewhere, but meh.

Anyways, this isn't really a dealbreaker to me.

I'm getting some errors:

[...]

I can't reproduce, sorry. Applying this revision from phabricator with arc works for me on both my svn and git working copies, and it runs without noticeable error.

Nescio added a subscriber: Nescio.Jul 17 2020, 4:31 PM
  • Apply revision;
  • Run 0A.D.;
  • Open civinfo page;
  • Confirm it runs correctly.

For what's it worth, I just executed the above and didn't encounter any errors.

Works as advertised :) From the main menu, from the match setup menu and from within a match.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 29 2020, 5:21 AM
This revision was automatically updated to reflect the committed changes.