Пример #1
0
    void MakeSteakerBook()
    {
        curSteakerDic = new Dictionary <ScheduleType, GameObject>();
        steakers      = Instantiate(preSteakerPlate).GetComponent <SteakerPlate>();
        GridLayoutGroup group = steakers.GetComponent <GridLayoutGroup>();

        steakers.transform.parent        = UIManager.Instance.Canvas.transform;
        steakers.transform.localPosition = new Vector2(276, 0);
        steakers.transform.localScale    = Vector3.one;

        GameObject obj = Instantiate(preSteakerButton);

        obj.transform.parent        = UIManager.Instance.Canvas.transform;
        obj.transform.localPosition = new Vector2(276, 0);
        obj.transform.localScale    = Vector3.one;
        obj.GetComponent <ObjectFollower>().Other = steakers.transform;

        steakerList.Clear();
        var dic = GameManager.Instance.SchedulesDic;

        int i = 0;

        foreach (var iter in dic)
        {
            if (i % STEAKER_LIMIT == 0)
            {
                steakerList.Add(new List <SteakerInfo>());
            }
            SteakerInfo info = new SteakerInfo();
            info.type = iter.Key;
            info.num  = iter.Value;

            if (preSteakerDic.TryGetValue(info.type, out obj))
            {
                GameObject steObj = Instantiate(obj);
                if (i / STEAKER_LIMIT == 0)
                {
                    steObj.transform.parent = steakers.transform;
                }
                steObj.transform.localScale = Vector3.one;

                Steaker ste = steObj.GetComponent <Steaker>();
                ste.Num = info.num;
                curSteakerDic.Add(info.type, steObj);
            }
            else
            {
                Debug.LogError("The Schedule" + info.type + " DOESN'T EXIST");
            }

            steakerList[i / STEAKER_LIMIT].Add(info);

            i += 1;
        }

        int useLength = steakerList[0].Count * 50 + (steakerList[0].Count - 1) * 70;

        group.padding.top = (528 - useLength) / 2;
    }
Пример #2
0
 void Start()
 {
     objNum  = staticObjNum++;
     steaker = GetComponent <Steaker>();
 }