public void GoToChangeLanguage()
    {
        hidePanels ();

        _user_interface.SetChangeLanguagePanelVisibility (true);
        _coach_scenario_state = Coach_scenario_state.PREFERENCES;
    }
    public void Initialize_Modules(Capture_module capture, Compare_module compare, Animation_module animate,Interaction_module interact, GUI_module user_interface, Recorded_animation_module animate_trial)
    {
        _coach_scenario_state = Coach_scenario_state.INITIALISATION;

        _capture = capture;
        _compare = compare;
        _animate = animate;
        _interact = interact;
        _user_interface = user_interface;
        _animate_trial = animate_trial;
        //Initialise 3D environment

        //Initialise 3D animation

        //Initialise capture module
        _capture.Initialise_capture(_device);
        //Initialise comparison module

        //Initialise database module

        //Initialise GUI module
        //TEMP
        _coach_scenario_state = Coach_scenario_state.START_SCREEN;
        Animation_data temp = new Animation_data();
        temp.Initialize_from_file("test_recorded_data/HB_Underarm_reference");
        _animate_trial.SetRecordedAnimation(temp);

        Animation_data temp_2 = new Animation_data();
        temp_2.Initialize_from_file("test_recorded_data/HB_Underarm_reference_copy");
        _animate_trial.SetReferenceAnimation(temp_2);

        _user_interface.SetLoginMenuVisibility(true);
    }
 public void GoToActivity()
 {
     Debug.Log ("The activity selected: " + GlobalVariables.selected_activity_id);
     hidePanels ();
     _user_interface.SetPlayerInfoPanelVisibility(true);
     _user_interface.SetActivityPanelVisibility (true);
     _coach_scenario_state = Coach_scenario_state.ACTIVITY;
     //UpdateCoachPanel ();
 }
    public void NewTrial()
    {
        _coach_scenario_state = Coach_scenario_state.NEW_TRIAL;

        _user_interface.SetCoachLeftPanelVisibility(false);
        _user_interface.SetPlayerInfoPanelVisibility(false);
        _user_interface.SetTrialsVisibility(false);
        _user_interface.SetToolBarVisibility(true);
        _user_interface.SetRecordVisibility(true);

        //Clean recorded data for the capturing module
        _capture.Prepare_new_capture();

        //Initialise comparison module with the corresponding reference
        //TODO: load the corresponding file
        var default_act = Compare.Utilities.Properties.Activity.DEFAULT;
        _compare.Initialise_comparison(default_act);

        Debug.Log ("New trial ");
    }
    public void Logout()
    {
        hidePanels ();
        /*_user_interface.SetLoginMenuVisibility(true);
        _user_interface.SetCoachLeftPanelVisibility (false);
        _user_interface.SetPlayerLeftPanelVisibility (false);*/

        _coach_scenario_state = Coach_scenario_state.START_SCREEN;
        GlobalVariables.user_id = 0;
        Application.LoadLevel ("Login");
    }
 public void GoToFeedback()
 {
     Debug.Log ("The feedback selected: " + GlobalVariables.selected_feedback_id);
     hidePanels ();
     _user_interface.SetPlayerInfoPanelVisibility(true);
     _user_interface.SetFeedbackPanelVisibility (true);
     _coach_scenario_state = Coach_scenario_state.FEEDBACK;
     //UpdateCoachPanel ();
 }
    public void Refresh_button_currentselection()
    {
        state = coach_and_train_scenario._coach_scenario_state;
        //State of the application
        switch (state){
        case Coach_scenario_state.START_SCREEN:
        case Coach_scenario_state.MAIN_MENU:
        case Coach_scenario_state.PREFERENCES:
        case Coach_scenario_state.CLUB_MENU:
            //All buttons are not visibles
            button_club.SetActive(false);
            button_team.SetActive(false);
            button_player.SetActive(false);
            button_skill.SetActive(false);
            break;
        case Coach_scenario_state.TEAM_MENU:
            //Visible club button
            button_club.SetActive(true);
            button_team.SetActive(false);
            button_player.SetActive(false);
            button_skill.SetActive(false);
            //Text on buttons
            club = _database.getClub(GlobalVariables.selected_club_id);
            button_club.GetComponent<Button>().GetComponentInChildren<Text>().text=club.name;
            break;
        case Coach_scenario_state.PLAYER_MENU:
        case Coach_scenario_state.PLAYER_PERSONAL_DATA:
        case Coach_scenario_state.PLAYER_ACTIVITY_MENU:
        case Coach_scenario_state.PLAYER_STATISTIC_MENU:
        case Coach_scenario_state.PLAYER_FEEDBACK_MENU:
            //Visible club, team
            button_club.SetActive(true);
            button_team.SetActive(true);
            button_player.SetActive(false);
            button_skill.SetActive(false);
            //Text on buttons
            club = _database.getClub(GlobalVariables.selected_club_id);
            button_club.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=club.name;
            team = _database.getTeam(GlobalVariables.selected_team_id);
            button_team.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=team.name;

            break;
        case Coach_scenario_state.SKILL_MENU:
            //Visible club, team
        /*			button_club.SetActive(true);
            button_team.SetActive(true);
            button_player.SetActive(true);
            button_skill.SetActive(false);
            //Text on buttons
            club = _database.getClub(GlobalVariables.selected_club_id);
            button_club.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=club.name;
            team = _database.getTeam(GlobalVariables.selected_team_id);
            button_team.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=team.name;
            player = _database.getPlayer(GlobalVariables.selected_player_id);
            button_player.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=player.name+" "+player.surname;
            break;*/
        case Coach_scenario_state.HERO_MENU:
            //Visible club, team
            button_club.SetActive(true);
            button_team.SetActive(true);
            button_player.SetActive(true);
            button_skill.SetActive(true);
            //Text on buttons
            club = _database.getClub(GlobalVariables.selected_club_id);
            button_club.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=club.name;
            team = _database.getTeam(GlobalVariables.selected_team_id);
            button_team.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=team.name;
            player = _database.getPlayer(GlobalVariables.selected_player_id);
            button_player.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=player.name+" "+player.surname;
            skill = _database.getSkill(GlobalVariables.selected_skill_id);
            button_skill.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=skill.name;
            break;
        }
    }
    public void GoToCoachActivities()
    {
        hidePanels ();
        _user_interface.SetCoachActivitiesPanelVisibility(true);

        _coach_scenario_state = Coach_scenario_state.COACH_ACTIVITY_MENU;
        //UpdateCoachPanel ();
    }
 public void GoToPlayerStatistics()
 {
     Debug.Log ("The player selected: " + GlobalVariables.selected_player_id);
     hidePanels ();
     _user_interface.SetPlayerStatisticsPanelVisibility (true);
     _user_interface.SetPlayerInfoPanelVisibility (true);
     _coach_scenario_state = Coach_scenario_state.PLAYER_STATISTIC_MENU;
     //UpdateCoachPanel ();
 }
    public void GoToPlayers()
    {
        Debug.Log ("The team selected: " + GlobalVariables.selected_team_id);
        hidePanels ();

        _user_interface.SetPlayersPanelVisibility (true);

        _coach_scenario_state = Coach_scenario_state.PLAYER_MENU;
        //UpdateCoachPanel ();
    }
    public void GoToPlayerPersonalData()
    {
        Debug.Log ("The player selected: " + GlobalVariables.selected_player_id);
        hidePanels ();

        _user_interface.SetPlayerPersonalDataPanelVisibility (true);
        _user_interface.SetPlayerActivityPanelVisibility (false);
        _user_interface.SetPlayerStatisticsPanelVisibility (false);
        _user_interface.SetPlayerFeedbacksPanelVisibility (false);
        _user_interface.SetPlayerInfoPanelVisibility (true);

        _coach_scenario_state = Coach_scenario_state.PLAYER_PERSONAL_DATA;
        //UpdateCoachPanel ();
    }
 public void GoToPlayerActivities()
 {
     Debug.Log ("The player selected: " + GlobalVariables.selected_player_id);
     hidePanels ();
     _user_interface.SetPlayerActivityPanelVisibility (true);
     _user_interface.SetPlayerInfoPanelVisibility (true);
     _coach_scenario_state = Coach_scenario_state.PLAYER_ACTIVITY_MENU;
     //UpdateCoachPanel ();
 }
    public void GoToPersonalData()
    {
        hidePanels ();

        //If it's coach
        if (GlobalVariables.usertype_id == 1)
        {
            //_user_interface.SetCoachLeftPanelVisibility(true);
            _user_interface.SetCoachMainMenuVisibility(false);

            //UpdateCoachPanel ();
        } else
        {
            //_user_interface.SetPlayerLeftPanelVisibility(true);
            _user_interface.SetPlayerMainMenuVisibility(false);
        }

        _user_interface.SetPersonalDataPanelVisibility (true);
        _user_interface.SetChangePasswordPanelVisibility (false);
        _coach_scenario_state = Coach_scenario_state.PREFERENCES;
    }
    public void GoToMainMenu()
    {
        hidePanels ();

        //If it's coach
        if (GlobalVariables.user.usertype_id == (int)User_type.COACH)
        {
            _user_interface.SetCoachLeftPanelVisibility (true);
            _user_interface.SetCoachMainMenuVisibility (true);

            //UpdateCoachPanel ();
        } else
        {
            _user_interface.SetPlayerLeftPanelVisibility(true);
            _user_interface.SetPlayerMainMenuVisibility(true);
        }

        _coach_scenario_state = Coach_scenario_state.MAIN_MENU;
    }
    public void GoToHeroes()
    {
        hidePanels ();

        _user_interface.SetHeroesPanelVisibility(true);
        _user_interface.SetPlayerInfoPanelVisibility (true);

        _coach_scenario_state = Coach_scenario_state.HERO_MENU;
        //UpdateCoachPanel ();
    }
 public void GoToChangePassword()
 {
     _user_interface.SetPersonalDataPanelVisibility (false);
     _user_interface.SetChangePasswordPanelVisibility (true);
     _coach_scenario_state = Coach_scenario_state.PREFERENCES;
 }
    /*public void saveCoach(Coach coach){
        //string name = GameObject.Find("ccp_input_name").GetComponent<InputField>().value;
        //string surname = GameObject.Find("ccp_input_surname").GetComponent<InputField>().value;
        //string birthdate = GameObject.Find("ccp_input_birthdate").GetComponent<InputField>().value;

        _database = new Database_module ();

        _database.saveCoach (coach);

        Debug.Log("Coach saved");

    }*/
    public void GoToClubs()
    {
        hidePanels ();

        _user_interface.SetClubsPanelVisibility(true);
        _coach_scenario_state = Coach_scenario_state.CLUB_MENU;
        //UpdateCoachPanel ();
    }
 public void GoToSkills()
 {
     Debug.Log ("The player selected: " + GlobalVariables.selected_player_id);
     hidePanels ();
     _user_interface.SetSkillsPanelVisibility(true);
     _user_interface.SetPlayerInfoPanelVisibility (true);
     _coach_scenario_state = Coach_scenario_state.SKILL_MENU;
     //UpdateCoachPanel ();
 }
    public void GoToTeams()
    {
        hidePanels ();

        Debug.Log ("The club selected: " + GlobalVariables.selected_club_id);
        _user_interface.SetTeamsPanelVisibility(true);

        _coach_scenario_state = Coach_scenario_state.TEAM_MENU;
        //UpdateCoachPanel ();
    }
    public void Login(string username, string password)
    {
        //string username = GameObject.Find("cl_input_username").GetComponent<InputField>().value;
        //string password = GameObject.Find("cl_input_password").GetComponent<InputField>().value;

        _database = new Database_module ();

        User user = _database.login (username, password);
        GlobalVariables.user = user;

        bool internet = _database.hasInternetAccess ();
        Debug.Log (internet);

        if (user.id != 0) {

            if (user.usertype_id==(int)User_type.COACH)
            {

                //It's a coach
                Coach coach = _database.getCoach(user.id);
                GlobalVariables.coach = coach;
                //Application.LoadLevel ("Coach_and_train");
                _user_interface.SetLoginMenuVisibility(false);
                _user_interface.SetCoachMainMenuVisibility(true);
                _user_interface.SetCoachLeftPanelVisibility(true);
            }
            else if (user.usertype_id==(int)User_type.PLAYER)
            {
                //It's a player
                _user_interface.SetLoginMenuVisibility(false);
                _user_interface.SetPlayerMainMenuVisibility(true);
                _user_interface.SetPlayerLeftPanelVisibility(true);
            }
            _coach_scenario_state = Coach_scenario_state.MAIN_MENU;
        }
        else
        {
            Debug.Log ("no user");
            _user_interface.SetLoginErrorVisibility(true);
            _user_interface.CleanLoginTextfields();
        }
        Debug.Log(username+" "+password);
    }
 void Start()
 {
     state = coach_and_train_scenario._coach_scenario_state;
     _database = new Database_module ();
 }
    public void GoToCoachFeedbacks()
    {
        hidePanels ();

        _user_interface.SetCoachFeedbacksPanelVisibility (true);

        _coach_scenario_state = Coach_scenario_state.COACH_FEEDBACK_MENU;
        //UpdateCoachPanel ();
    }