here u go frakits
This commit is contained in:
@@ -5,8 +5,10 @@ import sys.FileSystem;
|
||||
#end
|
||||
import flixel.FlxState;
|
||||
import funkin.backend.assets.ModsFolder;
|
||||
import funkin.backend.assets.ModsFolderLibrary;
|
||||
import funkin.backend.chart.EventsData;
|
||||
import funkin.backend.system.framerate.Framerate;
|
||||
import funkin.editors.ModConfigWarning;
|
||||
import funkin.menus.TitleState;
|
||||
import haxe.io.Path;
|
||||
|
||||
@@ -112,10 +114,23 @@ class MainState extends FlxState {
|
||||
if (Framerate.isLoaded)
|
||||
Framerate.instance.reload();
|
||||
|
||||
FlxG.switchState(new TitleState());
|
||||
|
||||
#if sys
|
||||
CoolUtil.safeAddAttributes('./.temp/', NativeAPI.FileAttribute.HIDDEN);
|
||||
#end
|
||||
|
||||
if (Options.devMode) {
|
||||
var lib:ModsFolderLibrary;
|
||||
for (e in Paths.assetsTree.libraries) {
|
||||
@:privateAccess if (!(e is openfl.utils.AssetLibrary) || !((lib = cast cast(e, openfl.utils.AssetLibrary).__proxy) is ModsFolderLibrary)) continue;
|
||||
if (lib.modName == ModsFolder.currentModFolder) {
|
||||
if (lib.exists(Paths.ini("config/modpack"), lime.utils.AssetType.TEXT)) break;
|
||||
|
||||
FlxG.switchState(new ModConfigWarning(lib));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FlxG.switchState(new TitleState());
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,15 @@
|
||||
package funkin.editors;
|
||||
|
||||
class ModConfigWarning extends UIState {
|
||||
import funkin.backend.assets.ModsFolderLibrary;
|
||||
import flixel.FlxState;
|
||||
|
||||
var libraryToMakeConfigIn:Dynamic = null;
|
||||
public static var defaultModConfigText =
|
||||
class ModConfigWarning extends UIState {
|
||||
public static var hadPopup:Bool = false;
|
||||
|
||||
var library:ModsFolderLibrary = null;
|
||||
var goToState:Class<FlxState>;
|
||||
|
||||
public static inline var defaultModConfigText =
|
||||
'[Common]
|
||||
MOD_NAME="YOUR MOD NAME HERE"
|
||||
MOD_DESCRIPTION="YOUR MOD DESCRIPTION HERE"
|
||||
@@ -26,49 +32,43 @@ DISABLE_BETA_WARNING_SCREEN=true
|
||||
MOD_DISCORD_CLIENT_ID=""
|
||||
MOD_DISCORD_LOGO_KEY=""';
|
||||
|
||||
public function new(library) {
|
||||
public function new(library:ModsFolderLibrary, ?goToState:Class<FlxState>) {
|
||||
super();
|
||||
|
||||
libraryToMakeConfigIn = library;
|
||||
this.library = library;
|
||||
this.goToState = goToState != null ? goToState : funkin.menus.TitleState;
|
||||
}
|
||||
|
||||
override function create() {
|
||||
super.create();
|
||||
override function createPost() {
|
||||
super.createPost();
|
||||
hadPopup = true;
|
||||
|
||||
openSubState(new UIWarningSubstate("Missing mod config!", "Your mod is currently missing a mod config file!\n\n\nWould you like to automatically generate one?\n\n(PS: If this is not your mod please disable Developer mode to stop this popup from appearing.)",
|
||||
[
|
||||
var substate = new UIWarningSubstate("Missing mod folder configuration!", "Your mod is currently missing a mod config file!\n\n\nWould you like to automatically generate one?\n\n(PS: If this is not your mod please disable Developer mode to stop this popup from appearing.)", [
|
||||
{
|
||||
label: "Not Now",
|
||||
color: 0x969533,
|
||||
onClick: function (_) {
|
||||
funkin.menus.MainMenuState.hadPopup = true;
|
||||
MusicBeatState.skipTransIn = false;
|
||||
MusicBeatState.skipTransOut = false;
|
||||
FlxG.switchState(new funkin.menus.MainMenuState());
|
||||
MusicBeatState.skipTransOut = MusicBeatState.skipTransIn = false;
|
||||
FlxG.switchState(cast Type.createInstance(goToState, []));
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Yes",
|
||||
onClick: function(_) {
|
||||
trace(libraryToMakeConfigIn.getPath("data/config/modpack.ini"));
|
||||
sys.io.File.saveContent(libraryToMakeConfigIn.getPath("data/config/modpack.ini"), defaultModConfigText);
|
||||
openSubState(new UIWarningSubstate("Created mod config!", "Your mod config file has been created at " + libraryToMakeConfigIn.getPath("data/config/modpack.ini") + "!", [
|
||||
var path = '${library.folderPath}/data/config/modpack.ini';
|
||||
CoolUtil.safeSaveFile(path, defaultModConfigText);
|
||||
openSubState(new UIWarningSubstate("Created mod config!", "Your mod config file has been created at " + path + "!", [
|
||||
{
|
||||
label: "Ok",
|
||||
onClick: function (_) {
|
||||
funkin.menus.MainMenuState.hadPopup = true;
|
||||
MusicBeatState.skipTransIn = false;
|
||||
MusicBeatState.skipTransOut = false;
|
||||
FlxG.switchState(new funkin.menus.MainMenuState());
|
||||
MusicBeatState.skipTransOut = MusicBeatState.skipTransIn = false;
|
||||
FlxG.switchState(cast Type.createInstance(goToState, []));
|
||||
}
|
||||
},
|
||||
], false));
|
||||
}
|
||||
}
|
||||
], false));
|
||||
}
|
||||
|
||||
override function update(elapsed) {
|
||||
super.update(elapsed);
|
||||
], false);
|
||||
substate.bHeight = 300;
|
||||
openSubState(substate);
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,8 @@ class UIWarningSubstate extends MusicBeatSubstate {
|
||||
|
||||
var warnCam:FlxCamera;
|
||||
|
||||
public var bHeight:Int = 232;
|
||||
|
||||
public override function onSubstateOpen() {
|
||||
super.onSubstateOpen();
|
||||
parent.persistentUpdate = false;
|
||||
@@ -69,7 +71,7 @@ class UIWarningSubstate extends MusicBeatSubstate {
|
||||
warnCam.zoom = 0.1;
|
||||
FlxG.cameras.add(warnCam, false);
|
||||
|
||||
var spr = new UISliceSprite(0, 0, CoolUtil.maxInt(560, 30 + (170 * buttons.length)), 232, 'editors/ui/${isError ? "normal" : "grayscale"}-popup');
|
||||
var spr = new UISliceSprite(0, 0, CoolUtil.maxInt(560, 30 + (170 * buttons.length)), bHeight, 'editors/ui/${isError ? "normal" : "grayscale"}-popup');
|
||||
spr.x = (FlxG.width - spr.bWidth) / 2;
|
||||
spr.y = (FlxG.height - spr.bHeight) / 2;
|
||||
spr.color = isError ? 0xFFFF0000 : 0xFFFFFF00;
|
||||
|
||||
@@ -27,8 +27,6 @@ class MainMenuState extends MusicBeatState
|
||||
|
||||
public var canAccessDebugMenus:Bool = !Flags.DISABLE_EDITORS;
|
||||
|
||||
public static var hadPopup = false;
|
||||
|
||||
override function create()
|
||||
{
|
||||
|
||||
@@ -82,23 +80,6 @@ class MainMenuState extends MusicBeatState
|
||||
add(versionText);
|
||||
|
||||
changeItem();
|
||||
|
||||
if (Options.devMode && !MainMenuState.hadPopup)
|
||||
for (i in Paths.assetsTree.libraries) {
|
||||
var l = i;
|
||||
if (l is openfl.utils.AssetLibrary) {
|
||||
@:privateAccess
|
||||
l = cast(l, openfl.utils.AssetLibrary).__proxy;
|
||||
}
|
||||
if (cast(l, funkin.backend.assets.IModsAssetLibrary).modName == funkin.backend.assets.ModsFolder.currentModFolder) {
|
||||
if (!l.exists(Paths.getPath("data/config/modpack.ini"), lime.utils.AssetType.TEXT)) {
|
||||
MusicBeatState.skipTransIn = true;
|
||||
MusicBeatState.skipTransOut = true;
|
||||
FlxG.switchState(new funkin.editors.ModConfigWarning(l));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var selectedSomethin:Bool = false;
|
||||
|
||||
Reference in New Issue
Block a user