コード例 #1
0
    private void createRecordData()
    {
        if (DataFoodList != null)
        {
            DataFoodList.Clear();
        }
        DataFoodList            = snl.loadData();
        transform.localPosition = new Vector3(0, 0, 0);
        int j = 0;

        for (int i = 0; i < DataFoodList.Count; i++)
        {
            if (DataFoodList[i].saveDate >= (DateTime.Now.Ticks - period))
            {
                TotalCal += DataFoodList[i].reciveCal;
                GameObject RecordDetail = (GameObject)GameObject.Instantiate(RecordTable);
                RecordDetail.SetActive(true);
                RecordDetail.transform.parent        = this.transform;
                RecordDetail.transform.localPosition = new Vector3(0, 0.4f - i * 0.8f, 0);

                ListTable idt = RecordDetail.GetComponent <ListTable>();
                idt.setContent(DataFoodList[i], j);
                updateFoodList.Add(DataFoodList[i]);
                FoodList.Add(RecordDetail);

                height = -(0.4f - j * 0.8f) - 2.0f;
                j++;
            }
        }
        DataFoodList = updateFoodList;
        Debug.Log(height);
        if (height <= 0.6f)
        {
            height      = 0.6f;
            AllowScroll = false;
        }
        else
        {
            AllowScroll = true;
        }

        if (TotalCal == 0)
        {
            Mascot[0].SetActive(false);
        }
        else if (TotalCal < 1500)
        {
            Mascot[0].SetActive(true);
        }
        else if (TotalCal > 2500)
        {
            Mascot[2].SetActive(true);
        }
        else
        {
            Mascot[1].SetActive(true);
        }
        //Debug.Log(FoodList.Count);
    }