public void SetActive(UniquePowerModifierData uniquePowerModifierData)
    {
        // save UPM data
        this.uniquePowerModifierData = uniquePowerModifierData;
        // update current duration left value
        UpdateDurationLeftText();
        // get UPM UI config
        UniquePowerModifierConfig uniquePowerModifierConfig = uniquePowerModifierData.GetUniquePowerModifierConfig();

        // update text button colors
        textButton.NormalColor      = uniquePowerModifierConfig.UniquePowerModifierStausIconUIConfig.statusIconTextNormalColor;
        textButton.HighlightedColor = uniquePowerModifierConfig.UniquePowerModifierStausIconUIConfig.statusIconTextHighlightedColor;
        textButton.PressedColor     = uniquePowerModifierConfig.UniquePowerModifierStausIconUIConfig.statusIconTextPressedColor;
        textButton.DisabledColor    = uniquePowerModifierConfig.UniquePowerModifierStausIconUIConfig.statusIconTextDisabledColor;
        // update text current color
        symbolText.color = textButton.NormalColor;
        // update text symbol
        symbolText.text = uniquePowerModifierConfig.UniquePowerModifierStausIconUIConfig.symbol;
        // update background image color
        backgroundImage.color = uniquePowerModifierConfig.UniquePowerModifierStausIconUIConfig.statusIconBackgroundColor;
        // activate game object
        gameObject.SetActive(true);
        // Start animation
        CoroutineQueueManager.Run(FadeBackground());
    }
Beispiel #2
0
 public void OnUniquePowerModifierDataHasBeenAdded(PartyUnit partyUnit)
 {
     // verify if this is the same party unit
     if (partyUnit == LPartyUnit)
     {
         Debug.Log("Add new UPM");
         // get added UPM (get last UPM from the list)
         UniquePowerModifierData uniquePowerModifierData = partyUnit.AppliedUniquePowerModifiersData[partyUnit.AppliedUniquePowerModifiersData.Count - 1];
         // verify if UPM has status icon config
         if (!(uniquePowerModifierData.GetUniquePowerModifierConfig().UniquePowerModifierStausIconUIConfig is UniquePowerModifierStatusIconNoneUIConfig))
         {
             // init parent transform
             Transform upmStatusIconParent;
             // get upm alignment
             UniquePowerModifierAlignment uniquePowerModifierAlignment = uniquePowerModifierData.GetUniquePowerModifierConfig().UniquePowerModifierStausIconUIConfig.uniquePowerModifierAlignment;
             // verify if UPM is buff or debuff
             if (uniquePowerModifierAlignment == UniquePowerModifierAlignment.Left)
             {
                 upmStatusIconParent = upmBuffsParentTranform;
             }
             else if (uniquePowerModifierAlignment == UniquePowerModifierAlignment.Right)
             {
                 upmStatusIconParent = upmDebuffsParentTranform;
             }
             else if (uniquePowerModifierAlignment == UniquePowerModifierAlignment.None)
             {
                 upmStatusIconParent = upmBuffsParentTranform;
                 Debug.LogWarning("UPM Status Icon UI Config should have alignment set. Falling back to positive alignment");
             }
             else
             {
                 Debug.LogError("Unhandled condition");
                 // exit without creating UPM status icon
                 return;
             }
             // create UI for added UPM based on UPM config
             UniquePowerModifierStatusIcon uniquePowerModifierStatusIcon = Instantiate(uniquePowerModifierStatusIconTemplate.gameObject, upmStatusIconParent).GetComponent <UniquePowerModifierStatusIcon>();
             // activate new UPM
             uniquePowerModifierStatusIcon.SetActive(uniquePowerModifierData);
         }
     }
 }
    //public override void Apply(InventoryItem inventoryItem, PartyUnit dstPartyUnit, UniquePowerModifierConfig uniquePowerModifierConfig, UniquePowerModifierID uniquePowerModifierID)
    //{
    //    throw new System.NotImplementedException();
    //}

    void ValidateTriggerCondition(UniquePowerModifierData uniquePowerModifierData)
    {
        // get unique power modifier config
        UniquePowerModifierConfig uniquePowerModifierConfig = uniquePowerModifierData.GetUniquePowerModifierConfig();

        // validate if condition has been configured correctly
        if (uniquePowerModifierConfig.TriggerCondition != TriggerCondition.NonePassive)
        {
            Debug.LogWarning("Trigger condition should be set to None Passive for this UPM");
        }
    }
    public UniquePowerModifierInfoData GetInfo()
    {
        UniquePowerModifierConfig uniquePowerModifierConfig = uniquePowerModifierData.GetUniquePowerModifierConfig();

        return(new UniquePowerModifierInfoData
        {
            name = uniquePowerModifierConfig.DisplayName,
            description = uniquePowerModifierConfig.Description,
            additionalInfo = new string[] {
                "Power: " + Math.Abs(uniquePowerModifierData.CurrentPower),
                "Duration: " + uniquePowerModifierData.DurationLeft + "/" + uniquePowerModifierConfig.UpmDurationMax,
                "Origin: " + uniquePowerModifierData.GetOriginDisplayName() + " " + uniquePowerModifierData.UniquePowerModifierID.modifierOrigin
            }
        });
    }