Example #1
0
    public void UpdateAbilities(ref IHardware[] activeHardwareList)
    {
        for (int i = 0; i < activeHardwareList.Length; i++)
        {
            IHardware activeHardware = activeHardwareList[i];
            Sprite    activeHardwareBubSprite;

            if (activeHardware == null)
            {
                activeHardwareBubSprite    = emptyAbilityBub;
                abilityBubImages[i].sprite = activeHardwareBubSprite;
                abilityMomentumCounters[i].SetActive(false);

                if (cooldownOverlays[i].enabled == true)
                {
                    cooldownOverlays[i].enabled = false;
                }
            }
            else
            {
                HardwareType activeHardwareType = activeHardware.Type;

                activeHardwareBubSprite    = DataAssociations.GetHardwareTypeBubImage(activeHardwareType);
                abilityBubImages[i].sprite = activeHardwareBubSprite;
                abilityMomentumCounters[i].SetActive(true);

                activeHardware.CooldownPercentUpdater  = null;
                activeHardware.CooldownPercentUpdater += GenerateCooldownPercentUpdater(i);

                activeHardware.CooldownDurationUpdater  = null;
                activeHardware.CooldownDurationUpdater += GenerateCooldownDurationUpdater(i);
            }
        }
    }
Example #2
0
    void UpdateEquippedGear(InventoryData inventory)
    {
        for (int i = 0; i < inventory.EquippedActiveHardware.Length; i++)
        {
            HardwareType equippedHardware = inventory.EquippedActiveHardware[i];
            activeHardwareImages[i].sprite = DataAssociations.GetHardwareTypeBubImage(equippedHardware);
        }

        for (int i = 0; i < inventory.EquippedPassiveHardware.Length; i++)
        {
            HardwareType equippedHardware = inventory.EquippedPassiveHardware[i];
            passiveHardwareImages[i].sprite = DataAssociations.GetHardwareTypeBubImage(equippedHardware);
        }
    }
    void DisplayAndActivateDiscoveredHardware()
    {
        for (int i = 0; i < discoverableHardwareTypes.Length; i++)
        {
            HardwareType hardwareType = discoverableHardwareTypes[i];
            if (InventoryController.HasDiscoveredHardware(hardwareType))
            {
                Sprite discoverableHardwareBubImage = DataAssociations.GetHardwareTypeBubImage(hardwareType);
                hardwareInventoryImages[i].sprite = discoverableHardwareBubImage;

                EventTrigger trigger = hardwareInventoryEventTriggers[i];

                AssignDragEventListeners(trigger, discoverableHardwareBubImage, hardwareType);
            }
        }
    }
    void UpdateRenewable(ref IRenewable activeRenewable)
    {
        RenewableTypes activeRenewableType     = activeRenewable.Type;
        Sprite         activeHardwareBubSprite = DataAssociations.GetRenewableTypeBubImage(activeRenewableType);

        renewableBubImage.sprite = activeHardwareBubSprite;

        activeRenewable.DurationUpdater  = null;
        activeRenewable.DurationUpdater += GeneratePercentDurationUpdater();

        activeRenewable.CooldownPercentUpdater  = null;
        activeRenewable.CooldownPercentUpdater += GenerateCooldownPercentUpdater();

        activeRenewable.CooldownDurationUpdater  = null;
        activeRenewable.CooldownDurationUpdater += GenerateCooldownDurationUpdater();
    }
    void DisplayAndActivateDiscoveredRenewables()
    {
        for (int i = 0; i < renewableTypes.Length; i++)
        {
            RenewableTypes renewableType = renewableTypes[i];
            if (InventoryController.HasDiscoveredRenewable(renewableType))
            {
                Sprite discoverableRenewableBubImage = DataAssociations.GetRenewableTypeBubImage(renewableType);
                renewableInventoryImages[i].sprite = discoverableRenewableBubImage;

                EventTrigger trigger = renewableInventoryEventTriggers[i];

                AssignDragEventListeners(trigger, discoverableRenewableBubImage, renewableType);
            }
        }
    }
        /// <summary>
        /// Serialize the data type description to XML
        /// </summary>
        /// <returns>Serialized data type descriptor</returns>
        public XElement ToXml()
        {
            var element = new XElement("DataTypeDescriptor",
                                       new XAttribute("dataTypeId", this.DataTypeId),
                                       new XAttribute("name", this.Name),
                                       new XAttribute("namespace", this.Namespace),
                                       this.Title != null ? new XAttribute("title", this.Title) : null,
                                       new XAttribute("isCodeGenerated", this.IsCodeGenerated),
                                       new XAttribute("cachable", this.Cachable),
                                       new XAttribute("searchable", this.Searchable),
                                       this.LabelFieldName != null ? new XAttribute("labelFieldName", this.LabelFieldName) : null,
                                       !string.IsNullOrEmpty(this.InternalUrlPrefix) ? new XAttribute("internalUrlPrefix", this.InternalUrlPrefix) : null,
                                       this.TypeManagerTypeName != null ? new XAttribute("typeManagerTypeName", this.TypeManagerTypeName) : null,
                                       !string.IsNullOrEmpty(this.BuildNewHandlerTypeName) ? new XAttribute("buildNewHandlerTypeName", this.BuildNewHandlerTypeName) : null);


            element.Add(new[]
            {
                new XElement("DataAssociations",
                             DataAssociations.Select(da => da.ToXml())),
                new XElement("DataScopes",
                             DataScopes.Select(dsi => new XElement("DataScopeIdentifier", new XAttribute("name", dsi)))),
                new XElement("KeyPropertyNames",
                             KeyPropertyNames.Select(name => new XElement("KeyPropertyName", new XAttribute("name", name)))),
                VersionKeyPropertyNames.Any()
                    ? new XElement("VersionKeyPropertyNames",
                                   VersionKeyPropertyNames.Select(name => new XElement("VersionKeyPropertyName", new XAttribute("name", name))))
                    : null,
                new XElement("SuperInterfaces",
                             SuperInterfaces.Select(su => new XElement("SuperInterface", new XAttribute("type", TypeManager.SerializeType(su))))),
                new XElement("Fields", Fields.Select(f => f.ToXml()))
            });

            if (Indexes.Any())
            {
                element.Add(new XElement("Indexes", Indexes.Select(i => i.ToXml())));
            }

            return(element);
        }
Example #7
0
 private void Awake()
 {
     instance = this;
 }
 void UpdateEquippedRenewable(InventoryData inventory)
 {
     activeRenewableImage.sprite = DataAssociations.GetRenewableTypeBubImage(inventory.EquippedRenewable);
 }