Browse Source

added assets, cleaned up some lint errors in typescript plugin, renamed typescript based plugin

Shaddock Heath 9 years ago
parent
commit
7480b51b4b

+ 1 - 1
EditorPluginExample/Resources/EditorData/Example.plugin.js.asset → EditorPluginExample/Resources/EditorData/JSExample.plugin.js.asset

@@ -1,6 +1,6 @@
 {
 	"version": 1,
-	"guid": "665b59fc3e7bd25a1a84d570adf55008",
+	"guid": "f2e4e2ea099058e4f68fbab37045b4c1",
 	"JavascriptImporter": {
 		"IsComponentFile": false
 	}

+ 21 - 18
EditorPluginExample/Resources/EditorData/Example.plugin.js → EditorPluginExample/Resources/EditorData/TSExample.plugin.js

@@ -1,15 +1,17 @@
-var ExamplePluginUILabel = "Example Plugin";
+"use strict";
+var ExamplePluginUILabel = "TS Example Plugin";
 var ExamplePluginTBPath = "EditorData/Example.tb.txt";
-var ExamplePluginService = (function () {
-    function ExamplePluginService() {
+var TSExamplePluginService = (function () {
+    function TSExamplePluginService() {
         var _this = this;
-        this.name = "ExampleService";
-        this.description = "This service demonstrates plugin functionality functionality.";
+        this.name = "TSExampleService";
+        this.description = "This service demonstrates plugin functionality written in TypeScript.";
         this.serviceLocator = null;
         this.extensionWindow = null;
         this.handleWidgetEvent = function (ev) {
-            if (!_this.extensionWindow)
+            if (!_this.extensionWindow) {
                 return;
+            }
             if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
                 if (ev.target.id == "example_cancel") {
                     _this.extensionWindow.hide();
@@ -24,7 +26,7 @@ var ExamplePluginService = (function () {
             return false;
         };
     }
-    ExamplePluginService.prototype.initialize = function (serviceLoader) {
+    TSExamplePluginService.prototype.initialize = function (serviceLoader) {
         Atomic.print("ExamplePluginService.initialize");
         this.serviceLocator = (serviceLoader);
         if (this.serviceLocator) {
@@ -32,7 +34,7 @@ var ExamplePluginService = (function () {
             this.serviceLocator.uiServices.register(this);
         }
     };
-    ExamplePluginService.prototype.projectUnloaded = function () {
+    TSExamplePluginService.prototype.projectUnloaded = function () {
         this.serviceLocator.uiServices.removePluginMenuItemSource(ExamplePluginUILabel);
         Atomic.print("ExamplePluginService.projectUnloaded");
         if (this.serviceLocator) {
@@ -40,30 +42,31 @@ var ExamplePluginService = (function () {
             this.serviceLocator.uiServices.unregister(this);
         }
     };
-    ExamplePluginService.prototype.projectLoaded = function (ev) {
+    TSExamplePluginService.prototype.projectLoaded = function (ev) {
         Atomic.print("ExamplePluginService.projectLoaded");
-        var menu = this.serviceLocator.uiServices.createPluginMenuItemSource(ExamplePluginUILabel, { "Open": ["exampleplugin open"] });
+        var menu = this.serviceLocator.uiServices.createPluginMenuItemSource(ExamplePluginUILabel, { "Open": ["tsexampleplugin open"] });
     };
-    ExamplePluginService.prototype.playerStarted = function () {
+    TSExamplePluginService.prototype.playerStarted = function () {
         Atomic.print("ExamplePluginService.playerStarted");
     };
-    ExamplePluginService.prototype.menuItemClicked = function (refId) {
+    TSExamplePluginService.prototype.menuItemClicked = function (refId) {
         Atomic.print("ExamplePluginService.menuItemClicked: " + refId);
-        if (refId == "exampleplugin open") {
+        if (refId == "tsexampleplugin open") {
             this.extensionWindow = this.serviceLocator.uiServices.showModalWindow(ExamplePluginUILabel, ExamplePluginTBPath, this.handleWidgetEvent);
             this.getWidgets();
             return true;
         }
         return false;
     };
-    ExamplePluginService.prototype.getWidgets = function () {
-        if (!this.extensionWindow)
+    TSExamplePluginService.prototype.getWidgets = function () {
+        if (!this.extensionWindow) {
             return;
+        }
         this.helloLabel = this.extensionWindow.getWidget("example_hello");
         this.nameField = this.extensionWindow.getWidget("example_name");
     };
-    return ExamplePluginService;
-})();
-var examplePluginService = new ExamplePluginService();
+    return TSExamplePluginService;
+}());
+var examplePluginService = new TSExamplePluginService();
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.default = examplePluginService;

+ 7 - 0
EditorPluginExample/Resources/EditorData/TSExample.plugin.js.asset

@@ -0,0 +1,7 @@
+{
+	"version": 1,
+	"guid": "6b7a00860900ce07eafd89703f8dca1a",
+	"JavascriptImporter": {
+		"IsComponentFile": false
+	}
+}

+ 15 - 13
EditorPluginExample/Resources/EditorData/Example.plugin.ts → EditorPluginExample/Resources/EditorData/TSExample.plugin.ts

@@ -1,13 +1,13 @@
 /// <reference path="../../typings/Atomic/AtomicWork.d.ts" />
 /// <reference path="../../typings/Atomic/EditorWork.d.ts" />
 
-const ExamplePluginUILabel = "Example Plugin";
+const ExamplePluginUILabel = "TS Example Plugin";
 const ExamplePluginTBPath = "EditorData/Example.tb.txt";
 
-class ExamplePluginService implements Editor.HostExtensions.HostEditorService, Editor.HostExtensions.ProjectServicesEventListener, Editor.HostExtensions.UIServicesEventListener {
+class TSExamplePluginService implements Editor.HostExtensions.HostEditorService, Editor.HostExtensions.ProjectServicesEventListener, Editor.HostExtensions.UIServicesEventListener {
 
-    name: string = "ExampleService";
-    description: string = "This service demonstrates plugin functionality functionality.";
+    name: string = "TSExampleService";
+    description: string = "This service demonstrates plugin functionality written in TypeScript.";
 
     private serviceLocator: Editor.HostExtensions.HostServiceLocator = null;
     private extensionWindow: Editor.Modal.ExtensionWindow = null;
@@ -35,7 +35,7 @@ class ExamplePluginService implements Editor.HostExtensions.HostEditorService, E
     }
     projectLoaded(ev: Editor.EditorEvents.LoadProjectEvent) {
         Atomic.print("ExamplePluginService.projectLoaded");
-        let menu = this.serviceLocator.uiServices.createPluginMenuItemSource(ExamplePluginUILabel, { "Open" : ["exampleplugin open"] });
+        let menu = this.serviceLocator.uiServices.createPluginMenuItemSource(ExamplePluginUILabel, { "Open" : ["tsexampleplugin open"] });
     }
     playerStarted() {
         Atomic.print("ExamplePluginService.playerStarted");
@@ -43,8 +43,8 @@ class ExamplePluginService implements Editor.HostExtensions.HostEditorService, E
 
     menuItemClicked(refId: string): boolean {
         Atomic.print("ExamplePluginService.menuItemClicked: " + refId);
-        
-        if (refId == "exampleplugin open") {
+
+        if (refId == "tsexampleplugin open") {
             this.extensionWindow = this.serviceLocator.uiServices.showModalWindow(
                 ExamplePluginUILabel, ExamplePluginTBPath, this.handleWidgetEvent);
             this.getWidgets();
@@ -55,16 +55,18 @@ class ExamplePluginService implements Editor.HostExtensions.HostEditorService, E
     }
 
     getWidgets() {
-        if (!this.extensionWindow)
+        if (!this.extensionWindow) {
             return;
+        }
 
         this.helloLabel = <Atomic.UITextField>this.extensionWindow.getWidget("example_hello");
         this.nameField = <Atomic.UIEditField>this.extensionWindow.getWidget("example_name");
     }
 
     handleWidgetEvent = (ev: Atomic.UIWidgetEvent): boolean => { // => notation used to bind "this" to the method
-        if (!this.extensionWindow)
+        if (!this.extensionWindow) {
             return;
+        }
 
         if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
 
@@ -76,7 +78,7 @@ class ExamplePluginService implements Editor.HostExtensions.HostEditorService, E
 
             if (ev.target.id == "example_speak") {
 
-                this.helloLabel.text = "Hello "+this.nameField.text;
+                this.helloLabel.text = "Hello " + this.nameField.text;
 
                 return true;
             }
@@ -84,8 +86,8 @@ class ExamplePluginService implements Editor.HostExtensions.HostEditorService, E
 
         return false;
 
-    }
+    };
 }
 
-const examplePluginService = new ExamplePluginService();
-export default examplePluginService;
+const examplePluginService = new TSExamplePluginService();
+export default examplePluginService;

+ 1 - 1
EditorPluginExample/Resources/EditorData/Example.plugin.ts.asset → EditorPluginExample/Resources/EditorData/TSExample.plugin.ts.asset

@@ -1,6 +1,6 @@
 {
 	"version": 1,
-	"guid": "1ee4c60ac3a41be878f1d1f2921b6ad8",
+	"guid": "0433a3791e5b64b50a98b4a4d3406bdb",
 	"TypeScriptImporter": {
 		"IsComponentFile": false
 	}

+ 1 - 1
EditorPluginExample/Resources/EditorData/tsconfig.json

@@ -12,6 +12,6 @@
         "experimentalDecorators": true
     },
     "files": [
-        "./Example.plugin.ts"
+        "./TSExample.plugin.ts"
     ]
 }