finish up help

This commit is contained in:
RandomityGuy 2023-06-27 00:54:23 +05:30
parent c60a62e87e
commit e05b318157
4 changed files with 226 additions and 111 deletions

BIN
data/ui/xbox/helpWindow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -0,0 +1,88 @@
package gui;
import src.MarbleGame;
import hxd.res.BitmapFont;
import h3d.Vector;
import src.ResourceLoader;
import src.Settings;
class AboutMenuOptionsGui extends GuiImage {
public function new() {
var res = ResourceLoader.getImage("data/ui/xbox/BG_fadeOutSoftEdge.png").resource.toTile();
super(res);
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
var domcasual32 = domcasual32b.toSdfFont(cast 42 * Settings.uiScale, MultiChannel);
this.horizSizing = Width;
this.vertSizing = Height;
this.position = new Vector();
this.extent = new Vector(640, 480);
var scene2d = MarbleGame.canvas.scene2d;
var offsetX = (scene2d.width - 1280) / 2;
var offsetY = (scene2d.height - 720) / 2;
var subX = 640 - (scene2d.width - offsetX) * 640 / scene2d.width;
var subY = 480 - (scene2d.height - offsetY) * 480 / scene2d.height;
var 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 = "HOW TO PLAY";
rootTitle.text.alpha = 0.5;
innerCtrl.addChild(rootTitle);
var btnList = new GuiXboxList();
btnList.position = new Vector(70 - offsetX, 165);
btnList.horizSizing = Left;
btnList.extent = new Vector(502, 500);
innerCtrl.addChild(btnList);
btnList.addButton(5, 'Marble Controls', (e) -> {
MarbleGame.canvas.setContent(new HelpCreditsGui(4));
});
btnList.addButton(5, 'Powerups', (e) -> {
MarbleGame.canvas.setContent(new HelpCreditsGui(0));
});
btnList.addButton(5, 'Blast Meter', (e) -> {
MarbleGame.canvas.setContent(new HelpCreditsGui(1));
});
btnList.addButton(5, 'Single Player Mode', (e) -> {
MarbleGame.canvas.setContent(new HelpCreditsGui(2));
});
btnList.addButton(5, 'Multiplayer Mode', (e) -> {
MarbleGame.canvas.setContent(new HelpCreditsGui(3));
});
var bottomBar = new GuiControl();
bottomBar.position = new Vector(0, 590);
bottomBar.extent = new Vector(640, 200);
bottomBar.horizSizing = Width;
bottomBar.vertSizing = Bottom;
innerCtrl.addChild(bottomBar);
var backButton = new GuiXboxButton("Back", 160);
backButton.position = new Vector(400, 0);
backButton.vertSizing = Bottom;
backButton.horizSizing = Right;
backButton.gamepadAccelerator = ["B"];
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new OptionsListGui());
bottomBar.addChild(backButton);
}
}

View file

@ -1,5 +1,6 @@
package gui; package gui;
import gui.GuiControl.MouseState;
import h2d.Scene; import h2d.Scene;
import h3d.shader.AlphaChannel; import h3d.shader.AlphaChannel;
import src.DtsObject; import src.DtsObject;
@ -12,129 +13,151 @@ import src.Settings;
import src.Util; import src.Util;
class HelpCreditsGui extends GuiImage { class HelpCreditsGui extends GuiImage {
var manualPageList:GuiTextListCtrl; var wndTxt:GuiMLText;
var wndTxtBg:GuiMLText;
var curScroll:Float = -50;
var doScroll = false;
public function new(index:Int) {
var res = ResourceLoader.getImage("data/ui/xbox/BG_fadeOutSoftEdge.png").resource.toTile();
super(res);
var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt");
var domcasual32b = new BitmapFont(domcasual32fontdata.entry);
@:privateAccess domcasual32b.loader = ResourceLoader.loader;
var domcasual32 = domcasual32b.toSdfFont(cast 42 * Settings.uiScale, MultiChannel);
public function new() {
function chooseBg() {
var rand = Math.random();
if (rand >= 0 && rand <= 0.244)
return ResourceLoader.getImage('data/ui/backgrounds/gold/${cast (Math.floor(Util.lerp(1, 12, Math.random())), Int)}.jpg');
if (rand > 0.244 && rand <= 0.816)
return ResourceLoader.getImage('data/ui/backgrounds/platinum/${cast (Math.floor(Util.lerp(1, 28, Math.random())), Int)}.jpg');
return ResourceLoader.getImage('data/ui/backgrounds/ultra/${cast (Math.floor(Util.lerp(1, 9, Math.random())), Int)}.jpg');
}
var img = chooseBg();
super(img.resource.toTile());
this.position = new Vector(0, 0);
this.extent = new Vector(640, 480);
this.horizSizing = Width; this.horizSizing = Width;
this.vertSizing = Height; this.vertSizing = Height;
this.position = new Vector();
this.extent = new Vector(640, 480);
var wnd = new GuiImage(ResourceLoader.getResource("data/ui/manual/window.png", ResourceLoader.getImage, this.imageResources).toTile()); var scene2d = MarbleGame.canvas.scene2d;
wnd.position = new Vector(0, 0);
wnd.extent = new Vector(640, 480);
wnd.horizSizing = Center;
wnd.vertSizing = Center;
this.addChild(wnd);
function loadButtonImages(path:String) { var offsetX = (scene2d.width - 1280) / 2;
var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile(); var offsetY = (scene2d.height - 720) / 2;
var hover = ResourceLoader.getResource('${path}_h.png', ResourceLoader.getImage, this.imageResources).toTile();
var pressed = ResourceLoader.getResource('${path}_d.png', ResourceLoader.getImage, this.imageResources).toTile();
return [normal, hover, pressed];
}
var homeButton = new GuiButton(loadButtonImages("data/ui/manual/home")); var subX = 640 - (scene2d.width - offsetX) * 640 / scene2d.width;
homeButton.position = new Vector(274, 385); var subY = 480 - (scene2d.height - offsetY) * 480 / scene2d.height;
homeButton.extent = new Vector(94, 46);
homeButton.accelerator = hxd.Key.ESCAPE;
homeButton.gamepadAccelerator = ["B"];
homeButton.pressedAction = (sender) -> {
MarbleGame.canvas.setContent(new MainMenuGui());
}
wnd.addChild(homeButton);
var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt"); var 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 titles = [
"POWERUPS",
"BLAST METER",
"SINGLE PLAYER MODE",
"MULTIPLAYER MODE",
"MARBLE CONTROLS",
"CREDITS"
];
var rootTitle = new GuiText(coliseum);
rootTitle.position = new Vector(100, 30);
rootTitle.extent = new Vector(1120, 80);
rootTitle.text.textColor = 0xFFFFFF;
rootTitle.text.text = titles[index];
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 11.7 * Settings.uiScale, MultiChannel); var arial14 = arial14b.toSdfFont(cast 21 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel);
var arial14big = arial14b.toSdfFont(cast 30 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel);
var pagefiles = []; var arial14med = arial14b.toSdfFont(cast 26 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel);
for (i in 1...23) {
var pg = ResourceLoader.load('ui/manual/pages/${i}.txt').entry;
pagefiles.push(pg);
}
var pagetxt = pagefiles.map(x -> x.getText());
var pageheadings = pagetxt.map(x -> x.substr(0, x.indexOf("\n")));
var scrollCtrl1 = new GuiControl();
scrollCtrl1.position = new Vector(29, 24);
scrollCtrl1.extent = new Vector(176, 352);
wnd.addChild(scrollCtrl1);
manualPageList = new GuiTextListCtrl(arial14, pageheadings);
manualPageList.position = new Vector(0, 0);
manualPageList.extent = new Vector(176, 352);
manualPageList.scrollable = true;
scrollCtrl1.addChild(manualPageList);
var scrollCtrl2 = new GuiScrollCtrl(ResourceLoader.getResource("data/ui/common/philscroll.png", ResourceLoader.getImage, this.imageResources)
.toTile());
scrollCtrl2.position = new Vector(219, 28);
scrollCtrl2.extent = new Vector(386, 342);
scrollCtrl2.childrenHandleScroll = true;
wnd.addChild(scrollCtrl2);
var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt");
var arial14b = new BitmapFont(arial14fontdata.entry);
@:privateAccess arial14b.loader = ResourceLoader.loader;
var arial14 = 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": 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 manualContent = new GuiMLText(arial14, mlFontLoader); var credits1 = '<p align="center"><font face="ArialBig"><br/>GarageGames Team</font><br/><br/><font face="ArialMed">Development</font><br/>Tim Aste<br/>Jane Chase<br/>Timothy Clarke<br/>Adam deGrandis<br/>Clark Fagot<br/>Matt Fairfax<br/>Mark Frohnmayer<br/>Ben Garney<br/>Tim Gift<br/>Davey Jackson<br/>Justin Kovac<br/>Joe Maruschak<br/>Mark McCoy<br/>Jay Moore<br/>Rick Overman<br/>John Quigley<br/>Brian Ramage<br/>Kevin Ryan<br/>Liam Ryan<br/>Alex Swanson<br/>Jeff Tunnell<br/>Pat Wilson<br/><br/><font face="ArialMed">Special Thanks</font><br/>Cafe Aroma<br/>Cafe Yumm!<br/>Mezza Luna Pizzeria<br/>Pizza Research Institute<br/>The GarageGames Community</p>';
manualContent.position = new Vector(0, 20); var credits2 = '<p align="center"><font face="ArialBig">Xbox Live Arcade Team</font><br/><br/><font face="ArialMed">Program Management</font><br/>Katie Stone<br/>Jon David<br/><br/><font face="ArialMed">Test Manager</font><br/>Tony Harlich<br/><br/><font face="ArialMed">Test</font><br/>Michael Jones<br/>Chad Dylan Long (VMC)<br/>Eric Snyder (VMC)<br/>Noriko Fritschle (VMC)<br/>Kevin Hathaway (VMC)<br/>Ty Roberts (VMC)<br/><br/><font face="ArialMed">Release Manager</font><br/>Julie Pitt (VOLT)<br/><br/><font face="ArialMed">Development</font><br/>Brian Ostergren<br/>Eric Heutchy<br/>Eric Fleegal<br/><br/><font face="ArialMed">Group Manager</font><br/>Greg Canessa<br/><br/><font face="ArialMed">Product Planning</font><br/>Ross Erickson<br/>Cherie Lutz<br/><br/><font face="ArialMed">Content Creation</font><br/>Michelle Lomba<br/><br/><font face="ArialMed">Usability</font><br/>Tom Fuller<br/>Chuck Harrison<br/><br/><font face="ArialMed">Special Thanks</font><br/>J Allard<br/>Shane Kim<br/>Don Ryan<br/>Chris Early<br/>Oliver Miyashita<br/>Mike Minahan<br/>VMC Consulting<br/>Ami Blaire<br/>Darryl Saunders<br/>Aaron Greenberg<br/>Michael Wolf<br/>David Hufford<br/>Darren Trencher</p>';
manualContent.extent = new Vector(376, 322); var credits3 = '<p align="center"><font face="ArialBig">Localization</font><br/><br/><font face="ArialMed">Japan Localization Team</font><br/>Shinya Muto<br/>Junya Chiba<br/>Go Komatsu<br/>Mayumi Koike<br/>Takehiro Kuga<br/>Masao Okamoto<br/>Yutaka Hasegawa<br/>Munetaka Fuse<br/>Takashi Sasaki<br/>Shinji Komiyama<br/><br/><font face="ArialMed">Korea Localization Team</font><br/>Eun Hee Lee<br/>In Goo Kwon<br/>Whi Young Yoon<br/>Ji Young Kim<br/><br/><font face="ArialMed">Taiwan Localization Team</font><br/>Robert Lin<br/>Carole Lin<br/>Lilia Lee<br/>Jason Cheng</p>';
manualContent.text.textColor = 0;
manualContent.scrollable = true;
scrollCtrl2.addChild(manualContent);
manualPageList.onSelectedFunc = (idx) -> { var texts = [
if (idx != -1) { "There are many powerups that will help you along. To collect a powerup, roll over it. It will appear in the powerup window.<br/><br/>On an Xbox 360 Controller, Pull the right trigger or press B to activate the powerup; Otherwise use left click or the Q key.",
var txt = pagetxt[idx]; "The Marble has a blast ability which gives you a slight upward boost. Use it wisely!<br/><br/>The Blast meter shows the current level of blast that you have available. It regenerates slowly over time.<br/><br/>On an Xbox 360 Controller, Press X or the right bumper to use your current blast power; Otherwise, use Right Click or the E key.<br/><br/>Collect the Ultra Blast powerup to instantly fill your blast meter - and then some!",
var txtlines = txt.split('\n'); "Get to the End Pad of each level as fast as possible.<br/><br/>Start Pad - You start the level here.<br/><br/>End Pad - Roll your marble here to end the level.<br/><br/>Gems - Some levels have gems. You must pick up all of them before you can end the level.<br/><br/>Time Travel - Roll through these to temporarily pause the clock.",
txtlines[0] = '<br/><font face="MarkerFelt32"><p align="center">${txtlines[0]}</p></font>'; "Race to the gems and pick them up to earn points. Get as many gems as you can, but be ready to go when the next group appears!<br/><br/>Some gems are worth more points than others. More valuable gems are usually harder to reach.<br/><br/>View the leaderboards to compare your ranking with other players around the world.",
var finaltxt = txtlines.join('<br/>') + '<br/>'; "Xbox 360 Controller:<br/>Use the left stick to move the marble. <br/><br/>Press A or pull the left trigger to make the marble jump.<br/><br/>Use the right stick to look around with the camera.<br/><br/>Keyboard and Mouse:<br/>Use the WASD keys to move.<br/>Move the mouse to look around.<br/>Press Space to Jump."
manualContent.text.text = finaltxt; ];
scrollCtrl2.setScrollMax(manualContent.text.textHeight); texts.push(credits1 + "<br/>" + credits2 + "<br/>" + credits3);
scrollCtrl2.updateScrollVisual();
} if (index == 5)
}; doScroll = true;
var textCtrl = new GuiControl();
textCtrl.position = new Vector(30, 33);
textCtrl.extent = new Vector(683, 403);
wnd.addChild(textCtrl);
wndTxtBg = new GuiMLText(arial14, mlFontLoader);
wndTxtBg.position = new Vector(2, 7);
wndTxtBg.extent = new Vector(683, 343);
wndTxtBg.text.textColor = 0x101010;
wndTxtBg.text.text = texts[index];
wndTxtBg.scrollable = true;
textCtrl.addChild(wndTxtBg);
wndTxt = new GuiMLText(arial14, mlFontLoader);
wndTxt.position = new Vector(0, 5);
wndTxt.extent = new Vector(683, 343);
wndTxt.text.textColor = 0xEBEBEB;
wndTxt.text.text = texts[index];
wndTxt.scrollable = true;
textCtrl.addChild(wndTxt);
var bottomBar = new GuiControl();
bottomBar.position = new Vector(0, 590);
bottomBar.extent = new Vector(640, 200);
bottomBar.horizSizing = Width;
bottomBar.vertSizing = Bottom;
innerCtrl.addChild(bottomBar);
var backButton = new GuiXboxButton("Ok", 160);
backButton.position = new Vector(960, 0);
backButton.vertSizing = Bottom;
backButton.horizSizing = Right;
backButton.gamepadAccelerator = ["OK"];
if (index == 5)
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new OptionsListGui());
else
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new AboutMenuOptionsGui());
bottomBar.addChild(backButton);
} }
public override function render(scene2d:Scene, ?parent:h2d.Flow) { override function update(dt:Float, mouseState:MouseState) {
super.render(scene2d, parent); super.update(dt, mouseState);
manualPageList.onSelectedFunc(0); if (doScroll) {
curScroll += dt * 20;
var realScroll = Math.max(curScroll, 0);
wndTxt.onScroll(0, realScroll);
wndTxtBg.onScroll(0, realScroll);
}
} }
} }

View file

@ -54,14 +54,18 @@ class OptionsListGui extends GuiImage {
btnList.extent = new Vector(502, 500); btnList.extent = new Vector(502, 500);
innerCtrl.addChild(btnList); innerCtrl.addChild(btnList);
btnList.addButton(0, 'Marble Appearance', (e) -> { btnList.addButton(3, 'Marble Appearance', (e) -> {
MarbleGame.canvas.pushDialog(new MarbleSelectGui()); MarbleGame.canvas.pushDialog(new MarbleSelectGui());
}); });
btnList.addButton(0, 'Input and Sound Options', (e) -> {}); btnList.addButton(3, 'Input and Sound Options', (e) -> {});
btnList.addButton(0, 'Video Options', (e) -> {}); btnList.addButton(3, 'Video Options', (e) -> {});
btnList.addButton(0, 'Misc Options', (e) -> {}); btnList.addButton(3, 'Misc Options', (e) -> {});
btnList.addButton(0, 'How to Play', (e) -> {}); btnList.addButton(5, 'How to Play', (e) -> {
btnList.addButton(0, 'Credits', (e) -> {}); MarbleGame.canvas.setContent(new AboutMenuOptionsGui());
});
btnList.addButton(5, 'Credits', (e) -> {
MarbleGame.canvas.setContent(new HelpCreditsGui(5));
});
var bottomBar = new GuiControl(); var bottomBar = new GuiControl();
bottomBar.position = new Vector(0, 590); bottomBar.position = new Vector(0, 590);