high_score.rml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <rml>
  2. <head>
  3. <title>High Scores</title>
  4. <link type="text/template" href="window.rml" />
  5. <style>
  6. body
  7. {
  8. width: 440dp;
  9. height: 440dp;
  10. margin: auto;
  11. }
  12. div#title_bar div#icon
  13. {
  14. decorator: image( icon-hiscore );
  15. }
  16. defender
  17. {
  18. display: inline-block;
  19. width: 64dp;
  20. height: 16dp;
  21. decorator: defender( high_scores_defender.tga );
  22. }
  23. table {
  24. margin-top: 5dp;
  25. height: 345dp;
  26. }
  27. tbody tr {
  28. height: 30dp;
  29. }
  30. tbody tr:last-child {
  31. height: auto;
  32. background-color: transparent;
  33. }
  34. tbody td
  35. {
  36. padding-top: 5dp;
  37. height: 30dp;
  38. white-space: nowrap;
  39. overflow: hidden;
  40. }
  41. button {
  42. margin-top: 20dp;
  43. }
  44. </style>
  45. <script>
  46. HighScore = HighScore or {}
  47. function HighScore.OnKeyDown(event)
  48. if event.parameters['key_identifier'] == rmlui.key_identifier.RETURN then
  49. Game.SetHighScoreName(Element.As.ElementFormControlInput(event.current_element).value)
  50. end
  51. end
  52. </script>
  53. </head>
  54. <body template="luawindow" onload="Window.OnWindowLoad(document) Game.SubmitHighScore()" onkeydown="if Window.EscapePressed(event) then Window.LoadMenu('main_menu',document) end">
  55. <table data-model="high_scores">
  56. <thead>
  57. <tr>
  58. <td style="width: 200%; margin-left: 10dp;">Pilot</td>
  59. <td style="min-width: 64dp;">Ship</td>
  60. <td>Wave</td>
  61. <td style="min-width: 64dp;">Score</td>
  62. </tr>
  63. </thead>
  64. <tbody>
  65. <tr data-for="score : scores">
  66. <td data-if="score.name_required">
  67. <input id="player_input" type="text" name="name" onkeydown="HighScore.OnKeyDown(event)" autofocus/>
  68. </td>
  69. <td data-if="!score.name_required">
  70. {{score.name}}
  71. </td>
  72. <td>
  73. <defender data-style-image-color="score.colour"/>
  74. </td>
  75. <td>
  76. {{score.wave}}
  77. </td>
  78. <td>
  79. {{score.score}}
  80. </td>
  81. </tr>
  82. <tr>
  83. <td data-if="scores.size == 0" colspan="4" style="vertical-align: middle"><em>No scores recorded. Play a game!</em></td>
  84. </tr>
  85. </tbody>
  86. </table>
  87. <button onclick="Game.SetHighScoreName('Anon') Window.LoadMenu('main_menu',document)">Main Menu</button>
  88. </body>
  89. </rml>