finish working level select
|
Before Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 150 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 593 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 358 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 389 KiB |
BIN
data/ui/xbox/levelPreviewWindow.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 36 KiB |
|
|
@ -55,6 +55,7 @@ class PreviewWorld extends Scheduler {
|
|||
var instanceManager:InstanceManager;
|
||||
|
||||
var misFile:MisFile;
|
||||
var currentMission:String;
|
||||
|
||||
var levelGroups:Map<String, MissionElementSimGroup> = [];
|
||||
|
||||
|
|
@ -70,8 +71,6 @@ class PreviewWorld extends Scheduler {
|
|||
}
|
||||
|
||||
public function init(onFinish:() -> Void) {
|
||||
this.instanceManager = new InstanceManager(scene);
|
||||
|
||||
var entry = ResourceLoader.getFileEntry("data/missions/megaMission.mis").entry;
|
||||
var misText = entry.getText();
|
||||
var mparser = new MisParser(misText);
|
||||
|
|
@ -124,10 +123,16 @@ class PreviewWorld extends Scheduler {
|
|||
}
|
||||
|
||||
public function loadMission(misname:String, onFinish:() -> Void) {
|
||||
var groupName = misname + "group";
|
||||
if (currentMission == misname) {
|
||||
onFinish();
|
||||
return;
|
||||
}
|
||||
currentMission = misname;
|
||||
var groupName = (misname + "group").toLowerCase();
|
||||
var group = levelGroups.get(groupName);
|
||||
if (group != null) {
|
||||
destroyAllObjects();
|
||||
this.instanceManager = new InstanceManager(scene);
|
||||
|
||||
var p = new h3d.prim.Cube(0.001, 0.001, 0.001);
|
||||
p.addUVs();
|
||||
|
|
@ -154,24 +159,15 @@ class PreviewWorld extends Scheduler {
|
|||
camPos.x *= -1;
|
||||
var camRot = MisParser.parseRotation(shapeElem.rotation);
|
||||
camRot.x *= -1;
|
||||
camRot.z *= -1;
|
||||
camRot.w *= -1;
|
||||
|
||||
var camMat = camRot.toMatrix();
|
||||
|
||||
var eu = camRot.toEuler();
|
||||
var camPitch = eu.y;
|
||||
var camYaw = eu.z + Math.PI / 2;
|
||||
|
||||
var off = new Vector(0, 0, 1.5);
|
||||
off.transform3x3(camMat);
|
||||
|
||||
var directionVector = new Vector(1, 0, 0);
|
||||
|
||||
var q1 = new Quat();
|
||||
q1.initRotateAxis(0, 1, 0, camPitch);
|
||||
directionVector.transform(q1.toMatrix());
|
||||
q1.initRotateAxis(0, 0, 1, camYaw);
|
||||
directionVector.transform(q1.toMatrix());
|
||||
var directionVector = new Vector(0, 1, 0);
|
||||
directionVector.transform3x3(camMat);
|
||||
|
||||
scene.camera.setFovX(90, Settings.optionsSettings.screenWidth / Settings.optionsSettings.screenHeight);
|
||||
|
||||
|
|
@ -181,7 +177,7 @@ class PreviewWorld extends Scheduler {
|
|||
}
|
||||
}
|
||||
|
||||
var mis = MissionList.missionsFilenameLookup.get(misname + '.mis');
|
||||
var mis = MissionList.missionsFilenameLookup.get((misname + '.mis').toLowerCase());
|
||||
var difficulty = ["beginner", "intermediate", "advanced"][mis.difficultyIndex];
|
||||
|
||||
var worker = new ResourceLoaderWorker(onFinish);
|
||||
|
|
@ -248,6 +244,8 @@ class PreviewWorld extends Scheduler {
|
|||
for (shape in dtsObjects) {
|
||||
shape.dispose();
|
||||
}
|
||||
interiors = [];
|
||||
dtsObjects = [];
|
||||
scene.removeChildren();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,22 +56,28 @@ class DifficultySelectGui extends GuiImage {
|
|||
btnList.extent = new Vector(502, 500);
|
||||
innerCtrl.addChild(btnList);
|
||||
|
||||
btnList.addButton(0, 'Beginner Levels', (e) -> {});
|
||||
btnList.addButton(0, 'Intermediate Levels', (e) -> {});
|
||||
btnList.addButton(0, 'Advanced Levels', (e) -> {});
|
||||
btnList.addButton(0, 'Beginner Levels', (e) -> {
|
||||
MarbleGame.canvas.setContent(new LevelSelectGui("beginner"));
|
||||
});
|
||||
btnList.addButton(0, 'Intermediate Levels', (e) -> {
|
||||
MarbleGame.canvas.setContent(new LevelSelectGui("intermediate"));
|
||||
});
|
||||
btnList.addButton(0, 'Advanced Levels', (e) -> {
|
||||
MarbleGame.canvas.setContent(new LevelSelectGui("advanced"));
|
||||
});
|
||||
btnList.addButton(0, 'Gem Hunt', (e) -> {}, 20);
|
||||
|
||||
var bottomBar = new GuiControl();
|
||||
bottomBar.position = new Vector(0, innerCtrl.extent.x * 590 / 480);
|
||||
bottomBar.position = new Vector(0, 590);
|
||||
bottomBar.extent = new Vector(640, 200);
|
||||
bottomBar.horizSizing = Width;
|
||||
bottomBar.vertSizing = Bottom;
|
||||
this.addChild(bottomBar);
|
||||
innerCtrl.addChild(bottomBar);
|
||||
|
||||
var backButton = new GuiXboxButton("Back", 160);
|
||||
backButton.position = new Vector(-240, 0);
|
||||
backButton.position = new Vector(400, 0);
|
||||
backButton.vertSizing = Bottom;
|
||||
backButton.horizSizing = Left;
|
||||
backButton.horizSizing = Right;
|
||||
backButton.gamepadAccelerator = ["B"];
|
||||
backButton.pressedAction = (e) -> MarbleGame.canvas.setContent(new MainMenuGui());
|
||||
bottomBar.addChild(backButton);
|
||||
|
|
|
|||
|
|
@ -130,30 +130,30 @@ class EndGameGui extends GuiImage {
|
|||
endGameWnd.addChild(egResultRight);
|
||||
|
||||
var bottomBar = new GuiControl();
|
||||
bottomBar.position = new Vector(0, innerCtrl.extent.x * 590 / 480);
|
||||
bottomBar.position = new Vector(0, 590);
|
||||
bottomBar.extent = new Vector(640, 200);
|
||||
bottomBar.horizSizing = Width;
|
||||
bottomBar.vertSizing = Bottom;
|
||||
this.addChild(bottomBar);
|
||||
innerCtrl.addChild(bottomBar);
|
||||
|
||||
var retryButton = new GuiXboxButton("Retry", 160);
|
||||
retryButton.position = new Vector(-240, 0);
|
||||
retryButton.position = new Vector(400, 0);
|
||||
retryButton.vertSizing = Bottom;
|
||||
retryButton.horizSizing = Left;
|
||||
retryButton.horizSizing = Right;
|
||||
retryButton.gamepadAccelerator = ["B"];
|
||||
retryButton.pressedAction = (e) -> restartFunc(retryButton);
|
||||
bottomBar.addChild(retryButton);
|
||||
|
||||
var lbButton = new GuiXboxButton("Leaderboard", 220);
|
||||
lbButton.position = new Vector(110, 0);
|
||||
lbButton.position = new Vector(750, 0);
|
||||
lbButton.vertSizing = Bottom;
|
||||
lbButton.horizSizing = Left;
|
||||
lbButton.horizSizing = Right;
|
||||
bottomBar.addChild(lbButton);
|
||||
|
||||
var nextButton = new GuiXboxButton("Next", 160);
|
||||
nextButton.position = new Vector(320, 0);
|
||||
nextButton.position = new Vector(960, 0);
|
||||
nextButton.vertSizing = Bottom;
|
||||
nextButton.horizSizing = Left;
|
||||
nextButton.horizSizing = Right;
|
||||
nextButton.pressedAction = (e) -> continueFunc(nextButton);
|
||||
bottomBar.addChild(nextButton);
|
||||
}
|
||||
|
|
|
|||
173
src/gui/GuiXboxOptionsList.hx
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
package gui;
|
||||
|
||||
import hxd.Key;
|
||||
import h3d.Matrix;
|
||||
import hxd.res.BitmapFont;
|
||||
import gui.GuiControl.MouseState;
|
||||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.Settings;
|
||||
import src.AudioManager;
|
||||
|
||||
class GuiXboxOptionsList extends GuiControl {
|
||||
var bgFill:GuiAnim;
|
||||
var optIcon:GuiAnim;
|
||||
var leftButton:GuiAnim;
|
||||
var rightButton:GuiAnim;
|
||||
var labelText:GuiText;
|
||||
var optionText:GuiText;
|
||||
var options:Array<String>;
|
||||
var currentOption:Int = 0;
|
||||
var alwaysActive:Bool = false;
|
||||
|
||||
var onChangeFunc:Int->Bool = null;
|
||||
|
||||
public function new(icon:Int, name:String, values:Array<String>) {
|
||||
super();
|
||||
|
||||
this.options = values;
|
||||
|
||||
var baseImage = ResourceLoader.getResource("data/ui/xbox/optionsCursorArray.png", ResourceLoader.getImage, this.imageResources).toTile();
|
||||
var inactiveImage = baseImage.sub(0, 2, 815, 94);
|
||||
var activeImage = baseImage.sub(0, 98, 815, 94);
|
||||
var leftArrow = baseImage.sub(0, 193, 22, 22);
|
||||
var leftArrowSelected = baseImage.sub(23, 193, 22, 22);
|
||||
var rightArrow = baseImage.sub(48, 193, 22, 22);
|
||||
var rightArrowSelected = baseImage.sub(72, 193, 22, 22);
|
||||
var arrowButtonImage = baseImage.sub(0, 256, 114, 94);
|
||||
var arrowButtonImagePressed = baseImage.sub(0, 352, 114, 94);
|
||||
var iconImage = baseImage.sub(74 * icon, 453, 36, 36);
|
||||
var iconImagePressed = baseImage.sub(74 * icon + 37, 453, 36, 36);
|
||||
|
||||
bgFill = new GuiAnim([inactiveImage, activeImage]);
|
||||
bgFill.position = new Vector(0, 0);
|
||||
bgFill.extent = new Vector(815, 94);
|
||||
this.addChild(bgFill);
|
||||
|
||||
optIcon = new GuiAnim([iconImage, iconImagePressed]);
|
||||
optIcon.position = new Vector(30, 30);
|
||||
optIcon.extent = new Vector(36, 36);
|
||||
this.addChild(optIcon);
|
||||
|
||||
var cmat = Matrix.I();
|
||||
cmat.colorGain(0x7F7F7F, 1);
|
||||
// cmat._44 = 1;
|
||||
var leftShadeFilter = new h2d.filter.ColorMatrix(cmat);
|
||||
leftShadeFilter.enable = false;
|
||||
var rightShadeFilter = new h2d.filter.ColorMatrix(cmat);
|
||||
rightShadeFilter.enable = false;
|
||||
|
||||
leftButton = new GuiAnim([arrowButtonImage, arrowButtonImagePressed]);
|
||||
leftButton.position = new Vector(815 * 0.3, 0);
|
||||
leftButton.extent = new Vector(114, 94);
|
||||
leftButton.anim.filter = leftShadeFilter;
|
||||
this.addChild(leftButton);
|
||||
|
||||
var leftButtonIcon = new GuiAnim([leftArrow, leftArrowSelected]);
|
||||
leftButtonIcon.position = new Vector(39, 36);
|
||||
leftButtonIcon.extent = new Vector(22, 22);
|
||||
leftButton.addChild(leftButtonIcon);
|
||||
|
||||
rightButton = new GuiAnim([arrowButtonImage, arrowButtonImagePressed]);
|
||||
rightButton.position = new Vector(815 * 0.8, 0);
|
||||
rightButton.extent = new Vector(114, 94);
|
||||
rightButton.anim.filter = rightShadeFilter;
|
||||
this.addChild(rightButton);
|
||||
|
||||
var rightButtonIcon = new GuiAnim([rightArrow, rightArrowSelected]);
|
||||
rightButtonIcon.position = new Vector(52, 36);
|
||||
rightButtonIcon.extent = new Vector(22, 22);
|
||||
rightButton.addChild(rightButtonIcon);
|
||||
|
||||
var arial14fontdata = ResourceLoader.getFileEntry("data/font/Arial Bold.fnt");
|
||||
var arial14b = new BitmapFont(arial14fontdata.entry);
|
||||
@:privateAccess arial14b.loader = ResourceLoader.loader;
|
||||
var arial14 = arial14b.toSdfFont(cast 26 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel);
|
||||
|
||||
labelText = new GuiText(arial14);
|
||||
labelText.position = new Vector(155, 36);
|
||||
labelText.extent = new Vector(100, 35);
|
||||
labelText.vertSizing = Top;
|
||||
labelText.text.text = name;
|
||||
labelText.text.textColor = 0x787878;
|
||||
this.addChild(labelText);
|
||||
|
||||
optionText = new GuiText(arial14);
|
||||
optionText.position = new Vector(400, 36);
|
||||
optionText.extent = new Vector(200, 35);
|
||||
optionText.vertSizing = Top;
|
||||
optionText.text.text = values[0];
|
||||
optionText.text.textColor = 0x787878;
|
||||
optionText.justify = Center;
|
||||
this.addChild(optionText);
|
||||
}
|
||||
|
||||
override function update(dt:Float, mouseState:MouseState) {
|
||||
if (alwaysActive) {
|
||||
bgFill.anim.currentFrame = 1;
|
||||
optIcon.anim.currentFrame = 1;
|
||||
labelText.text.textColor = 0x101010;
|
||||
optionText.text.textColor = 0x101010;
|
||||
}
|
||||
var leftBtnRect = leftButton.getHitTestRect();
|
||||
var rightBtnRect = rightButton.getHitTestRect();
|
||||
if (leftBtnRect.inRect(mouseState.position) || rightBtnRect.inRect(mouseState.position)) {
|
||||
if (Key.isPressed(Key.MOUSE_LEFT)) {
|
||||
AudioManager.playSound(ResourceLoader.getResource("data/sound/buttonpress.wav", ResourceLoader.getAudio, this.soundResources));
|
||||
}
|
||||
}
|
||||
// Left Button
|
||||
if (leftBtnRect.inRect(mouseState.position)) {
|
||||
if (Key.isDown(Key.MOUSE_LEFT)) {
|
||||
leftButton.anim.currentFrame = 1;
|
||||
leftButton.anim.filter.enable = true;
|
||||
} else {
|
||||
leftButton.anim.currentFrame = 1;
|
||||
leftButton.anim.filter.enable = false;
|
||||
}
|
||||
if (Key.isReleased(Key.MOUSE_LEFT)) {
|
||||
var newOption = currentOption - 1;
|
||||
if (newOption < 0)
|
||||
newOption = options.length - 1;
|
||||
|
||||
var doChange = true;
|
||||
if (onChangeFunc != null)
|
||||
doChange = onChangeFunc(newOption);
|
||||
if (doChange) {
|
||||
currentOption = newOption;
|
||||
optionText.text.text = options[currentOption];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
leftButton.anim.currentFrame = 0;
|
||||
leftButton.anim.filter.enable = false;
|
||||
}
|
||||
// Right Button
|
||||
if (rightBtnRect.inRect(mouseState.position)) {
|
||||
if (Key.isDown(Key.MOUSE_LEFT)) {
|
||||
rightButton.anim.currentFrame = 1;
|
||||
rightButton.anim.filter.enable = true;
|
||||
} else {
|
||||
rightButton.anim.currentFrame = 1;
|
||||
rightButton.anim.filter.enable = false;
|
||||
}
|
||||
if (Key.isReleased(Key.MOUSE_LEFT)) {
|
||||
var newOption = currentOption + 1;
|
||||
if (newOption >= options.length)
|
||||
newOption = 0;
|
||||
|
||||
var doChange = true;
|
||||
if (onChangeFunc != null)
|
||||
doChange = onChangeFunc(newOption);
|
||||
if (doChange) {
|
||||
currentOption = newOption;
|
||||
optionText.text.text = options[currentOption];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rightButton.anim.currentFrame = 0;
|
||||
rightButton.anim.filter.enable = false;
|
||||
}
|
||||
super.update(dt, mouseState);
|
||||
}
|
||||
}
|
||||
185
src/gui/LevelSelectGui.hx
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
package gui;
|
||||
|
||||
import src.Util;
|
||||
import haxe.io.Path;
|
||||
import h2d.filter.DropShadow;
|
||||
import src.MarbleGame;
|
||||
import gui.GuiControl.MouseState;
|
||||
import hxd.res.BitmapFont;
|
||||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.Settings;
|
||||
import src.MissionList;
|
||||
|
||||
class LevelSelectGui extends GuiImage {
|
||||
static var currentSelectionStatic:Int = 0;
|
||||
static var currentDifficultyStatic:String = "beginner";
|
||||
|
||||
public function new(difficulty:String) {
|
||||
var res = ResourceLoader.getImage("data/ui/xbox/BG_fadeOutSoftEdge.png").resource.toTile();
|
||||
super(res);
|
||||
|
||||
if (currentDifficultyStatic != difficulty) {
|
||||
currentSelectionStatic = 0;
|
||||
}
|
||||
currentDifficultyStatic = difficulty;
|
||||
|
||||
var difficultyMissions = MissionList.missionList['ultra'][currentDifficultyStatic];
|
||||
var curMission = difficultyMissions[currentSelectionStatic];
|
||||
|
||||
var lock = true;
|
||||
|
||||
var misFile = Path.withoutExtension(Path.withoutDirectory(curMission.path));
|
||||
MarbleGame.instance.setPreviewMission(misFile, () -> {
|
||||
lock = false;
|
||||
});
|
||||
|
||||
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 = "SELECT LEVEL";
|
||||
rootTitle.text.alpha = 0.5;
|
||||
innerCtrl.addChild(rootTitle);
|
||||
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 DifficultySelectGui());
|
||||
bottomBar.addChild(backButton);
|
||||
|
||||
var lbButton = new GuiXboxButton("Leaderboard", 220);
|
||||
lbButton.position = new Vector(750, 0);
|
||||
lbButton.vertSizing = Bottom;
|
||||
lbButton.horizSizing = Right;
|
||||
bottomBar.addChild(lbButton);
|
||||
|
||||
var nextButton = new GuiXboxButton("Play", 160);
|
||||
nextButton.position = new Vector(960, 0);
|
||||
nextButton.vertSizing = Bottom;
|
||||
nextButton.horizSizing = Right;
|
||||
nextButton.pressedAction = (e) -> {
|
||||
MarbleGame.instance.playMission(curMission);
|
||||
};
|
||||
bottomBar.addChild(nextButton);
|
||||
|
||||
var levelWnd = new GuiImage(ResourceLoader.getResource("data/ui/xbox/levelPreviewWindow.png", ResourceLoader.getImage, this.imageResources).toTile());
|
||||
levelWnd.position = new Vector(555, 469);
|
||||
levelWnd.extent = new Vector(535, 137);
|
||||
levelWnd.vertSizing = Bottom;
|
||||
levelWnd.horizSizing = Right;
|
||||
innerCtrl.addChild(levelWnd);
|
||||
|
||||
var statIcon = new GuiImage(ResourceLoader.getResource("data/ui/xbox/statIcon.png", ResourceLoader.getImage, this.imageResources).toTile());
|
||||
statIcon.position = new Vector(29, 54);
|
||||
statIcon.extent = new Vector(20, 20);
|
||||
levelWnd.addChild(statIcon);
|
||||
|
||||
var arial14fontdata = ResourceLoader.getFileEntry("data/font/Arial Bold.fnt");
|
||||
var arial14b = new BitmapFont(arial14fontdata.entry);
|
||||
@:privateAccess arial14b.loader = ResourceLoader.loader;
|
||||
var arial14 = arial14b.toSdfFont(cast 21 * Settings.uiScale, h2d.Font.SDFChannel.MultiChannel);
|
||||
function mlFontLoader(text:String) {
|
||||
return arial14;
|
||||
}
|
||||
|
||||
var c0 = 0xEBEBEB;
|
||||
var c1 = 0x8DFF8D;
|
||||
var c2 = 0x88BCEE;
|
||||
var c3 = 0xFF7575;
|
||||
|
||||
var levelInfoLeft = new GuiMLText(arial14, mlFontLoader);
|
||||
levelInfoLeft.position = new Vector(69, 54);
|
||||
levelInfoLeft.extent = new Vector(180, 100);
|
||||
levelInfoLeft.text.text = '<p align="right"><font color="#EBEBEB">My Best Time:</font><br/><font color="#EBEBEB">Par Time:</font></p>';
|
||||
levelInfoLeft.text.lineSpacing = 6;
|
||||
levelWnd.addChild(levelInfoLeft);
|
||||
|
||||
var levelInfoMid = new GuiMLText(arial14, mlFontLoader);
|
||||
levelInfoMid.position = new Vector(269, 54);
|
||||
levelInfoMid.extent = new Vector(180, 100);
|
||||
levelInfoMid.text.text = '<p align="left"><font color="#EBEBEB">None</font><br/><font color="#88BCEE">99:59:99</font></p>';
|
||||
levelInfoMid.text.lineSpacing = 6;
|
||||
levelWnd.addChild(levelInfoMid);
|
||||
|
||||
var levelInfoRight = new GuiMLText(arial14, mlFontLoader);
|
||||
levelInfoRight.position = new Vector(379, 54);
|
||||
levelInfoRight.extent = new Vector(180, 100);
|
||||
levelInfoRight.text.text = '<p align="left"><font color="#EBEBEB">Level 1<br/>Difficulty 1</font></p>';
|
||||
levelInfoRight.text.lineSpacing = 6;
|
||||
levelWnd.addChild(levelInfoRight);
|
||||
|
||||
function setLevel(idx:Int) {
|
||||
if (lock)
|
||||
return false;
|
||||
lock = true;
|
||||
curMission = difficultyMissions[idx];
|
||||
var misFile = Path.withoutExtension(Path.withoutDirectory(curMission.path));
|
||||
var mis = difficultyMissions[idx];
|
||||
MarbleGame.instance.setPreviewMission(misFile, () -> {
|
||||
lock = false;
|
||||
});
|
||||
var myScore = Settings.getScores(mis.path);
|
||||
var scoreDisp = "None";
|
||||
if (myScore.length != 0)
|
||||
scoreDisp = Util.formatTime(myScore[0].time);
|
||||
var isPar = myScore.length != 0 && myScore[0].time < mis.qualifyTime;
|
||||
var scoreColor = "#EBEBEB";
|
||||
if (isPar)
|
||||
scoreColor = "#8DFF8D";
|
||||
levelInfoMid.text.text = '<p align="left"><font color="${scoreColor}">${scoreDisp}</font><br/><font color="#88BCEE">${Util.formatTime(mis.qualifyTime)}</font></p>';
|
||||
levelInfoRight.text.text = '<p align="left"><font color="#EBEBEB">Level ${mis.missionInfo.level}<br/>Difficulty ${mis.missionInfo.difficulty}</font></p>';
|
||||
return true;
|
||||
}
|
||||
|
||||
var levelNames = difficultyMissions.map(x -> x.title);
|
||||
|
||||
var levelSelectOpts = new GuiXboxOptionsList(6, "Level", levelNames);
|
||||
levelSelectOpts.position = new Vector(380, 435);
|
||||
levelSelectOpts.extent = new Vector(815, 94);
|
||||
levelSelectOpts.vertSizing = Bottom;
|
||||
levelSelectOpts.horizSizing = Right;
|
||||
levelSelectOpts.alwaysActive = true;
|
||||
levelSelectOpts.onChangeFunc = setLevel;
|
||||
innerCtrl.addChild(levelSelectOpts);
|
||||
}
|
||||
}
|
||||
|
|
@ -34,6 +34,8 @@ class DirLight extends Light {
|
|||
}
|
||||
|
||||
override function getShadowDirection():h3d.Vector {
|
||||
if (MarbleGame.instance.world == null)
|
||||
return new h3d.Vector(0, 0, -1);
|
||||
return MarbleGame.instance.world.currentUp.multiply(-1);
|
||||
}
|
||||
|
||||
|
|
|
|||