Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Canned | More code
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLikesKirby authored Jun 17, 2024
1 parent bf66280 commit e935b35
Show file tree
Hide file tree
Showing 3 changed files with 1,201 additions and 1,201 deletions.
158 changes: 79 additions & 79 deletions source/CustomSongs.hx
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
/*package;
// CUSTOM STUFF LETS GOOOOO!
import lime.utils.Assets;
import openfl.utils.Assets as OpenFlAssets;
import haxe.Json;
import FreeplayState;
import sys.FileSystem;
import sys.io.File;
typedef SongsFile =
{
// JSON variables
var songs:Array<Dynamic>;
var weekNum:Int;
var songCharacters:Array<String>;
}
class SongData {
public var songsLoaded:Map<String, SongData> = new Map<String, SongData>();
public static var songsList:Array<String> = [];
public var folder:String = '';
// JSON variables
var songs:Array<String>;
var weekNum:Int;
var songCharacters:Array<String>;
public var fileName:String;
public static function createSongFile():SongsFile {
var songFile:SongsFile = {
songs: ['Warmup'],
weekNum: 0,
songCharacters: ['dave']
};
return songFile;
}
// HELP: Is there any way to convert a WeekFile to WeekData without having to put all variables there manually? I'm kind of a noob in haxe lmao
public function new(songFile:SongsFile, fileName:String) {
// here ya go - MiguelItsOut
for (field in Reflect.fields(songFile)) {
Reflect.setProperty(this, field, Reflect.getProperty(songFile, field));
}
this.fileName = fileName;
}
}
function addCustomSong(songToCheck:String, path:String, directory:String, i:Int, originalLength:Int)
{
if(!songsLoaded.exists(songToCheck))
{
var song:SongsFile = getSongFile(path);
if(song != null)
{
var weekFile:SongData = new SongData(song, songToCheck);
if(i >= originalLength)
{
weekFile.folder = directory.substring(Paths.mods().length, directory.length-1);
}
}
}
}
var songsLoaded:Map<String, SongData> = new Map<String, SongData>();
private function getSongFile(path:String):SongsFile {
var rawJson:String = null;
if(FileSystem.exists(path)) {
rawJson = File.getContent(path);
}
if(rawJson != null && rawJson.length > 0) {
return cast tjson.TJSON.parse(rawJson); // use haxelib install tjson 1.4.0 btw
}
return null;
} */
/*package;
// CUSTOM STUFF LETS GOOOOO!
import lime.utils.Assets;
import openfl.utils.Assets as OpenFlAssets;
import haxe.Json;
import FreeplayState;
import sys.FileSystem;
import sys.io.File;
typedef SongsFile =
{
// JSON variables
var songs:Array<Dynamic>;
var weekNum:Int;
var songCharacters:Array<String>;
}
class SongData {
public var songsLoaded:Map<String, SongData> = new Map<String, SongData>();
public static var songsList:Array<String> = [];
public var folder:String = '';
// JSON variables
var songs:Array<String>;
var weekNum:Int;
var songCharacters:Array<String>;
public var fileName:String;
public static function createSongFile():SongsFile {
var songFile:SongsFile = {
songs: ['Warmup'],
weekNum: 0,
songCharacters: ['dave']
};
return songFile;
}
// HELP: Is there any way to convert a WeekFile to WeekData without having to put all variables there manually? I'm kind of a noob in haxe lmao
public function new(songFile:SongsFile, fileName:String) {
// here ya go - MiguelItsOut
for (field in Reflect.fields(songFile)) {
Reflect.setProperty(this, field, Reflect.getProperty(songFile, field));
}
this.fileName = fileName;
}
}
function addCustomSong(songToCheck:String, path:String, directory:String, i:Int, originalLength:Int)
{
if(!songsLoaded.exists(songToCheck))
{
var song:SongsFile = getSongFile(path);
if(song != null)
{
var weekFile:SongData = new SongData(song, songToCheck);
if(i >= originalLength)
{
weekFile.folder = directory.substring(Paths.mods().length, directory.length-1);
}
}
}
}
var songsLoaded:Map<String, SongData> = new Map<String, SongData>();
private function getSongFile(path:String):SongsFile {
var rawJson:String = null;
if(FileSystem.exists(path)) {
rawJson = File.getContent(path);
}
if(rawJson != null && rawJson.length > 0) {
return cast tjson.TJSON.parse(rawJson); // use haxelib install tjson 1.4.0 btw
}
return null;
} */
Loading

0 comments on commit e935b35

Please sign in to comment.