@@ -27,11 +27,12 @@ typedef Data = {
2727
2828@:build (haxe.ui. ComponentBuilder .build (" assets/mainview.xml" ))
2929class MainUI extends VBox {
30+ var solarPath = " ./.solar-engine/" ;
31+
3032 var bannerBytes : Bytes = null ;
3133 var iconBytes : Bytes = null ;
3234
3335 var options : Array <String > = [" yes" , " no" ];
34- var typeOptions : Array <String > = [" Mods" , " Scripts" ];
3536
3637 public function new () {
3738 super ();
@@ -73,8 +74,18 @@ class MainUI extends VBox {
7374 });
7475 }
7576
76- clearbtn .onClick = function (event ){
77- Dialogs .messageBox (" Are you sure?" , " QUESTION" , MessageBoxType .TYPE_YESNO , function (callback ){
77+ openPredefine .onClick = function (event ) {
78+ var dialog : PredefinedDialog = new PredefinedDialog ();
79+ dialog .showDialog ();
80+ dialog .onDialogClosed = function (e ) {
81+ if (e .button == DialogButton .APPLY ) {
82+ submitType .text = dialog .typeOptions [dialog .submitDefine .listView .selectedIndex ];
83+ }
84+ }
85+ }
86+
87+ clearbtn .onClick = function (event ) {
88+ Dialogs .messageBox (" Are you sure?" , " QUESTION" , MessageBoxType .TYPE_YESNO , function (callback ) {
7889 (callback == DialogButton .YES ) ? clearInfo () : return ;
7990 });
8091 }
@@ -106,6 +117,10 @@ class MainUI extends VBox {
106117 Dialogs .messageBox (" Missing Download URL!" , " ERROR" , MessageBoxType .TYPE_ERROR );
107118 return ;
108119 }
120+ if (submitType .text == null || submitType .text == " " ) {
121+ Dialogs .messageBox (" Missing Submit Type!" , " ERROR" , MessageBoxType .TYPE_ERROR );
122+ return ;
123+ }
109124
110125 var data : Dynamic = defaultData ();
111126 data .isOpenSource = options [isOpenSourceSelect .listView .selectedIndex ];
@@ -117,13 +132,16 @@ class MainUI extends VBox {
117132 data .githubURL = githubUrl .text ?? = " " ;
118133 data .madeByURL = madeUrl .text ?? = " " ;
119134 data .downloadURL = downloadUrl .text ;
120- data .type = typeOptions [ submitType .listView . selectedIndex ] ;
135+ data .type = submitType .text ;
121136
122- File .saveContent (" ./.solar-engine/ config.json" , Json .stringify (data ));
123- File .saveContent (" ./.solar-engine/ readme.md" , " Has to be filled in." );
137+ File .saveContent (solarPath + " config.json" , Json .stringify (data ));
138+ File .saveContent (solarPath + " readme.md" , " Has to be filled in." );
124139
125- File .saveBytes (" ./.solar-engine/banner.png" , bannerBytes );
126- File .saveBytes (" ./.solar-engine/logo.png" , iconBytes );
140+ if (genChangelog .selected )
141+ File .saveContent (solarPath + " changelog.md" , " Has to be filled in." );
142+
143+ File .saveBytes (solarPath + " banner.png" , bannerBytes );
144+ File .saveBytes (solarPath + " logo.png" , iconBytes );
127145
128146 Dialogs .messageBox (" Info Saved!" , " SUCCESS" , MessageBoxType .TYPE_INFO );
129147
@@ -147,6 +165,8 @@ class MainUI extends VBox {
147165 }
148166
149167 function clearInfo () {
168+ genChangelog .selected = false ;
169+
150170 bannerBytes = null ;
151171 iconBytes = null ;
152172
@@ -160,10 +180,10 @@ class MainUI extends VBox {
160180 externalUrl .text = " " ;
161181 madeUrl .text = " " ;
162182 downloadUrl .text = " " ;
183+ submitType .text = " " ;
163184
164185 isOpenSourceSelect .listView .selectedIndex = 0 ;
165186 messesWithPC .listView .selectedIndex = 0 ;
166- submitType .listView .selectedIndex = 0 ;
167187
168188 PreviewUI .instance .bannerPreview .resource = null ;
169189 PreviewUI .instance .iconPreview .resource = null ;
0 commit comments