server_src_client-server-shared_gameStates_1-selectTournamentState.js.html 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Source: server/src/client-server-shared/gameStates/1-selectTournamentState.js | 12 Heroes</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css">
  12. <link type="text/css" rel="stylesheet" href="styles/prettify-jsdoc.css">
  13. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  14. <link type="text/css" rel="stylesheet" href="styles/tui-doc.css">
  15. </head>
  16. <body>
  17. <nav class="lnb" id="lnb">
  18. <div class="logo" style="">
  19. <img src="img/toast-ui.png" width="100%" height="100%">
  20. </div>
  21. <div class="title">
  22. <h1><a href="index.html" class="link">12 Heroes</a></h1>
  23. </div>
  24. <div class="search-container" id="search-container">
  25. <input type="text" placeholder="Search">
  26. <ul></ul>
  27. </div>
  28. <div class="lnb-api hidden"><h3>Namespaces</h3><ul><li><a href="Constants.html">Constants</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Constants_sub"></div></li><li><a href="Constants.HERO.html">Constants.HERO</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Constants.HERO_sub"><div class="member-type">Members</div><ul class="inner"><li><a href="Constants.HERO.html#.HERO_ABILITY">HERO_ABILITY</a></li><li><a href="Constants.HERO.html#.HERO_DEPLOY">HERO_DEPLOY</a></li><li><a href="Constants.HERO.html#.HERO_DISCARD">HERO_DISCARD</a></li><li><a href="Constants.HERO.html#.HERO_DISMISS">HERO_DISMISS</a></li><li><a href="Constants.HERO.html#.HERO_MOVE">HERO_MOVE</a></li><li><a href="Constants.HERO.html#.HERO_RECRUIT">HERO_RECRUIT</a></li><li><a href="Constants.HERO.html#.HERO_REPLACE">HERO_REPLACE</a></li></ul></div></li><li><a href="Constants.PLAYER.html">Constants.PLAYER</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Constants.PLAYER_sub"><div class="member-type">Members</div><ul class="inner"><li><a href="Constants.PLAYER.html#.PLAYER_PASS">PLAYER_PASS</a></li><li><a href="Constants.PLAYER.html#.PLAYER_SUPPLY">PLAYER_SUPPLY</a></li></ul></div></li><li><a href="Constants.POS.html">Constants.POS</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Constants.POS_sub"><div class="member-type">Members</div><ul class="inner"><li><a href="Constants.POS.html#.POS_BATTLE_CENTER">POS_BATTLE_CENTER</a></li><li><a href="Constants.POS.html#.POS_BATTLE_LEFT">POS_BATTLE_LEFT</a></li><li><a href="Constants.POS.html#.POS_BATTLE_RIGHT">POS_BATTLE_RIGHT</a></li><li><a href="Constants.POS.html#.POS_CAMP">POS_CAMP</a></li><li><a href="Constants.POS.html#.POS_DISCARD">POS_DISCARD</a></li><li><a href="Constants.POS.html#.POS_HAND">POS_HAND</a></li><li><a href="Constants.POS.html#.POS_PILE">POS_PILE</a></li></ul></div></li><li><a href="Constants.REQ.html">Constants.REQ</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Constants.REQ_sub"><div class="member-type">Members</div><ul class="inner"><li><a href="Constants.REQ.html#.REQ_ERROR">REQ_ERROR</a></li><li><a href="Constants.REQ.html#.REQ_IDLE">REQ_IDLE</a></li><li><a href="Constants.REQ.html#.REQ_REQUESTED">REQ_REQUESTED</a></li><li><a href="Constants.REQ.html#.REQ_SUCCESS">REQ_SUCCESS</a></li></ul></div></li></ul></div><div class="lnb-api hidden"><h3>Global</h3><ul><li><a href="global.html#getDraftSets">getDraftSets</a></li><li><a href="global.html#getHeroesIdsByFaction">getHeroesIdsByFaction</a></li><li><a href="global.html#shuffleHeroes">shuffleHeroes</a></li><li><a href="global.html#TH_Ability">TH_Ability</a></li><li><a href="global.html#TH_AbilityHook">TH_AbilityHook</a></li><li><a href="global.html#TH_AdvRule">TH_AdvRule</a></li><li><a href="global.html#TH_BattleTile">TH_BattleTile</a></li><li><a href="global.html#TH_Color">TH_Color</a></li><li><a href="global.html#TH_CommStatus">TH_CommStatus</a></li><li><a href="global.html#TH_DeckMode">TH_DeckMode</a></li><li><a href="global.html#TH_Faction">TH_Faction</a></li><li><a href="global.html#TH_GameDataStore">TH_GameDataStore</a></li><li><a href="global.html#TH_GameGlobalState">TH_GameGlobalState</a></li><li><a href="global.html#TH_GameStateEnum">TH_GameStateEnum</a></li><li><a href="global.html#TH_HeroAction">TH_HeroAction</a></li><li><a href="global.html#TH_HeroCard">TH_HeroCard</a></li><li><a href="global.html#TH_HeroInGame">TH_HeroInGame</a></li><li><a href="global.html#TH_HeroPosition">TH_HeroPosition</a></li><li><a href="global.html#TH_MessageChatFrom">TH_MessageChatFrom</a></li><li><a href="global.html#TH_MessageDraftStep">TH_MessageDraftStep</a></li><li><a href="global.html#TH_MessageFaction">TH_MessageFaction</a></li><li><a href="global.html#TH_MessageTournamentDeckStep">TH_MessageTournamentDeckStep</a></li><li><a href="global.html#TH_PlayerAction">TH_PlayerAction</a></li><li><a href="global.html#TH_PlayerGameState">TH_PlayerGameState</a></li><li><a href="global.html#TH_Popularity">TH_Popularity</a></li><li><a href="global.html#TH_ReqStatus">TH_ReqStatus</a></li></ul></div>
  29. </nav>
  30. <div id="resizer"></div>
  31. <div class="main" id="main">
  32. <section>
  33. <article>
  34. <pre class="prettyprint source linenums"><code>'use strict';
  35. import { shuffleHeroes } from '../heroesHelper';
  36. export default function selectTournamentState(duelController) {
  37. let duelCtrl = duelController;
  38. let start = () => {
  39. /** @type {import('type/game').TH_GameDataStore} */
  40. let gameData = duelCtrl.getGameData();
  41. gameData.game['waitingFor/blue'] = true;
  42. gameData.game['waitingFor/red'] = true;
  43. gameData.game.currentPlayer = 'both';
  44. duelCtrl.storeData(gameData);
  45. };
  46. let update = (
  47. /** @type {import('type/comm').TH_MessageTournamentDeckStep} */ payload = null
  48. ) => {
  49. /** @type {import('type/game').TH_GameDataStore} */
  50. let gameData = duelCtrl.getGameData();
  51. if (payload) {
  52. let player = payload.color + 'player';
  53. let randomHeroes = shuffleHeroes(payload.twelveHeroes);
  54. // Init player twelve heroes
  55. gameData[player].twelveHeroes = randomHeroes;
  56. gameData.game['waitingFor/' + payload.color] = false;
  57. duelCtrl.storeData(gameData);
  58. }
  59. if (
  60. gameData.game['waitingFor/blue'] === false &amp;&amp;
  61. gameData.game['waitingFor/red'] === false
  62. ) {
  63. duelCtrl.endCurrentState();
  64. }
  65. };
  66. let end = () => {
  67. console.log('Go to next game state : 2_CHANGE_UP_TO_3_CARDS');
  68. duelCtrl.setCurrentState('2_CHANGE_UP_TO_3_CARDS');
  69. duelCtrl.startCurrentState();
  70. };
  71. return {
  72. start,
  73. update,
  74. end
  75. };
  76. }
  77. </code></pre>
  78. </article>
  79. </section>
  80. </div>
  81. <footer>
  82. <img class="logo" src="img/toast-ui.png" style="">
  83. <div class="footer-text">NHN Entertainment. Frontend Development Lab</div>
  84. </footer>
  85. <script>prettyPrint();</script>
  86. <script src="scripts/jquery.min.js"></script>
  87. <script src="scripts/tui-doc.js"></script>
  88. <script src="scripts/linenumber.js"></script>
  89. <script>
  90. var id = '_sub'.replace(/"/g, '_');
  91. var selectedApi = document.getElementById(id); // do not use jquery selector
  92. var $selectedApi = $(selectedApi);
  93. $selectedApi.removeClass('hidden');
  94. $selectedApi.parent().find('.glyphicon').removeClass('glyphicon-plus').addClass('glyphicon-minus');
  95. showLnbApi();
  96. </script>
  97. </body>
  98. </html>