Beispiel #1
0
    public void SetInfo(int score, Texture2D tex, List <float> emotion)
    {
        Score          = score;
        ScoreText.text = score.ToString();
        SmileProject.Instance.AddScore(score);
        m_emotion      = emotion;
        Review.texture = tex;
        m_tex2d        = tex;
        Review.gameObject.GetComponent <AspectRatioFitter> ().aspectRatio = (float)tex.width / tex.height;

        m_emotion = emotion;
        Review.gameObject.GetComponent <AspectRatioFitter>().aspectRatio = (float)tex.width / tex.height;
        List <EmotionInfo> _info_list = new List <EmotionInfo>();

        for (int i = 0; i < m_emotion.Count; ++i)
        {
            EmotionInfo _einfo = new EmotionInfo();
            _einfo.name  = ImitateTranslateService.GetTextByIndex(i);
            _einfo.score = m_emotion[i];
            _info_list.Add(_einfo);
        }
        _info_list.Sort(_compass);
        if (m_detail_list.Count == 0)
        {
            for (int i = 0; i < 5; ++i)
            {
                GameObject      _u    = GameObject.Instantiate(unit_pref);
                SmileDetailUnit _unit = _u.GetComponent <SmileDetailUnit>();
                _unit.SetInfo(_info_list[i].name, (int)(_info_list[i].score * 100));
                _u.transform.parent        = m_root;
                _u.transform.localScale    = Vector3.one;
                _u.transform.localPosition = new Vector3(0, -89 * i, 0);
                _u.SetActive(true);
                m_detail_list.Add(_unit);
            }
        }
        else
        {
            for (int i = 0; i < 5; ++i)
            {
                m_detail_list[i].SetInfo(_info_list[i].name, (int)(_info_list[i].score * 100));
                if (_info_list[i].score >= 0.1f)
                {
                    m_detail_list[i].gameObject.SetActive(true);
                }
                else
                {
                    m_detail_list[i].gameObject.SetActive(false);
                }
            }
        }
    }
Beispiel #2
0
    private List <DetailRow> ResultToDetailRowList(ImitateResult result)
    {
        var ret = new List <DetailRow>();

        foreach (var item in result.itemList)
        {
            var title = ImitateTranslateService.GetTextByIndex(item.index);
            Debug.Log($"title: {item.index} -> {title}");
            var likely = ImitateManager.RateSignleItem01(item.target, item.input);
            Debug.Log($"likely: {item.target} : {item.input} -> {likely}");
            var row = new DetailRow();
            row.title   = title;
            row.percent = likely;
            ret.Add(row);
        }
        return(ret);
    }