Josh Engebretson 10 年之前
父節點
當前提交
4e49c32413

二進制
Data/AtomicEditor/Resources/EditorData/AtomicEditor/editor/skin/module_2d.png


二進制
Data/AtomicEditor/Resources/EditorData/AtomicEditor/editor/skin/module_3d.png


+ 10 - 0
Data/AtomicEditor/Resources/EditorData/AtomicEditor/editor/skin/skin.tb.txt

@@ -127,6 +127,16 @@ elements
 		width 48
 		height 48
 
+	Module2D-Small
+		bitmap module_2d.png
+		width 48
+		height 48
+
+	Module3D-Small
+		bitmap module_3d.png
+		width 48
+		height 48
+
 	LogoAtomic64
 		bitmap logo_atomic_64.png
 

+ 2 - 2
Data/AtomicEditor/Resources/EditorData/AtomicEditor/editor/ui/activation.tb.txt

@@ -11,10 +11,10 @@ TBLayout: axis: y, distribution: gravity, position: left
 	TBLayout:
 		TBButton: text: Activate, id: activate
 			lp: min-width: 128, min-height: 64
+		TBButton: text: "Get Free Key", id: get_key
+			lp: min-width: 128, min-height: 64			
 	TBSeparator: gravity: left right, skin: AESeparator
 	TBLayout:
-		TBButton: text: "Get Activation Key", id: get_key
-		TBButton: text: "Lost My Key", id: lost_key
 		TBButton: text: Quit, id: quit
 
 	TBSeparator: gravity: left right, skin: AESeparator

+ 10 - 0
Data/AtomicEditor/Resources/EditorData/AtomicEditor/editor/ui/infomodule3d.tb.txt

@@ -0,0 +1,10 @@
+TBLayout: axis: y, distribution: gravity
+	TBEditField: multiline: 1, styling: 1, gravity: all, id: info, readonly: 1
+		font: size: 14
+		text: "3D module required for 3D content\n\n" \
+				"<widget TBSkinImage: skin: 'Module3D-Small'>" 
+		lp: min-width: 480, min-height: 240
+	TBSeparator: gravity: left right, skin: AESeparator
+	TBLayout:
+		TBButton: text: OK, id: ok
+		TBButton: text: Purchase, id: purchase

+ 16 - 9
Source/AtomicEditor/Source/License/AELicenseSystem.cpp

@@ -230,9 +230,9 @@ void LicenseSystem::RemoveLicense()
     }
 }
 
-bool LicenseSystem::HasPlatformLicense()
+bool LicenseSystem::IsStarterLicense()
 {
-    return licenseWindows_ || licenseMac_ || licenseAndroid_ || licenseIOS_ || licenseHTML5_;
+    return !licenseAndroid_;
 }
 
 
@@ -407,7 +407,14 @@ void LicenseSystem::HandleVerification(StringHash eventType, VariantMap& eventDa
             else if (code == 2)
             {
                 // something is wrong with the key
-                key_ = "";
+                LOGERRORF("Error with product key");
+
+                RemoveLicense();
+                ResetLicense();
+                UIModalOps* ops = GetSubsystem<UIModalOps>();
+                ops->Hide();
+                ops->ShowActivation();
+
             }
             else if (code == 3)
             {
@@ -461,13 +468,13 @@ void LicenseSystem::HandleVerification(StringHash eventType, VariantMap& eventDa
                     SaveLicense();
                 }
 
-                if (!HasPlatformLicense())
-                {
-                    UIModalOps* ops = GetSubsystem<UIModalOps>();
-                    if (!ops->ModalActive())
-                        ops->ShowPlatformsInfo();
+                //if (!HasPlatformLicense())
+                //{
+                //    UIModalOps* ops = GetSubsystem<UIModalOps>();
+                //    if (!ops->ModalActive())
+                //        ops->ShowPlatformsInfo();
 
-                }
+               // }
 
             }
 

+ 1 - 1
Source/AtomicEditor/Source/License/AELicenseSystem.h

@@ -58,7 +58,7 @@ public:
     bool LicenseModule3D() { return licenseModule3D_; }
 
     /// Returns whether there are any platform licenses available
-    bool HasPlatformLicense();
+    bool IsStarterLicense();
 
     bool RequestPlatformChange(AEEditorPlatform platform);
 

+ 10 - 1
Source/AtomicEditor/Source/License/UIActivation.cpp

@@ -82,7 +82,16 @@ bool UIActivation::OnEvent(const TBWidgetEvent &ev)
 
     if (ev.type == EVENT_TYPE_CLICK)
     {
-        if (ev.target->GetID() == TBIDC("activate"))
+        if (ev.target->GetID() == TBIDC("get_key"))
+        {
+            FileSystem* fileSystem = GetSubsystem<FileSystem>();
+            fileSystem->SystemOpen("https://store.atomicgameengine.com/store/store.php");
+        }
+        else if (ev.target->GetID() == TBIDC("quit"))
+        {
+            editor->RequestExit();
+        }
+        else if (ev.target->GetID() == TBIDC("activate"))
         {
             TBStr _key;
             licenseKey_->GetText(_key);

+ 1 - 1
Source/AtomicEditor/Source/License/UIActivationSuccess.cpp

@@ -57,7 +57,7 @@ bool UIActivationSuccess::OnEvent(const TBWidgetEvent &ev)
 
             LicenseSystem* licenseSystem = GetSubsystem<LicenseSystem>();
 
-            if (!licenseSystem->HasPlatformLicense())
+            if (licenseSystem->IsStarterLicense())
             {
                 SharedPtr<UIActivationSuccess> keepAlive(this);
                 UIModalOps* ops = GetSubsystem<UIModalOps>();

+ 6 - 0
Source/AtomicEditor/Source/License/UIEulaAgreement.cpp

@@ -9,6 +9,7 @@
 #include <TurboBadger/tb_window.h>
 #include <TurboBadger/tb_select.h>
 #include <TurboBadger/tb_editfield.h>
+#include <TurboBadger/tb_tab_container.h>
 
 #include <Atomic/Core/Context.h>
 #include <Atomic/IO/File.h>
@@ -69,6 +70,11 @@ UIEulaAgreement::UIEulaAgreement(Context* context):
 
     window_->ResizeToFitContent();
     Center();
+
+    TBTabContainer* container = window_->GetWidgetByIDAndType<TBTabContainer>(TBIDC("tabcontainer"));
+    assert(container);
+    container->SetValue(0);
+
 }
 
 

+ 23 - 1
Source/AtomicEditor/Source/Player/UIPlayer.cpp

@@ -16,6 +16,10 @@
 
 #include <Atomic/Graphics/Graphics.h>
 #include <Atomic/Graphics/Viewport.h>
+#include <Atomic/Graphics/Camera.h>
+
+#include "UI/Modal/UIModalOps.h"
+#include "License/AELicenseSystem.h"
 
 #include "AEEditor.h"
 #include "AEEvents.h"
@@ -36,6 +40,11 @@ UIPlayer::UIPlayer(Context* context):
     UIModalOpWindow(context)
 {
 
+// BEGIN LICENSE MANAGEMENT
+    LicenseSystem* license = GetSubsystem<LicenseSystem>();
+    starterLicense_ = license->IsStarterLicense();
+// END LICENSE MANAGEMENT
+
     aePlayer_ = GetSubsystem<AEPlayer>();
     aePlayer_->SetUIPlayer(this);
 
@@ -90,10 +99,23 @@ UIPlayer::~UIPlayer()
 
 void UIPlayer::HandleUpdate(StringHash eventType, VariantMap& eventData)
 {
-
     view3D_->QueueUpdate();
     UI* ui = GetSubsystem<UI>();
 
+    // BEGIN LICENSE MANAGEMENT
+    if (starterLicense_)
+    {
+        Camera* camera = view3D_->GetViewport()->GetCamera();
+        if (camera && !camera->IsOrthographic())
+        {
+            SendEvent(E_EDITORPLAYSTOP);
+            UIModalOps* ops = GetSubsystem<UIModalOps>();
+            ops->ShowInfoModule3D();
+            return;
+        }
+    }
+    // END LICENSE MANAGEMENT
+
     TBWidgetDelegate* view3DDelegate = view3D_->GetWidgetDelegate();
     TBRect rect = view3DDelegate->GetRect();
     view3DDelegate->ConvertToRoot(rect.x, rect.y);

+ 2 - 0
Source/AtomicEditor/Source/Player/UIPlayer.h

@@ -44,6 +44,8 @@ private:
 
 
     IntVector2 playerSize_;
+
+    bool starterLicense_;
 };
 
 }

+ 22 - 8
Source/AtomicEditor/Source/UI/Modal/UIAbout.cpp

@@ -7,6 +7,7 @@
 #include <TurboBadger/tb_window.h>
 #include <TurboBadger/tb_select.h>
 #include <TurboBadger/tb_editfield.h>
+#include <TurboBadger/tb_tab_container.h>
 
 #include <Atomic/Core/Context.h>
 #include <Atomic/IO/File.h>
@@ -48,7 +49,6 @@ UIAbout::UIAbout(Context* context):
     TBEditField* about_text = window_->GetWidgetByIDAndType<TBEditField>(TBIDC("about_text"));
     assert(about_text);
 
-
     ResourceCache* cache = GetSubsystem<ResourceCache>();
 
     SharedPtr<File> file = cache->GetFile("AtomicEditor/eulas/atomic_game_engine_eula.txt");
@@ -70,6 +70,10 @@ UIAbout::UIAbout(Context* context):
 
     window_->ResizeToFitContent();
     Center();
+
+    TBTabContainer* container = window_->GetWidgetByIDAndType<TBTabContainer>(TBIDC("tabcontainer"));
+    assert(container);
+    container->SetValue(0);
 }
 
 
@@ -87,17 +91,22 @@ void UIAbout::GenerateAboutText(String& text)
     text.AppendWithFormat("<color #D4FB79>Version  %i.%i.p%i</color>\n", ATOMIC_EDITOR_VERSION_MAJOR, ATOMIC_EDITOR_VERSION_MINOR, ATOMIC_EDITOR_VERSION_PATCH);
     text += "(c) 2014-2015 THUNDERBEAST GAMES LLC\n\n";
 
-    text += "<color #76D6FF>Installed platform licenses:</color>\n\n";
+    text += "<color #D4FB79>Installed platforms and modules:</color>\n\n";
 
-    if (licenseSystem->HasPlatformLicense())
+    if (licenseSystem->IsStarterLicense())
     {
-        text += "    <widget TBSkinImage: skin: 'LogoMac-Small'> <widget TBSkinImage: skin: 'LogoWindows-Small'> " \
-        "<widget TBSkinImage: skin: 'LogoHTML5-Small'> <widget TBSkinImage: skin: 'LogoAndroid-Small'> " \
-        "<widget TBSkinImage: skin: 'LogoIOS-Small'>\n\n";
+        text += "    <widget TBSkinImage: skin: 'LogoMac-Small'> <widget TBSkinImage: skin: 'LogoWindows-Small'> <widget TBSkinImage: skin: 'Module2D-Small'>\n\n";
+
+        text += "<color #76D6FF>Available platforms and modules:</color>\n\n" \
+        "    <widget TBSkinImage: skin: 'LogoHTML5-Small'> <widget TBSkinImage: skin: 'LogoAndroid-Small'> " \
+        "<widget TBSkinImage: skin: 'LogoIOS-Small'> <widget TBSkinImage: skin: 'Module3D-Small'> "\
+        "<widget TBButton: text: 'Purchase' id: 'purchase_pro' >\n\n";
     }
     else
     {
-        text += "<color #FF2600>    No platform licenses installed</color>\n\n";
+        text += "    <widget TBSkinImage: skin: 'LogoMac-Small'> <widget TBSkinImage: skin: 'LogoWindows-Small'> " \
+        "<widget TBSkinImage: skin: 'LogoHTML5-Small'> <widget TBSkinImage: skin: 'LogoAndroid-Small'> " \
+        "<widget TBSkinImage: skin: 'LogoIOS-Small'> <widget TBSkinImage: skin: 'Module2D-Small'> <widget TBSkinImage: skin: 'Module3D-Small'>\n\n";
     }
 
     text += "<color #76D6FF>Special Thanks:</color>\n\n";
@@ -109,7 +118,12 @@ bool UIAbout::OnEvent(const TBWidgetEvent &ev)
 {
     if (ev.type == EVENT_TYPE_CLICK)
     {
-        if (ev.target->GetID() == TBIDC("ok"))
+        if (ev.target->GetID() == TBIDC("purchase_pro"))
+        {
+            FileSystem* fileSystem = GetSubsystem<FileSystem>();
+            fileSystem->SystemOpen("https://store.atomicgameengine.com/store/store.php");
+        }
+        else if (ev.target->GetID() == TBIDC("ok"))
         {
             GetSubsystem<UIModalOps>()->Hide();
             return true;

+ 2 - 0
Source/AtomicEditor/Source/UI/Modal/UIBuildSettings.cpp

@@ -300,6 +300,7 @@ bool UIBuildSettings::OnEvent(const TBWidgetEvent &ev)
 // BEGIN LICENSE MANAGEMENT
 
             LicenseSystem* licenseSystem = GetSubsystem<LicenseSystem>();
+            /*
             if (!licenseSystem->HasPlatformLicense())
             {
                 SharedPtr<UIBuildSettings> keepAlive(this);
@@ -308,6 +309,7 @@ bool UIBuildSettings::OnEvent(const TBWidgetEvent &ev)
                 ops->ShowPlatformsInfo();
                 return true;
             }
+            */
 
             TBID id = platformSelect_->GetSelectedItemID();
             RequestPlatformChange(id);

+ 78 - 0
Source/AtomicEditor/Source/UI/Modal/UIInfoModule3D.cpp

@@ -0,0 +1,78 @@
+// 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 <TurboBadger/tb_window.h>
+#include <TurboBadger/tb_select.h>
+#include <TurboBadger/tb_editfield.h>
+
+#include <Atomic/Core/Context.h>
+#include <Atomic/UI/TBUI.h>
+
+#include "Resources/AEResourceOps.h"
+#include "AEPreferences.h"
+
+#include "AEEditor.h"
+#include "AEEvents.h"
+#include "Project/AEProject.h"
+#include "Project/ProjectUtils.h"
+#include "License/AELicenseSystem.h"
+
+#include "UIInfoModule3D.h"
+
+namespace AtomicEditor
+{
+
+// UIBuildSettings------------------------------------------------
+
+InfoModule3D::InfoModule3D(Context* context):
+    UIModalOpWindow(context)
+{
+    Editor* editor = GetSubsystem<Editor>();
+    Project* project = editor->GetProject();
+
+    TBUI* tbui = GetSubsystem<TBUI>();
+    window_->SetText("3D Module Required");
+
+    tbui->LoadResourceFile(window_->GetContentRoot(), "AtomicEditor/editor/ui/infomodule3d.tb.txt");
+
+    window_->ResizeToFitContent();
+    Center();
+
+}
+
+
+InfoModule3D::~InfoModule3D()
+{
+}
+
+bool InfoModule3D::OnEvent(const TBWidgetEvent &ev)
+{
+    if (ev.type == EVENT_TYPE_CLICK)
+    {
+        UIModalOps* ops = GetSubsystem<UIModalOps>();
+        if (ev.target->GetID() == TBIDC("ok"))
+        {
+            ops->Hide();
+            return true;
+        }
+        if (ev.target->GetID() == TBIDC("purchase"))
+        {
+
+            //Editor* editor = GetSubsystem<Editor>();
+            FileSystem* fs = GetSubsystem<FileSystem>();
+            fs->SystemOpen("https://store.atomicgameengine.com/store/store.php");
+            ops->Hide();
+
+            return true;
+        }
+
+
+    }
+
+    return false;
+}
+
+}

+ 29 - 0
Source/AtomicEditor/Source/UI/Modal/UIInfoModule3D.h

@@ -0,0 +1,29 @@
+// 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
+
+#pragma once
+
+#include "UIModalOps.h"
+
+#include <TurboBadger/tb_select.h>
+#include <TurboBadger/tb_select_item.h>
+
+namespace AtomicEditor
+{
+
+class InfoModule3D : public UIModalOpWindow
+{
+    OBJECT(InfoModule3D);
+
+public:
+
+    InfoModule3D(Context* context);
+    virtual ~InfoModule3D();
+    bool OnEvent(const TBWidgetEvent &ev);
+
+private:
+
+};
+
+}

+ 12 - 2
Source/AtomicEditor/Source/UI/Modal/UIModalOps.cpp

@@ -28,6 +28,7 @@
 #include "UINewProject.h"
 #include "UIAbout.h"
 #include "UIPlatformsInfo.h"
+#include "UIInfoModule3D.h"
 
 #include "License/UIActivation.h"
 #include "License/UIActivationSuccess.h"
@@ -182,10 +183,12 @@ void UIModalOps::ShowBuild()
     Show();
 // BEGIN LICENSE MANAGEMENT
     LicenseSystem* licenseSystem = GetSubsystem<LicenseSystem>();
+    /*
     if (licenseSystem->HasPlatformLicense())
+    */
         opWindow_ = new UIBuild(context_);
-    else
-        opWindow_ = new PlatformsInfo(context_);
+    //else
+    //    opWindow_ = new PlatformsInfo(context_);
 // END LICENSE MANAGEMENT
 }
 
@@ -294,6 +297,13 @@ void UIModalOps::ShowPlayer()
     opWindow_ = new UIPlayer(context_);
 }
 
+void UIModalOps::ShowInfoModule3D()
+{
+    assert(opWindow_.Null());
+    Show();
+    opWindow_ = new InfoModule3D(context_);
+}
+
 void UIModalOps::OnWidgetDelete(TBWidget *widget)
 {
     if (isHiding_)

+ 1 - 0
Source/AtomicEditor/Source/UI/Modal/UIModalOps.h

@@ -59,6 +59,7 @@ class UIModalOps: public AEWidget, private TBWidgetListener
     void ShowActivationSuccess();
     void ShowManageLicense();
     void ShowAbout();
+    void ShowInfoModule3D();
     void ShowPlatformsInfo();
     void ShowEulaAgreement();