using System;
using System.IO;
using System.Collections.Generic;
using SFML.Window;
using SFML.Graphics;

namespace YourBeatingHeart.Main
{
    /// <summary>
    /// Everything constant which should be accessible from everywhere and will often be modified by the
    /// programmer should live here.
    /// </summary>
    public static class Constants
    {
        public static readonly bool DEBUG = false;

        public static readonly bool DEBUG_FULLSCREEN = true && DEBUG;
        public static readonly bool DEBUG_FULLSCREEN_WINDOW = false && DEBUG;
        public static readonly bool DEBUG_SOUND_DROPBOX = false && DEBUG;
        public static readonly bool DEBUG_RELOAD_SOUND_EVERY_TIME = DEBUG_SOUND_DROPBOX && DEBUG;

        public static string WINDOW_NAME = "Blood Trial";

        public const uint TARGET_WIDTH = 1920;
        public const uint TARGET_HEIGHT = 1080;
        public const bool FULLSCREEN_DEFAULT_UPSCALED = true;

        public const String FOLDER_BASE = "data";
        public static readonly String FOLDER_IMAGES = Path.Combine(FOLDER_BASE, "images");
        public static readonly String FOLDER_FONTS = Path.Combine(FOLDER_BASE, "fonts");
        public static readonly String FOLDER_SOUNDS = Path.Combine(FOLDER_BASE, "sounds");
        public static readonly String FOLDER_LEVELS = Path.Combine(FOLDER_BASE, "levels");
        public static readonly String FOLDER_DATA = Path.Combine(FOLDER_BASE, "data");

        public static readonly Font DEFAULT_FONT = new Font(Path.Combine(FOLDER_FONTS, "feast_of_flesh.ttf"));

        public static float GRAVITY = 1500;

        public static float PLAYER_WALK_SPEED = 350;
        public static float PLAYER_JUMP_IMPULSE = -750f;
        public static float PLAYER_STOMP_IMPULSE = 3000f;

        public static float GROUND_FRICTION = 0.7f;
        public static float ITEM_BUMPINESS = 0.4f;
        public static float ITEM_BUMP_THRESHOLD = 5f;
        public static float THROW_IMPULSE = 1000;

        public static float EXECUTE_RANGE_X = 100;
        public static int EXECUTE_BUTTON_PRESSES = 8;
        public static float EXECUTE_TIMEOUT = 0.3f;

        public static long STUN_DURATION = 3000;

        public static int ANIMATION_FPS = 15;
        public static int SPRITE_SHEET_WIDTH = 2048;

        public static long ROUND_LENGTH = 3 * 60 * 1000;

        public static float HEART_BEAT_SPEED_SCALE = 1f;
        public static float HEART_BEATING_DURATION = 15f;

        public const float RESPAWN_BORDER = 10f;
        public const float RESPAWN_HEIGHT = 1020f;

        public const float KILLING_PHASE_BETWEEN_DELAY = 2f;

        public const float REMAINS_COUNT = 5;

        public static FloatRect TOUCHDOWN_AREA = new FloatRect(910, 120, 100, 230);
        public static int SCORE_PER_TOUCHDOWN = 1;
        public static int SCORE_PER_THROW = 1;
        public static float[,] SCORE_X_POS = new float[,]
        {
            {TARGET_WIDTH/2, 0,                 0,                  0},
            {TARGET_WIDTH/4, 3*TARGET_WIDTH/4,  0,                  0},
            {TARGET_WIDTH/3, TARGET_WIDTH/2,    2*TARGET_WIDTH/3,   0},
            {TARGET_WIDTH/5, 2*TARGET_WIDTH/5,  3*TARGET_WIDTH/5,   4*TARGET_WIDTH/5},
        };

        public static readonly Dictionary<uint, Color> PLAYER_COLORS = new Dictionary<uint, Color>()
        {
            {0, Color.Red},
            {1, Color.Green},
            {2, Color.Blue},
            {3, Color.Yellow}
        };

        public static readonly string[] PLAYER_NAMES = new[] {"Genkis", "Mao", "Bruma", "Kappa"};
        
        public static long RESTART_DELAY_AFTER_SACRIFICE = 5000;
        public static long RESTART_DELAY_AFTER_NO_WINNER = 5000;

        public const float PLAYER_START_HEIGHT = 1024f;
    }
}
