Merge remote-tracking branch 'master/main'

This commit is contained in:
⍚~Nex
2024-02-09 15:33:36 +01:00
11 changed files with 114 additions and 25 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
## PLEASE NOTE - THIS IS STILL IN A BETA STATE
### Mods created with beta versions of Codename may not be compatible with the release version
Known issues in the alpha:
Known issues in the beta:
- Some options are missing
- Week 6 still have no dialogue
+3 -3
View File
@@ -4,9 +4,9 @@
<checkbox id="checkboxExample" name="Checkbox example" />
<number id="numberExample" name="Number example" min="0" max="10" change="1"/>
<choice id="choiceExample" name="Choice Example">
<value name="Disabled" value="disabled" />
<value name="This Only" value="thisonly" />
<value name="All" value="all" />
<value name="Disabled" value="disabled"/>
<value name="This only" value="thisOnly"/>
<value name="All" value="all"/>
</choice>
<menu name="Submenu Example" desc="Submenu test">
-1
View File
@@ -1 +0,0 @@
typedef Main = funkin.backend.system.Main;
+4
View File
@@ -36,6 +36,10 @@ import funkin.backend.assets.ModsFolder;
class Main extends Sprite
{
// make this empty once you guys are done with the project.
// good luck /gen <3 @crowplexus
public static final releaseCycle:String = "Beta";
public static var instance:Main;
public static var modToLoad:String = null;
@@ -11,6 +11,6 @@ class CodenameBuildField extends TextField {
defaultTextFormat = Framerate.textFormat;
autoSize = LEFT;
multiline = wordWrap = false;
text = 'Codename Engine Beta\nCommit ${GitCommitMacro.commitNumber} (${GitCommitMacro.commitHash})';
text = 'Codename Engine ${Main.releaseCycle}\nCommit ${GitCommitMacro.commitNumber} (${GitCommitMacro.commitHash})';
}
}
}
+2 -1
View File
@@ -1,4 +1,5 @@
#if !macro
import funkin.backend.system.Main;
import funkin.backend.assets.Paths;
import funkin.backend.MusicBeatState;
import funkin.backend.MusicBeatSubstate;
@@ -27,4 +28,4 @@ import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
using StringTools;
using funkin.backend.utils.CoolUtil;
#end
#end
+1 -1
View File
@@ -20,7 +20,7 @@ class BetaWarningState extends MusicBeatState {
disclaimer = new FunkinText(16, titleAlphabet.y + titleAlphabet.height + 10, FlxG.width - 32, "", 32);
disclaimer.alignment = CENTER;
disclaimer.applyMarkup("This engine is still in a beta state. That means *majority of the features* are either *buggy* or *non finished*. If you find any bugs, please report them to the Codename Engine GitHub.\n\nPress ENTER to continue",
disclaimer.applyMarkup('This engine is still in a *${Main.releaseCycle}* state. That means *majority of the features* are either *buggy* or *non finished*. If you find any bugs, please report them to the Codename Engine GitHub.\n\nPress ENTER to continue',
[
new FlxTextFormatMarkerPair(new FlxTextFormat(0xFFFF4444), "*")
]
+6 -16
View File
@@ -76,9 +76,9 @@ class MainMenuState extends MusicBeatState
FlxG.camera.follow(camFollow, null, 0.06);
var versionShit:FunkinText = new FunkinText(5, FlxG.height - 2, 0, 'Codename Engine v${Application.current.meta.get('version')}\nAlpha: Commit ${funkin.backend.system.macros.GitCommitMacro.commitNumber} (${funkin.backend.system.macros.GitCommitMacro.commitHash})\n[TAB] Open Mods menu\n');
versionShit.scrollFactor.set();
var versionShit:FunkinText = new FunkinText(5, FlxG.height - 2, 0, 'Codename Engine v${Application.current.meta.get('version')}\nCommit ${funkin.backend.system.macros.GitCommitMacro.commitNumber} (${funkin.backend.system.macros.GitCommitMacro.commitHash})\n[TAB] Open Mods menu\n');
versionShit.y -= versionShit.height;
versionShit.scrollFactor.set();
add(versionShit);
changeItem();
@@ -165,20 +165,10 @@ class MainMenuState extends MusicBeatState
if (event.cancelled) return;
switch (daChoice)
{
case 'story mode':
FlxG.switchState(new StoryMenuState());
trace("Story Menu Selected");
case 'freeplay':
FlxG.switchState(new FreeplayState());
trace("Freeplay Menu Selected");
case 'donate':
FlxG.switchState(new CreditsMain());
trace("Credits Menu Selected");
case 'options':
FlxG.switchState(new OptionsMenu());
case 'story mode': FlxG.switchState(new StoryMenuState());
case 'freeplay': FlxG.switchState(new FreeplayState());
case 'donate': FlxG.switchState(new CreditsMain());
case 'options': FlxG.switchState(new OptionsMenu());
}
});
}
+17
View File
@@ -121,6 +121,23 @@ class OptionsMenu extends TreeMenu {
continue;
}
options.push(new NumOption(name, desc, Std.parseFloat(node.att.min), Std.parseFloat(node.att.max), Std.parseFloat(node.att.change), node.att.id, null, FlxG.save.data));
case "choice":
if (!node.has.id) {
Logs.trace("A choice option requires an \"id\" for option saving.", WARNING);
continue;
}
var optionOptions:Array<Dynamic> = [];
var optionDisplayOptions:Array<String> = [];
for(choice in node.elements) {
optionOptions.push(choice.att.value);
optionDisplayOptions.push(choice.att.name);
}
if(optionOptions.length > 0)
options.push(new ArrayOption(name, desc, optionOptions, optionDisplayOptions, node.att.id, null, FlxG.save.data));
case "menu":
options.push(new TextOption(name + " >", desc, function() {
optionsTree.add(new OptionsScreen(name, desc, parseOptionsFromXML(node)));
+77
View File
@@ -0,0 +1,77 @@
package funkin.options.type;
import flixel.effects.FlxFlicker;
class ArrayOption extends OptionType {
public var selectCallback:String->Void;
private var __text:Alphabet;
private var __selectiontext:Alphabet;
public var options:Array<Dynamic>;
public var displayOptions:Array<String>;
public var currentSelection:Int;
var optionName:String;
public var parent:Dynamic;
public var text(get, set):String;
private function get_text() {return __text.text;}
private function set_text(v:String) {return __text.text = v;}
public function new(text:String, desc:String, options:Array<Dynamic>, displayOptions:Array<String>, optionName:String, ?selectCallback:String->Void = null, ?parent:Dynamic) {
super(desc);
this.selectCallback = selectCallback;
this.displayOptions = displayOptions;
this.options = options;
if (parent == null)
parent = Options;
this.parent = parent;
if(Reflect.field(parent, optionName) != null)
{
if(options.indexOf(Reflect.field(parent, optionName)) != -1)
this.currentSelection = options.indexOf(Reflect.field(parent, optionName));
else
this.currentSelection = 0;
}
this.optionName = optionName;
add(__text = new Alphabet(100, 20, text, true));
add(__selectiontext = new Alphabet(__text.width + 120, -30, formatTextOption(), false));
}
public override function draw() {
super.draw();
}
public override function onChangeSelection(change:Float):Void
{
if(currentSelection <= 0 && change == -1 || currentSelection >= options.length - 1 && change == 1 ) return;
currentSelection += Math.round(change);
__selectiontext.text = formatTextOption();
Reflect.setField(parent, optionName, options[currentSelection]);
if(selectCallback != null)
selectCallback(options[currentSelection]);
}
private function formatTextOption() {
var currentOptionString = ": ";
if((currentSelection > 0))
currentOptionString += "< ";
else
currentOptionString += " ";
currentOptionString += displayOptions[currentSelection];
if(!(currentSelection >= options.length - 1))
currentOptionString += " >";
return currentOptionString;
}
}
+1
View File
@@ -1,5 +1,6 @@
package openfl.utils;
import funkin.backend.system.Main;
import funkin.options.Options;
import funkin.backend.system.OptimizedBitmapData;
import openfl.utils._internal.Log;