Browse Source

Resurrecting About dialog

Josh Engebretson 10 years ago
parent
commit
2234f50b0a

+ 1 - 0
Script/AtomicEditor/tsconfig.json

@@ -46,6 +46,7 @@
         "./ui/license/ActivationWindow.ts",
         "./ui/license/EULAWindow.ts",
         "./ui/menus/MenuItemSources.ts",
+        "./ui/modal/About.ts",
         "./ui/modal/CreateProject.ts",
         "./ui/modal/MessageModal.ts",
         "./ui/modal/ModalOps.ts",

+ 7 - 0
Script/AtomicEditor/ui/MainFrameMenu.ts

@@ -19,6 +19,13 @@ class MainFrameMenu extends Atomic.ScriptObject {
 
         if (target.id == "menu atomic editor popup") {
 
+            if (refid == "about atomic editor") {
+
+                EditorUI.getModelOps().showAbout();
+
+                return true;
+            }
+
             if (refid == "quit") {
 
                 this.sendEvent(EditorEvents.Quit);

+ 1 - 1
Script/AtomicEditor/ui/license/EULAWindow.ts

@@ -21,7 +21,7 @@ class EULAWindow extends ModalWindow {
         var container = this.getWidget("tabcontainer");
         container.value = 0;
 
-        var cache = Atomic.getResourceCache();
+        var cache = Atomic.cache;
 
         var file = cache.getFile("AtomicEditor/eulas/atomic_game_engine_eula.txt");
         this.age_license.text = file.readText();

+ 102 - 0
Script/AtomicEditor/ui/modal/About.ts

@@ -0,0 +1,102 @@
+
+import EditorUI = require("../EditorUI");
+import ModalWindow = require("./ModalWindow");
+
+class About extends ModalWindow {
+
+    constructor() {
+
+        super();
+
+        // we're not calling this.init here as it calls resizeToFitContent
+        // and center, which screw up the generated About text being resized
+
+        this.text = "About the Atomic Game Engine";
+        this.load("AtomicEditor/editor/ui/about.tb.txt");
+
+        this.age_license = <Atomic.UIEditField> this.getWidget("age_license");
+        this.thirdparty_license = <Atomic.UIEditField> this.getWidget("thirdparty_license");
+        this.externaltool_license = <Atomic.UIEditField> this.getWidget("externaltool_license");
+        this.about_text = <Atomic.UIEditField> this.getWidget("about_text");
+
+        var cache = Atomic.cache;
+
+        var file = cache.getFile("AtomicEditor/eulas/atomic_game_engine_eula.txt");
+        this.age_license.text = file.readText();
+
+        file = cache.getFile("AtomicEditor/eulas/atomic_thirdparty_eula.txt");
+        this.thirdparty_license.text = file.readText();
+
+        file = cache.getFile("AtomicEditor/eulas/atomic_external_tools_eula.txt");
+        this.externaltool_license.text = file.readText();
+
+        this.about_text.text = this.generateAboutText();
+
+        var get_pro = <Atomic.UIButton> this.getWidget("purchase_pro");
+        if (get_pro) {
+            get_pro.onClick = function() {
+                Atomic.fileSystem.systemOpen("https://store.atomicgameengine.com/site");
+            }
+        }
+
+        this.resizeToFitContent();
+        this.center();
+
+        this.getWidget("tabcontainer").value = 0;
+
+    }
+
+    handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
+
+        if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
+
+            var id = ev.target.id;
+
+            if (id == "ok") {
+                this.hide();
+                return true;
+            }
+        }
+    }
+
+
+    generateAboutText(): string {
+
+        var text = "";
+
+        text += "<widget TBImageWidget: filename: 'AtomicEditor/editor/images/atomic_logo.png'>\n\n";
+        text += "<color #D4FB79>Version  0.1.p0</color>\n\n";
+        text += "(c) 2014-2015 THUNDERBEAST GAMES LLC\n\n\n";
+
+        text += "<color #D4FB79>Installed platforms and modules:</color>\n\n";
+
+        if (ToolCore.licenseSystem.isStandardLicense()) {
+            text += "    <widget TBSkinImage: skin: 'LogoMac-Small'> <widget TBSkinImage: skin: 'LogoWindows-Small'> <widget TBSkinImage: skin: 'Module2D-Small'>\n\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: 'Get Pro' skin: 'TBButton.greentext' id: 'purchase_pro' >\n\n\n";
+        }
+        else {
+            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";
+        text += "    The Urho3D Project - http://urho3d.github.io\n\n";
+        text += "    Sami Vaarala - http://www.duktape.org";
+
+        return text;
+
+    }
+
+    age_license: Atomic.UIEditField;
+    thirdparty_license: Atomic.UIEditField;
+    externaltool_license: Atomic.UIEditField;
+    about_text: Atomic.UIEditField;
+
+}
+
+export = About;

+ 0 - 3
Script/AtomicEditor/ui/modal/CreateProject.ts

@@ -130,9 +130,6 @@ class CreateProject extends ModalWindow {
                 return true;
 
             }
-
-
-
         }
     }
 

+ 54 - 42
Script/AtomicEditor/ui/modal/ModalOps.ts

@@ -1,5 +1,6 @@
 import EditorUI = require("../EditorUI");
 import ModalWindow = require("./ModalWindow");
+import About = require("./About");
 import NewProject = require("./NewProject");
 import CreateProject = require("./CreateProject");
 
@@ -21,84 +22,84 @@ class ModalOps extends Atomic.ScriptObject {
 
     }
 
-    showCreateProject(projectTemplateFolder:string) {
+    showCreateProject(projectTemplateFolder: string) {
 
-      if (this.show()) {
+        if (this.show()) {
 
-          this.opWindow = new CreateProject(projectTemplateFolder);
+            this.opWindow = new CreateProject(projectTemplateFolder);
 
-      }
+        }
 
     }
 
-    showCreateFolder(resourcePath:string) {
+    showCreateFolder(resourcePath: string) {
 
-      if (this.show()) {
+        if (this.show()) {
 
-          this.opWindow = new UIResourceOps.CreateFolder(resourcePath);
+            this.opWindow = new UIResourceOps.CreateFolder(resourcePath);
 
-      }
+        }
 
     }
 
-    showCreateComponent(resourcePath:string) {
+    showCreateComponent(resourcePath: string) {
 
-      if (this.show()) {
+        if (this.show()) {
 
-          this.opWindow = new UIResourceOps.CreateComponent(resourcePath);
+            this.opWindow = new UIResourceOps.CreateComponent(resourcePath);
 
-      }
+        }
 
     }
 
-    showCreateScript(resourcePath:string) {
+    showCreateScript(resourcePath: string) {
 
-      if (this.show()) {
+        if (this.show()) {
 
-          this.opWindow = new UIResourceOps.CreateScript(resourcePath);
+            this.opWindow = new UIResourceOps.CreateScript(resourcePath);
 
-      }
+        }
 
     }
 
-    showCreateScene(resourcePath:string) {
+    showCreateScene(resourcePath: string) {
 
-      if (this.show()) {
+        if (this.show()) {
 
-          this.opWindow = new UIResourceOps.CreateScene(resourcePath);
+            this.opWindow = new UIResourceOps.CreateScene(resourcePath);
 
-      }
+        }
 
     }
 
-    showCreateMaterial(resourcePath:string) {
+    showCreateMaterial(resourcePath: string) {
 
-      if (this.show()) {
+        if (this.show()) {
 
-          this.opWindow = new UIResourceOps.CreateMaterial(resourcePath);
+            this.opWindow = new UIResourceOps.CreateMaterial(resourcePath);
 
-      }
+        }
 
     }
 
 
-    showResourceDelete(asset:ToolCore.Asset) {
+    showResourceDelete(asset: ToolCore.Asset) {
 
-      if (this.show()) {
+        if (this.show()) {
 
-          this.opWindow = new UIResourceOps.ResourceDelete(asset);
+            this.opWindow = new UIResourceOps.ResourceDelete(asset);
 
-      }
+        }
 
     }
 
-    showResourceSelection(windowText:string, importerType:string, callback: (asset: ToolCore.Asset, args:any) => void, args:any = undefined) {
+    showResourceSelection(windowText: string, importerType: string, callback: (asset: ToolCore.Asset, args: any) => void, args: any = undefined) {
 
-      if (this.show()) {
+        if (this.show()) {
 
-          this.opWindow = new ResourceSelection(windowText, importerType, callback, args);
+            this.opWindow = new ResourceSelection(windowText, importerType, callback, args);
 
-      }
+        }
 
     }
 
@@ -113,31 +114,42 @@ class ModalOps extends Atomic.ScriptObject {
 
     showEULAWindow() {
 
-      if (this.show()) {
+        if (this.show()) {
 
-          this.opWindow = new EULAWindow();
+            this.opWindow = new EULAWindow();
 
-      }
+        }
 
     }
 
     showActivationWindow() {
 
-      if (this.show()) {
+        if (this.show()) {
 
-          this.opWindow = new ActivationWindow();
+            this.opWindow = new ActivationWindow();
 
-      }
+        }
 
     }
 
+    showAbout() {
+
+        if (this.show()) {
+
+            this.opWindow = new About();
+
+        }
+
+    }
+
+
     showActivationSuccessWindow() {
 
-      if (this.show()) {
+        if (this.show()) {
 
-          this.opWindow = new ActivationSuccessWindow();
+            this.opWindow = new ActivationSuccessWindow();
 
-      }
+        }
 
     }
 
@@ -172,7 +184,7 @@ class ModalOps extends Atomic.ScriptObject {
             this.opWindow = null;
 
             if (window.parent)
-              window.parent.removeChild(window, false);
+                window.parent.removeChild(window, false);
 
             var view = EditorUI.getView();
             view.setFocusRecursive();

+ 2 - 2
Source/Atomic/UI/UIWidget.cpp

@@ -153,12 +153,12 @@ void UIWidget::OnDelete()
 
     widget_ = 0;
 
-    UnsubscribeFromAllEvents();
-
     VariantMap eventData;
     eventData[WidgetDeleted::P_WIDGET] = this;
     SendEvent(E_WIDGETDELETED, eventData);
 
+    UnsubscribeFromAllEvents();
+
     ReleaseRef();
 }