Esempio n. 1
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();
    }
    public void DrawEvents()
    {
        RnMUI_SpellSlot mSlot = target as RnMUI_SpellSlot;

        EditorGUIUtility.labelWidth = 100f;

        NGUIEditorTools.DrawEvents("On Assign", mSlot, mSlot.onAssign);
        NGUIEditorTools.DrawEvents("On Unassign", mSlot, mSlot.onUnassign);
    }
Esempio n. 3
0
    /// <summary>
    /// Assign the slot by the passed source slot.
    /// </summary>
    /// <param name="source">Source.</param>
    public override bool Assign(Object source)
    {
        if (source is RnMUI_SpellSlot)
        {
            RnMUI_SpellSlot sourceSlot = source as RnMUI_SpellSlot;

            if (sourceSlot != null)
            {
                return(this.Assign(sourceSlot.GetSpellInfo()));
            }
        }

        // Default
        return(false);
    }
Esempio n. 4
0
    void Start()
    {
        if (this.slot == null)
        {
            this.slot = this.GetComponent <RnMUI_SpellSlot>();
        }

        if (this.slot == null || this.spellDatabase == null)
        {
            this.Destruct();
            return;
        }

        this.slot.Assign(this.spellDatabase.GetByID(this.assignSpell));
        this.Destruct();
    }
Esempio 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);
    }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        EditorGUIUtility.labelWidth = 120f;
        RnMUI_SpellSlot mSlot = target as RnMUI_SpellSlot;

        EditorGUILayout.Space();

        RnMUI_SlotCooldown cooldown = EditorGUILayout.ObjectField("Cooldown Handle", mSlot.cooldownHandle, typeof(RnMUI_SlotCooldown), true) as RnMUI_SlotCooldown;

        if (mSlot.cooldownHandle != cooldown)
        {
            mSlot.cooldownHandle = cooldown;
        }

        DrawEvents();
    }
Esempio n. 7
0
 /// <summary>
 /// Executes the on assign event listener.
 /// </summary>
 protected virtual void ExecuteOnAssign()
 {
     current = this;
     EventDelegate.Execute(this.onAssign);
     current = null;
 }