mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-26 12:41:40 +00:00
add changelog button
This commit is contained in:
parent
6788fa2319
commit
f6f24161fb
6 changed files with 42 additions and 31 deletions
BIN
data/ui/common/philscroll.png
Normal file
BIN
data/ui/common/philscroll.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 727 B |
BIN
data/ui/motd/motd_buttn_textless_d.png
Normal file
BIN
data/ui/motd/motd_buttn_textless_d.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
data/ui/motd/motd_buttn_textless_h.png
Normal file
BIN
data/ui/motd/motd_buttn_textless_h.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
data/ui/motd/motd_buttn_textless_n.png
Normal file
BIN
data/ui/motd/motd_buttn_textless_n.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
|
|
@ -16,6 +16,11 @@ class MainMenuGui extends GuiImage {
|
||||||
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
|
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
|
||||||
var domcasual32 = domcasual32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
var domcasual32 = domcasual32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
||||||
|
|
||||||
|
var domcasual24fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||||
|
var domcasual24b = new BitmapFont(domcasual24fontdata.entry);
|
||||||
|
@:privateAccess domcasual24b.loader = ResourceLoader.loader;
|
||||||
|
var domcasual24 = domcasual24b.toSdfFont(cast 20 * Settings.uiScale, MultiChannel);
|
||||||
|
|
||||||
this.horizSizing = Width;
|
this.horizSizing = Width;
|
||||||
this.vertSizing = Height;
|
this.vertSizing = Height;
|
||||||
this.position = new Vector();
|
this.position = new Vector();
|
||||||
|
|
@ -80,10 +85,23 @@ class MainMenuGui extends GuiImage {
|
||||||
};
|
};
|
||||||
homebase.addChild(exitButton);
|
homebase.addChild(exitButton);
|
||||||
|
|
||||||
|
var changelogButton = new GuiButtonText(loadButtonImages("data/ui/motd/motd_buttn_textless"), domcasual24);
|
||||||
|
changelogButton.txtCtrl.text.text = "Changelog";
|
||||||
|
changelogButton.txtCtrl.text.textColor = 0;
|
||||||
|
changelogButton.ratio = 0.35;
|
||||||
|
changelogButton.horizSizing = Left;
|
||||||
|
changelogButton.vertSizing = Top;
|
||||||
|
changelogButton.position = new Vector(530, 394);
|
||||||
|
changelogButton.setExtent(new Vector(106, 85));
|
||||||
|
changelogButton.pressedAction = (sender) -> {
|
||||||
|
MarbleGame.canvas.pushDialog(new VersionGui());
|
||||||
|
}
|
||||||
|
this.addChild(changelogButton);
|
||||||
|
|
||||||
var kofi = new GuiButton(loadButtonImages("data/ui/kofi1"));
|
var kofi = new GuiButton(loadButtonImages("data/ui/kofi1"));
|
||||||
kofi.horizSizing = Left;
|
kofi.horizSizing = Left;
|
||||||
kofi.vertSizing = Top;
|
kofi.vertSizing = Top;
|
||||||
kofi.position = new Vector(473, 424);
|
kofi.position = new Vector(473, 354);
|
||||||
kofi.extent = new Vector(143, 36);
|
kofi.extent = new Vector(143, 36);
|
||||||
kofi.pressedAction = (sender) -> {
|
kofi.pressedAction = (sender) -> {
|
||||||
#if sys
|
#if sys
|
||||||
|
|
@ -98,7 +116,7 @@ class MainMenuGui extends GuiImage {
|
||||||
var github = new GuiButton(loadButtonImages("data/ui/github"));
|
var github = new GuiButton(loadButtonImages("data/ui/github"));
|
||||||
github.horizSizing = Left;
|
github.horizSizing = Left;
|
||||||
github.vertSizing = Top;
|
github.vertSizing = Top;
|
||||||
github.position = new Vector(522, 380);
|
github.position = new Vector(522, 310);
|
||||||
github.extent = new Vector(94, 38);
|
github.extent = new Vector(94, 38);
|
||||||
github.pressedAction = (sender) -> {
|
github.pressedAction = (sender) -> {
|
||||||
#if sys
|
#if sys
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,17 @@ import src.Settings;
|
||||||
|
|
||||||
class VersionGui extends GuiImage {
|
class VersionGui extends GuiImage {
|
||||||
public function new() {
|
public function new() {
|
||||||
var img = ResourceLoader.getImage("data/ui/motd/messagewindow.png");
|
var img = ResourceLoader.getImage("data/ui/help/help_gui.png");
|
||||||
super(img.resource.toTile());
|
super(img.resource.toTile());
|
||||||
this.horizSizing = Center;
|
this.horizSizing = Center;
|
||||||
this.vertSizing = Center;
|
this.vertSizing = Center;
|
||||||
this.position = new Vector(4, 12);
|
this.position = new Vector(4, 12);
|
||||||
this.extent = new Vector(631, 455);
|
this.extent = new Vector(609, 460);
|
||||||
|
|
||||||
|
var helpWindow = new GuiImage(ResourceLoader.getResource("data/ui/help/help_window.png", ResourceLoader.getImage, this.imageResources).toTile());
|
||||||
|
helpWindow.position = new Vector(30, 31);
|
||||||
|
helpWindow.extent = new Vector(549, 338);
|
||||||
|
this.addChild(helpWindow);
|
||||||
|
|
||||||
function loadButtonImages(path:String) {
|
function loadButtonImages(path:String) {
|
||||||
var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile();
|
var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
|
|
@ -23,19 +28,20 @@ class VersionGui extends GuiImage {
|
||||||
return [normal, hover, pressed];
|
return [normal, hover, pressed];
|
||||||
}
|
}
|
||||||
|
|
||||||
var dlButton = new GuiButton(loadButtonImages("data/ui/motd/ok"));
|
var homeButton = new GuiButton(loadButtonImages("data/ui/play/back"));
|
||||||
dlButton.position = new Vector(500, 370);
|
homeButton.position = new Vector(278, 378);
|
||||||
dlButton.extent = new Vector(88, 41);
|
homeButton.extent = new Vector(79, 61);
|
||||||
dlButton.vertSizing = Top;
|
homeButton.accelerator = hxd.Key.ESCAPE;
|
||||||
dlButton.pressedAction = (sender) -> {
|
homeButton.gamepadAccelerator = ["B"];
|
||||||
|
homeButton.pressedAction = (sender) -> {
|
||||||
MarbleGame.canvas.popDialog(this);
|
MarbleGame.canvas.popDialog(this);
|
||||||
}
|
}
|
||||||
this.addChild(dlButton);
|
this.addChild(homeButton);
|
||||||
|
|
||||||
var scrollCtrl = new GuiScrollCtrl(ResourceLoader.getResource("data/ui/common/philscroll.png", ResourceLoader.getImage, this.imageResources).toTile());
|
var scrollCtrl = new GuiScrollCtrl(ResourceLoader.getResource("data/ui/common/philscroll.png", ResourceLoader.getImage, this.imageResources).toTile());
|
||||||
scrollCtrl.position = new Vector(31, 30);
|
scrollCtrl.position = new Vector(31, 30);
|
||||||
scrollCtrl.extent = new Vector(568, 317);
|
scrollCtrl.extent = new Vector(509, 298);
|
||||||
this.addChild(scrollCtrl);
|
helpWindow.addChild(scrollCtrl);
|
||||||
|
|
||||||
var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt");
|
var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt");
|
||||||
var arial14b = new BitmapFont(arial14fontdata.entry);
|
var arial14b = new BitmapFont(arial14fontdata.entry);
|
||||||
|
|
@ -43,21 +49,8 @@ class VersionGui extends GuiImage {
|
||||||
var arial14 = arial14b.toSdfFont(cast 14 * Settings.uiScale, MultiChannel);
|
var arial14 = arial14b.toSdfFont(cast 14 * Settings.uiScale, MultiChannel);
|
||||||
var arial16 = arial14b.toSdfFont(cast 14 * Settings.uiScale, MultiChannel);
|
var arial16 = arial14b.toSdfFont(cast 14 * Settings.uiScale, MultiChannel);
|
||||||
|
|
||||||
var markerFelt32fontdata = ResourceLoader.getFileEntry("data/font/MarkerFelt.fnt");
|
|
||||||
var markerFelt32b = new BitmapFont(markerFelt32fontdata.entry);
|
|
||||||
@:privateAccess markerFelt32b.loader = ResourceLoader.loader;
|
|
||||||
var markerFelt32 = markerFelt32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
|
||||||
var markerFelt24 = markerFelt32b.toSdfFont(cast 18 * Settings.uiScale, MultiChannel);
|
|
||||||
var markerFelt18 = markerFelt32b.toSdfFont(cast 14 * Settings.uiScale, MultiChannel);
|
|
||||||
|
|
||||||
function mlFontLoader(text:String) {
|
function mlFontLoader(text:String) {
|
||||||
switch (text) {
|
switch (text) {
|
||||||
case "MarkerFelt32":
|
|
||||||
return markerFelt32;
|
|
||||||
case "MarkerFelt24":
|
|
||||||
return markerFelt24;
|
|
||||||
case "MarkerFelt18":
|
|
||||||
return markerFelt18;
|
|
||||||
case "Arial16":
|
case "Arial16":
|
||||||
return arial14;
|
return arial14;
|
||||||
default:
|
default:
|
||||||
|
|
@ -65,20 +58,20 @@ class VersionGui extends GuiImage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var changelogContent = new GuiMLText(markerFelt18, mlFontLoader);
|
var changelogContent = new GuiMLText(arial14, mlFontLoader);
|
||||||
changelogContent.position = new Vector(0, 0);
|
changelogContent.position = new Vector(0, 0);
|
||||||
changelogContent.extent = new Vector(566, 317);
|
changelogContent.extent = new Vector(500, 298);
|
||||||
changelogContent.text.textColor = 0;
|
changelogContent.text.textColor = 0;
|
||||||
changelogContent.scrollable = true;
|
changelogContent.scrollable = true;
|
||||||
changelogContent.text.text = "Loading changelog, please wait.<br/>";
|
changelogContent.text.text = "Loading changelog, please wait.<br/>";
|
||||||
Http.get("https://raw.githubusercontent.com/RandomityGuy/MBHaxe/master/CHANGELOG.md", (res) -> {
|
Http.get("https://raw.githubusercontent.com/RandomityGuy/MBHaxe/mbg/CHANGELOG.md", (res) -> {
|
||||||
var mdtext = res.toString();
|
var mdtext = res.toString();
|
||||||
var res = "";
|
var res = "";
|
||||||
changelogContent.text.text = "";
|
changelogContent.text.text = "";
|
||||||
for (line in mdtext.split("\n")) {
|
for (line in mdtext.split("\n")) {
|
||||||
if (StringTools.startsWith(line, "#")) {
|
if (StringTools.startsWith(line, "#")) {
|
||||||
line = StringTools.replace(line, "#", "");
|
line = StringTools.replace(line, "#", "");
|
||||||
line = '<font face="MarkerFelt24">' + line + "</font>";
|
line = '<font face="Arial16">' + line + "</font>";
|
||||||
}
|
}
|
||||||
res += line + "<br/>";
|
res += line + "<br/>";
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +84,7 @@ class VersionGui extends GuiImage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function checkVersion() {
|
public static function checkVersion() {
|
||||||
Http.get("https://raw.githubusercontent.com/RandomityGuy/MBHaxe/master/CHANGELOG.md", (res) -> {
|
Http.get("https://raw.githubusercontent.com/RandomityGuy/MBHaxe/mbg/CHANGELOG.md", (res) -> {
|
||||||
var mdtext = res.toString();
|
var mdtext = res.toString();
|
||||||
var firstline = mdtext.split("\n")[0];
|
var firstline = mdtext.split("\n")[0];
|
||||||
firstline = StringTools.replace(firstline, "#", "");
|
firstline = StringTools.replace(firstline, "#", "");
|
||||||
|
|
@ -100,7 +93,7 @@ class VersionGui extends GuiImage {
|
||||||
// We need to update lol
|
// We need to update lol
|
||||||
var mbo = new MessageBoxOkDlg("New version available! Please update your game.", () -> {
|
var mbo = new MessageBoxOkDlg("New version available! Please update your game.", () -> {
|
||||||
#if sys
|
#if sys
|
||||||
hxd.System.openURL("https://github.com/RandomityGuy/MBHaxe/blob/master/README.md");
|
hxd.System.openURL("https://github.com/RandomityGuy/MBHaxe/blob/mbg/README.md");
|
||||||
#end
|
#end
|
||||||
});
|
});
|
||||||
MarbleGame.canvas.pushDialog(mbo);
|
MarbleGame.canvas.pushDialog(mbo);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue