# Path: base/scene.py
# class BaseScene(object):
#     """Abstract class for all scenes"""
#     __metaclass__ = abc.ABCMeta
# 
#     def __init__(self, console_manager, scene_manager, game_context):
#         self.console_manager = console_manager
#         self.main_console = console_manager.main_console
#         self.scene_manager = scene_manager
#         self.game_context = game_context
# 
#     @abc.abstractmethod
#     def render(self):
#         pass
# 
#     @abc.abstractmethod
#     def handle_input(self):
#         pass
# 
#     def transition_to(self, scene_name):
#         self.scene_manager.transition_to(scene_name)
# 
# Path: components/stats.py
# def make_character_stats(health=0, strength=8, dexterity=8, constitution=8,
#                          intelligence=8, charisma=8, wisdom=8, size=5, **kwargs):
#     """Helper function to add common core character stats."""
#     stats = Stats()
#     stats.add_core_stat(StatsEnum.Health, health, health)
#     stats.add_core_stat(StatsEnum.Strength, strength, strength)
#     stats.add_core_stat(StatsEnum.Dexterity, dexterity, dexterity)
#     stats.add_core_stat(StatsEnum.Constitution, constitution, constitution)
#     stats.add_core_stat(StatsEnum.Intelligence, intelligence, intelligence)
#     stats.add_core_stat(StatsEnum.Charisma, charisma, charisma)
#     stats.add_core_stat(StatsEnum.Weight, wisdom, wisdom)
#     stats.add_core_stat(StatsEnum.Size, size, size)
# 
#     return stats
# 
# Path: data/python_templates/classes.py
# def build_warrior_class():
# def build_thief_class():
# 
# Path: data/python_templates/races.py
# def build_orc_race():
# def build_troll_race():
# def build_human_race():
# 
# Path: data/python_templates/outfits.py
# def build_starter_warrior():
# def build_starter_thief():
# 
# Path: stats/enums.py
# class StatsEnum(Enum):
#     Health = 'health'
#     Mana = 'mana'
#     Strength = 'strength'
#     Dexterity = 'dexterity'
#     Constitution = 'constitution'
#     Intelligence = 'intelligence'
#     Charisma = 'charisma'
#     Wisdom = 'wisdom'
#     Sharpness = 'sharpness'
#     Hardness = 'hardness'
#     Weight = 'weight'
#     Size = 'size'
#     Potency = 'potency'
#     MaxDamage = 'max_damage'
#     MinDamage = 'min_damage'
#     ArmorClass = 'armor_class'
# 
# Path: managers/console_manager.py
# class Menu(Console):
#     """
#     Create console for displaying choices to the player
#     """
#     MENU_TEMPLATE = """
#         {menu_name}
#         {menu_text}
#         {options}
#     """
# 
#     OPTION_TEMPLATE = "({option_char:}) {option_description}"
# 
#     def __init__(self, name, text, options, width, height):
#         Console.__init__(self, width, height)
#         self.name = name
#         self.text = text
#         self.options = options
#         self.max_options_len = 26
#         self.letter_index = ord('a')
# 
#     def create_menu(self, pos_x, pos_y):
#         self.move(pos_x, pos_y)
#         self.printStr(self.MENU_TEMPLATE.format(
#             menu_name=self.name,
#             menu_text=self.text,
#             options=self._build_options()
#         ))
# 
#     def _build_options(self):
#         option_msg = []
#         for option_text in self.options:
#             option = self.OPTION_TEMPLATE.format(
#                 option_char=chr(self.letter_index),
#                 option_description=option_text
#             )
#             option_msg.append(option)
#             self.letter_index += 1
#         return "\n".join(option_msg)
# 
#     def print_str(self, text, pos_x, pos_y):
#         self.move(pos_x, pos_y)
#         self.printStr(text)
# 
# Path: ui/controls.py
# ACTIVE_CONTROL_COLOR = (255, 255, 0)
# INACTIVE_CONTROL_COLOR = (255, 255, 255)
# CHOSEN_CONTROL_COLOR = (100, 255, 100)
# BLACK_COLOR = (0, 0, 0)
# class InputControl(object):
# class ListChoiceControl(object):
# class PointDistributionControl(object):
#     def __init__(self, question):
#     def handle_input(self, **kwargs):
#     def text(self):
#     def render(self, console, active, **kwargs):
#     def __init__(self, question, options, root_console):
#     def __assign_letter(self):
#     def text(self):
#     def _get_formatted_options(self):
#     def handle_input(self, **kwargs):
#     def render(self, console, active, **kwargs):
#     def __init__(self, question, options, root_console, initial_value, max_value, total_points, cost_calculator):
#     def text(self):
#     def answer(self):
#     def _get_formatted_options(self):
#     def handle_input(self, **kwargs):
#     def render(self, console, active, **kwargs):
#     def __increase_value(self):
#     def __decrease_value(self):
#     def __cycle_next_option(self):
#     def __cycle_previous_option(self):


import tdl
from base.scene import BaseScene
from components.stats import make_character_stats
from data.python_templates.classes import character_class_templates
from data.python_templates.races import race_templates
from data.python_templates.outfits import starter_warrior, starter_thief
from stats.enums import StatsEnum
from managers.console_manager import Menu
from ui import controls




class CharacterCreationScene(BaseScene):
    ID = "CharacterCreation"

    # TODO We need a sort of cursor to print every control in its place.
    # TODO For that we need to have a render func passing the cursor
    # TODO and each control needs a menu to render on.
    
    def __init__(self, console_manager, scene_manager, game_context):
        super().__init__(console_manager, scene_manager, game_context)
        self.character_factory = self.game_context.character_factory
        self.body_factory = self.game_context.body_factory
        self.options = ["Finish"]

        self.control_name = controls.InputControl("Name:")

# Path: base/scene.py
# class BaseScene(object):
#     """Abstract class for all scenes"""
#     __metaclass__ = abc.ABCMeta
# 
#     def __init__(self, console_manager, scene_manager, game_context):
#         self.console_manager = console_manager
#         self.main_console = console_manager.main_console
#         self.scene_manager = scene_manager
#         self.game_context = game_context
# 
#     @abc.abstractmethod
#     def render(self):
#         pass
# 
#     @abc.abstractmethod
#     def handle_input(self):
#         pass
# 
#     def transition_to(self, scene_name):
#         self.scene_manager.transition_to(scene_name)
# 
# Path: components/stats.py
# def make_character_stats(health=0, strength=8, dexterity=8, constitution=8,
#                          intelligence=8, charisma=8, wisdom=8, size=5, **kwargs):
#     """Helper function to add common core character stats."""
#     stats = Stats()
#     stats.add_core_stat(StatsEnum.Health, health, health)
#     stats.add_core_stat(StatsEnum.Strength, strength, strength)
#     stats.add_core_stat(StatsEnum.Dexterity, dexterity, dexterity)
#     stats.add_core_stat(StatsEnum.Constitution, constitution, constitution)
#     stats.add_core_stat(StatsEnum.Intelligence, intelligence, intelligence)
#     stats.add_core_stat(StatsEnum.Charisma, charisma, charisma)
#     stats.add_core_stat(StatsEnum.Weight, wisdom, wisdom)
#     stats.add_core_stat(StatsEnum.Size, size, size)
# 
#     return stats
# 
# Path: data/python_templates/classes.py
# def build_warrior_class():
# def build_thief_class():
# 
# Path: data/python_templates/races.py
# def build_orc_race():
# def build_troll_race():
# def build_human_race():
# 
# Path: data/python_templates/outfits.py
# def build_starter_warrior():
# def build_starter_thief():
# 
# Path: stats/enums.py
# class StatsEnum(Enum):
#     Health = 'health'
#     Mana = 'mana'
#     Strength = 'strength'
#     Dexterity = 'dexterity'
#     Constitution = 'constitution'
#     Intelligence = 'intelligence'
#     Charisma = 'charisma'
#     Wisdom = 'wisdom'
#     Sharpness = 'sharpness'
#     Hardness = 'hardness'
#     Weight = 'weight'
#     Size = 'size'
#     Potency = 'potency'
#     MaxDamage = 'max_damage'
#     MinDamage = 'min_damage'
#     ArmorClass = 'armor_class'
# 
# Path: managers/console_manager.py
# class Menu(Console):
#     """
#     Create console for displaying choices to the player
#     """
#     MENU_TEMPLATE = """
#         {menu_name}
#         {menu_text}
#         {options}
#     """
# 
#     OPTION_TEMPLATE = "({option_char:}) {option_description}"
# 
#     def __init__(self, name, text, options, width, height):
#         Console.__init__(self, width, height)
#         self.name = name
#         self.text = text
#         self.options = options
#         self.max_options_len = 26
#         self.letter_index = ord('a')
# 
#     def create_menu(self, pos_x, pos_y):
#         self.move(pos_x, pos_y)
#         self.printStr(self.MENU_TEMPLATE.format(
#             menu_name=self.name,
#             menu_text=self.text,
#             options=self._build_options()
#         ))
# 
#     def _build_options(self):
#         option_msg = []
#         for option_text in self.options:
#             option = self.OPTION_TEMPLATE.format(
#                 option_char=chr(self.letter_index),
#                 option_description=option_text
#             )
#             option_msg.append(option)
#             self.letter_index += 1
#         return "\n".join(option_msg)
# 
#     def print_str(self, text, pos_x, pos_y):
#         self.move(pos_x, pos_y)
#         self.printStr(text)
# 
# Path: ui/controls.py
# ACTIVE_CONTROL_COLOR = (255, 255, 0)
# INACTIVE_CONTROL_COLOR = (255, 255, 255)
# CHOSEN_CONTROL_COLOR = (100, 255, 100)
# BLACK_COLOR = (0, 0, 0)
# class InputControl(object):
# class ListChoiceControl(object):
# class PointDistributionControl(object):
#     def __init__(self, question):
#     def handle_input(self, **kwargs):
#     def text(self):
#     def render(self, console, active, **kwargs):
#     def __init__(self, question, options, root_console):
#     def __assign_letter(self):
#     def text(self):
#     def _get_formatted_options(self):
#     def handle_input(self, **kwargs):
#     def render(self, console, active, **kwargs):
#     def __init__(self, question, options, root_console, initial_value, max_value, total_points, cost_calculator):
#     def text(self):
#     def answer(self):
#     def _get_formatted_options(self):
#     def handle_input(self, **kwargs):
#     def render(self, console, active, **kwargs):
#     def __increase_value(self):
#     def __decrease_value(self):
#     def __cycle_next_option(self):
#     def __cycle_previous_option(self):


# Path: scenes/character_creation.py
import tdl
from base.scene import BaseScene
from components.stats import make_character_stats
from data.python_templates.classes import character_class_templates
from data.python_templates.races import race_templates
from data.python_templates.outfits import starter_warrior, starter_thief
from stats.enums import StatsEnum
from managers.console_manager import Menu
from ui import controls





class CharacterCreationScene(BaseScene):
    ID = "CharacterCreation"

    # TODO We need a sort of cursor to print every control in its place.
    # TODO For that we need to have a render func passing the cursor
    # TODO and each control needs a menu to render on.
    
    def __init__(self, console_manager, scene_manager, game_context):
        super().__init__(console_manager, scene_manager, game_context)
        self.character_factory = self.game_context.character_factory
        self.body_factory = self.game_context.body_factory
        self.options = ["Finish"]

        self.control_name = controls.InputControl("Name:")

        self.control_class = controls.ListChoiceControl(