Beispiel #1
0
    public void Insert_Strok(List <Tuple <float, float> > input, Alphabate_manager alphabate, List <int> to_be_delete, int stroke_number)
    {
        if (record_mode)
        {
            string path = "Assets/Local_DataBase/Students/" + userName + "/" + stroke_to_record;
            Debug.Log("Track Path: " + path);
            StreamWriter sw = File.AppendText(path);

            float start_x = input[0].Item1;
            float start_y = input[0].Item2;

            // Modified
            sw.WriteLine(start_x + " " + start_y);

            for (int i = 1; i < input.Count; i++)
            {
                // Modified
                //sw.WriteLine((input[i].Item1 - start_x) + " " + (input[i].Item2 - start_y));
                sw.WriteLine((input[i].Item1) + " " + (input[i].Item2));
            }
            sw.Close();
        }
        else
        {
            if (alphabate == null)
            {
                Set_Error_Inactive();
                Error_Write_On_Character.SetActive(true);
                Destroy(current);
                return;
            }
            if (alphabate.Get_Assessment() == null)
            {
                Debug.Log(alphabate.gameObject.name);
                return;
            }
            tester = alphabate.Get_Assessment();
            if (current.GetComponent <Track>().Get_Stroke_Number() == -1)
            {
                Set_Error_Inactive();
                Error_Write_On_Character.SetActive(true);
                Destroy(current);
                return;
            }
            if (!alphabate.Increment_Stroke(current.GetComponent <Track>().Get_Stroke_Number()))
            {
                Set_Error_Inactive();
                Error_Incorrect_Stroke_Order.SetActive(true);
                tester.Add_Incorrect_Stroke();
                Destroy(current);
                return;
            }
            int status = alphabate.remove_Hit(to_be_delete, stroke_number, input);
            if (status == 1)
            {
                Set_Error_Inactive();
                Error_Sequence.SetActive(true);
                tester.IncorrectOrder();
                Destroy(current);
                return;
            }
            else if (status == 2)
            {
                Set_Error_Inactive();
                Error_Connections.SetActive(true);
                tester.ConnectionIssues();
                Destroy(current);
                return;
            }
            if (alphabate.finish())
            {
                Finished_one();
            }
            tester.Load_Standard(current.GetComponent <Track>().Get_Current_Alphabate().Get_Strok_Name() + current.GetComponent <Track>().Get_Stroke_Number());
            tester.compare_Deviation(input);
            if (hit_board)
            {
                tester.Add_Board();
            }
            hit_board = false;
        }
    }