Example #1
0
 public BuffIcon(BuffIconType type, ushort graphic, long timer, string text)
 {
     Type    = type;
     Graphic = graphic;
     Timer   = (timer <= 0 ? 0xFFFF_FFFF : Time.Ticks + timer * 1000);
     Text    = text;
 }
Example #2
0
 public BuffIcon(BuffIconType type, ushort graphic, long timer, string text)
 {
     Type    = type;
     Graphic = graphic;
     Timer   = timer;
     Text    = text;
 }
Example #3
0
    IEnumerator BuffIconCoroutine(BuffIconType type)
    {
        if (type == BuffIconType.None)
        {
            yield break;
        }

        GameObject buffItem = Instantiate(m_buffItem, m_buffParent);

        buffItem.name = m_buffItem.name;

        Image iconImage = buffItem.GetComponent <Image>();

        if (iconImage == null)
        {
            yield break;
        }
        iconImage.sprite = m_buffIcons[(int)type];

        yield return(new WaitForSeconds(10f));

        iconImage.sprite = null;
        Destroy(buffItem);

        yield return(null);
    }
Example #4
0
    public override void BuffIn(BuffType buffType, Stat.Element element = Stat.Element.None)
    {
        BuffIconType iconType = BuffIconType.None;

        switch (buffType)
        {
        case BuffType.Element:
        {
            if (element == Stat.Element.None)
            {
                return;
            }

            switch (element)
            {
            case Stat.Element.Fire:
                iconType = BuffIconType.Fire;
                break;

            case Stat.Element.Ice:
                iconType = BuffIconType.Ice;
                break;

            case Stat.Element.Thunder:
                iconType = BuffIconType.Thunder;
                break;
            }
        }
        break;

        case BuffType.Strength:
            iconType = BuffIconType.Strength;
            break;

        case BuffType.Guard:
            iconType = BuffIconType.Guard;
            break;

        case BuffType.Speed:
            iconType = BuffIconType.Speed;
            break;
        }

        StartCoroutine(BuffIconCoroutine(iconType));
    }
Example #5
0
        public void RemoveBuff(BuffIconType type)
        {
            foreach (BuffControlEntry entry in Children.OfType <BuffControlEntry>()
                     .Where(s => s.Icon.Type == type))
            {
                if (Height > _background.Height)
                {
                    int delta = Height - _background.Height;

                    if (_direction == GumpDirection.RIGHT_VERTICAL)
                    {
                        Y             += delta;
                        Height        -= delta;
                        _background.Y -= delta;
                        _button.Y     -= delta;
                    }
                    else if (_direction == GumpDirection.LEFT_VERTICAL)
                    {
                        Height -= delta;
                    }
                }

                if (Width > _background.Width)
                {
                    int delta = Width - _background.Width;

                    if (_direction == GumpDirection.RIGHT_HORIZONTAL)
                    {
                        X             += delta;
                        Width         -= delta;
                        _background.X -= delta;
                        _button.X     -= delta;
                    }
                    else if (_direction == GumpDirection.LEFT_HORIZONTAL)
                    {
                        Width -= delta;
                    }
                }

                entry.Dispose();
            }

            UpdateElements();
        }
Example #6
0
 public void AddBuff(BuffIconType type)
 {
     Add(new BuffControlEntry(World.Player.BuffIcons[type]));
     UpdateElements();
 }