コード例 #1
0
        private void LoadButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog load        = new OpenFileDialog();
            string         initialPath = Program.defaultPath + @"\Stat Blocks";

            if (mostRecentPath != "")
            {
                initialPath = mostRecentPath;
            }
            else
            {
                if (parent.session.settings.UserStatBlockDirectory != "")
                {
                    initialPath = parent.session.settings.UserStatBlockDirectory;
                }
            }

            if (!Directory.Exists(initialPath))
            {
                Directory.CreateDirectory(initialPath);
            }
            load.InitialDirectory = initialPath;
            DialogResult confirm = load.ShowDialog();

            if (confirm == DialogResult.OK)
            {
                BattleIO loader     = new BattleIO();
                Fighter  newFighter = loader.LoadStatBlock(load.FileName);

                savePath = load.FileName;

                mostRecentPath = Path.GetDirectoryName(load.FileName);
                LoadFighter(load.FileName);
            }
        }
コード例 #2
0
        private void LoadFighter(string path)
        {
            BattleIO loader     = new BattleIO();
            Fighter  newFighter = loader.LoadStatBlock(path);

            savePath = path;

            mostRecentPath        = Path.GetDirectoryName(path);
            userPopulated         = false;
            nameBox.Text          = newFighter.Name;
            HPValBox.Text         = newFighter.HP.ToString();
            multBox.Text          = newFighter.HPMult.ToString();
            addBox.Text           = newFighter.HPAdd.ToString();
            dBox.Text             = newFighter.HPDieType.ToString();
            ACValBox.Text         = newFighter.AC.ToString();
            FFBox.Text            = newFighter.FlatFootedAC.ToString();
            touchBox.Text         = newFighter.TouchAC.ToString();
            InitBox.Text          = newFighter.InitBonus.ToString();
            CMBBox.Text           = newFighter.CMB.ToString();
            CMDBox.Text           = newFighter.CMD.ToString();
            fortBox.Text          = newFighter.fort.ToString();
            refBox.Text           = newFighter.reflex.ToString();
            willBox.Text          = newFighter.will.ToString();
            attacks               = newFighter.attacks;
            attackCountLabel.Text = newFighter.attacks.Count + " attacks.";
            skillCountLabel.Text  = newFighter.skills.Count + " skills.";
            skillList             = newFighter.skills;
            strBox.Text           = newFighter.Str.ToString();
            dexBox.Text           = newFighter.Dex.ToString();
            conBox.Text           = newFighter.Con.ToString();
            intBox.Text           = newFighter.Int.ToString();
            wisBox.Text           = newFighter.Wis.ToString();
            chaBox.Text           = newFighter.Cha.ToString();
            srBox.Text            = newFighter.SpellResist.ToString();
            drBox.Text            = newFighter.DamageReduce.ToString();
            bioBox.Text           = newFighter.Notes;
            userPopulated         = true;
            saved = true;
        }