From 1f6b7625adbc1343bb5e57ae606fbc54923ad219 Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Fri, 4 Aug 2023 18:07:47 -0700 Subject: [PATCH] icon colors work in character editor --- source/funkin/editors/character/CharacterInfoScreen.hx | 2 ++ source/funkin/editors/ui/UIColorwheel.hx | 6 +++++- source/funkin/game/Character.hx | 5 +++-- source/funkin/game/PlayState.hx | 4 ++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/source/funkin/editors/character/CharacterInfoScreen.hx b/source/funkin/editors/character/CharacterInfoScreen.hx index 7f7169fa..eae1cd48 100644 --- a/source/funkin/editors/character/CharacterInfoScreen.hx +++ b/source/funkin/editors/character/CharacterInfoScreen.hx @@ -167,6 +167,8 @@ class CharacterInfoScreen extends UISubstateWindow { xml.set("scale", Std.string(scaleStepper.value)); xml.set("antialiasing", antialiasingCheckbox.checked ? "true" : "false"); xml.set("sprite", spriteTextBox.label.text); + if (iconColorWheel.colorChanged) + xml.set("color", iconColorWheel.curColor.toHexString(false).replace("0x", "#")); for (anim in character.animDatas) { diff --git a/source/funkin/editors/ui/UIColorwheel.hx b/source/funkin/editors/ui/UIColorwheel.hx index cc47b5df..a25b41bd 100644 --- a/source/funkin/editors/ui/UIColorwheel.hx +++ b/source/funkin/editors/ui/UIColorwheel.hx @@ -17,7 +17,7 @@ class UIColorwheel extends UISliceSprite { var colorHexTextBox:UITextBox; var rgbNumSteppers:Array = []; // r,g,b - public var curColor:Null = FlxColor.WHITE; + public var curColor:Null; public var curColorString:String = "#FFFFFF"; public var saturation:Float; @@ -118,6 +118,9 @@ class UIColorwheel extends UISliceSprite { } } + // For Character Editor + public var colorChanged:Bool = false; + // Make the colorwhell feel better static inline var hitBoxExtenstion:Float = 8; @@ -135,6 +138,7 @@ class UIColorwheel extends UISliceSprite { if (sprite == colorSlider) updateColorSliderMouse(mousePos); if (sprite == colorPicker) updateColorPickerMouse(mousePos); updateWheel(); + colorChanged = true; spritePos.put(); break; diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index 7e589ef7..0b302f60 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -52,7 +52,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset public var playerOffsets:Bool = false; public var icon:String = null; - public var iconColor:FlxColor = -1; + public var iconColor:Null = null; public var gameOverCharacter:String = "bf-dead"; public var cameraOffset:FlxPoint = new FlxPoint(0, 0); @@ -409,7 +409,8 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset xml.set("holdTime", Std.string(holdTime)); xml.set("flipX", Std.string(flipX)); xml.set("icon", icon); - xml.set("color", iconColor.toHexString(false).replace("0x", "#")); + if (iconColor != null) + xml.set("color", iconColor.toHexString(false).replace("0x", "#")); xml.set("scale", Std.string(scale.x)); xml.set("antialiasing", antialiasing == true ? "true" : "false"); xml.set("sprite", sprite); diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 9b564454..acf7e6cf 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -685,8 +685,8 @@ class PlayState extends MusicBeatState healthBar = new FlxBar(healthBarBG.x + 4, healthBarBG.y + 4, RIGHT_TO_LEFT, Std.int(healthBarBG.width - 8), Std.int(healthBarBG.height - 8), this, 'health', 0, maxHealth); healthBar.scrollFactor.set(); - var leftColor:Int = dad.iconColor != -1 && Options.colorHealthBar ? dad.iconColor : 0xFFFF0000; - var rightColor:Int = boyfriend.iconColor != -1 && Options.colorHealthBar ? boyfriend.iconColor : 0xFF66FF33; + var leftColor:Int = dad.iconColor != null && Options.colorHealthBar ? dad.iconColor : 0xFFFF0000; + var rightColor:Int = boyfriend.iconColor != null && Options.colorHealthBar ? boyfriend.iconColor : 0xFF66FF33; if (opponentMode) healthBar.createFilledBar(rightColor, leftColor); // switch the colors else healthBar.createFilledBar(leftColor, rightColor); add(healthBar);