Browse Source

Source build update

Josh Engebretson 10 years ago
parent
commit
d9b2bcae58

+ 1 - 0
CMakeLists.txt

@@ -19,6 +19,7 @@ if (ATOMIC_DEV_BUILD)
     add_definitions("-DATOMIC_DEV_BUILD=1")
 endif()
 
+add_definitions("-DATOMIC_SOURCE_BUILD=1")
 
 # this is here as QtCreator is having trouble picking up #include <Atomic/*> without it
 include_directories(${CMAKE_SOURCE_DIR}/Source ${CMAKE_SOURCE_DIR}/Source/AtomicEditor/Source)

BIN
Resources/EditorData/AtomicEditor/editor/images/source_header.jpg


+ 16 - 0
Resources/EditorData/AtomicEditor/editor/ui/sourceinfo.tb.txt

@@ -0,0 +1,16 @@
+TBLayout: axis: y, distribution: gravity
+	TBImageWidget: filename: "AtomicEditor/editor/images/source_header.jpg"
+		lp: width: 512, height: 167
+	TBEditField: multiline: 1, styling: 1, gravity: all, id: info, readonly: 1, scroll-mode: off
+		font: size: 14
+		text: "\nAtomic Pro is required for <color #76D6FF>GitHub development snapshots</color> and <color #76D6FF>custom engine builds</color>.\n\n" \
+		"\nPlease download the binary release or <color #D4FB79>upgrade to Atomic Pro</color>.\n\n"
+		lp: min-width: 480, min-height: 160
+	TBSeparator: gravity: left right, skin: AESeparator
+	TBLayout:
+		TBButton: text: Quit, id: quit
+			lp: min-width: 64, min-height: 64	
+		TBButton: text: Download Binary, id: download
+			lp: min-width: 128, min-height: 64
+		TBButton: text: Get Pro for Full Source, id: purchase, skin: TBButton.greentext
+			lp: min-width: 128, min-height: 64

+ 11 - 0
Script/AtomicEditor/editor/EditorLicense.ts

@@ -9,6 +9,7 @@ class EditorLicense extends Atomic.ScriptObject {
 
         this.subscribeToEvent("LicenseEulaRequired", (eventData) => this.handleLicenseEulaRequired(eventData));
         this.subscribeToEvent("LicenseActivationRequired", (eventData) => this.handleLicenseActivationRequired(eventData));
+        this.subscribeToEvent("LicenseSuccess", (eventData) => this.handleLicenseSuccess(eventData));
 
     }
 
@@ -26,6 +27,16 @@ class EditorLicense extends Atomic.ScriptObject {
 
     }
 
+    handleLicenseSuccess(eventData) {
+
+        if (ToolCore.licenseSystem.sourceBuild && ToolCore.licenseSystem.isStandardLicense()) {
+
+          var ops = EditorUI.getModelOps();
+          ops.showProWindow("AtomicEditor/editor/ui/sourceinfo.tb.txt");
+
+        }
+
+    }
 
 }
 

+ 10 - 0
Script/AtomicEditor/ui/modal/ModalOps.ts

@@ -8,6 +8,7 @@ import EULAWindow = require("./license/EULAWindow");
 import ActivationWindow = require("./license/ActivationWindow");
 import ActivationSuccessWindow = require("./license/ActivationSuccessWindow");
 import ManageLicense = require("./license/ManageLicense");
+import ProWindow = require("./license/ProWindow");
 
 import ResourceSelection = require("./ResourceSelection");
 
@@ -143,6 +144,15 @@ class ModalOps extends Atomic.ScriptObject {
 
     }
 
+    showProWindow(uiPath:string) {
+
+        if (this.show()) {
+
+            this.opWindow = new ProWindow(uiPath);
+
+        }
+
+    }
 
     showAbout() {
 

+ 4 - 1
Script/AtomicEditor/ui/modal/ModalWindow.ts

@@ -3,10 +3,13 @@ import EditorUI = require("../EditorUI");
 
 class ModalWindow extends Atomic.UIWindow {
 
-    constructor() {
+    constructor(disableClose:boolean = false) {
 
         super();
 
+        if (disableClose)
+          this.settings = Atomic.UI_WINDOW_SETTINGS_DEFAULT & ~Atomic.UI_WINDOW_SETTINGS_CLOSE_BUTTON;
+
         var view = EditorUI.getView();
         view.addChild(this);
 

+ 33 - 11
Script/AtomicEditor/ui/modal/license/ActivationWindow.ts

@@ -4,39 +4,61 @@ import EditorUI = require("ui/EditorUI");
 import ModalWindow = require("../ModalWindow");
 import ProgressModal = require("../ProgressModal");
 
-class ActivationWidow extends ModalWindow {
+class ActivationWindow extends ModalWindow {
 
     constructor() {
 
-        super();
+        super(true);
 
         this.init("Product Activation", "AtomicEditor/editor/ui/activation.tb.txt");
 
-        this.licenseKeyEdit = <Atomic.UIEditField> this.getWidget("license_key");
+        this.licenseKeyEdit = <Atomic.UIEditField>this.getWidget("license_key");
 
         this.subscribeToEvent("LicenseActivationError", (eventData) => this.handleLicenseActivationError(eventData));
         this.subscribeToEvent("LicenseActivationSuccess", (eventData) => this.handleLicenseActivationSuccess(eventData));
 
         this.progressModal = new ProgressModal("Activation", "Activating, please wait...");
 
+        if (ToolCore.licenseSystem.sourceBuild) {
+
+            var button = <Atomic.UIButton>this.getWidget("get_key");
+            button.text = "Get Pro Key";
+
+            var message = "\nAtomic Pro is required for <color #76D6FF>GitHub development snapshots</color> and <color #76D6FF>custom engine builds</color>.\n\n";
+            message += "Press OK to activate or acquire your Atomic Pro license";
+            new Atomic.UIMessageWindow(this, "modal_error").show("Atomic Pro Required", message, Atomic.UI_MESSAGEWINDOW_SETTINGS_OK, true, 640, 260);
+
+        }
+
+
+
     }
 
     handleLicenseActivationError(ev) {
 
-      this.progressModal.hide();
+        this.progressModal.hide();
 
-      EditorUI.showModalError("Activation Error",
-          ev.message);
+        EditorUI.showModalError("Activation Error",
+            ev.message);
 
     }
 
     handleLicenseActivationSuccess(ev) {
 
-      this.progressModal.hide();
+        this.progressModal.hide();
+
+        this.hide();
+
+        if (ToolCore.licenseSystem.sourceBuild && ToolCore.licenseSystem.isStandardLicense()) {
 
-      this.hide();
+            // show pro window
+            EditorUI.getModelOps().showProWindow("AtomicEditor/editor/ui/sourceinfo.tb.txt");
 
-      EditorUI.getModelOps().showActivationSuccessWindow();
+        } else {
+
+            EditorUI.getModelOps().showActivationSuccessWindow();
+
+        }
 
     }
 
@@ -78,8 +100,8 @@ class ActivationWidow extends ModalWindow {
         }
 
     }
-    progressModal:ProgressModal;
+    progressModal: ProgressModal;
     licenseKeyEdit: Atomic.UIEditField;
 }
 
-export = ActivationWidow;
+export = ActivationWindow;

+ 51 - 0
Script/AtomicEditor/ui/modal/license/ProWindow.ts

@@ -0,0 +1,51 @@
+
+import EditorEvents = require("editor/EditorEvents");
+import EditorUI = require("ui/EditorUI");
+import ModalWindow = require("../ModalWindow");
+import ProgressModal = require("../ProgressModal");
+
+class ProWindow extends ModalWindow {
+
+    constructor(uiPath: string) {
+
+        super(true);
+
+        this.init("Atomic Pro Required", uiPath);
+
+    }
+
+    handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
+
+        if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
+
+            var id = ev.target.id;
+
+            if (id == 'purchase') {
+
+                Atomic.fileSystem.systemOpen("https://store.atomicgameengine.com/site");
+
+            } else if (id == "download") {
+
+                Atomic.fileSystem.systemOpen("http://atomicgameengine.com/download");
+
+            } else if (id == "quit") {
+
+                this.sendEvent(EditorEvents.Quit);
+
+            }
+
+            if (id == "ok") {
+
+                this.hide();
+
+                return true;
+            }
+
+            return false;
+
+        }
+    }
+
+}
+
+export = ProWindow;

+ 10 - 0
Source/ToolCore/License/LicenseSystem.cpp

@@ -610,6 +610,16 @@ void LicenseSystem::RequestServerActivation(const String& key)
     SubscribeToEvent(serverActivation_, E_CURLCOMPLETE, HANDLER(LicenseSystem, HandleActivationResult));
 }
 
+bool LicenseSystem::GetSourceBuild()
+{
+
+#ifdef ATOMIC_SOURCE_BUILD
+    return true;
+#else
+    return false;
+#endif
+}
+
 }
 
 // END LICENSE MANAGEMENT

+ 2 - 0
Source/ToolCore/License/LicenseSystem.h

@@ -48,6 +48,8 @@ public:
 
     void Initialize();
 
+    bool GetSourceBuild();
+
     bool LicenseWindows() { return licenseWindows_; }
     bool LicenseMac() { return licenseMac_; }
     bool LicenseAndroid() { return licenseAndroid_; }