Exemple #1
0
            private void CreateChild <T> (InGameObjectBase igo, int i) where T : MenuButtonParent
            {
                T elem = Instantiate(menuButton, self).GetComponent <T>();

                elem.igo = igo;
                elem.OnCreated();
                elem.index = i;
                thisActiveChild.childsIMB.Add((T)elem);
            }
Exemple #2
0
        void OnEnable()
        {
            int index = -1;

            if (childsIMB[0].GetType() == typeof(CharaMenuButton))
            {
                index = 0;
            }
            if (childsIMB[0].GetType() == typeof(ItemMenuButton))
            {
                index = 1;
            }
            if (childsIMB[0].GetType() == typeof(ObjectiveMenuButton))
            {
                index = 2;
            }

            InGameObjectBase[] igoGeneralList = new InGameObjectBase[0];

            switch (index)
            {
            case 0:
                igoGeneralList = igoGeneralList.CopyToArray(GeneralValue.igoData.AllCharacters);
                break;

            case 1:
                igoGeneralList = igoGeneralList.CopyToArray(GeneralValue.igoData.AllItems);
                break;

            case 2:
                igoGeneralList = igoGeneralList.CopyToArray(GeneralValue.igoData.AllGoals);
                break;
            }

            for (var i = 0; i < childsIMB.Count; i++)
            {
                if (!igoGeneralList[i].isDiscovered)
                {
                    childsIMB[i].gameObject.SetActive(false);
                }
                else
                {
                    childsIMB[i].gameObject.SetActive(true);
                }
            }
        }