Exemple #1
0
    void OnEnable()
    {
        if (ps == null)
        {
            ps = GameObject.FindObjectOfType <PostScript>();
        }

        if (SceneManager.GetActiveScene().name == "01_2.Quiz")
        {
            sound_day      = QuizManager.day;
            sound_sentence = QuizManager.sentence_count;
            sound_word     = QuizManager.word_count;
            cutSoundIndex  = 1;
        }
        else if (SceneManager.GetActiveScene().name == "01_1.Study")
        {
            sound_day      = NextBtnClickedScript.day;
            sound_sentence = NextBtnClickedScript.sentence_count;
            sound_word     = NextBtnClickedScript.word_count;
            cutSoundIndex  = 1;
        }

        Debug.Log("gameObject.name.Remove(gameObject.name.Length - 1, 1) = " + gameObject.name.Remove(gameObject.name.Length - 1, 1));

        if (gameObject.name.Remove(gameObject.name.Length - 1, 1) == "" || gameObject.name.Remove(gameObject.name.Length - 1, 1) == "Study4_")
        {
            Debug.Log("=========================Coroutine=======================");
            StartCoroutine(AudioStart());
        }
    }
    public void NextBtnClicked()
    {
        string classId = Global.classId;

        pageNum++;

        Debug.Log("NextBtnClicked");
        CantTouchPage.SetActive(true);

        Transform tempTransform = gameObject.transform;

        StopCoroutine(TimerScript.StopWatchStart());
        int clickTime = (int)TimerScript.sw.ElapsedMilliseconds;

        TimerScript.sw.Stop();

        ps = GameObject.FindObjectOfType <PostScript>();
        int maxPageNum = ps.quizJson["data"][0].Count - 1;

        if (pageNum < maxPageNum) // maxPageNum is empty
        {
            string[] tempString_AA = new string[] { };
            tempString_AA = ps.quizJson["data"][0][pageNum]["quiz_id"].ToString().Split(';');
            templistTimer[Int32.Parse(tempString_AA[1].Remove(1)) - 1] += clickTime;
            AnswerCheck(2); // check sentence changed and send result. set next sentence answer to default value
        }

        TimerScript.sw.Reset();

        if (pageNum == maxPageNum)
        {
            CantTouchPage.SetActive(false);

            tempTransform.parent.Find("PopUpPage").Find("panel").Find("Text").gameObject.GetComponent <Text>().text = "퀴즈 종료";
            tempTransform.parent.Find("PopUpPage").gameObject.SetActive(true);

            ps.QuizInfoInit(templistTimer, templistAnswer, classId, Int32.Parse(tempWordID), day); // send reset to server
        }
        else
        {
            for (int i = 0; i < page.Length; i++)
            {
                if (tempTransform.Find(page[i]) != null)
                {
                    tempTransform.Find(page[i]).gameObject.SetActive(false);
                }
            }
            //tempTransform.Find(page[int.Parse(ps.quizJson["data"][0][pageNum]["quiz_type"].Value) + 7]).gameObject.SetActive(true);
            //tempTransform.Find(page[int.Parse(ps.quizJson["data"][0][pageNum]["quiz_type"].Value) + 7]).GetComponent<RandomQuizScript>().QuizInit();
            tempTransform.Find(page[pageNum % 5]).gameObject.SetActive(true);
            tempTransform.Find(page[pageNum % 5]).GetComponent <RandomQuizScript>().QuizInit();
        }


        SlotScript.moveCount_last = 0;
        SlotScript.moveCount      = 0;

        CantTouchPage.SetActive(false);
    }
    private void Start()
    {
        _CharFace  = Character.GetComponent <Animator>();
        _FlagState = currentText.transform.parent.gameObject.GetComponent <Animator>();

        ps = GameObject.FindObjectOfType <PostScript>();
        qm = GameObject.FindObjectOfType <QuizManager>();
    }
Exemple #4
0
        private Metadata ReadMetadata(PostScript postScript, byte postScriptLength)
        {
            var offset = -1 - postScriptLength - (long)postScript.FooterLength - (long)postScript.MetadataLength;

            _inputStream.Seek(offset, SeekOrigin.End);
            var compressedStream = new StreamSegment(_inputStream, (long)postScript.MetadataLength, true);
            var metadataStream   = OrcCompressedStream.GetDecompressingStream(compressedStream, postScript.Compression);

            return(Serializer.Deserialize <Metadata>(metadataStream));
        }
    public void AnswerBtnClicked()
    {
        if (ps == null)
        {
            ps = GameObject.FindObjectOfType <PostScript>();
        }
        if (qm == null)
        {
            qm = GameObject.FindObjectOfType <QuizManager>();
        }

        if (gameObject.GetComponent <Toggle>().isOn == true)
        {
            //gameObject.transform.Find("Background").Find("Checkmark").GetComponent<Image>().color = new Color(gameObject.transform.Find("Background").Find("Checkmark").GetComponent<Image>().color.r, gameObject.transform.Find("Background").Find("Checkmark").GetComponent<Image>().color.g, gameObject.transform.Find("Background").Find("Checkmark").GetComponent<Image>().color.b, 1.0f);


            Debug.Log(Int32.Parse(gameObject.name.Remove(0, gameObject.name.Length - 1)) - 1);
            if (Int32.Parse(gameObject.name.Remove(0, gameObject.name.Length - 1)) - 1 == RandomQuizScript.quiz1_answer_choice)
            {
                ResultScore();
                //StartCoroutine(Plus());
                //QuizManager.page_currentScore[QuizManager.pageNum] = page_currentScore[QuizManager.pageNum];
                //gameObject.transform.Find("Label").GetComponent<Text>().color = new Color(0.113f, 0.859f, 0.086f);

                Debug.Log("Correct");
                currentText.transform.position = new Vector3(this.transform.position.x + 30.0f, this.transform.position.y + 20.0f, this.transform.position.z);
                currentText.gameObject.SetActive(true);


                //gameObject.transform.parent.parent.parent.parent.parent.Find("UIpage").Find("Oimage").gameObject.SetActive(true);

                //qm.AnswerCheck(1);

                //val_str = QuizManager.sentence_count.ToString() + ",TestResultTable,q1_result" + ",1";
                //ps.PostInit(val_str);
            }
            else
            {
                //WrongScore();
                //StartCoroutine(Minus());
                //QuizManager.page_currentScore[QuizManager.pageNum] = page_currentScore[QuizManager.pageNum];

                Debug.Log("fault");


                //qm.AnswerCheck(0);

                //val_str = QuizManager.sentence_count.ToString() + ",TestResultTable,q1_result" + ",0";
                //ps.PostInit(val_str);
            }
            CantTouchPage.SetActive(true);
            Transform tempTransform = GameObject.Find("Quiz1").transform;
            tempTransform.GetComponent <RandomQuizScript>().GoNext();
        }
    }
Exemple #6
0
    public void DayBtnClicked(string classId, int day_value, string m_Id)
    {
        Debug.Log("DayBtnClicked()");
        ps           = GameObject.FindObjectOfType <PostScript>();
        parameter_id = m_Id;
        //ps.UserInfoParse(parameter_id);

        ps.WordIDParse(classId, day_value, parameter_id);

        gameObject.transform.Find("Day_Choice").Find("Paper").gameObject.SetActive(false);
        gameObject.transform.Find("Day_Choice").Find("StudyStart").gameObject.SetActive(true);

        StartCoroutine(ParseTimer(0.3f, classId, day_value));
    }
Exemple #7
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this as PostScript;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        System.GC.GetTotalMemory(true);
    }
    static void Init()
    {
        PostScript ps = GameObject.Find("Post").GetComponent <PostScript>();

        page_isAnswer     = new bool[ps.parse_WordID.Count];
        page_ModifyCount  = new int[ps.parse_WordID.Count];
        page_currentScore = new int[ps.parse_WordID.Count];
        trueorfalse       = new bool[ps.parse_WordID.Count];

        for (int i = 0; i < page_isAnswer.Length; i++)
        {
            page_isAnswer[i]     = false;
            page_ModifyCount[i]  = 0;
            page_currentScore[i] = 10;
        }
    }
    public static void Init()
    {
        PostScript ps = GameObject.Find("Post").GetComponent <PostScript>();

        //page_isAnswer = new bool[ps.parse_WordID.Count];
        //page_currentScore = new int[ps.parse_WordID.Count];

        /*for (int i = 0; i < page_isAnswer.Length; i++)
         * {
         *  page_isAnswer[i] = false;
         *  page_currentScore[i] = 10;
         * }*/
        //Debug.Log("ps.parse_WordID.Count = " + ps.parse_WordID.Count);

        isInit = true;
    }
    public void DayBtnClicked(string classId, int day_value, string m_Id)
    {
        pageNum = 0;

        Debug.Log("DayBtnClicked Start");
        ps           = GameObject.FindObjectOfType <PostScript>();
        parameter_id = m_Id;
        //ps.UserInfoParse(parameter_id);

        if (ps.parse_WordID.Count <= 0) // 0 <- 4, forelink change condition
        {
            ps.WordIDParse(classId, day_value, parameter_id);
        }

        gameObject.transform.Find("Day_Choice").Find("Paper").gameObject.SetActive(false);
        gameObject.transform.Find("Day_Choice").Find("StudyStart").gameObject.SetActive(true);

        StartCoroutine(ParseTimer(0.3f, classId, day_value));

        Debug.Log("DayBtnClicked End");
    }
Exemple #11
0
    public void NextBtnClicked()
    {
        Debug.Log("NextBtnClicked()");

        string classId = Global.classId;

        if (word_length <= 0)
        {
            Debug.Log("NextBtnClicked() word_length is zero, return");
            return;
        }

        CantTouchPage.SetActive(true);

        if (prev_or_next == false && startIndex == 2)
        {
            startIndex++;
        }
        prev_or_next = true;

        Transform tempTransform = gameObject.transform;

        StopCoroutine(TimerScript.StopWatchStart());
        int clickTime = (int)TimerScript.sw.ElapsedMilliseconds;

        TimerScript.sw.Stop();

        sentenceTimer.Add(clickTime);

        ps = GameObject.FindObjectOfType <PostScript>();

        /*
         * forelink - startIndex transition on study contents
         *  (1 -> Popup -> 3 -> Popup -> 4 -> 5 -> 6) x 2 -> 7
         *  1: study1 - sentence intro
         *  3: study3 - word1 meaning (Study3*.wav)
         *  4: study4 - word1 usage 1 (Study4*.wav)
         *  5: study5 - word1 usage 2
         *  6: study6 - word1 usage 3
         * forelink - startIndex transition on quiz contents
         *  8 -> 9 -> 10 -> 11 -> 12 -> 13 -> 14 -> 8 -> 9 -> 10 -> 11 -> 12 -> 13 -> 14
         *  8: quiz1 - meaning of word1
         *  9: quiz2 - sound of word1
         * 10: quiz3 - select correct word1 for blank in sentence
         * 11: quiz4 - meaning of word2
         * 12: quiz5 - sound of word2
         * 13: quiz6 - select correct word2 for blank in sentence
         * 14: quiz7 - ordering words for sentence
         */
        switch (startIndex)//인덱스에 해당하는 DB에 가서 그 값을 저장한다
        {
        case 1:
            if (word_count == 1)    //단어가 여러개일때 다시 여기로 오면서 타임 값이 0이 되므로 word_count가 1일때 한번만 저장시키기로 한다
            {
                val_str = sentence_count.ToString() + ",DayTimerTable,Study1," + clickTime.ToString() + "," + rotate_number.ToString();
                //Debug.Log("val_str = " + val_str);
                ps.RenumPostInit(val_str);
            }
            break;

        case 3:
            val_str = sentence_count.ToString() + ",DayTimerTable,Study3_" + word_count.ToString() + "," + clickTime.ToString() + "," + rotate_number.ToString();
            ps.RenumPostInit(val_str);
            break;

        case 4:
            val_str = sentence_count.ToString() + ",DayTimerTable,Study4_" + word_count.ToString() + "," + clickTime.ToString() + "," + rotate_number.ToString();
            ps.RenumPostInit(val_str);
            break;

        case 7:
            val_str = sentence_count.ToString() + ",DayTimerTable,Study5," + clickTime.ToString() + "," + rotate_number.ToString();
            ps.RenumPostInit(val_str);
            break;

        default:
            break;
        }

        TimerScript.sw.Reset();

        if ((startIndex == (ps.parse_Attribute[7 + 2 * (word_count - 1)].Split(';').Length + 2)) && (word_count < word_number))
        {
            tempTransform.Find(page[startIndex]).gameObject.SetActive(false);
            startIndex = 1;
            word_count++;
            StudyText[1].text = ps.parse_Attribute[2 + word_count - 1];
            StudyText[2].text = ps.parse_Attribute[6 + 2 * (word_count - 1)];
            StudyText[3].text = ps.parse_Attribute[7 + 2 * (word_count - 1)].Split(';')[0];
            StudyText[4].text = ps.parse_Attribute[7 + 2 * (word_count - 1)].Split(';')[1];
            StudyText[5].text = ps.parse_Attribute[7 + 2 * (word_count - 1)].Split(';')[2];
            for (int i = 0; i < ps.tempSpriteList.Count; i++)
            {
                if (sentence_count + "_2_" + word_count.ToString() == ps.tempSpriteList[i].name)
                {
                    Debug.Log("sentence_count + _2_ + word_count.ToString() = " + sentence_count + "_2_" + word_count.ToString());
                    Debug.Log("ps.tempSpriteList[i].name = " + ps.tempSpriteList[i].name);
                    StudyImage[1].sprite = ps.tempSpriteList[i];
                    StudyImage[2].sprite = ps.tempSpriteList[i];
                    StudyImage[3].sprite = ps.tempSpriteList[i];
                    StudyImage[4].sprite = ps.tempSpriteList[i];
                }
            }
            tempTransform.Find(page[startIndex]).gameObject.SetActive(true);
            word_length = StudyText[1].text.Length;
            NextBtnClicked();//Study1이 화면에 보이지 않고 바로 넘어가게 끔
        }
        else if (startIndex == 2)
        {
            tempTransform.Find(page[startIndex - 1]).gameObject.SetActive(false);
            tempTransform.Find(page[startIndex]).gameObject.SetActive(true);
            tempTransform.Find(page[startIndex + 1]).gameObject.SetActive(true);
            startIndex++;
        }
        else if (startIndex == 0 || startIndex == 4 || startIndex == 5 || startIndex == 6 || startIndex == 8 || startIndex == 9)
        {
            while (!ps.isParseDone)
            {
                if (ps.isParseDone)
                {
                    break;
                }
            }
            if (tempTransform.Find(page[startIndex + 1]).Find("CurrentText") != null)
            {
                tempTransform.Find(page[startIndex + 1]).Find("CurrentText").GetComponent <Text>().text = StudyText[1].text;
            }
            tempTransform.Find(page[startIndex]).gameObject.SetActive(false);
            tempTransform.Find(page[startIndex + 1]).gameObject.SetActive(true);
            startIndex++;
        }
        else if (startIndex == 1 || startIndex == 3 || startIndex == 7)
        {
            if (startIndex == 1)
            {
                tempTransform.Find(page[startIndex]).gameObject.GetComponent <AudioSource>().clip = null;
                tempTransform.parent.Find("PopUpPage").Find("panel").Find("Text").gameObject.GetComponent <Text>().text = "'" + StudyText[1].text + "'" + " 단어를 배워봐요!";
                tempTransform.parent.Find("PopUpPage").gameObject.GetComponent <AudioSource>().clip = Resources.Load("Sound/PopUpSound/word_study_start") as AudioClip;
                if (tempTransform.Find(page[startIndex + 1]).Find("CurrentText") != null)
                {
                    tempTransform.Find(page[startIndex + 1]).Find("CurrentText").GetComponent <Text>().text = StudyText[1].text;
                }
            }
            else if (startIndex == 3)
            {
                tempTransform.Find(page[startIndex]).gameObject.GetComponent <AudioSource>().clip = null;
                tempTransform.parent.Find("PopUpPage").Find("panel").Find("Text").gameObject.GetComponent <Text>().text = "'" + StudyText[1].text + "'" + " 단어는 어떻게 사용될까요?";
                tempTransform.parent.Find("PopUpPage").gameObject.GetComponent <AudioSource>().clip = Resources.Load("Sound/PopUpSound/word_use") as AudioClip;
                if (tempTransform.Find(page[startIndex + 1]).Find("CurrentText") != null)
                {
                    tempTransform.Find(page[startIndex + 1]).Find("CurrentText").GetComponent <Text>().text = StudyText[1].text;
                }
            }
            else if (startIndex == 7)
            {
                CantTouchPage.SetActive(false);
                if (sentence_count % sentence_lastnumber != 0)
                {
                    NextSentenceBtnClicked();
                }
                else
                {
                    ps.StudyInfoInit(sentenceTimer, classId, sentence_count);
                    tempTransform.parent.Find("PopUpPage").Find("panel").Find("Text").gameObject.GetComponent <Text>().text = "학습 종료";
                    tempTransform.parent.Find("PopUpPage").gameObject.SetActive(true);
                    tempTransform.parent.Find("PopUpPage").GetComponent <AudioSource>().Stop();
                }
                return;
            }
            tempTransform.parent.Find("PopUpPage").gameObject.SetActive(true);
        }
        if (startIndex == 0 || startIndex == 12)
        {
            if (startIndex == 12)
            {
                tempTransform.Find(page[11]).gameObject.SetActive(false);
            }

            UIpage.SetActive(false);
            for (int i = 0; i < 6; i++)
            {
                if (i == 0 || i == 1 || i == 2)
                {
                    Quiz1Toggle[i].gameObject.transform.parent.parent.Find("Label").GetComponent <Text>().color = new Color(0.24f, 0.22f, 0.22f);
                }
                Quiz1Toggle[i].color = new Color(Quiz1Toggle[i].color.r, Quiz1Toggle[i].color.g, Quiz1Toggle[i].color.b, 0f);
            }
            tempTransform.Find("Quiz1").Find("WordQuiz").gameObject.SetActive(false);
            tempTransform.Find("Quiz1").Find("SentenceQuiz").gameObject.SetActive(false);

            for (int i = 0; i < 6; i++)
            {
                Quiz2Toggle[i].color = new Color(Quiz2Toggle[i].color.r, Quiz2Toggle[i].color.g, Quiz2Toggle[i].color.b, 0f);
            }
            tempTransform.Find("Quiz2").Find("WordQuiz").gameObject.SetActive(false);
            tempTransform.Find("Quiz2").Find("SoundQuiz").gameObject.SetActive(false);

            tempTransform.Find("Quiz3").Find("Size3").gameObject.SetActive(false);
            tempTransform.Find("Quiz3").Find("Size4").gameObject.SetActive(false);
            tempTransform.Find("Quiz3").Find("Size5").gameObject.SetActive(false);

            for (int i = 0; i < 3; i++)
            {
                Quiz4Toggle[i].color = new Color(Quiz4Toggle[i].color.r, Quiz4Toggle[i].color.g, Quiz4Toggle[i].color.b, 0f);
            }

            RandomQuizScript.toggleList.Clear();
            RandomQuizScript.cp_last_index = 21;//초기화
            RandomQuizScript.cp_count      = 1;
        }
        else
        {
            UIpage.SetActive(true);
        }

        SlotScript.moveCount = 0;
        CantTouchPage.SetActive(false);
    }
    public void PrevBtnClicked()
    {
        string classId = Global.classId;

        pageNum--;

        CantTouchPage.SetActive(true);

        Transform tempTransform = gameObject.transform;

        StopCoroutine(TimerScript.StopWatchStart());
        int clickTime = (int)TimerScript.sw.ElapsedMilliseconds;

        TimerScript.sw.Stop();

        string[] tempString_AA = new string[] { };
        tempString_AA = ps.quizJson["data"][0][pageNum]["quiz_id"].ToString().Split(';');
        if ((pageNum - wordChangeCount) >= 0)
        {
            templistTimer[Int32.Parse(tempString_AA[1].Remove(1)) - 1] += clickTime;
        }
        else
        {
            pageNum++;
            TimerScript.sw.Reset();

            SlotScript.moveCount_last = 0;
            SlotScript.moveCount      = 0;

            CantTouchPage.SetActive(false);
            return;
        }

        ps = GameObject.FindObjectOfType <PostScript>();
        switch (startIndex)//인덱스에 해당하는 DB에 가서 그 값을 저장한다
        {
        case 8:
            StartCoroutine(AddAnsweTimer(0));
            val_str = sentence_count.ToString() + ",DayTimerTable,Quiz1," + clickTime.ToString() + "," + rotate_number.ToString();
            ps.RenumPostInit(val_str);
            break;

        case 9:
            StartCoroutine(AddAnsweTimer(1));
            val_str = sentence_count.ToString() + ",DayTimerTable,Quiz2," + clickTime.ToString() + "," + rotate_number.ToString();
            ps.RenumPostInit(val_str);
            break;

        case 10:
            StartCoroutine(AddAnsweTimer(2));
            val_str = sentence_count.ToString() + ",DayTimerTable,Quiz3," + clickTime.ToString() + "," + rotate_number.ToString();
            ps.RenumPostInit(val_str);
            break;

        case 11:
            val_str = sentence_count.ToString() + ",DayTimerTable,Quiz4," + clickTime.ToString() + "," + rotate_number.ToString();
            ps.RenumPostInit(val_str);
            break;

        default:
            break;
        }
        TimerScript.sw.Reset();

        if (pageNum >= 0)
        {
            for (int i = 0; i < page.Length; i++)
            {
                // Debug.Log(page[i]);
                if (tempTransform.Find(page[i]) != null)
                {
                    tempTransform.Find(page[i]).gameObject.SetActive(false);
                }
            }

            // Debug.Log(ps.quizJson["data"][0][pageNum]["quiz_type"].Value);

            //tempTransform.Find(page[int.Parse(ps.quizJson["data"][0][pageNum]["quiz_type"].Value) + 7]).gameObject.SetActive(true);
            //tempTransform.Find(page[int.Parse(ps.quizJson["data"][0][pageNum]["quiz_type"].Value) + 7]).GetComponent<RandomQuizScript>().QuizInit();
            tempTransform.Find(page[pageNum % 5]).gameObject.SetActive(true);
            tempTransform.Find(page[pageNum % 5]).GetComponent <RandomQuizScript>().QuizInit();
        }
        else
        {
            pageNum = 0;
        }

        SlotScript.moveCount_last = 0;
        SlotScript.moveCount      = 0;

        CantTouchPage.SetActive(false);
    }
Exemple #13
0
 internal static extern Error FT_Get_PS_Font_Info(IntPtr face, out PostScript.Internal.FontInfoRec afont_info);
    public void OnDrop(PointerEventData eventData)
    {
        if (!item)
        {
            //Debug.Log("here come");
            DragHandlerScript.itemBeingDragged.transform.SetParent(transform);
            DragHandlerScript.slotName = DragHandlerScript.itemBeingDragged.transform.parent.name.Remove(DragHandlerScript.itemBeingDragged.transform.parent.name.Length - 1);

            if (DragHandlerScript.itemBeingDragged.name.Remove(5, 1) == "Image")//Study
            {
                RandomQuizScript.quiz3_temp_answer[Int32.Parse(DragHandlerScript.itemBeingDragged.transform.parent.name.Remove(0, DragHandlerScript.itemBeingDragged.transform.parent.name.Length - 1)) - 1]
                    = DragHandlerScript.itemBeingDragged.name.Remove(0, DragHandlerScript.itemBeingDragged.name.Length - 1);
                Debug.Log("Int32Parse? = " + (Int32.Parse(DragHandlerScript.itemBeingDragged.transform.parent.name.Remove(0, DragHandlerScript.itemBeingDragged.transform.parent.name.Length - 1)) - 1));
                Debug.Log("RandomQuizScript.quiz3_temp_answer = " + RandomQuizScript.quiz3_temp_answer[Int32.Parse(DragHandlerScript.itemBeingDragged.transform.parent.name.Remove(0, DragHandlerScript.itemBeingDragged.transform.parent.name.Length - 1)) - 1]);
            }
            else//Test
            {
                //WeeklyTestCtrlScript.Test3_temp_answer[Int32.Parse(DragHandlerScript.itemBeingDragged.transform.parent.name.Remove(0, DragHandlerScript.itemBeingDragged.transform.parent.name.Length - 1)) - 1]
                //    = DragHandlerScript.itemBeingDragged.name.Remove(0, DragHandlerScript.itemBeingDragged.name.Length - 1);
            }

            if (DragHandlerScript.questionName == "Puzzle" && DragHandlerScript.slotName == "Slot")
            {
                if (DragHandlerScript.itemBeingDragged.name.Remove(5, 1) == "Testi")
                {
                    //if (WeeklyTestCtrlScript.Test3_temp_answer[Int32.Parse(DragHandlerScript.itemBeingDragged.transform.parent.name.Remove(0, DragHandlerScript.itemBeingDragged.transform.parent.name.Length - 1)) - 1] != WeeklyTestCtrlScript.test_ex[Int32.Parse(DragHandlerScript.itemBeingDragged.transform.parent.name.Remove(0, DragHandlerScript.itemBeingDragged.transform.parent.name.Length - 1)) - 1])
                    //{
                    //    WeeklyTestCtrlScript.wrong_answer_check[WeeklyTestCtrlScript.testCount - 1] += (WeeklyTestCtrlScript.Test3_temp_answer[Int32.Parse(DragHandlerScript.itemBeingDragged.transform.parent.name.Remove(0, DragHandlerScript.itemBeingDragged.transform.parent.name.Length - 1)) - 1]);//틀린거 넣을 곳
                    //}
                }
                moveCount_last++;
                Debug.Log("moveCount_last = " + moveCount_last);
            }
            else if (DragHandlerScript.questionName == "Slot" && DragHandlerScript.slotName == "Puzzle")
            {
                if (DragHandlerScript.itemBeingDragged.name.Remove(5, 1) == "Testi")
                {
                    //if (WeeklyTestCtrlScript.wrong_answer_check[WeeklyTestCtrlScript.testCount - 1] != null)
                    //{
                    //    WeeklyTestCtrlScript.wrong_answer_check[WeeklyTestCtrlScript.testCount - 1] = WeeklyTestCtrlScript.wrong_answer_check[WeeklyTestCtrlScript.testCount - 1].Replace((WeeklyTestCtrlScript.Test3_temp_answer[Int32.Parse(DragHandlerScript.itemBeingDragged.transform.parent.name.Remove(0, DragHandlerScript.itemBeingDragged.transform.parent.name.Length - 1)) - 1]), "");
                    //}
                }
                moveCount--;
                moveCount_last--;
                Debug.Log("moveCount_last minus = " + moveCount_last);
            }
            ps = GameObject.FindObjectOfType <PostScript>();
            if (moveCount == DragHandlerScript.quizsize || moveCount_last == DragHandlerScript.quizsize)//모든 단어를 다 위로 올렸을때
            {
                checkAnswer = true;
                adjustment  = 0;
                for (int i = 1; i <= DragHandlerScript.quizsize; i++)
                {
                    image_puzzleName   = gameObject.transform.parent.Find("Slot" + i.ToString()).GetChild(0).name.Remove(0, gameObject.transform.parent.Find("Slot" + i.ToString()).GetChild(0).name.Length - 1);
                    image_puzzleNumber = Int32.Parse(image_puzzleName);

                    if (DragHandlerScript.itemBeingDragged.name.Remove(5, 1) == "Image")                         //Study퀴즈에서
                    {
                        if ((RandomQuizScript.quiz3_temp_answer[i - 1] != RandomQuizScript.quiz3_answer[i - 1])) //틀린 단어가 있으면
                        {
                            Debug.Log("startIndex = " + QuizManager.startIndex);
                            adjustment++;
                            Debug.Log("!!!!!QuizSize = " + DragHandlerScript.quizsize);
                            Debug.Log("RandomQuizScript.quiz3_temp_answer[" + (i - 1) + "] = " + RandomQuizScript.quiz3_temp_answer[i - 1]);
                            Debug.Log("RandomQuizScript.quiz3_answer[" + (i - 1) + "] = " + RandomQuizScript.quiz3_answer[i - 1]);
                            //원래 있던 자리로 내린다 size 별로
                            if (DragHandlerScript.quizsize == 3)
                            {
                                gameObject.transform.parent.Find("Slot" + i.ToString()).GetChild(0).SetParent(RandomQuizScript.study_size3_init[image_puzzleNumber - 1]);
                            }
                            else if (DragHandlerScript.quizsize == 4)
                            {
                                gameObject.transform.parent.Find("Slot" + i.ToString()).GetChild(0).SetParent(RandomQuizScript.study_size4_init[image_puzzleNumber - 1]);
                            }
                            else if (DragHandlerScript.quizsize == 5)
                            {
                                string temp_objName = gameObject.transform.parent.Find("Slot" + i.ToString()).GetChild(0).name;
                                gameObject.transform.parent.Find("Slot" + i.ToString()).GetChild(0).SetParent(RandomQuizScript.study_size5_init[image_puzzleNumber - 1]);
                                Debug.Log(RandomQuizScript.study_size5_init[image_puzzleNumber - 1]);

                                if (RandomQuizScript.study_size5_init[image_puzzleNumber - 1].name.Contains("Slot"))
                                {
                                    Debug.Log("--------------" + RandomQuizScript.study_size5_init[image_puzzleNumber - 1].name.Remove(0, 4));
                                    Debug.Log("-temp_objName-" + temp_objName);

                                    int tempint = Int32.Parse(temp_objName.Remove(0, 5));

                                    Debug.Log("tempInt = " + tempint);
                                    Debug.Log("i.Tostring() = " + i.ToString());
                                    RandomQuizScript.quiz3_temp_answer[image_puzzleNumber - 1] = "" + tempint;

                                    moveCount_last++;
                                }
                            }
                            moveCount--;
                            moveCount_last--;

                            Debug.Log("Slot" + i.ToString());
                            Debug.Log("Back to = " + RandomQuizScript.study_size5_init[image_puzzleNumber - 1]);
                            checkAnswer = false;
                        }
                        if (adjustment == 1)
                        {
                            if (!WordSentenceQuizScript.page_isAnswer[QuizManager.pageNum])
                            {
                                Debug.Log("CountTemp[6] = " + QuizManager.page_ModifyCount[QuizManager.pageNum]);
                            }
                        }
                    }
                    else//Test에서는 밑으로 내리지 않으므로 안내림
                    {
                        //if ((WeeklyTestCtrlScript.Test3_temp_answer[i - 1] != WeeklyTestCtrlScript.test_ex[i - 1]))
                        //{
                        //    checkAnswer = false;
                        //}moveCount_last
                    }
                }
                if (checkAnswer == true)
                {
                    if (DragHandlerScript.itemBeingDragged.name.Remove(5, 1) == "Image")
                    {
                        if (!WordSentenceQuizScript.page_isAnswer[QuizManager.pageNum])
                        {
                            //WordSentenceQuizScript.ResultScore();
                            StartCoroutine(EmptyObject.GetComponent <WordSentenceQuizScript>().Plus());

                            //WordSentenceQuizScript.page_currentScore[QuizManager.pageNum] = WordSentenceQuizScript.currentSc;
                            QuizManager.page_currentScore[QuizManager.pageNum] = WordSentenceQuizScript.page_currentScore[QuizManager.pageNum];
                        }
                        WordSentenceQuizScript.page_isAnswer[QuizManager.pageNum] = true;
                        QuizManager.page_isAnswer[QuizManager.pageNum]            = WordSentenceQuizScript.page_isAnswer[QuizManager.pageNum];


                        gameObject.transform.parent.parent.parent.parent.parent.Find("UIpage").Find("Oimage").gameObject.SetActive(true);
                        QuizManager.trueorfalse[QuizManager.pageNum] = true;
                        GameObject.FindObjectOfType <QuizManager>().AnswerCheck(1);
                        val_str = QuizManager.sentence_count.ToString() + ",TestResultTable,q3_result" + ",1";
                        ps.PostInit(val_str);
                        StartCoroutine(DeleteOXimage());
                    }
                    else
                    {
                        //if (WeeklyTestCtrlScript.next_or_prev == true) WeeklyTestCtrlScript.percent[WeeklyTestCtrlScript.testCount - 1] = true;
                        //else WeeklyTestCtrlScript.percent[WeeklyTestCtrlScript.testCount] = true;

                        //val_str = WeeklyTestCtrlScript.count_choice.ToString() + ",TestResultTable,t3_result" + ",1";
                        //ps.PostInit(val_str);
                    }
                }
                else
                {
                    if (DragHandlerScript.itemBeingDragged.name.Remove(5, 1) == "Image")
                    {
                        //WordSentenceQuizScript.WrongScore();
                        StartCoroutine(EmptyObject.GetComponent <WordSentenceQuizScript>().Minus());

                        //WordSentenceQuizScript.page_currentScore[QuizManager.pageNum] = WordSentenceQuizScript.currentSc;
                        QuizManager.page_currentScore[QuizManager.pageNum] = WordSentenceQuizScript.page_currentScore[QuizManager.pageNum];

                        gameObject.transform.parent.parent.parent.parent.parent.Find("UIpage").Find("Ximage").gameObject.SetActive(true);
                        QuizManager.trueorfalse[QuizManager.pageNum] = false;

                        GameObject.FindObjectOfType <QuizManager>().AnswerCheck(0);
                        val_str = QuizManager.sentence_count.ToString() + ",TestResultTable,q3_result" + ",0";
                        ps.PostInit(val_str);
                        StartCoroutine(DeleteOXimage());
                    }
                    else
                    {
                        //if (WeeklyTestCtrlScript.next_or_prev == true) WeeklyTestCtrlScript.percent[WeeklyTestCtrlScript.testCount - 1] = false;
                        //else WeeklyTestCtrlScript.percent[WeeklyTestCtrlScript.testCount] = false;

                        //val_str = WeeklyTestCtrlScript.count_choice.ToString() + ",TestResultTable,t3_result" + ",0";
                        //ps.PostInit(val_str);
                    }
                }
            }
        }
        else
        {
            Debug.Log("ewqkljeqw");
        }
    }
Exemple #15
0
    void Awake()
    {
        if (ps == null)
        {
            ps = GameObject.FindObjectOfType <PostScript>();
        }

        /*
         * forelink replace below code - previous code truncate user_id after position 6
         */
        string urlParameter = Application.absoluteURL;
        string userId       = null;
        string classId      = "";
        int    day          = 0;
        string type         = null;
        string mediaUrl     = null; // parameter added by forelink
        string gotoUrl      = null; // parameter added by forelink

        if (SceneManager.GetActiveScene().name == "01_1.Study")
        {
            type = "study";
        }
        else
        {
            type = "quiz";
        }
        if (urlParameter == null || urlParameter == "") // forelink - for pc standalone running
        {
            //lParameter = "https://kukp.forelink-cloud.co.kr/moodle3/kukp/unity1.1/" + type + "/index.html?id=kukpadmin&class_id=math2p&day=1&media=https://kukp.forelink-cloud.co.kr/moodle3/kukp/media_math2p";
            urlParameter = "https://kukp.forelink-cloud.co.kr/moodle3/kukp/unity1.1/" + type + "/index.html?id=kukpadmin&class_id=elem2p&day=1&media=https://kukp.forelink-cloud.co.kr/moodle3/kukp/media_elem2";
            // "&media=url1!q1=A|q2=a|q3=1&goto=url2!q4=B|q5=b|q6=2"
            Debug.Log("NextBtnClicked: temporary url = " + urlParameter);
        }

        int index = urlParameter.IndexOf("?");

        if (index != -1)
        {
            string[] queryParameters = urlParameter.Substring(index + 1).Split('&');
            for (int i = 0; i < queryParameters.Length; i++)
            {
                if (queryParameters[i].StartsWith("id="))
                {
                    userId = queryParameters[i].Substring(3);
                }
                else if (queryParameters[i].StartsWith("class_id="))
                {
                    classId = queryParameters[i].Substring(9);
                }
                else if (queryParameters[i].StartsWith("day="))
                {
                    day = Int32.Parse(queryParameters[i].Substring(4));
                }
                else if (queryParameters[i].StartsWith("media="))
                {
                    mediaUrl = queryParameters[i].Substring(6);
                }
                else if (queryParameters[i].StartsWith("goto="))
                {
                    gotoUrl = queryParameters[i].Substring(5);
                }
            }
            if (mediaUrl != null) // '!', '|' is used to specify url query part
            {
                mediaUrl = mediaUrl.Replace("!", "?");
                mediaUrl = mediaUrl.Replace("|", "&");
            }
            if (gotoUrl != null) // '!', '|' is used to specify url query part
            {
                gotoUrl = gotoUrl.Replace("!", "?");
                gotoUrl = gotoUrl.Replace("|", "&");
            }
        }
        if (mediaUrl == null)
        {
            mediaUrl = "";
        }
        if (gotoUrl == null)
        {
            gotoUrl = "";
        }
        // Debug.Log("NextBtnClicked: id = " + (userId!=null?userId:"null") + ", day = " + day + " ["+type+", "+mediaUrl+", "+gotoUrl+"]");

        if (userId != null && userId != "" && day != 0)
        {
            PlayerPrefs.SetString("user_id", userId);
            Global.userId   = userId;
            Global.classId  = classId;
            Global.nRound   = day;
            Global.type     = type;
            Global.mediaUrl = mediaUrl;
            Global.gotoUrl  = gotoUrl;
            if (SceneManager.GetActiveScene().name == "01_1.Study")
            {
                DayBtnClicked(classId, day, userId);
            }
            if (SceneManager.GetActiveScene().name == "01_2.Quiz")
            {
                sentence_count = 1;
                startIndex     = 8;
                DayBtnClicked(classId, day, userId);
            }
        }
    }
 void Awake()
 {
     ps = GameObject.FindObjectOfType <PostScript>();
 }
Exemple #17
0
 internal static extern Error FT_Get_PS_Font_Private(IntPtr face, out PostScript.Internal.PrivateRec afont_private);