UIInfoModule3D.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  2. // Please see LICENSE.md in repository root for license information
  3. // https://github.com/AtomicGameEngine/AtomicGameEngine
  4. #include "AtomicEditor.h"
  5. #include <TurboBadger/tb_window.h>
  6. #include <TurboBadger/tb_select.h>
  7. #include <TurboBadger/tb_editfield.h>
  8. #include <Atomic/Core/Context.h>
  9. #include <Atomic/UI/UI.h>
  10. #include "Resources/AEResourceOps.h"
  11. #include "AEPreferences.h"
  12. #include "AEEditor.h"
  13. #include "AEEvents.h"
  14. #include "Project/AEProject.h"
  15. #include "Project/ProjectUtils.h"
  16. #include "License/AELicenseSystem.h"
  17. #include "UIInfoModule3D.h"
  18. namespace AtomicEditor
  19. {
  20. // UIBuildSettings------------------------------------------------
  21. InfoModule3D::InfoModule3D(Context* context,const String &exampleFolder, const String &exampleScreenshot):
  22. UIModalOpWindow(context)
  23. , exampleFolder_(exampleFolder)
  24. , exampleScreenshot_(exampleScreenshot)
  25. {
  26. Editor* editor = GetSubsystem<Editor>();
  27. Project* project = editor->GetProject();
  28. UI* tbui = GetSubsystem<UI>();
  29. window_->SetSettings(WINDOW_SETTINGS_DEFAULT & ~WINDOW_SETTINGS_CLOSE_BUTTON);
  30. window_->SetText("Atomic Game Engine Pro Required");
  31. tbui->LoadResourceFile(window_->GetContentRoot(), "AtomicEditor/editor/ui/infomodule3d.tb.txt");
  32. window_->ResizeToFitContent();
  33. Center();
  34. }
  35. InfoModule3D::~InfoModule3D()
  36. {
  37. }
  38. bool InfoModule3D::OnEvent(const TBWidgetEvent &ev)
  39. {
  40. if (ev.type == EVENT_TYPE_CLICK)
  41. {
  42. UIModalOps* ops = GetSubsystem<UIModalOps>();
  43. if (ev.target->GetID() == TBIDC("ok"))
  44. {
  45. SharedPtr<InfoModule3D> keepAlive(this);
  46. ops->Hide();
  47. if (exampleFolder_.Length())
  48. {
  49. ops->ShowCreateProject(exampleFolder_, exampleScreenshot_);
  50. }
  51. return true;
  52. }
  53. if (ev.target->GetID() == TBIDC("purchase"))
  54. {
  55. //Editor* editor = GetSubsystem<Editor>();
  56. FileSystem* fs = GetSubsystem<FileSystem>();
  57. fs->SystemOpen("https://store.atomicgameengine.com/site");
  58. ops->Hide();
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64. }