Skip to content

Commit 1e526ee

Browse files
committed
New stuff
1 parent eadd1e6 commit 1e526ee

5 files changed

Lines changed: 77 additions & 30 deletions

File tree

Project.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<!-- NMML reference: https://gist.github.com/1763850 -->
44

55
<!-- metadata, make sure 'package' is at least 3 segments (ie. com.mycompany.myproject) -->
6-
<app title="Main" package="" file="Main" main="Main" version="1.0.0" company="" />
6+
<app title="Setup SolarFiles" package="" file="Setup SolarFiles" main="Main" version="0.2.0" company="net.solarengine.setupsolarfiles" />
77

88
<!--The flixel preloader is not accurate in Chrome. You can use it regualary if you embed the swf into a html file, or you can set the actual size of your file manually at "Flxpreloader-onUpdate-bytesTotal"!-->
99
<app preloader="flixel.system.FlxPreloader" />
10-
<app file="Main" path="build/flixel" />
10+
<app file="Setup SolarFiles" path="build/flixel" />
1111

1212
<!--The swf version should be at least 11.2 if you want to use the FLX_MOUSE_ADVANCED option-->
1313
<set name="SWF_VERSION" value="11.8" />

assets/mainview.xml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<vbox style="padding: 5px;">
22
<style>
3-
body{
4-
font-size: 12px;
5-
}
6-
73
.button, .textfield, .textarea, .label{
84
margin-top: 5px;
95
margin-bottom: 5px;
@@ -14,6 +10,15 @@
1410
.textfield{
1511
width: 200;
1612
}
13+
14+
.checkbox{
15+
font-size: 12px;
16+
17+
padding: 5px;
18+
19+
margin-top: 5px;
20+
margin-bottom: 20px;
21+
}
1722
</style>
1823

1924
<button text="Icon" id="iconbtn" />
@@ -28,13 +33,13 @@
2833
<label text="Made by:" verticalAlign="center" />
2934
<textfield placeholder="Some dev" id="txtMadeBy" validator="required" />
3035
<label text="Github URL:" />
31-
<textfield placeholder="https://github.com/SomeUser/repo" id="githubUrl"/>
36+
<textfield placeholder="https://github.com/SomeUser/repo" id="githubUrl" />
3237
<label text="External URL:" />
33-
<textfield placeholder="https://website.dev" id="externalUrl"/>
38+
<textfield placeholder="https://website.dev" id="externalUrl" />
3439
<label text="Madeby URL:" />
35-
<textfield placeholder="https://dev.dev" id="madeUrl"/>
40+
<textfield placeholder="https://dev.dev" id="madeUrl" />
3641
<label text="Download URL:" />
37-
<textfield placeholder="https://download.url" id="downloadUrl" validator="required"/>
42+
<textfield placeholder="https://download.url" id="downloadUrl" validator="required" />
3843

3944
<label text="Is opensource:" />
4045
<list-item-picker width="150" validator="required" id="isOpenSourceSelect">
@@ -44,25 +49,23 @@
4449
</data>
4550
</list-item-picker>
4651

47-
<label text="Messes with computer:"/>
52+
<label text="Messes with computer:" />
4853
<list-item-picker width="150" validator="required" id="messesWithPC">
4954
<data>
5055
<item text="Yes" />
5156
<item text="No" />
5257
</data>
5358
</list-item-picker>
54-
55-
<label text="Type:"/>
56-
<list-item-picker width="150" validator="required" id="submitType">
57-
<data>
58-
<item text="Mod" />
59-
<item text="Script" />
60-
</data>
61-
</list-item-picker>
6259
</grid>
6360
</hbox>
6461
<hbox>
65-
<button text="Save" id="finish"/>
66-
<button text="Clear" id="clearbtn"/>
62+
<label text="Type:" />
63+
<textfield placeholder="Mod" id="submitType" validator="required" />
64+
<button id="openPredefine" text="Predefined Types" />
65+
</hbox>
66+
<checkbox text="Has Changelog?" id="genChangelog" selected="false" />
67+
<hbox>
68+
<button text="Save" id="finish" />
69+
<button text="Clear" id="clearbtn" />
6770
</hbox>
6871
</vbox>

assets/predefined.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<dialog title="Predefined" width="300" height="150" style="font-size: 12px;">
2+
<grid>
3+
<list-item-picker width="150" id="submitDefine">
4+
<data>
5+
<item text="Mod" />
6+
<item text="Script" />
7+
<item text="Improvement" />
8+
<item text="Other" />
9+
</data>
10+
</list-item-picker>
11+
</grid>
12+
</dialog>

src/ui/MainUI.hx

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ typedef Data = {
2727

2828
@:build(haxe.ui.ComponentBuilder.build("assets/mainview.xml"))
2929
class 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;

src/ui/PredefinedDialog.hx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package ui;
2+
3+
import haxe.ui.containers.dialogs.Dialog;
4+
5+
@:build(haxe.ui.ComponentBuilder.build("assets/predefined.xml"))
6+
class PredefinedDialog extends Dialog{
7+
public var typeOptions:Array<String> = ["Mod", "Script", "Improvement", "Other"];
8+
public function new(){
9+
super();
10+
buttons = DialogButton.CANCEL | DialogButton.APPLY;
11+
}
12+
}

0 commit comments

Comments
 (0)