Esempio n. 1
0
        public void Initialize()
        {
            PlaneManager gamePreferences = Services.Get <PlaneManager>();

            int current = gamePreferences.GetCurrentPlaneId();

            Dictionary <string, PlayerPrefabItemList> prefabData = gamePreferences.GetPrefabData();

            foreach (var entry in prefabData)
            {
                var items = entry.Value.playerPrefabItems;
                for (int i = 0; i < items.Count; ++i)
                {
                    PlaneCard card = GameObject.Instantiate <PlaneCard>(m_cardPrefab);
                    card.transform.SetParent(m_grid.transform, false);
                    card.Initialize(entry.Value.Bundle, entry.Key, items[i].iconFile, items[i].id, current == items[i].id);
                    card.ClickedEvent += HandleCardClicked;
                }
            }

            m_justInitialized = true;
        }