Пример #1
0
    public void OnInit(DatabaseManager.CursoContentLineData data, CursoContentUI.types type)
    {
        this.data = data;
        this.type = type;
        isDone    = false;
        Init();
        Reset();
        avatarName.text = data.character_id.ToString();
        field.text      = data.text;
        List <DatabaseManager.MultiplechoiceData> arr;

        if (type == CursoContentUI.types.CURSO)
        {
            arr = Data.Instance.databaseManager.GetMultiplechoiceDataByCursoID(data.id);
        }
        else
        {
            arr = Data.Instance.databaseManager.GetMultiplechoiceDataByVentaID(data.id);
        }
        foreach (DatabaseManager.MultiplechoiceData d in arr)
        {
            UICursoContentButton newButton = (UICursoContentButton)AddItem();
            newButton.OnInit(d);
        }
    }
Пример #2
0
    public void OnInit(DatabaseManager.CursoContentLineData data, CursoContentUI.types type)
    {
        anim = GetComponent <CursoContentUI>().client.GetComponentInChildren <Animator>();

        this.type = type;
        this.data = data;
        Init();
        if (type == CursoContentUI.types.CURSO)
        {
            int character_id = Data.Instance.databaseManager.GetCursoByID(Data.Instance.userData.curso_active_id).character_id;
            if (character_id == 0)
            {
                mentorName = "Xavier";
            }
            else
            {
                mentorName = "Christian";
            }

            if (data.character_id == 0)
            {
                avatarName.text = mentorName;
            }
            else
            {
                avatarName.text = "Conejo";
            }
            field.text = data.text;
        }
        else
        {
            arr        = Data.Instance.databaseManager.GetMultiplechoiceDataByVentaID(data.id);
            field.text = arr[0].text;
            if (arr[0].goto_id == 0 && arr[0].correct > 0)
            {
                anim.Play("happy");
                Events.PlaySound("ui", "btn_ok", false);
            }
            else if (arr[0].goto_id == 0 && arr[0].correct == 0)
            {
                anim.Play("unhappy");
                Events.PlaySound("ui", "btn_bad", false);
            }
            else
            {
                anim.Play("neutral");
                Events.PlaySound("ui", "btn", false);
            }
        }
        panel.SetActive(true);
    }
Пример #3
0
    void SetOn()
    {
        multiplechoiceUI.Close();
        dialoguesUI.Close();
        if (id > data.all.Length - 1)
        {
            if (type == types.CURSO)
            {
                GetComponent <CursosUI>().CursoReady();
            }
            return;
        }
        DatabaseManager.CursoContentLineData d = data.all[id];

        foreach (GameObject go in characters)
        {
            go.transform.localPosition = new Vector3(1000, 0, 0);
        }

        if (d.character_id == 1)
        {
            client.transform.localPosition = clientPos;
        }
        else
        {
            characters[0].transform.localPosition = conejoPos;
        }

        List <DatabaseManager.MultiplechoiceData> arr;

        if (type == types.CURSO)
        {
            arr = Data.Instance.databaseManager.GetMultiplechoiceDataByCursoID(d.id);
        }
        else
        {
            arr = Data.Instance.databaseManager.GetMultiplechoiceDataByVentaID(d.id);
        }

        print("Curso Content: character_id: " + d.character_id + "     d.isMultiplechoice: " + d.isMultiplechoice + "   arr: " + arr.Count + "  d.goto_id: " + d.goto_id);
        if (arr.Count < 2)
        {
            d.isMultiplechoice = false;
        }

        if (d.isMultiplechoice)
        {
            multiplechoiceUI.OnInit(d, type);

            if (type == types.VENTA)
            {
                int highscore = 0;
                foreach (DatabaseManager.MultiplechoiceData multipleData in arr)
                {
                    if (multipleData.correct > highscore)
                    {
                        highscore = multipleData.correct;
                    }
                }
                GetComponent <VentasUI>().totalScore += highscore;
            }
        }
        else
        {
            dialoguesUI.OnInit(d, type);
        }
    }