// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved // Please see LICENSE.md in repository root for license information // https://github.com/AtomicGameEngine/AtomicGameEngine #include "AtomicEditor.h" #include #include #include #include #include #include #include #include #include #include "Resources/AEResourceOps.h" #include "AEPreferences.h" #include "AEVersion.h" #include "AEEditor.h" #include "AEEvents.h" #include "Project/AEProject.h" #include "Project/ProjectUtils.h" #include "License/AELicenseSystem.h" #include "UIAbout.h" namespace AtomicEditor { UIAbout::UIAbout(Context* context): UIModalOpWindow(context) { UI* tbui = GetSubsystem(); window_->SetText("About the Atomic Game Engine"); tbui->LoadResourceFile(window_->GetContentRoot(), "AtomicEditor/editor/ui/about.tb.txt"); TBEditField* age_license = window_->GetWidgetByIDAndType(TBIDC("age_license")); assert(age_license); TBEditField* thirdparty_license = window_->GetWidgetByIDAndType(TBIDC("thirdparty_license")); assert(thirdparty_license); TBEditField* externaltool_license = window_->GetWidgetByIDAndType(TBIDC("externaltool_license")); assert(externaltool_license); TBEditField* about_text = window_->GetWidgetByIDAndType(TBIDC("about_text")); assert(about_text); ResourceCache* cache = GetSubsystem(); SharedPtr file = cache->GetFile("AtomicEditor/eulas/atomic_game_engine_eula.txt"); String text; file->ReadText(text); age_license->SetText(text.CString()); file = cache->GetFile("AtomicEditor/eulas/atomic_thirdparty_eula.txt"); file->ReadText(text); thirdparty_license->SetText(text.CString()); file = cache->GetFile("AtomicEditor/eulas/atomic_external_tools_eula.txt"); file->ReadText(text); externaltool_license->SetText(text.CString()); GenerateAboutText(text); about_text->SetText(text.CString()); window_->ResizeToFitContent(); Center(); TBTabContainer* container = window_->GetWidgetByIDAndType(TBIDC("tabcontainer")); assert(container); container->SetValue(0); } UIAbout::~UIAbout() { } void UIAbout::GenerateAboutText(String& text) { LicenseSystem* licenseSystem = GetSubsystem(); text.Clear(); text += "\n\n"; text.AppendWithFormat("Version %i.%i.p%i\n\n", ATOMIC_EDITOR_VERSION_MAJOR, ATOMIC_EDITOR_VERSION_MINOR, ATOMIC_EDITOR_VERSION_PATCH); text += "(c) 2014-2015 THUNDERBEAST GAMES LLC\n\n\n"; text += "Installed platforms and modules:\n\n"; if (licenseSystem->IsStandardLicense()) { text += " \n\n\n"; text += "Available platforms and modules:\n\n" \ " " \ " "\ "\n\n\n"; } else { text += " " \ " " \ " \n\n"; } text += "Special Thanks:\n\n"; text += " The Urho3D Project - http://urho3d.github.io\n\n"; text += " Sami Vaarala - http://www.duktape.org"; } bool UIAbout::OnEvent(const TBWidgetEvent &ev) { if (ev.type == EVENT_TYPE_CLICK) { if (ev.target->GetID() == TBIDC("purchase_pro")) { FileSystem* fileSystem = GetSubsystem(); fileSystem->SystemOpen("https://store.atomicgameengine.com/site"); } else if (ev.target->GetID() == TBIDC("ok")) { GetSubsystem()->Hide(); return true; } } return false; } }