コード例 #1
0
ファイル: SpellIcon.cs プロジェクト: weedindeed/EndlessClient
		public SpellIcon(ActiveSpells parent, SpellRecord data, int slot)
			: base(parent, slot)
		{
			_spellData = data;
			_spellGraphic = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.SpellIcons, _spellData.Icon);
			_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)});
			OnLevelChanged();

			_clickTime = DateTime.Now;
		}
コード例 #2
0
		private void _beginSpellCast(SpellRecord spell)
		{
			if (Character.SelectedSpell <= 0)
				throw new InvalidOperationException("You must have a selected spell before casting (race condition?");

			var castTime = (int)(Math.Round(spell.CastTime / 2.0 * 950)); //this probably needs different math
			_spellCastTimer.Change(castTime, Timeout.Infinite);
		}
コード例 #3
0
		private bool _addNewSpellToSlot(int slot, SpellRecord data, short level)
		{
			var emptySpellInDestinationSlot = _childItems.Single(x => x.Slot == slot);
			if (slot < 0 || !(emptySpellInDestinationSlot is EmptySpellIcon))
				return false;

			_setSpellSlotInRegistry(slot, data.ID);
			_childItems.Remove(emptySpellInDestinationSlot);
			((XNAControl)emptySpellInDestinationSlot).SetParent(null);
			((XNAControl)emptySpellInDestinationSlot).Close();

			var newSpell = new SpellIcon(this, data, slot) {Level = level};

			var displaySlot = GetDisplaySlotFromSlot(slot);
			newSpell.SetDisplaySlot(displaySlot);

			var scrollOffset = _scroll == null ? 0 : _scroll.ScrollOffset;
			newSpell.Visible = displaySlot >= scrollOffset*SPELL_ROW_LENGTH &&
			                   displaySlot < scrollOffset*SPELL_ROW_LENGTH + 2*SPELL_ROW_LENGTH;

			_childItems.Add(newSpell);

			return true;
		}