Skip to content

Commit

Permalink
Move Spell Icon stuff to Old namespace. Prep for rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Apr 12, 2022
1 parent 6f6a54f commit 8141961
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion EndlessClient/HUD/Panels/Old/OldActiveSpellsPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using EndlessClient.Dialogs;
using EndlessClient.HUD.Spells;
using EndlessClient.HUD.Spells.Old;
using EndlessClient.Old;
using EndlessClient.UIControls;
using EOLib;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Microsoft.Xna.Framework.Input;
using XNAControls.Old;

namespace EndlessClient.HUD.Spells
namespace EndlessClient.HUD.Spells.Old
{
public class EmptySpellIcon : XNAControl, ISpellIcon
{
Expand All @@ -32,7 +32,7 @@ public virtual bool Selected
{
if (value)
{
((EOGame) Game).Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_WARNING, EOResourceID.SPELL_NOTHING_WAS_SELECTED);
((EOGame)Game).Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_WARNING, EOResourceID.SPELL_NOTHING_WAS_SELECTED);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using EOLib.IO.Pub;

namespace EndlessClient.HUD.Spells
namespace EndlessClient.HUD.Spells.Old
{
public interface ISpellIcon
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace EndlessClient.HUD.Spells
namespace EndlessClient.HUD.Spells.Old
{
public class SpellIcon : EmptySpellIcon
{
Expand Down Expand Up @@ -61,7 +61,7 @@ public SpellIcon(OldActiveSpells parent, ESFRecord data, int slot)
_spellGraphicSourceRect = new Rectangle(0, 0, _spellGraphic.Width / 2, _spellGraphic.Height);

_spellLevelColor = new Texture2D(Game.GraphicsDevice, 1, 1);
_spellLevelColor.SetData(new[] {Color.FromNonPremultiplied(0xc9, 0xb8, 0x9b, 0xff)});
_spellLevelColor.SetData(new[] { Color.FromNonPremultiplied(0xc9, 0xb8, 0x9b, 0xff) });
OnLevelChanged();

_clickTime = DateTime.Now;
Expand Down Expand Up @@ -99,14 +99,14 @@ protected override void OnSlotChanged()

private void OnSelected()
{
var hud = ((EOGame) Game).Hud;
var hud = ((EOGame)Game).Hud;
switch (SpellData.Target)
{
case SpellTarget.Normal:
hud.SetStatusLabel(EOResourceID.SKILLMASTER_WORD_SPELL, SpellData.Name, EOResourceID.SPELL_WAS_SELECTED);
break;
case SpellTarget.Group:
if(!hud.MainPlayerIsInParty())
if (!hud.MainPlayerIsInParty())
hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_WARNING, EOResourceID.SPELL_ONLY_WORKS_ON_GROUP);
break;
}
Expand All @@ -126,13 +126,13 @@ private void UpdateIconSourceRect()
{
SetIconHover(MouseOver);
if (MouseOver && !_parentSpellContainer.AnySpellsDragging())
((EOGame) Game).Hud.SetStatusLabel(EOResourceID.SKILLMASTER_WORD_SPELL, SpellData.Name);
((EOGame)Game).Hud.SetStatusLabel(EOResourceID.SKILLMASTER_WORD_SPELL, SpellData.Name);
}
}

private void SetIconHover(bool hover)
{
var halfWidth = _spellGraphic.Width/2;
var halfWidth = _spellGraphic.Width / 2;
_spellGraphicSourceRect = new Rectangle(hover ? halfWidth : 0, 0, halfWidth, _spellGraphic.Height);
}

Expand Down Expand Up @@ -226,7 +226,7 @@ private void DrawSpellIcon()
alphaColor = Color.FromNonPremultiplied(255, 255, 255, 128);
}

if (targetDrawArea.Width*targetDrawArea.Height == 0)
if (targetDrawArea.Width * targetDrawArea.Height == 0)
return;

SpriteBatch.Draw(_spellGraphic, targetDrawArea, _spellGraphicSourceRect, alphaColor);
Expand Down

0 comments on commit 8141961

Please sign in to comment.