コード例 #1
0
 private void CombatantList_DoubleClick(object sender, EventArgs e)
 {
     if (this.SelectedCombatantGroup != null)
     {
         int           initBonus     = 0;
         CombatData    item          = this.SelectedCombatantGroup[0];
         EncounterSlot encounterSlot = this.fEncounter.FindSlot(item);
         if (encounterSlot == null)
         {
             Hero hero = Session.Project.FindHero(item.ID);
             if (hero != null)
             {
                 initBonus = hero.InitBonus;
             }
             Trap trap = this.fEncounter.FindTrap(item.ID);
             if (trap != null)
             {
                 initBonus = trap.Initiative;
             }
         }
         else
         {
             initBonus = encounterSlot.Card.Initiative;
         }
         InitiativeForm initiativeForm = new InitiativeForm(initBonus, item.Initiative);
         if (initiativeForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             foreach (CombatData selectedCombatantGroup in this.SelectedCombatantGroup)
             {
                 selectedCombatantGroup.Initiative = initiativeForm.Score;
             }
             this.update_list();
         }
     }
 }
コード例 #2
0
        private void CombatantList_DoubleClick(object sender, EventArgs e)
        {
            if (SelectedCombatantGroup != null)
            {
                int bonus = 0;

                CombatData    cd   = SelectedCombatantGroup[0];
                EncounterSlot slot = fEncounter.FindSlot(cd);
                if (slot != null)
                {
                    bonus = slot.Card.Initiative;
                }
                else
                {
                    // Hero or trap

                    Hero hero = Session.Project.FindHero(cd.ID);
                    if (hero != null)
                    {
                        bonus = hero.InitBonus;
                    }

                    Trap trap = fEncounter.FindTrap(cd.ID);
                    if (trap != null)
                    {
                        bonus = trap.Initiative;
                    }
                }

                InitiativeForm dlg = new InitiativeForm(bonus, cd.Initiative);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    foreach (CombatData data in SelectedCombatantGroup)
                    {
                        data.Initiative = dlg.Score;
                    }

                    update_list();
                }
            }
        }