public override void OnHtmlInputEvent(string href, MouseEvent e)
 {
     if (e == MouseEvent.Click)
     {
         string[] hrefs = href.Split('=');
         if (hrefs.Length != 2)
         {
             return;
         }
         if (hrefs[0] == "page")
         {
             int page;
             if (int.TryParse(hrefs[1], out page))
             {
                 SetActivePage(page);
             }
         }
         else if (hrefs[0] == "spell")
         {
             int spell;
             if (int.TryParse(hrefs[1], out spell))
             {
                 m_World.Interaction.CastSpell(spell);
             }
         }
         else if (hrefs[0] == "spellicon")
         {
             int spell;
             if (int.TryParse(hrefs[1], out spell))
             {
                 m_World.Interaction.CastSpell(spell);
             }
         }
     }
     else if (e == MouseEvent.DragBegin)
     {
         string[] hrefs = href.Split('=');
         if (hrefs.Length != 2)
         {
             return;
         }
         if (hrefs[0] == "spellicon")
         {
             int spellIndex;
             if (!int.TryParse(hrefs[1], out spellIndex))
             {
                 return;
             }
             SpellDefinition spell = Magery.GetSpell(spellIndex);
             if (spell.ID == spellIndex)
             {
                 InputManager       input = ServiceRegistry.GetService <InputManager>();
                 UseSpellButtonGump gump  = new UseSpellButtonGump(spell);
                 UserInterface.AddControl(gump, input.MousePosition.X - 22, input.MousePosition.Y - 22);
                 UserInterface.AttemptDragControl(gump, input.MousePosition, true);
             }
         }
     }
 }
Beispiel #2
0
 private void OnSpellDrag(string href)
 {
     string[] hrefs = href.Split('=');
     if (hrefs.Length != 2)
     {
         return;
     }
     if (hrefs[0] == "spellicon")
     {
         int spellIndex;
         if (!int.TryParse(hrefs[1], out spellIndex))
         {
             return;
         }
         SpellDefinition    spell = Magery.Spells[spellIndex];
         InputManager       input = ServiceRegistry.GetService <InputManager>();
         UseSpellButtonGump gump  = new UseSpellButtonGump(spell);
         UserInterface.AddControl(gump, input.MousePosition.X - 22, input.MousePosition.Y - 22);
         UserInterface.AttemptDragControl(gump, input.MousePosition, true);
     }
 }
Beispiel #3
0
 public override void OnHtmlInputEvent(string href, MouseEvent e)
 {
     if (e == MouseEvent.DoubleClick)
     {
             string[] hrefs = href.Split('=');
             if (hrefs.Length != 2)
                 return;
             else if (hrefs[0] == "page")
             {
                 int page;
                 if (int.TryParse(hrefs[1], out page))
                     m_World.Interaction.CastSpell(page-4);
             }
             else if (hrefs[0] == "spell")
             {
                 int spell;
                 if (int.TryParse(hrefs[1], out spell))
                     m_World.Interaction.CastSpell(spell);
             }
             else if (hrefs[0] == "spellicon")
             {
                 int spell;
                 if (int.TryParse(hrefs[1], out spell))
                     m_World.Interaction.CastSpell(spell);
             }
     }
     else if (e == MouseEvent.Click)
     {
         string[] hrefs = href.Split('=');
         if (hrefs.Length != 2)
             return;
         if (hrefs[0] == "page")
         {
             int page;
             if (int.TryParse(hrefs[1], out page))
                 SetActivePage(page);
         }
     }
     else if (e == MouseEvent.DragBegin)
     {
         string[] hrefs = href.Split('=');
         if (hrefs.Length != 2)
             return;
         if (hrefs[0] == "spellicon")
         {
             int spellIndex;
             if (!int.TryParse(hrefs[1], out spellIndex))
                 return;
             SpellDefinition spell = Magery.GetSpell(spellIndex);
             if (spell.ID == spellIndex)
             {
                 InputManager input = ServiceRegistry.GetService<InputManager>();
                 UseSpellButtonGump gump = new UseSpellButtonGump(spell);
                 UserInterface.AddControl(gump, input.MousePosition.X - 22, input.MousePosition.Y - 22);
                 UserInterface.AttemptDragControl(gump, input.MousePosition, true);
             }
         }
     }
 }
 private void OnSpellDrag(string href)
 {
     string[] hrefs = href.Split('=');
     if (hrefs.Length != 2)
         return;
     if (hrefs[0] == "spellicon")
     {
         int spellIndex;
         if (!int.TryParse(hrefs[1], out spellIndex))
             return;
         SpellDefinition spell = Magery.Spells[spellIndex];
         InputManager input = ServiceRegistry.GetService<InputManager>();
         UseSpellButtonGump gump = new UseSpellButtonGump(spell);
         UserInterface.AddControl(gump, input.MousePosition.X - 22, input.MousePosition.Y - 22);
         UserInterface.AttemptDragControl(gump, input.MousePosition, true);
     }
 }