Merge branch 'rewrite/master' into feature/audio-tab-upgrade

This commit is contained in:
Cameron Taylor 2024-01-25 22:52:31 -05:00
commit 72fe05ddf5
6 changed files with 112 additions and 7 deletions

View file

@ -54,14 +54,14 @@
"name": "haxeui-core",
"type": "git",
"dir": null,
"ref": "bb904f8b4b205755a310c23ff25219f9dcd62711",
"ref": "5b2d5b8e7e470cf637953e1369c80a1f42016a75",
"url": "https://github.com/haxeui/haxeui-core"
},
{
"name": "haxeui-flixel",
"type": "git",
"dir": null,
"ref": "1ec470c297afd7758a90dc9399aa1e3a4ea6ca0b",
"ref": "e9f880522e27134b29df4067f82df7d7e5237b70",
"url": "https://github.com/haxeui/haxeui-flixel"
},
{

View file

@ -8,8 +8,7 @@ class PolygonVisGroup extends FlxTypedGroup<PolygonSpectogram>
{
public var playerVis:PolygonSpectogram;
public var opponentVis:PolygonSpectogram;
var instVis:PolygonSpectogram;
public var instVis:PolygonSpectogram;
public function new()
{
@ -51,6 +50,43 @@ class PolygonVisGroup extends FlxTypedGroup<PolygonSpectogram>
instVis = vis;
}
public function clearPlayerVis():Void
{
if (playerVis != null)
{
remove(playerVis);
playerVis.destroy();
playerVis = null;
}
}
public function clearOpponentVis():Void
{
if (opponentVis != null)
{
remove(opponentVis);
opponentVis.destroy();
opponentVis = null;
}
}
public function clearInstVis():Void
{
if (instVis != null)
{
remove(instVis);
instVis.destroy();
instVis = null;
}
}
public function clearAllVis():Void
{
clearPlayerVis();
clearOpponentVis();
clearInstVis();
}
/**
* Overrides the add function to add a visualizer to the group.
* @param vis The visualizer to add.

View file

@ -235,6 +235,7 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
difficulty.timeChanges = metadata.timeChanges;
difficulty.looped = metadata.looped;
difficulty.generatedBy = metadata.generatedBy;
difficulty.offsets = metadata?.offsets ?? new SongOffsets();
difficulty.stage = metadata.playData.stage;
difficulty.noteStyle = metadata.playData.noteStyle;

View file

@ -1366,6 +1366,46 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
return currentSongMetadata.artist = value;
}
/**
* Convenience property to get the player charId for the current variation.
*/
var currentPlayerChar(get, set):String;
function get_currentPlayerChar():String
{
if (currentSongMetadata.playData.characters.player == null)
{
// Initialize to the default value if not set.
currentSongMetadata.playData.characters.player = Constants.DEFAULT_CHARACTER;
}
return currentSongMetadata.playData.characters.player;
}
function set_currentPlayerChar(value:String):String
{
return currentSongMetadata.playData.characters.player = value;
}
/**
* Convenience property to get the opponent charId for the current variation.
*/
var currentOpponentChar(get, set):String;
function get_currentOpponentChar():String
{
if (currentSongMetadata.playData.characters.opponent == null)
{
// Initialize to the default value if not set.
currentSongMetadata.playData.characters.opponent = Constants.DEFAULT_CHARACTER;
}
return currentSongMetadata.playData.characters.opponent;
}
function set_currentOpponentChar(value:String):String
{
return currentSongMetadata.playData.characters.opponent = value;
}
/**
* Convenience property to get the song offset data for the current variation.
*/
@ -1401,6 +1441,23 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
return value;
}
var currentVocalOffset(get, set):Float;
function get_currentVocalOffset():Float
{
// Currently there's only one vocal offset, so we just grab the player's offset since both should be the same.
// Should probably make it so we can set offsets for player + opponent individually, though.
return currentSongOffsets.getVocalOffset(currentPlayerChar);
}
function set_currentVocalOffset(value:Float):Float
{
// Currently there's only one vocal offset, so we just apply it to both characters.
currentSongOffsets.setVocalOffset(currentPlayerChar, value);
currentSongOffsets.setVocalOffset(currentOpponentChar, value);
return value;
}
/**
* The variation ID for the difficulty which is currently being edited.
*/

View file

@ -190,7 +190,7 @@ class ChartEditorAudioHandler
state.audioVisGroup.playerVis.detail = 1;
state.audioVisGroup.playerVis.y = Math.max(state.gridTiledSprite?.y ?? 0.0, ChartEditorState.GRID_INITIAL_Y_POS - ChartEditorState.GRID_TOP_PAD);
state.audioVocalTrackGroup.playerVoicesOffset = state.currentSongOffsets.getVocalOffset(charId);
state.audioVocalTrackGroup.playerVoicesOffset = state.currentVocalOffset;
return true;
case DAD:
state.audioVocalTrackGroup.addOpponentVoice(vocalTrack);
@ -202,7 +202,7 @@ class ChartEditorAudioHandler
state.audioVisGroup.opponentVis.detail = 1;
state.audioVisGroup.opponentVis.y = Math.max(state.gridTiledSprite?.y ?? 0.0, ChartEditorState.GRID_INITIAL_Y_POS - ChartEditorState.GRID_TOP_PAD);
state.audioVocalTrackGroup.opponentVoicesOffset = state.currentSongOffsets.getVocalOffset(charId);
state.audioVocalTrackGroup.opponentVoicesOffset = state.currentVocalOffset;
return true;
case OTHER:
@ -223,6 +223,10 @@ class ChartEditorAudioHandler
{
state.audioVocalTrackGroup.clear();
}
if (state.audioVisGroup != null)
{
state.audioVisGroup.clearAllVis();
}
}
/**

View file

@ -150,7 +150,12 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox
inputOffsetVocal.onChange = function(event:UIEvent) {
if (event.value == null) return;
chartEditorState.currentSongMetadata.offsets.setVocalOffset(chartEditorState.currentSongMetadata.playData.characters.player, event.value);
chartEditorState.currentVocalOffset = event.value;
if (chartEditorState.audioVocalTrackGroup != null)
{
chartEditorState.audioVocalTrackGroup.playerVoicesOffset = event.value;
chartEditorState.audioVocalTrackGroup.opponentVoicesOffset = event.value;
}
};
inputScrollSpeed.onChange = function(event:UIEvent) {
var valid:Bool = event.target.value != null && event.target.value > 0;
@ -191,6 +196,8 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox
inputStage.value = chartEditorState.currentSongMetadata.playData.stage;
inputNoteStyle.value = chartEditorState.currentSongMetadata.playData.noteStyle;
inputBPM.value = chartEditorState.currentSongMetadata.timeChanges[0].bpm;
inputOffsetInst.value = chartEditorState.currentSongMetadata.offsets.getInstrumentalOffset();
inputOffsetVocal.value = chartEditorState.currentSongMetadata.offsets.getVocalOffset(chartEditorState.currentSongMetadata.playData.characters.player);
inputScrollSpeed.value = chartEditorState.currentSongChartScrollSpeed;
labelScrollSpeed.text = 'Scroll Speed: ${chartEditorState.currentSongChartScrollSpeed}x';
frameVariation.text = 'Variation: ${chartEditorState.selectedVariation.toTitleCase()}';