diff --git a/assets/images/editors/charter/add-strumline.png b/assets/images/editors/charter/add-strumline.png index d890a9a1..f2262c21 100644 Binary files a/assets/images/editors/charter/add-strumline.png and b/assets/images/editors/charter/add-strumline.png differ diff --git a/assets/images/editors/charter/lock-strumline.png b/assets/images/editors/charter/lock-strumline.png index 0583bec2..f2262c21 100644 Binary files a/assets/images/editors/charter/lock-strumline.png and b/assets/images/editors/charter/lock-strumline.png differ diff --git a/assets/images/editors/ui/audio-time-empty.png b/assets/images/editors/ui/audio-time-empty.png index d5a36361..0f380282 100644 Binary files a/assets/images/editors/ui/audio-time-empty.png and b/assets/images/editors/ui/audio-time-empty.png differ diff --git a/assets/images/editors/ui/audio-time-full.png b/assets/images/editors/ui/audio-time-full.png index 22073536..c52c765a 100644 Binary files a/assets/images/editors/ui/audio-time-full.png and b/assets/images/editors/ui/audio-time-full.png differ diff --git a/assets/images/editors/ui/audio-volume-empty.png b/assets/images/editors/ui/audio-volume-empty.png index 7255b513..5ad6dc52 100644 Binary files a/assets/images/editors/ui/audio-volume-empty.png and b/assets/images/editors/ui/audio-volume-empty.png differ diff --git a/assets/images/editors/ui/audio-volume-full.png b/assets/images/editors/ui/audio-volume-full.png index 76ffc958..bac31729 100644 Binary files a/assets/images/editors/ui/audio-volume-full.png and b/assets/images/editors/ui/audio-volume-full.png differ diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 280795bb..5ab87d09 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -45,6 +45,7 @@ class Charter extends UIState { public var scrollBar:UIScrollBar; public var songPosInfo:UIText; + public var playBackSlider:UISlider; public var topMenuSpr:UITopMenu; public var gridBackdrops:CharterBackdropGroup; @@ -373,6 +374,9 @@ class Charter extends UIState { songPosInfo.alignment = RIGHT; uiGroup.add(songPosInfo); + //playBackSlider = new UISlider(FlxG.width - 180 - 26 - 12, (23/2) - (4/2), 180, [{start: 0.25, end: 1, size: 0.5}, {start: 1, end: 3, size: 0.5}]); + //uiGroup.add(playBackSlider); + strumlineInfoBG = new UISprite(); strumlineInfoBG.loadGraphic(Paths.image('editors/charter/strumline-info-bg')); strumlineInfoBG.y = 23; @@ -1259,6 +1263,7 @@ class Charter extends UIState { public function buildEvents() { PlayState.SONG.events = []; + eventsGroup.sortEvents(); for(e in eventsGroup.members) { for(event in e.events) { event.time = Conductor.getTimeForStep(e.step); diff --git a/source/funkin/editors/charter/CharterEvent.hx b/source/funkin/editors/charter/CharterEvent.hx index 7fe4fff6..6de57ceb 100644 --- a/source/funkin/editors/charter/CharterEvent.hx +++ b/source/funkin/editors/charter/CharterEvent.hx @@ -85,8 +85,8 @@ class CharterEvent extends UISliceSprite implements ICharterSelectable { } public function handleDrag(change:FlxPoint) { - var newStep:Float = FlxMath.bound(step + change.x, 0, Charter.instance.__endStep-1); - y = ((step = newStep) * 40) - 17; + var newStep:Float = step = FlxMath.bound(step + change.x, 0, Charter.instance.__endStep-1); + y = ((newStep) * 40) - 17; } public function refreshEventIcons() { diff --git a/source/funkin/editors/ui/UISlider.hx b/source/funkin/editors/ui/UISlider.hx new file mode 100644 index 00000000..f8faeefc --- /dev/null +++ b/source/funkin/editors/ui/UISlider.hx @@ -0,0 +1,69 @@ +package funkin.editors.ui; + +using StringTools; + +typedef SliderSegement = { + var start:Float; + var end:Float; + var size:Float; +} + +class UISlider extends UISprite { + public var segments:Array = []; + public var barWidth:Int = 120; + + public var barStartSpr:FlxSprite; + public var startText:UIText; + public var barEndSpr:FlxSprite; + public var endText:UIText; + + public var barSegements:Map<{segment:Float, size:Float}, UISprite> = []; + + public function new(x:Float, y:Float, width:Int = 120, segments:Array) { + this.segments = segments; + this.barWidth = width; + + super(x, y); + makeSolid(barWidth, 4, -1); + + members.push(barStartSpr = new FlxSprite(x-4,y+((4/2))).makeSolid(4, 12, -1)); + members.push(barEndSpr = new FlxSprite(x+barWidth,y+((4/2))).makeSolid(4, 12, -1)); + + members.push(startText = new UIText(x, y, 0, Std.string(segments[0].start).replace("0.", "."))); + members.push(endText = new UIText(x + barWidth + 8, y, 0, Std.string(segments[segments.length-1].end))); + + var midSegments:Map = []; + for (segment in segments) { + var isFront:Bool = segment.start == segments[0].start; + var isEnd:Bool = segment.end == segments[segments.length-1].end; + + if (isFront && !midSegments.exists(Std.int(segment.end*1000))) midSegments.set(Std.int(segment.end*1000), segment.size); + if (isEnd && !midSegments.exists(Std.int(segment.start*1000))) midSegments.set(Std.int(segment.start*1000), segment.size); + } + + for (segment => size in midSegments) { + var segmentSpr:UISprite = new UISprite(x,y); + segmentSpr.makeSolid(4, 8, -1); + segmentSpr.members = [new UIText(x, y, 0, Std.string(segment/1000).replace("0.", "."), 10)]; + members.push(segmentSpr); + + barSegements.set({segment: segment/1000, size: size}, segmentSpr); + } + } + + public override function update(elapsed:Float) { + barStartSpr.follow(this, -4, (4-12)/2); + barEndSpr.follow(this, barWidth, (4-12)/2); + + startText.follow(this, -startText.width-10, (4/2) - (startText.height/2)); + endText.follow(this, barWidth + 10, (4/2) - (endText.height/2)); + + for (segmentData => sprite in barSegements) { + sprite.follow(this, (barWidth * segmentData.size) - (sprite.width/2), ((4-8)/2) -2); + if (sprite.members[0] != null && sprite.members[0] is UIText) + cast(sprite.members[0], UIText).follow(sprite,0,sprite.height); + } + + super.update(elapsed); + } +} \ No newline at end of file