mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-27 05:01:38 +00:00
version gui and fixes
This commit is contained in:
parent
2c610dd59c
commit
7fa5924fca
6 changed files with 125 additions and 58 deletions
|
|
@ -14,6 +14,7 @@ import src.Util;
|
||||||
class GuiConsoleScrollCtrl extends GuiControl {
|
class GuiConsoleScrollCtrl extends GuiControl {
|
||||||
public var scrollY:Float = 0;
|
public var scrollY:Float = 0;
|
||||||
public var childrenHandleScroll:Bool = false;
|
public var childrenHandleScroll:Bool = false;
|
||||||
|
public var scrollToBottom:Bool = true;
|
||||||
|
|
||||||
var maxScrollY:Float;
|
var maxScrollY:Float;
|
||||||
|
|
||||||
|
|
@ -125,9 +126,13 @@ class GuiConsoleScrollCtrl extends GuiControl {
|
||||||
|
|
||||||
public function setScrollMax(max:Float) {
|
public function setScrollMax(max:Float) {
|
||||||
var renderRect = this.getRenderRectangle();
|
var renderRect = this.getRenderRectangle();
|
||||||
var scrollExtentY = renderRect.extent.y - 34 * Settings.uiScale;
|
if (scrollToBottom) {
|
||||||
var scrollBarYSize = (scrollExtentY * scrollExtentY / (maxScrollY * Settings.uiScale - 34 * Settings.uiScale));
|
var scrollExtentY = renderRect.extent.y - 34 * Settings.uiScale;
|
||||||
this.scrollY = scrollExtentY - scrollBarYSize * Settings.uiScale;
|
var scrollBarYSize = (scrollExtentY * scrollExtentY / (maxScrollY * Settings.uiScale - 34 * Settings.uiScale));
|
||||||
|
this.scrollY = scrollExtentY - scrollBarYSize * Settings.uiScale;
|
||||||
|
} else {
|
||||||
|
this.scrollY = 0;
|
||||||
|
}
|
||||||
this.maxScrollY = max;
|
this.maxScrollY = max;
|
||||||
this.dirty = true;
|
this.dirty = true;
|
||||||
this.updateScrollVisual();
|
this.updateScrollVisual();
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ class MainMenuGui extends GuiImage {
|
||||||
cast(this.parent, Canvas).setContent(new OptionsListGui());
|
cast(this.parent, Canvas).setContent(new OptionsListGui());
|
||||||
});
|
});
|
||||||
btnList.addButton(2, "Changelog", (sender) -> {
|
btnList.addButton(2, "Changelog", (sender) -> {
|
||||||
MarbleGame.canvas.pushDialog(new VersionGui());
|
MarbleGame.canvas.setContent(new VersionGui());
|
||||||
});
|
});
|
||||||
btnList.addButton(4, "Return to Arcade", (sender) -> {
|
btnList.addButton(4, "Return to Arcade", (sender) -> {
|
||||||
#if hl
|
#if hl
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ class ReplayCenterGui extends GuiImage {
|
||||||
.toTile());
|
.toTile());
|
||||||
scrollCtrl.position = new Vector(25, 22);
|
scrollCtrl.position = new Vector(25, 22);
|
||||||
scrollCtrl.extent = new Vector(550, 280);
|
scrollCtrl.extent = new Vector(550, 280);
|
||||||
|
scrollCtrl.scrollToBottom = false;
|
||||||
achievementsWnd.addChild(scrollCtrl);
|
achievementsWnd.addChild(scrollCtrl);
|
||||||
|
|
||||||
var replayListCtrl = new GuiTextListCtrl(arial14, replayList.map(x -> x.name));
|
var replayListCtrl = new GuiTextListCtrl(arial14, replayList.map(x -> x.name));
|
||||||
|
|
|
||||||
|
|
@ -8,85 +8,142 @@ import src.ResourceLoader;
|
||||||
import src.Settings;
|
import src.Settings;
|
||||||
|
|
||||||
class VersionGui extends GuiImage {
|
class VersionGui extends GuiImage {
|
||||||
|
var innerCtrl:GuiControl;
|
||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
var img = ResourceLoader.getImage("data/ui/motd/messagewindow.png");
|
var res = ResourceLoader.getImage("data/ui/xbox/BG_fadeOutSoftEdge.png").resource.toTile();
|
||||||
super(img.resource.toTile());
|
super(res);
|
||||||
this.horizSizing = Center;
|
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
|
||||||
this.vertSizing = Center;
|
var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
|
||||||
this.position = new Vector(4, 12);
|
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
|
||||||
this.extent = new Vector(631, 455);
|
var domcasual32 = domcasual32b.toSdfFont(cast 42 * Settings.uiScale, MultiChannel);
|
||||||
|
|
||||||
function loadButtonImages(path:String) {
|
this.horizSizing = Width;
|
||||||
var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile();
|
this.vertSizing = Height;
|
||||||
var hover = ResourceLoader.getResource('${path}_h.png', ResourceLoader.getImage, this.imageResources).toTile();
|
this.position = new Vector();
|
||||||
var pressed = ResourceLoader.getResource('${path}_d.png', ResourceLoader.getImage, this.imageResources).toTile();
|
this.extent = new Vector(640, 480);
|
||||||
return [normal, hover, pressed];
|
|
||||||
}
|
|
||||||
|
|
||||||
var dlButton = new GuiButton(loadButtonImages("data/ui/motd/ok"));
|
var scene2d = MarbleGame.canvas.scene2d;
|
||||||
dlButton.position = new Vector(500, 370);
|
|
||||||
dlButton.extent = new Vector(88, 41);
|
|
||||||
dlButton.vertSizing = Top;
|
|
||||||
dlButton.pressedAction = (sender) -> {
|
|
||||||
MarbleGame.canvas.popDialog(this);
|
|
||||||
}
|
|
||||||
this.addChild(dlButton);
|
|
||||||
|
|
||||||
var scrollCtrl = new GuiScrollCtrl(ResourceLoader.getResource("data/ui/common/philscroll.png", ResourceLoader.getImage, this.imageResources).toTile());
|
var offsetX = (scene2d.width - 1280) / 2;
|
||||||
scrollCtrl.position = new Vector(31, 30);
|
var offsetY = (scene2d.height - 720) / 2;
|
||||||
scrollCtrl.extent = new Vector(568, 317);
|
|
||||||
this.addChild(scrollCtrl);
|
|
||||||
|
|
||||||
var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt");
|
var subX = 640 - (scene2d.width - offsetX) * 640 / scene2d.width;
|
||||||
|
var subY = 480 - (scene2d.height - offsetY) * 480 / scene2d.height;
|
||||||
|
|
||||||
|
innerCtrl = new GuiControl();
|
||||||
|
innerCtrl.position = new Vector(offsetX, offsetY);
|
||||||
|
innerCtrl.extent = new Vector(640 - subX, 480 - subY);
|
||||||
|
innerCtrl.horizSizing = Width;
|
||||||
|
innerCtrl.vertSizing = Height;
|
||||||
|
this.addChild(innerCtrl);
|
||||||
|
|
||||||
|
var coliseumfontdata = ResourceLoader.getFileEntry("data/font/ColiseumRR.fnt");
|
||||||
|
var coliseumb = new BitmapFont(coliseumfontdata.entry);
|
||||||
|
@:privateAccess coliseumb.loader = ResourceLoader.loader;
|
||||||
|
var coliseum = coliseumb.toSdfFont(cast 44 * Settings.uiScale, MultiChannel);
|
||||||
|
|
||||||
|
var rootTitle = new GuiText(coliseum);
|
||||||
|
rootTitle.position = new Vector(100, 30);
|
||||||
|
rootTitle.extent = new Vector(1120, 80);
|
||||||
|
rootTitle.text.textColor = 0xFFFFFF;
|
||||||
|
rootTitle.text.text = "CHANGELOG";
|
||||||
|
rootTitle.text.alpha = 0.5;
|
||||||
|
innerCtrl.addChild(rootTitle);
|
||||||
|
|
||||||
|
var wnd = new GuiImage(ResourceLoader.getResource("data/ui/xbox/helpWindow.png", ResourceLoader.getImage, this.imageResources).toTile());
|
||||||
|
wnd.position = new Vector(260, 107);
|
||||||
|
wnd.extent = new Vector(736, 460);
|
||||||
|
wnd.horizSizing = Right;
|
||||||
|
wnd.vertSizing = Bottom;
|
||||||
|
innerCtrl.addChild(wnd);
|
||||||
|
|
||||||
|
var arial14fontdata = ResourceLoader.getFileEntry("data/font/Arial Bold.fnt");
|
||||||
var arial14b = new BitmapFont(arial14fontdata.entry);
|
var arial14b = new BitmapFont(arial14fontdata.entry);
|
||||||
@:privateAccess arial14b.loader = ResourceLoader.loader;
|
@:privateAccess arial14b.loader = ResourceLoader.loader;
|
||||||
var arial14 = arial14b.toSdfFont(cast 14 * Settings.uiScale, MultiChannel);
|
var arial14 = arial14b.toSdfFont(cast 21 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel);
|
||||||
var arial16 = arial14b.toSdfFont(cast 14 * Settings.uiScale, MultiChannel);
|
var arial14big = arial14b.toSdfFont(cast 30 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel);
|
||||||
|
var arial14med = arial14b.toSdfFont(cast 26 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel);
|
||||||
|
|
||||||
var markerFelt32fontdata = ResourceLoader.getFileEntry("data/font/MarkerFelt.fnt");
|
var bottomBar = new GuiControl();
|
||||||
var markerFelt32b = new BitmapFont(markerFelt32fontdata.entry);
|
bottomBar.position = new Vector(0, 590);
|
||||||
@:privateAccess markerFelt32b.loader = ResourceLoader.loader;
|
bottomBar.extent = new Vector(640, 200);
|
||||||
var markerFelt32 = markerFelt32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
bottomBar.horizSizing = Width;
|
||||||
var markerFelt24 = markerFelt32b.toSdfFont(cast 18 * Settings.uiScale, MultiChannel);
|
bottomBar.vertSizing = Bottom;
|
||||||
var markerFelt18 = markerFelt32b.toSdfFont(cast 14 * Settings.uiScale, MultiChannel);
|
innerCtrl.addChild(bottomBar);
|
||||||
|
|
||||||
|
var backButton = new GuiXboxButton("Ok", 160);
|
||||||
|
backButton.position = new Vector(960, 0);
|
||||||
|
backButton.vertSizing = Bottom;
|
||||||
|
backButton.horizSizing = Right;
|
||||||
|
backButton.gamepadAccelerator = ["OK"];
|
||||||
|
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new MainMenuGui());
|
||||||
|
bottomBar.addChild(backButton);
|
||||||
|
|
||||||
|
var textCtrl = new GuiConsoleScrollCtrl(ResourceLoader.getResource("data/ui/common/osxscroll.png", ResourceLoader.getImage, this.imageResources)
|
||||||
|
.toTile());
|
||||||
|
textCtrl.position = new Vector(30, 33);
|
||||||
|
textCtrl.extent = new Vector(683, 403);
|
||||||
|
textCtrl.scrollToBottom = false;
|
||||||
|
wnd.addChild(textCtrl);
|
||||||
|
|
||||||
function mlFontLoader(text:String) {
|
function mlFontLoader(text:String) {
|
||||||
switch (text) {
|
switch (text) {
|
||||||
case "MarkerFelt32":
|
case "ArialBig":
|
||||||
return markerFelt32;
|
return arial14big;
|
||||||
case "MarkerFelt24":
|
case "ArialMed":
|
||||||
return markerFelt24;
|
return arial14med;
|
||||||
case "MarkerFelt18":
|
|
||||||
return markerFelt18;
|
|
||||||
case "Arial16":
|
|
||||||
return arial14;
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return arial14;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var changelogContent = new GuiMLText(markerFelt18, mlFontLoader);
|
var wndTxtBg = new GuiMLText(arial14, mlFontLoader);
|
||||||
changelogContent.position = new Vector(0, 0);
|
wndTxtBg.position = new Vector(2, 7);
|
||||||
changelogContent.extent = new Vector(566, 317);
|
wndTxtBg.extent = new Vector(683, 343);
|
||||||
changelogContent.text.textColor = 0;
|
wndTxtBg.text.textColor = 0x101010;
|
||||||
changelogContent.scrollable = true;
|
wndTxtBg.text.text = "Loading changelog, please wait.<br/>";
|
||||||
changelogContent.text.text = "Loading changelog, please wait.<br/>";
|
wndTxtBg.scrollable = true;
|
||||||
|
textCtrl.addChild(wndTxtBg);
|
||||||
|
|
||||||
|
var wndTxt = new GuiMLText(arial14, mlFontLoader);
|
||||||
|
wndTxt.position = new Vector(0, 5);
|
||||||
|
wndTxt.extent = new Vector(683, 343);
|
||||||
|
wndTxt.text.textColor = 0xEBEBEB;
|
||||||
|
wndTxt.text.text = "Loading changelog, please wait.<br/>";
|
||||||
|
wndTxt.scrollable = true;
|
||||||
|
textCtrl.addChild(wndTxt);
|
||||||
|
|
||||||
Http.get("https://raw.githubusercontent.com/RandomityGuy/MBHaxe/master/CHANGELOG.md", (res) -> {
|
Http.get("https://raw.githubusercontent.com/RandomityGuy/MBHaxe/master/CHANGELOG.md", (res) -> {
|
||||||
var mdtext = res.toString();
|
var mdtext = res.toString();
|
||||||
var res = "";
|
var res = "";
|
||||||
changelogContent.text.text = "";
|
wndTxt.text.text = "";
|
||||||
|
wndTxtBg.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="ArialMed">' + line + "</font>";
|
||||||
}
|
}
|
||||||
res += line + "<br/>";
|
res += line + "<br/>";
|
||||||
}
|
}
|
||||||
changelogContent.text.text += res;
|
wndTxt.text.text += res;
|
||||||
scrollCtrl.setScrollMax(changelogContent.text.textHeight);
|
wndTxtBg.text.text += res;
|
||||||
|
textCtrl.setScrollMax(wndTxt.text.textHeight);
|
||||||
}, (e) -> {
|
}, (e) -> {
|
||||||
changelogContent.text.text = "Failed to fetch changelog.";
|
wndTxt.text.text = "Failed to fetch changelog.";
|
||||||
|
wndTxtBg.text.text = "Failed to fetch changelog.";
|
||||||
});
|
});
|
||||||
scrollCtrl.addChild(changelogContent);
|
}
|
||||||
|
|
||||||
|
override function onResize(width:Int, height:Int) {
|
||||||
|
var offsetX = (width - 1280) / 2;
|
||||||
|
var offsetY = (height - 720) / 2;
|
||||||
|
|
||||||
|
var subX = 640 - (width - offsetX) * 640 / width;
|
||||||
|
var subY = 480 - (height - offsetY) * 480 / height;
|
||||||
|
innerCtrl.position = new Vector(offsetX, offsetY);
|
||||||
|
innerCtrl.extent = new Vector(640 - subX, 480 - subY);
|
||||||
|
|
||||||
|
super.onResize(width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -180,6 +180,7 @@ class MissionElementItem extends MissionElementBase {
|
||||||
var collideable:String;
|
var collideable:String;
|
||||||
var isStatic:String;
|
var isStatic:String;
|
||||||
var rotate:String;
|
var rotate:String;
|
||||||
|
var permanent:String;
|
||||||
var showhelponpickup:String;
|
var showhelponpickup:String;
|
||||||
var timebonus:Null<String>;
|
var timebonus:Null<String>;
|
||||||
var timepenalty:Null<String>;
|
var timepenalty:Null<String>;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package shapes;
|
package shapes;
|
||||||
|
|
||||||
|
import mis.MisParser;
|
||||||
import dts.DtsFile;
|
import dts.DtsFile;
|
||||||
import src.ResourceLoader;
|
import src.ResourceLoader;
|
||||||
import mis.MissionElement.MissionElementItem;
|
import mis.MissionElement.MissionElementItem;
|
||||||
|
|
@ -19,6 +20,8 @@ class AntiGravity extends PowerUp {
|
||||||
this.autoUse = true;
|
this.autoUse = true;
|
||||||
this.useInstancing = true;
|
this.useInstancing = true;
|
||||||
this.animateSubObjectOpacities = true;
|
this.animateSubObjectOpacities = true;
|
||||||
|
if (MisParser.parseBoolean(element.permanent))
|
||||||
|
norespawn = true;
|
||||||
if (norespawn)
|
if (norespawn)
|
||||||
this.cooldownDuration = Math.NEGATIVE_INFINITY;
|
this.cooldownDuration = Math.NEGATIVE_INFINITY;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue