package zero1hd.rhythmbullet.ui.windows;

import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Slider;
import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;

public class DifficultyWindow extends Window {
	private Slider sensitivityRating;
	private Label sensitivityRatingTitle;
	private Slider speedModifier;
	private Label speedModifierTitle;
	private Slider healthModifier;
	private Label healthModifierTitle;
	
	public DifficultyWindow(Skin skin) {
		super("Difficulty Adjuster", skin, "tinted");
		sensitivityRating = new Slider(0f, 100f, 1f, false, skin);
		sensitivityRating.setValue(0f);
		sensitivityRating.addListener(new ChangeListener() {
			
			@Override
			public void changed(ChangeEvent event, Actor actor) {
				sensitivityRatingTitle.setText("Base Difficulty: " + sensitivityRating.getValue());
			}
		});
		
		sensitivityRatingTitle = new Label("Base Difficulty: " + sensitivityRating.getValue(), skin, "sub-font", skin.getColor("default"));
		add(sensitivityRatingTitle);
		add(sensitivityRating);
		
		row();
		
		speedModifier = new Slider(1f, 3f, 0.25f, false, skin);
		speedModifier.setValue(1f);
		speedModifier.addListener(new ChangeListener() {
			@Override
			public void changed(ChangeEvent event, Actor actor) {
				speedModifierTitle.setText("Speed Modifier: " + speedModifier.getValue());
			}
		});
		speedModifierTitle = new Label("Speed Modifier: " + speedModifier.getValue(), skin, "sub-font", skin.getColor("default"));
		add(speedModifierTitle);
		add(speedModifier);
		
		row();

		healthModifier = new Slider(0f, 5f, 1f, false, skin);
		healthModifier.setValue(0f);
		healthModifier.addListener(new ChangeListener() {
			
			@Override
			public void changed(ChangeEvent event, Actor actor) {
				healthModifierTitle.setText("Health modifier: " + healthModifier.getValue());
			}
		});
		healthModifierTitle = new Label("Health modifier: " + healthModifier.getValue(), skin, "sub-font", skin.getColor("default"));
		add(healthModifierTitle);
		add(healthModifier);
		
		pack();
	}
	
	public float getOverallDiffMod() {
		return sensitivityRating.getValue();
	}
	
	public float getSpeedModifier() {
		return speedModifier.getValue();
	}
	
	public float getHealthModifier() {
		return healthModifier.getValue();
	}
}
