Пример #1
0
 public void Initialize(CScoreInfo.CScore kScore)
 {
     m_txtNo.text   = kScore.m_No.ToString();
     m_txtName.text = kScore.m_Name;
     m_txtKor.text  = kScore.m_Kor.ToString();
     m_txtMath.text = kScore.m_Mat.ToString();
     m_txtEng.text  = kScore.m_Eng.ToString();
     m_txtTot.text  = kScore.Total.ToString();
     m_txtAvg.text  = string.Format("{0:0.00}", kScore.Average);
 }
Пример #2
0
    public void OnClicked_Load()
    {
        m_kScoreInfo.LoadFile();

        m_listItem.Clear();
        for (int i = 0; i < m_kScoreInfo.m_listScore.Count; i++)
        {
            CScoreInfo.CScore kScore  = m_kScoreInfo.m_listScore[i];
            CScoreItemUI      kItemUI = CreateItemUI(kScore);
            m_listItem.Add(kItemUI);
        }
    }
Пример #3
0
    public void OnClicked_Delete()
    {
        CScoreInfo.CScore kScore = m_kScoreInfo.FindScore(m_kCurItemUI.GetNumber());
        if (kScore != null)
        {
            m_kScoreInfo.RemoveItem(kScore.m_Name);
            m_listItem.Remove(m_kCurItemUI);

            Destroy(m_kCurItemUI.gameObject);
            m_kCurItemUI = null;
        }
    }
Пример #4
0
    public void OnClicked_Add()
    {
        int    nNo   = int.Parse(m_InputNo.text);
        string sName = m_InputName.text;
        int    nKor  = int.Parse(m_InputKor.text);
        int    nMath = int.Parse(m_InputMath.text);
        int    nEng  = int.Parse(m_InputEng.text);

        CScoreInfo.CScore kScore  = m_kScoreInfo.AddItem(nNo, sName, nKor, nEng, nMath);
        CScoreItemUI      kItemUI = CreateItemUI(kScore);

        m_listItem.Add(kItemUI);
    }
Пример #5
0
    public void OnClicked_Repair()
    {
        int    nNo   = int.Parse(m_InputNo.text);
        string sName = m_InputName.text;
        int    nKor  = int.Parse(m_InputKor.text);
        int    nMath = int.Parse(m_InputMath.text);
        int    nEng  = int.Parse(m_InputEng.text);

        CScoreInfo.CScore kScore = m_kScoreInfo.Repair(nNo, sName, nKor, nEng, nMath);
        if (m_kCurItemUI != null)
        {
            m_kCurItemUI.Initialize(kScore);
        }
    }
Пример #6
0
    public CScoreItemUI CreateItemUI(CScoreInfo.CScore kScore)
    {
        GameObject go = m_ListView.CreateItem();

        if (go != null)
        {
            CScoreItemUI kItemUI = go.GetComponent <CScoreItemUI>();
            kItemUI.Initialize(kScore);

            Button btn = go.GetComponent <Button>();
            btn.onClick.AddListener(() => OnSelectedItem(go, kScore));
            return(kItemUI);
        }
        return(null);
    }
Пример #7
0
    public CScoreItemUI CreateItemUI(CScoreInfo.CScore kScore)
    {
        GameObject go = Instantiate(m_prefabItem, m_ScrollRect.content);

        go.transform.localScale = new Vector3(1, 1, 1);
        CScoreItemUI kItemUI = go.GetComponent <CScoreItemUI>();

        kItemUI.Initialize(kScore);

        Button btn = go.GetComponent <Button>();

        btn.onClick.AddListener(() => OnSelectedItem(go, kScore));

        return(kItemUI);
    }
Пример #8
0
    public void OnSelectedItem(GameObject go, CScoreInfo.CScore kScore)
    {
        if (m_kCurItemUI != null)
        {
            m_kCurItemUI.SetSelectd(false);
        }

        m_InputNo.text   = kScore.m_No.ToString();
        m_InputName.text = kScore.m_Name;
        m_InputKor.text  = kScore.m_Kor.ToString();
        m_InputMath.text = kScore.m_Mat.ToString();
        m_InputEng.text  = kScore.m_Eng.ToString();

        m_kCurItemUI = go.GetComponent <CScoreItemUI>();
        m_kCurItemUI.SetSelectd(true);
    }