mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
minor replay bugfixes
This commit is contained in:
parent
7fa5924fca
commit
2b40a4eca9
5 changed files with 24 additions and 96 deletions
|
|
@ -300,6 +300,7 @@ class MarbleGame {
|
||||||
|
|
||||||
public function watchMissionReplay(mission:Mission, replay:Replay) {
|
public function watchMissionReplay(mission:Mission, replay:Replay) {
|
||||||
canvas.clearContent();
|
canvas.clearContent();
|
||||||
|
destroyPreviewWorld();
|
||||||
world = new MarbleWorld(scene, scene2d, mission);
|
world = new MarbleWorld(scene, scene2d, mission);
|
||||||
world.replay = replay;
|
world.replay = replay;
|
||||||
world.isWatching = true;
|
world.isWatching = true;
|
||||||
|
|
|
||||||
|
|
@ -967,15 +967,19 @@ class MarbleWorld extends Scheduler {
|
||||||
MarbleGame.instance.touchInput.hideControls(@:privateAccess this.playGui.playGuiCtrl);
|
MarbleGame.instance.touchInput.hideControls(@:privateAccess this.playGui.playGuiCtrl);
|
||||||
}
|
}
|
||||||
this.setCursorLock(false);
|
this.setCursorLock(false);
|
||||||
|
var misFile = haxe.io.Path.withoutExtension(haxe.io.Path.withoutDirectory(mission.path));
|
||||||
this.dispose();
|
this.dispose();
|
||||||
#if !js
|
MarbleGame.instance.setPreviewMission(misFile, () -> {
|
||||||
MarbleGame.canvas.setContent(new ReplayCenterGui());
|
#if !js
|
||||||
#end
|
MarbleGame.canvas.setContent(new ReplayCenterGui());
|
||||||
#if js
|
#end
|
||||||
MarbleGame.canvas.setContent(new MainMenuGui());
|
#if js
|
||||||
var pointercontainer = js.Browser.document.querySelector("#pointercontainer");
|
MarbleGame.canvas.setContent(new MainMenuGui());
|
||||||
pointercontainer.hidden = false;
|
var pointercontainer = js.Browser.document.querySelector("#pointercontainer");
|
||||||
#end
|
pointercontainer.hidden = false;
|
||||||
|
#end
|
||||||
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -371,7 +371,10 @@ class Replay {
|
||||||
|
|
||||||
public function recordRandomGenState(ri:Int) {
|
public function recordRandomGenState(ri:Int) {
|
||||||
initialState.randomGens.push(ri);
|
initialState.randomGens.push(ri);
|
||||||
initialState.randomGenTimes.push(currentRecordFrame.time);
|
if (currentRecordFrame == null)
|
||||||
|
initialState.randomGenTimes.push(0);
|
||||||
|
else
|
||||||
|
initialState.randomGenTimes.push(currentRecordFrame.time);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRandomGenState() {
|
public function getRandomGenState() {
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class ReplayCenterGui extends GuiImage {
|
||||||
rootTitle.position = new Vector(100, 30);
|
rootTitle.position = new Vector(100, 30);
|
||||||
rootTitle.extent = new Vector(1120, 80);
|
rootTitle.extent = new Vector(1120, 80);
|
||||||
rootTitle.text.textColor = 0xFFFFFF;
|
rootTitle.text.textColor = 0xFFFFFF;
|
||||||
rootTitle.text.text = "REPLAY CENTRE";
|
rootTitle.text.text = "REPLAYS";
|
||||||
rootTitle.text.alpha = 0.5;
|
rootTitle.text.alpha = 0.5;
|
||||||
innerCtrl.addChild(rootTitle);
|
innerCtrl.addChild(rootTitle);
|
||||||
|
|
||||||
|
|
@ -160,91 +160,6 @@ class ReplayCenterGui extends GuiImage {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
bottomBar.addChild(nextButton);
|
bottomBar.addChild(nextButton);
|
||||||
|
|
||||||
// var playButton = new GuiButton(loadButtonImages('data/ui/replay/play', true));
|
|
||||||
// playButton.position = new Vector(323, 386);
|
|
||||||
// playButton.extent = new Vector(94, 46);
|
|
||||||
// playButton.disabled = true;
|
|
||||||
// playButton.pressedAction = (e) -> {
|
|
||||||
// var repl = replayList[selectedIdx];
|
|
||||||
// if (repl.readFull()) {
|
|
||||||
// var repmis = repl.mission;
|
|
||||||
// if (!StringTools.contains(repmis, "data/"))
|
|
||||||
// repmis = "data/" + repmis;
|
|
||||||
// var mi = repl.customId == 0 ? MissionList.missions.get(repmis) : Marbleland.missions.get(repl.customId);
|
|
||||||
// if (mi.isClaMission) {
|
|
||||||
// mi.download(() -> {
|
|
||||||
// MarbleGame.instance.watchMissionReplay(mi, repl);
|
|
||||||
// });
|
|
||||||
// playButton.disabled = true; // Don't let us play anything else
|
|
||||||
// } else {
|
|
||||||
// MarbleGame.instance.watchMissionReplay(mi, repl);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// wnd.addChild(playButton);
|
|
||||||
|
|
||||||
// var homeButton = new GuiButton(loadButtonImages('data/ui/replay/home'));
|
|
||||||
// homeButton.position = new Vector(224, 386);
|
|
||||||
// homeButton.extent = new Vector(94, 46);
|
|
||||||
// homeButton.pressedAction = (e) -> {
|
|
||||||
// MarbleGame.canvas.setContent(new MainMenuGui());
|
|
||||||
// }
|
|
||||||
// wnd.addChild(homeButton);
|
|
||||||
|
|
||||||
// var scrollCtrl = new GuiScrollCtrl(ResourceLoader.getResource("data/ui/common/philscroll.png", ResourceLoader.getImage, this.imageResources).toTile());
|
|
||||||
// scrollCtrl.position = new Vector(30, 25);
|
|
||||||
// scrollCtrl.extent = new Vector(283, 346);
|
|
||||||
// scrollCtrl.childrenHandleScroll = true;
|
|
||||||
// wnd.addChild(scrollCtrl);
|
|
||||||
|
|
||||||
// var arial14fontdata = ResourceLoader.getFileEntry("data/font/arial.fnt");
|
|
||||||
// var arial14b = new BitmapFont(arial14fontdata.entry);
|
|
||||||
// @:privateAccess arial14b.loader = ResourceLoader.loader;
|
|
||||||
// var arial14 = arial14b.toSdfFont(cast 12 * 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);
|
|
||||||
|
|
||||||
// var missionName = new GuiText(markerFelt24);
|
|
||||||
// missionName.position = new Vector(327, 181);
|
|
||||||
// missionName.extent = new Vector(278, 14);
|
|
||||||
// missionName.text.textColor = 0;
|
|
||||||
// missionName.justify = Center;
|
|
||||||
// wnd.addChild(missionName);
|
|
||||||
|
|
||||||
// var replayListBox = new GuiTextListCtrl(markerFelt24, replayList.map(x -> x.name));
|
|
||||||
// replayListBox.position = new Vector(0, 0);
|
|
||||||
// replayListBox.extent = new Vector(283, 346);
|
|
||||||
// replayListBox.textYOffset = -6;
|
|
||||||
// replayListBox.scrollable = true;
|
|
||||||
// replayListBox.onSelectedFunc = (idx) -> {
|
|
||||||
// if (idx < 0)
|
|
||||||
// return;
|
|
||||||
// selectedIdx = idx;
|
|
||||||
// playButton.disabled = false;
|
|
||||||
// var thisReplay = replayList[idx];
|
|
||||||
// var repmis = thisReplay.mission;
|
|
||||||
// if (!StringTools.contains(repmis, "data/"))
|
|
||||||
// repmis = "data/" + repmis;
|
|
||||||
// if (MissionList.missions == null)
|
|
||||||
// MissionList.buildMissionList();
|
|
||||||
// var m = thisReplay.customId == 0 ? MissionList.missions.get(repmis) : Marbleland.missions.get(thisReplay.customId);
|
|
||||||
// missionName.text.text = m.title;
|
|
||||||
// m.getPreviewImage((t) -> {
|
|
||||||
// pmPreview.bmp.tile = t;
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// scrollCtrl.addChild(replayListBox);
|
|
||||||
// scrollCtrl.setScrollMax(replayListBox.calculateFullHeight());
|
|
||||||
|
|
||||||
// var replayFrame = new GuiImage(ResourceLoader.getResource("data/ui/replay/replayframe.png", ResourceLoader.getImage, this.imageResources).toTile());
|
|
||||||
// replayFrame.position = new Vector(351, 21);
|
|
||||||
// replayFrame.extent = new Vector(234, 168);
|
|
||||||
// wnd.addChild(replayFrame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override function onResize(width:Int, height:Int) {
|
override function onResize(width:Int, height:Int) {
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,12 @@ class HuntMode extends NullMode {
|
||||||
|
|
||||||
function findGemSpawnGroup(outSpawnPoint:Vector) {
|
function findGemSpawnGroup(outSpawnPoint:Vector) {
|
||||||
// Pick random spawn point
|
// Pick random spawn point
|
||||||
var spawnPoint = gemSpawnPoints[Math.floor(Math.random() * gemSpawnPoints.length)];
|
var rnd:Int = Std.int(Math.random() * gemSpawnPoints.length);
|
||||||
|
if (level.isRecording)
|
||||||
|
level.replay.recordRandomGenState(rnd);
|
||||||
|
if (level.isWatching)
|
||||||
|
rnd = level.replay.getRandomGenState();
|
||||||
|
var spawnPoint = gemSpawnPoints[rnd];
|
||||||
var pos = spawnPoint.position;
|
var pos = spawnPoint.position;
|
||||||
|
|
||||||
var results = [];
|
var results = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue