Exemplo n.º 1
0
    public virtual List <EventPanel> CreateEventPanel(Transform transform)
    {
        List <EventPanel>     EventPanelList = new List <EventPanel>();
        RandomEventController randomEvent    = transform.GetComponent <RandomEventController>();

        if (randomEvent != null)
        {
            randomEvent.randomEventList.RemoveAll(x => x == null);
            foreach (GeneralEvent generalEvent in randomEvent.randomEventList)
            {
                if (!EventPanels.Exists(x => x.generalEvent == generalEvent))
                {
                    EventPanel eventPanel = CreatePanel(generalEvent);
                    EventPanelList.Add(eventPanel);
                    eventPanel.Draw(generalEvent.transform);
                }
            }
        }
        else
        {
            ActionMGController actionMGController = transform.GetComponent <ActionMGController>();
            if (actionMGController != null)
            {
                GeneralEvent generalEvent = actionMGController.MgComplite;
                if (!EventPanels.Exists(x => x.generalEvent == generalEvent))
                {
                    EventPanel eventPanel = CreatePanel(generalEvent);
                    EventPanelList.Add(eventPanel);
                    eventPanel.Draw(generalEvent.transform);
                }

                generalEvent = actionMGController.MgNotComplite;
                if (!EventPanels.Exists(x => x.generalEvent == generalEvent))
                {
                    EventPanel eventPanel = CreatePanel(generalEvent);
                    EventPanelList.Add(eventPanel);
                    eventPanel.Draw(generalEvent.transform);
                }
            }
        }
        EventPanels.AddRange(EventPanelList);
        return(EventPanelList);
    }