Esempio n. 1
0
        private void ItemList_DoubleClick(object sender, EventArgs e)
        {
            switch (fType)
            {
            case OverviewType.Encounters:
            {
                if (SelectedEncounter != null)
                {
                    int level = Workspace.GetPartyLevel(SelectedEncounter.First);

                    EncounterBuilderForm dlg = new EncounterBuilderForm(SelectedEncounter.Second, level, false);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        SelectedEncounter.First.Element = dlg.Encounter;
                        Session.Modified = true;

                        update_list();
                    }

                    return;
                }
            }
            break;

            case OverviewType.Traps:
            {
                if (SelectedTrap != null)
                {
                    if (SelectedTrap.First.Element is TrapElement)
                    {
                        TrapElement te = SelectedTrap.First.Element as TrapElement;

                        TrapBuilderForm dlg = new TrapBuilderForm(SelectedTrap.Second);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            te.Trap          = dlg.Trap;
                            Session.Modified = true;

                            update_list();
                        }

                        return;
                    }

                    if (SelectedTrap.First.Element is Encounter)
                    {
                        Encounter enc   = SelectedTrap.First.Element as Encounter;
                        int       index = enc.Traps.IndexOf(SelectedTrap.Second);

                        TrapBuilderForm dlg = new TrapBuilderForm(SelectedTrap.Second);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            enc.Traps[index] = dlg.Trap;
                            Session.Modified = true;

                            update_list();
                        }

                        return;
                    }
                }
            }
            break;

            case OverviewType.SkillChallenges:
            {
                if (SelectedChallenge != null)
                {
                    if (SelectedChallenge.First.Element is SkillChallenge)
                    {
                        SkillChallenge sc = SelectedChallenge.First.Element as SkillChallenge;

                        SkillChallengeBuilderForm dlg = new SkillChallengeBuilderForm(SelectedChallenge.Second);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            sc.Name       = dlg.SkillChallenge.Name;
                            sc.Level      = dlg.SkillChallenge.Level;
                            sc.Complexity = dlg.SkillChallenge.Complexity;
                            sc.Success    = dlg.SkillChallenge.Success;
                            sc.Failure    = dlg.SkillChallenge.Failure;

                            sc.Skills.Clear();
                            foreach (SkillChallengeData scd in dlg.SkillChallenge.Skills)
                            {
                                sc.Skills.Add(scd.Copy());
                            }

                            Session.Modified = true;

                            update_list();
                        }

                        return;
                    }

                    if (SelectedChallenge.First.Element is Encounter)
                    {
                        Encounter enc   = SelectedChallenge.First.Element as Encounter;
                        int       index = enc.SkillChallenges.IndexOf(SelectedChallenge.Second);

                        SkillChallengeBuilderForm dlg = new SkillChallengeBuilderForm(SelectedChallenge.Second);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            enc.SkillChallenges[index] = dlg.SkillChallenge;
                            Session.Modified           = true;

                            update_list();
                        }

                        return;
                    }
                }
            }
            break;

            case OverviewType.Treasure:
            {
                if (SelectedParcel != null)
                {
                    int index = SelectedParcel.First.Parcels.IndexOf(SelectedParcel.Second);

                    ParcelForm dlg = new ParcelForm(SelectedParcel.Second);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        SelectedParcel.First.Parcels[index] = dlg.Parcel;
                        Session.Modified = true;

                        update_list();
                    }

                    return;
                }
            }
            break;
            }
        }
Esempio n. 2
0
        private void ItemList_DoubleClick(object sender, EventArgs e)
        {
            switch (this.fType)
            {
            case OverviewType.Encounters:
            {
                if (this.SelectedEncounter == null)
                {
                    break;
                }
                int partyLevel = Workspace.GetPartyLevel(this.SelectedEncounter.First);
                EncounterBuilderForm encounterBuilderForm = new EncounterBuilderForm(this.SelectedEncounter.Second, partyLevel, false);
                if (encounterBuilderForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    this.SelectedEncounter.First.Element = encounterBuilderForm.Encounter;
                    Session.Modified = true;
                    this.update_list();
                }
                return;
            }

            case OverviewType.Traps:
            {
                if (this.SelectedTrap == null)
                {
                    break;
                }
                if (this.SelectedTrap.First.Element is TrapElement)
                {
                    TrapElement     element         = this.SelectedTrap.First.Element as TrapElement;
                    TrapBuilderForm trapBuilderForm = new TrapBuilderForm(this.SelectedTrap.Second);
                    if (trapBuilderForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        element.Trap     = trapBuilderForm.Trap;
                        Session.Modified = true;
                        this.update_list();
                    }
                    return;
                }
                if (!(this.SelectedTrap.First.Element is Encounter))
                {
                    break;
                }
                Encounter       trap             = this.SelectedTrap.First.Element as Encounter;
                int             num              = trap.Traps.IndexOf(this.SelectedTrap.Second);
                TrapBuilderForm trapBuilderForm1 = new TrapBuilderForm(this.SelectedTrap.Second);
                if (trapBuilderForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    trap.Traps[num]  = trapBuilderForm1.Trap;
                    Session.Modified = true;
                    this.update_list();
                }
                return;
            }

            case OverviewType.SkillChallenges:
            {
                if (this.SelectedChallenge == null)
                {
                    break;
                }
                if (this.SelectedChallenge.First.Element is SkillChallenge)
                {
                    SkillChallenge            name = this.SelectedChallenge.First.Element as SkillChallenge;
                    SkillChallengeBuilderForm skillChallengeBuilderForm = new SkillChallengeBuilderForm(this.SelectedChallenge.Second);
                    if (skillChallengeBuilderForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        name.Name       = skillChallengeBuilderForm.SkillChallenge.Name;
                        name.Level      = skillChallengeBuilderForm.SkillChallenge.Level;
                        name.Complexity = skillChallengeBuilderForm.SkillChallenge.Complexity;
                        name.Success    = skillChallengeBuilderForm.SkillChallenge.Success;
                        name.Failure    = skillChallengeBuilderForm.SkillChallenge.Failure;
                        name.Skills.Clear();
                        foreach (SkillChallengeData skill in skillChallengeBuilderForm.SkillChallenge.Skills)
                        {
                            name.Skills.Add(skill.Copy());
                        }
                        Session.Modified = true;
                        this.update_list();
                    }
                    return;
                }
                if (!(this.SelectedChallenge.First.Element is Encounter))
                {
                    break;
                }
                Encounter skillChallenge = this.SelectedChallenge.First.Element as Encounter;
                int       num1           = skillChallenge.SkillChallenges.IndexOf(this.SelectedChallenge.Second);
                SkillChallengeBuilderForm skillChallengeBuilderForm1 = new SkillChallengeBuilderForm(this.SelectedChallenge.Second);
                if (skillChallengeBuilderForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    skillChallenge.SkillChallenges[num1] = skillChallengeBuilderForm1.SkillChallenge;
                    Session.Modified = true;
                    this.update_list();
                }
                return;
            }

            case OverviewType.Treasure:
            {
                if (this.SelectedParcel == null)
                {
                    break;
                }
                int        parcel     = this.SelectedParcel.First.Parcels.IndexOf(this.SelectedParcel.Second);
                ParcelForm parcelForm = new ParcelForm(this.SelectedParcel.Second);
                if (parcelForm.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                {
                    break;
                }
                this.SelectedParcel.First.Parcels[parcel] = parcelForm.Parcel;
                Session.Modified = true;
                this.update_list();
                break;
            }

            default:
            {
                return;
            }
            }
        }