BuildComplete.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  3. // LICENSE: Atomic Game Engine Editor and Tools EULA
  4. // Please see LICENSE_ATOMIC_EDITOR_AND_TOOLS.md in repository root for
  5. // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
  6. //
  7. class BuildComplete extends Atomic.UIWindow {
  8. constructor(parent: Atomic.UIWidget, ev: ToolCore.BuildCompleteEvent) {
  9. super();
  10. parent.addChild(this);
  11. this.buildFolder = ev.buildFolder;
  12. this.text = ev.success ? "Build Complete" : "Build Failed";
  13. this.load("AtomicEditor/editor/ui/buildcomplete.tb.txt");
  14. this.resizeToFitContent();
  15. this.center();
  16. var reveal = <Atomic.UIButton>this.getWidget("reveal");
  17. if (!ev.success)
  18. reveal.setState(Atomic.UI_WIDGET_STATE_DISABLED, true);
  19. this.subscribeToEvent(this, "WidgetEvent", (data) => this.handleWidgetEvent(data));
  20. }
  21. handleWidgetEvent(ev: Atomic.UIWidgetEvent): boolean {
  22. if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
  23. if (ev.target.id == "reveal") {
  24. console.log("REVEAL!");
  25. var utils = new Editor.FileUtils();
  26. utils.revealInFinder(this.buildFolder);
  27. }
  28. if (ev.target.id == "ok") {
  29. // passed up to build output window for now
  30. // which closes both
  31. return false;
  32. }
  33. }
  34. return false;
  35. }
  36. buildFolder: string;
  37. }
  38. export = BuildComplete;