private void upgradeSpell_click(object sender, MouseEventArgs e)
 {
     character.upgradeSpell(spell);
     Visible = false;
     gameNetworkManager.enqueueMsg(NetworkMsgPrefix.LevelUpSpell, GameNetworkUtilities.serializeSpellAction(spell, character.CurrentTile));
     shop.SpellShopView.ShowSpells(manager.SelectedTile.CurrentCharacter);
     if (!isNewSpell)
     {
         SoundManager.PlaySound("upgradeSpell.wav");
         Visible = false;
     }
 }
 private void buySkill_click(object sender, MouseEventArgs e)
 {
     if (manager.Player.Gold < SPELL_PRICE)
     {
         return;
     }
     SoundManager.PlaySound("learnSpell.wav");
     manager.Player.Gold -= SPELL_PRICE;
     character.learnSpell(spell);
     Visible = false;
     gameNetworkManager.enqueueMsg(NetworkMsgPrefix.LearnSpell, GameNetworkUtilities.serializeSpellAction(spell, character.CurrentTile));
     shop.SpellShopView.ShowSpells(manager.SelectedTile.CurrentCharacter);
     character.ChooseSpell.refreshPanel(character, character.ActiveSpells);
     character.InactiveSpell.refreshPanel(character.InactiveSpells);
 }
 private MouseEventHandler mouseEvent(List <Spells[]> spells, int k, PictureBox pic)
 {
     return((sender, e) =>
     {
         int charIndex = character.gameManager.TeamBlue.IndexOf(character);
         Spells[] currentSpell = spells[k];
         if (character.ActiveSpells.Count == 0)
         {
             character.DefaultSkill = currentSpell;
             gameNetworkManager.enqueueMsg(NetworkMsgPrefix.DefaultSkill, GameNetworkUtilities.serializeSpellActionMoving(currentSpell, charIndex));
         }
         character.ActiveSpells.Add(currentSpell);
         gameNetworkManager.enqueueMsg(NetworkMsgPrefix.AddActiveSpells, GameNetworkUtilities.serializeSpellAction(currentSpell, character.CurrentTile));
         character.InactiveSpells.Remove(currentSpell);
         refreshPanel(character.InactiveSpells);
         character.ChooseSpell.refreshPanel(character, character.ActiveSpells);
     });
 }
Exemplo n.º 4
0
 private MouseEventHandler mouseEvent(List <Spells[]> actives, int k)
 {
     return((sender, e) =>
     {
         int charIndex = character.gameManager.TeamBlue.IndexOf(character);
         Spells[] currentSpell = actives[k];
         if (character.gameManager.CurrentGameStage == StageManager.GameStage.Buy && e.Button == MouseButtons.Right)
         {
             character.InactiveSpells.Add(currentSpell);
             character.ActiveSpells.Remove(currentSpell);
             gameNetworkManager.enqueueMsg(NetworkMsgPrefix.RemActiveSpells, GameNetworkUtilities.serializeSpellAction(currentSpell, character.CurrentTile));
             refreshPanel(character, character.ActiveSpells);
             character.InactiveSpell.refreshPanel(character.InactiveSpells);
         }
         if (e.Button == MouseButtons.Left)
         {
             if (character.gameManager.CurrentGameStage == StageManager.GameStage.Fight && character.Stats[StatusType.Charge] == character.Stats[StatusType.ChargeMax])
             {
                 character.gameManager.removeRangeFromForm(this);
                 character.SpellReady = false;
                 character.resetMana();
                 currentSpell[character.SpellLevel[currentSpell]].castSpell(character);
             }
             if (character.Stats[StatusType.Charge] / character.Stats[StatusType.ChargeMax] < 0.9)
             {
                 character.DefaultSkill = currentSpell;
                 gameNetworkManager.enqueueMsg(NetworkMsgPrefix.DefaultSkill, GameNetworkUtilities.serializeSpellActionMoving(currentSpell, charIndex));
                 //gameNetworkManager.enqueueMsg(NetworkMsgPrefix.DefaultSkill, GameNetworkUtilities.serializeSpellAction(currentSpell,character.CurrentTile));
                 spellSwap(k);
                 gameNetworkManager.enqueueMsg(NetworkMsgPrefix.ExchActiveSpells, GameNetworkUtilities.serializeSpellSwap(k, charIndex));
                 if (character.gameManager.CurrentGameStage == StageManager.GameStage.Fight && e.Button == MouseButtons.Left)
                 {
                     character.hideChooseSpellUI();
                 }
                 refreshPanel(character, character.ActiveSpells);
             }
         }
     });
 }