NavEditorConsoleDlg.gui 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. //--- OBJECT WRITE BEGIN ---
  2. %guiContent = new GuiWindowCtrl(NavEditorConsoleDlg) {
  3. text = "Nav Console";
  4. resizeWidth = "1";
  5. resizeHeight = "1";
  6. canMove = "1";
  7. canClose = "1";
  8. canMinimize = "1";
  9. canMaximize = "1";
  10. canCollapse = "0";
  11. closeCommand = "NavEditorConsoleDlg.setVisible(false);";
  12. edgeSnap = "1";
  13. margin = "0 0 0 0";
  14. padding = "0 0 0 0";
  15. anchorTop = "1";
  16. anchorBottom = "0";
  17. anchorLeft = "1";
  18. anchorRight = "0";
  19. position = "238 170";
  20. extent = "320 240";
  21. minExtent = "8 2";
  22. horizSizing = "right";
  23. vertSizing = "bottom";
  24. profile = "GuiWindowProfile";
  25. visible = "1";
  26. active = "1";
  27. tooltipProfile = "GuiToolTipProfile";
  28. hovertime = "1000";
  29. isContainer = "1";
  30. canSave = "1";
  31. canSaveDynamicFields = "1";
  32. new GuiTextCtrl() {
  33. maxLength = "1024";
  34. margin = "0 0 0 0";
  35. padding = "0 0 0 0";
  36. anchorTop = "1";
  37. anchorBottom = "0";
  38. anchorLeft = "1";
  39. anchorRight = "0";
  40. position = "3 222";
  41. extent = "149 13";
  42. minExtent = "8 2";
  43. horizSizing = "right";
  44. vertSizing = "top";
  45. profile = "GuiTextProfile";
  46. visible = "1";
  47. active = "1";
  48. tooltipProfile = "GuiToolTipProfile";
  49. hovertime = "1000";
  50. isContainer = "1";
  51. internalName = "StatusLeft";
  52. canSave = "1";
  53. canSaveDynamicFields = "0";
  54. };
  55. new GuiScrollCtrl() {
  56. willFirstRespond = "1";
  57. hScrollBar = "dynamic";
  58. vScrollBar = "dynamic";
  59. lockHorizScroll = "1";
  60. lockVertScroll = "0";
  61. constantThumbHeight = "0";
  62. childMargin = "0 0";
  63. mouseWheelScrollSpeed = "-1";
  64. margin = "-14 41 3 3";
  65. padding = "0 0 0 0";
  66. anchorTop = "0";
  67. anchorBottom = "0";
  68. anchorLeft = "0";
  69. anchorRight = "0";
  70. position = "3 23";
  71. extent = "314 194";
  72. minExtent = "8 2";
  73. horizSizing = "relative";
  74. vertSizing = "relative";
  75. profile = "GuiEditorScrollProfile";
  76. visible = "1";
  77. active = "1";
  78. tooltipProfile = "GuiToolTipProfile";
  79. hovertime = "1000";
  80. isContainer = "1";
  81. internalName = "OutputScroll";
  82. canSave = "1";
  83. canSaveDynamicFields = "0";
  84. new GuiListBoxCtrl() {
  85. allowMultipleSelections = "0";
  86. fitParentWidth = "1";
  87. colorBullet = "1";
  88. position = "1 1";
  89. extent = "312 16";
  90. minExtent = "8 2";
  91. horizSizing = "relative";
  92. vertSizing = "relative";
  93. profile = "GuiListBoxProfile";
  94. visible = "1";
  95. active = "1";
  96. tooltipProfile = "GuiToolTipProfile";
  97. hovertime = "1000";
  98. isContainer = "0";
  99. internalName = "Output";
  100. canSave = "1";
  101. canSaveDynamicFields = "0";
  102. };
  103. };
  104. };
  105. //--- OBJECT WRITE END ---
  106. new ScriptMsgListener(NavEditorConsoleListener);
  107. getNavMeshEventManager().subscribe(NavEditorConsoleListener, "NavMeshCreated");
  108. getNavMeshEventManager().subscribe(NavEditorConsoleListener, "NavMeshRemoved");
  109. getNavMeshEventManager().subscribe(NavEditorConsoleListener, "NavMeshStartUpdate");
  110. getNavMeshEventManager().subscribe(NavEditorConsoleListener, "NavMeshUpdate");
  111. getNavMeshEventManager().subscribe(NavEditorConsoleListener, "NavMeshTileUpdate");
  112. function NavEditorConsoleListener::onNavMeshCreated(%this, %data)
  113. {
  114. }
  115. function NavEditorConsoleListener::onNavMeshRemoved(%this, %data)
  116. {
  117. }
  118. function NavEditorConsoleListener::onNavMeshStartUpdate(%this, %data)
  119. {
  120. NavEditorConsoleDlg-->Output.clearItems();
  121. NavEditorConsoleDlg-->Output.addItem("Build starting for NavMesh" SPC %data, "0 0.6 0");
  122. NavEditorConsoleDlg-->OutputScroll.scrollToBottom();
  123. }
  124. function NavEditorConsoleListener::onNavMeshUpdate(%this, %data)
  125. {
  126. %message = "";
  127. if(getWordCount(%data) == 2)
  128. {
  129. %seconds = getWord(%data, 1);
  130. %minutes = mFloor(%seconds / 60);
  131. %seconds -= %minutes * 60;
  132. %message = "Built NavMesh" SPC getWord(%data, 0) SPC "in" SPC %minutes @ "m" SPC mRound(%seconds) @ "s";
  133. if(NavEditorGui.playSoundWhenDone)
  134. {
  135. sfxPlayOnce(Audio2D, "tools/navEditor/done.wav");
  136. }
  137. }
  138. else
  139. {
  140. %message = "Loaded NavMesh" SPC %data;
  141. }
  142. NavEditorConsoleDlg-->Output.addItem(%message, "0 0.6 0");
  143. NavEditorConsoleDlg-->OutputScroll.scrollToBottom();
  144. NavEditorConsoleDlg->StatusLeft.setText("");
  145. }
  146. function NavEditorConsoleListener::onNavMeshTileUpdate(%this, %data)
  147. {
  148. %mesh = getWord(%data, 0);
  149. %index = getWord(%data, 1);
  150. %total = getWord(%data, 2);
  151. %tile = getWords(%data, 3, 4);
  152. %success = getWord(%data, 5) == "1";
  153. if(!%success)
  154. {
  155. %message = "NavMesh" SPC %mesh SPC "tile" SPC %tile SPC "build failed!";
  156. NavEditorConsoleDlg-->Output.addItem(%message, "1 0 0");
  157. NavEditorConsoleDlg-->OutputScroll.scrollToBottom();
  158. }
  159. %percent = %index / %total * 100;
  160. NavEditorConsoleDlg->StatusLeft.setText("Build progress:" SPC mRound(%percent) @ "%");
  161. }