Пример #1
0
    public void Init(List <Pairing> pairs, int stage)
    {
        RectTransform     r   = stage2a;
        List <RacePairUI> pui = pair_ui0;

        if (stage == 1)
        {
            pui = pair_ui1;
            r   = stage2b;
        }
        else if (stage == 2)
        {
            pui = pair_ui2;
            r   = stage2c;
        }

        RaceManager rm = GameObject.FindObjectOfType <RaceManager>();

        foreach (Pairing p in pairs)
        {
            GameObject go = Instantiate(racePairPrefab) as GameObject;
            RacePairUI ui = go.GetComponent <RacePairUI>();
            ui.transform.SetParent(r.transform);
            Competitor a = rm.GetCompetitorbyName(p.name1);
            Competitor b = rm.GetCompetitorbyName(p.name2);
            if (b == null)
            {
                ui.SetRacers(p.name1, p.name2, a.stage1_place, 0);
            }
            else
            {
                ui.SetRacers(p.name1, p.name2, a.stage1_place, b.stage1_place);
            }
            pui.Add(ui);
        }
    }
Пример #2
0
    public void Init(List <Pairing> pairs)
    {
        RaceManager rm = GameObject.FindObjectOfType <RaceManager>();

        foreach (Pairing p in pairs)
        {
            GameObject go = Instantiate(racePairPrefab) as GameObject;
            RacePairUI ui = go.GetComponent <RacePairUI>();
            ui.transform.SetParent(infoParent.transform);
            Competitor a = rm.GetCompetitorbyName(p.name1);
            Competitor b = rm.GetCompetitorbyName(p.name2);

            if (b == null)
            {
                ui.SetRacers(p.name1, p.name2, a.qual_place, 0);
            }
            else
            {
                ui.SetRacers(p.name1, p.name2, a.qual_place, b.qual_place);
            }

            pair_ui.Add(ui);
        }
    }