Example #1
0
    void SetMouth(int i)
    {
        if (summaryMouth == null)
        {
            return;
        }

        summaryMouth.SetMouth(i);
    }
Example #2
0
    public void Setup(ui_review_month_responses obj, int i, String label, String val, UserResponse response)
    {
        command_parent = obj;
        myIndex        = i;

        transform.Find("dimension").GetComponent <UnityEngine.UI.Text>().text = label;
        transform.Find("value").GetComponent <UnityEngine.UI.Text>().text     = val;

        if (summaryMouth != null)
        {
            summaryMouth.SetMouth((int)response);
        }
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        var userData = GameObject.Find("Canvas").GetComponent <UITestbed>().userData;



        switch (this.currentMode)
        {
        case Mode.Overview:
        {
            transform.Find("current-overview").gameObject.SetActive(true);
            transform.Find("dimension-summary").gameObject.SetActive(false);
            transform.Find("current-summary").gameObject.SetActive(false);

            var root = transform.Find("current-overview");

            root.Find("results").gameObject.SetActive(false);

            if ((data.data != null) && (data.data.Count > 0))
            {
                root.Find("record").GetComponent <UnityEngine.UI.Text>().text =
                    "Record " + (currentResponseIndex + 1) + " of " + data.data.Count + "\n"
                    + data.data[currentResponseIndex].date.ToString();

                var i = 0;

                foreach (UserData.Dimensions dimension in Enum.GetValues(typeof(UserData.Dimensions)))
                {
                    var label = userData.GetDimensionLabel(i);

                    root.Find("current-overview-item (" + i + ")").gameObject.SetActive(true);

                    root.Find("current-overview-item (" + i + ")").GetComponent <ui_current_overview_item>()
                    .Setup(this
                           , i
                           , label
                           , userData.GetQuestionResponse(data.data[currentResponseIndex], dimension)
                           , data.data[currentResponseIndex].responses[dimension].response
                           );

                    i++;
                }

                root.Find("prev").gameObject.SetActive(currentResponseIndex != 0);
                root.Find("next").gameObject.SetActive(currentResponseIndex + 1 < data.data.Count);

                //GARETH disable
                //root.Find("results").gameObject.SetActive(true);
                root.Find("results").gameObject.SetActive(false);
            }
            else
            {
                for (var i = 0; i < 6; i++)
                {
                    var label = userData.GetDimensionLabel(i);

                    root.Find("current-overview-item (" + i + ")").gameObject.SetActive(false);
                }

                root.Find("record").GetComponent <UnityEngine.UI.Text>().text = "No Responses for current month";
                root.Find("prev").gameObject.SetActive(false);
                root.Find("next").gameObject.SetActive(false);
                root.Find("results").gameObject.SetActive(false);
            }
        }
        break;

        case Mode.Summary:
        {
            transform.Find("current-overview").gameObject.SetActive(false);
            transform.Find("dimension-summary").gameObject.SetActive(false);
            transform.Find("current-summary").gameObject.SetActive(true);

            var root = transform.Find("current-summary");
            root.Find("average-label").GetComponent <UnityEngine.UI.Text>().text =
                "My average for " + data.time.ToString("MMMM", CultureInfo.InvariantCulture) + " " + data.time.Year;

            root.Find("feedback-to-user").GetComponent <UnityEngine.UI.Text>().text = userData.GetMonthlyFeedback(data.time);

            summaryMouth.SetMouth(userData.GetMonthlyFeedbackAsInt(data.time));
        }
        break;

        case Mode.Dimension_Summary:
        {
            transform.Find("current-overview").gameObject.SetActive(false);
            transform.Find("dimension-summary").gameObject.SetActive(true);
            transform.Find("current-summary").gameObject.SetActive(false);


            var root = transform.Find("dimension-summary");

            var label = userData.GetDimensionLabel(dimensionDetailID);

            root.Find("item").Find("dimension").GetComponent <UnityEngine.UI.Text>().text = label;
            root.Find("item").Find("value").GetComponent <UnityEngine.UI.Text>().text     = userData.GetQuestionResponse(data.data[currentResponseIndex], (UserData.Dimensions)dimensionDetailID);

            //if review historic - only show feedback
            root.Find("enter-details").gameObject.SetActive(writeData);
            root.Find("view-details").gameObject.SetActive(!writeData);

            root.Find("recorded-tab").GetComponent <UnityEngine.UI.Text>().text =
                "Recorded " + data.data[currentResponseIndex].date;

            if (writeData == true)
            {
                root.Find("enter-details").Find("InputField").GetComponent <UnityEngine.UI.InputField>().text = userData.GetQuestionResponseNarrative(data.data[currentResponseIndex], (UserData.Dimensions)dimensionDetailID);
            }
            else
            {
                root.Find("view-details").Find("Text").GetComponent <UnityEngine.UI.Text>().text = userData.GetQuestionResponseNarrative(data.data[currentResponseIndex], (UserData.Dimensions)dimensionDetailID);
            }
        }
        break;
        }
    }