Ejemplo n.º 1
0
 void OnDisable()
 {
     //// remove all slots with items
     //foreach(ItemSlotDropHandler inventorySlot in GetComponentsInChildren<ItemSlotDropHandler>())
     //{
     //    Destroy(inventorySlot.gameObject);
     //}
     RecycleBin.RecycleChildrenOf(inventoryItemsGrid.gameObject);
 }
Ejemplo n.º 2
0
 void SetUniqueAbilitiesActive(bool doActivate)
 {
     // verify if we need to activate or deactivate abilities list
     if (doActivate)
     {
         // loop through all possible unique abilities configs
         foreach (UniqueAbilityConfig uniqueAbilityConfig in ConfigManager.Instance.UniqueAbilityConfigs)
         {
             // verify this ability is applicable only to specific factions
             if (uniqueAbilityConfig.doLimitUsageByFaction)
             {
                 // verify if that ability is allowed for this Faction
                 if (Array.Exists(uniqueAbilityConfig.applicableToFactions, element => element == factionSelectionGroup.GetSelectedFaction()))
                 {
                     TextToggle uniqueAbilityToggle = CreateNewAbilityToggle(uniqueAbilityConfig);
                     // adjust text color and toggle color schema to represent Faction-specific ability
                     uniqueAbilityToggle.GetComponent <Text>().color = factionSpecificAbilityNormalColor;
                     uniqueAbilityToggle.NormalColor      = factionSpecificAbilityNormalColor;
                     uniqueAbilityToggle.HighlightedColor = factionSpecificAbilityHighlightedColor;
                     uniqueAbilityToggle.PressedColor     = factionSpecificAbilityPressedColor;
                 }
             }
             else
             {
                 CreateNewAbilityToggle(uniqueAbilityConfig);
             }
         }
         // preselect first toggle
         uniqueAbilitiesToggleGroup.GetComponentsInChildren <TextToggle>()[0].ActOnLeftMouseClick();
     }
     else
     {
         // remove all previus abilities
         RecycleBin.RecycleChildrenOf(uniqueAbilitiesToggleGroup.gameObject);
         //// loop through all abilities in UI
         //foreach(Transform t in uniqueAbilitiesToggleGroup.transform)
         //{
         //    // move toggle to recycle bin and destroy it (move is required, because actual destroy is being done at the end of the frame,
         //    // but we need to preselect new toggle on reset SetUniqueAbilitiesActive(false/true)
         //    t.SetParent(RecycleBin.Instance.transform);
         //    Debug.Log("Destroy " + t.name);
         //    Destroy(t.gameObject);
         //}
     }
 }
 void OnDisable()
 {
     // remove all created additional info texts
     RecycleBin.RecycleChildrenOf(upmAdditionalInfoArea.gameObject);
 }