mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
progression stuff
This commit is contained in:
parent
9c3348bea5
commit
e4ac8275c4
5 changed files with 41 additions and 6 deletions
|
|
@ -22,6 +22,11 @@ class AudioManager {
|
||||||
musicGroup.volume = Settings.optionsSettings.musicVolume;
|
musicGroup.volume = Settings.optionsSettings.musicVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function updateVolumes() {
|
||||||
|
soundGroup.volume = Settings.optionsSettings.soundVolume;
|
||||||
|
musicGroup.volume = Settings.optionsSettings.musicVolume;
|
||||||
|
}
|
||||||
|
|
||||||
public static function update(scene3d:Scene) {
|
public static function update(scene3d:Scene) {
|
||||||
manager.listener.syncCamera(scene3d.camera);
|
manager.listener.syncCamera(scene3d.camera);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ class Mission {
|
||||||
public var path:String;
|
public var path:String;
|
||||||
public var missionInfo:MissionElementScriptObject;
|
public var missionInfo:MissionElementScriptObject;
|
||||||
public var index:Int;
|
public var index:Int;
|
||||||
|
public var difficultyIndex:Int;
|
||||||
|
|
||||||
public function new() {}
|
public function new() {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package src;
|
package src;
|
||||||
|
|
||||||
|
import src.AudioManager;
|
||||||
import hxd.Key;
|
import hxd.Key;
|
||||||
import src.MarbleGame;
|
import src.MarbleGame;
|
||||||
import hxd.Window;
|
import hxd.Window;
|
||||||
|
|
@ -72,9 +73,12 @@ class Settings {
|
||||||
invertYAxis: false
|
invertYAxis: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static var progression = [0, 0, 0];
|
||||||
|
|
||||||
public static function applySettings() {
|
public static function applySettings() {
|
||||||
Window.getInstance().resize(optionsSettings.screenWidth, optionsSettings.screenHeight);
|
Window.getInstance().resize(optionsSettings.screenWidth, optionsSettings.screenHeight);
|
||||||
Window.getInstance().displayMode = optionsSettings.isFullScreen ? FullscreenResize : Windowed;
|
Window.getInstance().displayMode = optionsSettings.isFullScreen ? FullscreenResize : Windowed;
|
||||||
|
AudioManager.updateVolumes();
|
||||||
|
|
||||||
MarbleGame.canvas.render(MarbleGame.canvas.scene2d);
|
MarbleGame.canvas.render(MarbleGame.canvas.scene2d);
|
||||||
save();
|
save();
|
||||||
|
|
@ -103,7 +107,8 @@ class Settings {
|
||||||
var outputData = {
|
var outputData = {
|
||||||
highScores: highScores,
|
highScores: highScores,
|
||||||
options: optionsSettings,
|
options: optionsSettings,
|
||||||
controls: controlsSettings
|
controls: controlsSettings,
|
||||||
|
progression: progression
|
||||||
};
|
};
|
||||||
var json = Json.stringify(outputData);
|
var json = Json.stringify(outputData);
|
||||||
File.saveContent("settings.json", json);
|
File.saveContent("settings.json", json);
|
||||||
|
|
@ -118,6 +123,7 @@ class Settings {
|
||||||
}
|
}
|
||||||
optionsSettings = json.options;
|
optionsSettings = json.options;
|
||||||
controlsSettings = json.controls;
|
controlsSettings = json.controls;
|
||||||
|
progression = json.progression;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,11 @@ class EndGameGui extends GuiControl {
|
||||||
|
|
||||||
var idx = scoreTimes.indexOf(timeState.gameplayClock);
|
var idx = scoreTimes.indexOf(timeState.gameplayClock);
|
||||||
|
|
||||||
|
if (Settings.progression[mission.difficultyIndex] == mission.index) {
|
||||||
|
Settings.progression[mission.difficultyIndex]++;
|
||||||
|
}
|
||||||
|
Settings.save();
|
||||||
|
|
||||||
if (idx <= 2) {
|
if (idx <= 2) {
|
||||||
var end = new EnterNameDlg(idx, (name) -> {
|
var end = new EnterNameDlg(idx, (name) -> {
|
||||||
if (scoreSubmitted)
|
if (scoreSubmitted)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
package gui;
|
package gui;
|
||||||
|
|
||||||
|
import h3d.Matrix;
|
||||||
|
import h2d.filter.ColorMatrix;
|
||||||
|
import h2d.Tile;
|
||||||
|
import h3d.mat.Texture;
|
||||||
|
import h2d.Bitmap;
|
||||||
|
import hxd.BitmapData;
|
||||||
import src.AudioManager;
|
import src.AudioManager;
|
||||||
import src.Settings.Score;
|
import src.Settings.Score;
|
||||||
import src.Settings.Settings;
|
import src.Settings.Settings;
|
||||||
|
|
@ -91,6 +97,8 @@ class PlayMissionGui extends GuiImage {
|
||||||
pmPreview.position = new Vector(312, 42);
|
pmPreview.position = new Vector(312, 42);
|
||||||
pmPreview.extent = new Vector(258, 193);
|
pmPreview.extent = new Vector(258, 193);
|
||||||
pmBox.addChild(pmPreview);
|
pmBox.addChild(pmPreview);
|
||||||
|
var filt = new ColorMatrix(Matrix.I());
|
||||||
|
pmPreview.bmp.filter = filt;
|
||||||
|
|
||||||
var levelWnd = new GuiImage(ResourceLoader.getImage("data/ui/play/level_window.png").toTile());
|
var levelWnd = new GuiImage(ResourceLoader.getImage("data/ui/play/level_window.png").toTile());
|
||||||
levelWnd.position = new Vector();
|
levelWnd.position = new Vector();
|
||||||
|
|
@ -101,7 +109,7 @@ class PlayMissionGui extends GuiImage {
|
||||||
var domcasual24 = new BitmapFont(domcasual24fontdata.entry);
|
var domcasual24 = new BitmapFont(domcasual24fontdata.entry);
|
||||||
@:privateAccess domcasual24.loader = ResourceLoader.loader;
|
@:privateAccess domcasual24.loader = ResourceLoader.loader;
|
||||||
|
|
||||||
var domcasual32fontdata = ResourceLoader.loader.load("data/font/DomCasual24px.fnt");
|
var domcasual32fontdata = ResourceLoader.loader.load("data/font/DomCasual32px.fnt");
|
||||||
var domcasual32 = new BitmapFont(domcasual32fontdata.entry);
|
var domcasual32 = new BitmapFont(domcasual32fontdata.entry);
|
||||||
@:privateAccess domcasual32.loader = ResourceLoader.loader;
|
@:privateAccess domcasual32.loader = ResourceLoader.loader;
|
||||||
|
|
||||||
|
|
@ -112,8 +120,8 @@ class PlayMissionGui extends GuiImage {
|
||||||
var arialBold14fontdata = ResourceLoader.loader.load("data/font/ArialBold14px.fnt");
|
var arialBold14fontdata = ResourceLoader.loader.load("data/font/ArialBold14px.fnt");
|
||||||
var arialBold14 = new BitmapFont(arialBold14fontdata.entry);
|
var arialBold14 = new BitmapFont(arialBold14fontdata.entry);
|
||||||
@:privateAccess arialBold14.loader = ResourceLoader.loader;
|
@:privateAccess arialBold14.loader = ResourceLoader.loader;
|
||||||
|
|
||||||
// TODO texts
|
// TODO texts
|
||||||
|
|
||||||
var levelBkgnd = new GuiText(domcasual24);
|
var levelBkgnd = new GuiText(domcasual24);
|
||||||
levelBkgnd.position = new Vector(5, 156);
|
levelBkgnd.position = new Vector(5, 156);
|
||||||
levelBkgnd.extent = new Vector(254, 24);
|
levelBkgnd.extent = new Vector(254, 24);
|
||||||
|
|
@ -144,6 +152,7 @@ class PlayMissionGui extends GuiImage {
|
||||||
pmPlay.pressedAction = (sender) -> {
|
pmPlay.pressedAction = (sender) -> {
|
||||||
// Wacky hacks
|
// Wacky hacks
|
||||||
currentList[currentSelection].index = currentSelection;
|
currentList[currentSelection].index = currentSelection;
|
||||||
|
currentList[currentSelection].difficultyIndex = ["beginner", "intermediate", "advanced"].indexOf(currentCategory);
|
||||||
cast(this.parent, Canvas).marbleGame.playMission(currentList[currentSelection]);
|
cast(this.parent, Canvas).marbleGame.playMission(currentList[currentSelection]);
|
||||||
}
|
}
|
||||||
pmBox.addChild(pmPlay);
|
pmBox.addChild(pmPlay);
|
||||||
|
|
@ -175,7 +184,7 @@ class PlayMissionGui extends GuiImage {
|
||||||
function mlFontLoader(text:String) {
|
function mlFontLoader(text:String) {
|
||||||
switch (text) {
|
switch (text) {
|
||||||
case "DomCasual24":
|
case "DomCasual24":
|
||||||
return domcasual32.toFont();
|
return domcasual24.toFont();
|
||||||
case "Arial14":
|
case "Arial14":
|
||||||
return arial14.toFont();
|
return arial14.toFont();
|
||||||
case "ArialBold14":
|
case "ArialBold14":
|
||||||
|
|
@ -303,6 +312,17 @@ class PlayMissionGui extends GuiImage {
|
||||||
} else
|
} else
|
||||||
pmNext.disabled = false;
|
pmNext.disabled = false;
|
||||||
|
|
||||||
|
if (Settings.progression[["beginner", "intermediate", "advanced"].indexOf(currentCategory)] < currentSelection) {
|
||||||
|
noQualText.text.visible = true;
|
||||||
|
filt.matrix.identity();
|
||||||
|
filt.matrix.colorGain(0, 96 / 255);
|
||||||
|
pmPlay.disabled = true;
|
||||||
|
} else {
|
||||||
|
noQualText.text.visible = false;
|
||||||
|
filt.matrix.identity();
|
||||||
|
pmPlay.disabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
var currentMission = currentList[currentSelection];
|
var currentMission = currentList[currentSelection];
|
||||||
|
|
||||||
var scoreData:Array<Score> = Settings.getScores(currentMission.path);
|
var scoreData:Array<Score> = Settings.getScores(currentMission.path);
|
||||||
|
|
@ -341,8 +361,6 @@ class PlayMissionGui extends GuiImage {
|
||||||
|
|
||||||
levelBkgnd.text.text = currentCategory.charAt(0).toUpperCase() + currentCategory.substr(1) + ' Level ${currentSelection + 1}';
|
levelBkgnd.text.text = currentCategory.charAt(0).toUpperCase() + currentCategory.substr(1) + ' Level ${currentSelection + 1}';
|
||||||
levelFgnd.text.text = currentCategory.charAt(0).toUpperCase() + currentCategory.substr(1) + ' Level ${currentSelection + 1}';
|
levelFgnd.text.text = currentCategory.charAt(0).toUpperCase() + currentCategory.substr(1) + ' Level ${currentSelection + 1}';
|
||||||
|
|
||||||
noQualText.text.visible = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue