Browse Source

Initial mockup of the language select field in the new project dialog

Shaddock Heath 10 years ago
parent
commit
95c2061d0d

+ 10 - 5
Resources/EditorData/AtomicEditor/editor/ui/createproject.tb.txt

@@ -2,20 +2,25 @@ TBLayout: axis: y, distribution: gravity, position: left
 	TBLayout: distribution: gravity
 		TBLayout: distribution: gravity
 			TBTextField: text: "Project Name:"
-			TBLayout: gravity: left right, distribution-position: right bottom				
+			TBLayout: gravity: left right, distribution-position: right bottom
 				TBEditField: id: project_name, text: "MyGame", autofocus: 1
 					lp: min-width: 240
-		TBLayout: gravity: left right, distribution-position: right bottom				
+	TBLayout: distribution: gravity
+		TBTextField: text: "Project Language:"
+		TBLayout: gravity: left right, distribution-position: right bottom
+			TBSelectDropdown: id: project_language
+				lp: min-width: 240
+		TBLayout: gravity: left right, distribution-position: right bottom
 			TBImageWidget: id: project_image
 				lp: width: 128, height: 96
 	TBSeparator: gravity: left right, skin: AESeparator
-	TBTextField: text: "Project Directory:"		
+	TBTextField: text: "Project Directory:"
 	TBLayout: axis: y, distribution: gravity, position: left
 		TBLayout: gravity: left right, distribution-position: right bottom
 			TBEditField: id: project_path
 				lp: min-width: 380
 			TBButton: text: "Choose" id: choose_path
 	TBSeparator: gravity: left right, skin: AESeparator
-	TBLayout: 
+	TBLayout:
 		TBButton: text: Create, id: create
-		TBButton: text: Cancel, id: cancel
+		TBButton: text: Cancel, id: cancel

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

@@ -21,6 +21,7 @@ class CreateProject extends ModalWindow {
 
         this.projectPathField = <Atomic.UIEditField> this.getWidget("project_path");
         this.projectNameField = <Atomic.UIEditField> this.getWidget("project_name");
+        this.projectLanguageField = <Atomic.UISelectDropdown> this.getWidget("project_language");
         this.image = <Atomic.UIImageWidget> this.getWidget("project_image");
 
         if (!imagePath)
@@ -44,6 +45,7 @@ class CreateProject extends ModalWindow {
         }
 
         this.projectPathField.text = userDocuments;
+        this.populateLanguageSelectionList();
 
         this.resizeToFitContent();
         this.center();
@@ -139,8 +141,29 @@ class CreateProject extends ModalWindow {
         }
     }
 
+    /**
+     * Queries the json file for languages that are available to this template and populates the
+     * list.
+     */
+    populateLanguageSelectionList() {
+      this.projectLanguageFieldSource.clear();
+      var languages: string[] = ["JavaScript", "TypeScript", "CSharp"];
+
+      for (var i in languages) {
+          this.projectLanguageFieldSource.addItem(new Atomic.UISelectItem(languages[i]));
+      }
+
+      this.projectLanguageField.source = this.projectLanguageFieldSource;
+
+      // force a refresh
+      this.projectLanguageField.value = -1;
+      this.projectLanguageField.value = 0;
+    }
+
     projectPathField: Atomic.UIEditField;
     projectNameField: Atomic.UIEditField;
+    projectLanguageField: Atomic.UISelectDropdown;
+    projectLanguageFieldSource: Atomic.UISelectItemSource = new Atomic.UISelectItemSource();
     image: Atomic.UIImageWidget;
 
     templateSourceDir: string;