Ejemplo n.º 1
0
    /// <summary>
    /// Assign the slot by spell info.
    /// </summary>
    /// <param name="spellInfo">Spell info.</param>
    public bool Assign(UISpellInfo spellInfo)
    {
        if (spellInfo == null)
        {
            return(false);
        }

        // Use the base class assign
        if (this.Assign(spellInfo.Icon))
        {
            // Set the spell info
            this.spellInfo = spellInfo;

            // Check if we have a cooldown handler
            if (this.cooldownHandle != null)
            {
                this.cooldownHandle.OnAssignSpell(spellInfo);
            }

            // Execute the assign event listener
            this.ExecuteOnAssign();

            // Success
            return(true);
        }

        return(false);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Raises the assign spell event.
    /// </summary>
    /// <param name="spellInfo">Spell info.</param>
    public void OnAssignSpell(UISpellInfo spellInfo)
    {
        // Save the spell info, very importatnt to be set before anything else
        this.currentSpellInfo = spellInfo;

        // Check if this spell still has cooldown
        if (spellCooldowns.ContainsKey(spellInfo.ID))
        {
            float cooldownTill = spellCooldowns[spellInfo.ID];

            // Check if the cooldown isnt expired
            if (cooldownTill > Time.time)
            {
                float remainingTime = cooldownTill - Time.time;

                // Start the remaing cooldown
                this.StartCooldown(remainingTime);
            }
            else
            {
                // Cooldown already expired, remove the record
                spellCooldowns.Remove(spellInfo.ID);
            }
        }
    }
Ejemplo n.º 3
0
    public void OnAssign()
    {
        RnMUI_SpellSlot slot = RnMUI_SpellSlot.current;

        if (slot != null)
        {
            UISpellInfo info = slot.GetSpellInfo();

            if (info != null)
            {
                if (this.rankLabel != null)
                {
                    this.rankLabel.text = Random.Range(1, 5).ToString();
                }

                if (this.nameLabel != null)
                {
                    this.nameLabel.text = info.Name;
                }

                if (this.descriptionLabel != null)
                {
                    this.descriptionLabel.text = info.Description;
                }
            }
        }

        this.OnSizeChange();
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Unassign this slot.
    /// </summary>
    public override void Unassign()
    {
        // Remove the icon
        base.Unassign();

        // Clear the talent info
        this.talentInfo = null;

        // Clear the spell info
        this.spellInfo = null;
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Performs a slot swap.
    /// </summary>
    /// <param name="targetObject">Target slot.</param>
    public override bool PerformSlotSwap(Object targetObject)
    {
        // Get the source slot
        RnMUI_SpellSlot targetSlot = (targetObject as RnMUI_SpellSlot);

        // Get the target slot icon
        UISpellInfo targetSpellInfo = targetSlot.GetSpellInfo();

        // Assign the target slot with this one
        bool assign1 = targetSlot.Assign(this);

        // Assign this slot by the target slot spell info
        bool assign2 = this.Assign(targetSpellInfo);

        // Return the status
        return(assign1 && assign2);
    }
Ejemplo n.º 6
0
    /// <summary>
    /// Unassign this slot.
    /// </summary>
    public override void Unassign()
    {
        // Remove the icon
        base.Unassign();

        // Clear the spell info
        this.spellInfo = null;

        // Check if we have a cooldown handler
        if (this.cooldownHandle != null)
        {
            this.cooldownHandle.OnUnassign();
        }

        // Execute the unassign event listener
        this.ExecuteOnUnassign();
    }
Ejemplo n.º 7
0
    /// <summary>
    /// Assign the specified slot by talentInfo and spellInfo.
    /// </summary>
    /// <param name="talentInfo">Talent info.</param>
    /// <param name="spellInfo">Spell info.</param>
    public bool Assign(UITalentInfo talentInfo, UISpellInfo spellInfo)
    {
        if (talentInfo == null || spellInfo == null)
        {
            return(false);
        }

        // Use the base class to assign the icon
        base.Assign(spellInfo.Icon);

        // Set the talent info
        this.talentInfo = talentInfo;

        // Set the spell info
        this.spellInfo = spellInfo;

        // Update the points label
        this.UpdatePointsLabel();

        // Return success
        return(true);
    }
Ejemplo n.º 8
0
    /// <summary>
    /// Raises the unassign event.
    /// </summary>
    public void OnUnassign()
    {
        this.InterruptCooldown();

        this.currentSpellInfo = null;
    }