-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New settings widgets and customizable note effects #2793
New settings widgets and customizable note effects #2793
Conversation
can we also add a fps option to go along with the PercentagePreferenceItem widget theres already a pr for it, but yeah |
An FPS cap? Though, you may want to open a separate PR yourself for that if this one gets merged. |
The referenced PRs might want to both use my implementation of the new settings widget system, since arguably after check out both of them my commit history and code are the least chaotic out of both xD (except some ninjamuffin commits show up on mine for some reason and I have no idea why) Mine also provides a settings widget for enums and allows for features to let the user preview what the settings do (ex: playing a hit sound when its selected by the user to tell the user what it'll sounds like). I'm happy to discuss and implement any changes needed here, as well as answering any questions you two have! @prplnorangesoda @lemz1 |
the only thing i would change is maybe the offset that the percentage and enum items have when not being selected. i've also updated my pr to use your implementation, since yours is arguably better if you make some changes, just @ me |
I adjusted the offset, now looks about the same as it does for the checkbox widget. No changes needed on your side! PS: I forgot to make a new branch for the PR and I ended up pushing a whole ass Pico Dadbattle rechart to it because I can't git lmao. The PR under this comment is the new one for the assets, I closed the old one. |
@FlooferLand Could you make a pull request that contains JUST the EnumPreferenceItem and PercentagePreferenceItem? They'd save me a bunch of time to have and I don't want to steal them from you but I don't think we're going to merge the hitsounds themselves, at least not for a while. |
In that case I would also like to see the NumberPreferenceItem added. Im using it for this pr #2602, but it could also be used for other things. Maybe we could combine funkin/ui/options/items/NumberPreferenceItem.hxpackage funkin.ui.options.items;
import funkin.ui.TextMenuList;
import funkin.ui.AtlasText;
import funkin.input.Controls;
/**
* Preference item that allows the player to pick a value between min and max
*/
class NumberPreferenceItem extends TextMenuItem
{
function controls():Controls
{
return PlayerSettings.player1.controls;
}
public var lefthandText:AtlasText;
public var currentValue:Float;
public var min:Float;
public var max:Float;
public var step:Float;
public var precision:Int;
public var onChangeCallback:Null<Float->Void>;
public function new(x:Float, y:Float, name:String, defaultValue:Float, min:Float, max:Float, step:Float, precision:Int, ?callback:Float->Void):Void
{
super(x, y, name, function() {
callback(this.currentValue);
});
lefthandText = new AtlasText(15, y, formatted(defaultValue), AtlasFont.DEFAULT);
updateHitbox();
this.currentValue = defaultValue;
this.min = min;
this.max = max;
this.step = step;
this.precision = precision;
this.onChangeCallback = callback;
}
static final HOLD_DELAY:Float = 0.5; // seconds
static final CHANGE_RATE:Float = 0.02; // seconds
var holdDelayTimer:Float = HOLD_DELAY; // seconds
var changeRateTimer:Float = 0.0; // seconds
override function update(elapsed:Float):Void
{
super.update(elapsed);
// var fancyTextFancyColor:Color;
if (selected)
{
holdDelayTimer -= elapsed;
if (holdDelayTimer <= 0.0)
{
changeRateTimer -= elapsed;
}
var jpLeft:Bool = controls().UI_LEFT_P;
var jpRight:Bool = controls().UI_RIGHT_P;
if (jpLeft || jpRight)
{
holdDelayTimer = HOLD_DELAY;
changeRateTimer = 0.0;
}
var shouldDecrease:Bool = jpLeft;
var shouldIncrease:Bool = jpRight;
if (controls().UI_LEFT && holdDelayTimer <= 0.0 && changeRateTimer <= 0.0)
{
shouldDecrease = true;
changeRateTimer = CHANGE_RATE;
}
else if (controls().UI_RIGHT && holdDelayTimer <= 0.0 && changeRateTimer <= 0.0)
{
shouldIncrease = true;
changeRateTimer = CHANGE_RATE;
}
if (shouldDecrease) currentValue -= step;
else if (shouldIncrease) currentValue += step;
currentValue = currentValue.clamp(min, max);
if (onChangeCallback != null && (shouldIncrease || shouldDecrease))
{
onChangeCallback(currentValue);
}
}
lefthandText.text = formatted(currentValue);
}
function formatted(value:Float):String
{
return '${toFixed(value)}';
}
function toFixed(value:Float):Float
{
var multiplier:Float = Math.pow(10, precision);
return Math.floor(value * multiplier) / multiplier;
}
} funkin/ui/options/PreferencesMenu.hx function createPrefItemNumber(prefName:String, prefDesc:String, onChange:Float->Void, defaultValue:Float, min:Float, max:Float, step:Float,
precision:Int):Void
{
var item = new NumberPreferenceItem(0, (120 * items.length) + 30, prefName, defaultValue, min, max, step, precision, onChange);
items.addItem(prefName, item);
preferenceItems.add(item.lefthandText);
} |
I moved the new settings widgets to their own separate branch/PR as requested by Eric, There appear to be no breaking changes between this PR and the new PR for people using my settings widgets. Just do a I'm not quite sure what to do about this PR now as the settings widgets have been moved into the new one, as I can't exactly delete the entire Git history of this PR and rename it in order to make it only implement my hitsounds changes. |
… to 0.5.3) (#3834) * Create Charting Issue template * Include images and videos in charting issue template * Update version in bug report template * Update version in crash report template
* Create compiling.yml * Update compiling.yml * Update compiling.yml * Update compiling.yml * Update compiling.yml * Update compiling.yml * charting (Hundrec) thanks hundrec i like this * Delete .github/ISSUE_TEMPLATE/charting.yml
This PR appears to have merge conflicts. Please fix them! |
I'm guessing the PR was reopened for the note effects, as I already split the settings part into another PR and that got merged. |
You can reimplement and force push to this branch, or you can close this and create a new PR. |
71e3083
to
0c06ba9
Compare
Moving to a new PR for cleanliness sake! |
See #4038 |
New PR is #4112 Should be ready for review / merging! |
This PR:
CheckboxPreferenceItem
) and adds aPercentagePreferenceItem
and anEnumPreferenceItem
HitNoteScriptEvent
(did this as it makes it look like the note splashes have a sound effect, but it sometimes leads to hit sounds not playing since not everyone is built like an autoclicker)These additions were made to easily allow hold (note cover) roll sounds to be added in the future but I haven't started implementing those since I'm not knowledged enough with Haxe or FNF's codebase to add them, and users might not want the weird RrRRrrRrrRrrRrrRrrRrr sounds when holding notes.
See the following for a showcase of this PR: https://youtu.be/WcJCl3hX6YM (dw its unlisted)
See funkin.assets#36 for the associated funkin.assets PR (it should be merged/reviewed first if possible, as I'll have to change things in this PR to add/remove any new sounds/changes added there)